Update Unit.lua

GetSTN fix if template os nil
This commit is contained in:
Thomas 2025-01-11 10:14:03 +01:00 committed by GitHub
parent 63c68d729b
commit fbcc4ee32b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1777,7 +1777,8 @@ function UNIT:GetSTN()
local VCN = nil -- VoiceCallsignNumber
local FGL = false -- FlightGroupLeader
local template = self:GetTemplate()
if template.AddPropAircraft then
if template then
if template.AddPropAircraft then
if template.AddPropAircraft.STN_L16 then
STN = template.AddPropAircraft.STN_L16
elseif template.AddPropAircraft.SADL_TN then
@ -1793,6 +1794,6 @@ function UNIT:GetSTN()
if template.datalinks and template.datalinks.SADL and template.datalinks.SADL.settings then
FGL = template.datalinks.SADL.settings.flightLead
end
end
return STN, VCL, VCN, FGL
end