Fix bug wen "newing" a new BAirboss.

This commit is contained in:
2025-01-03 16:56:21 +08:00
parent 1b8d6154c1
commit dd265920cc
2 changed files with 26 additions and 10 deletions
Binary file not shown.
+26 -10
View File
@@ -132,9 +132,11 @@ do
return return
end end
self.carrierUnit = Unit.getByName(carrierUnitName) local obj = Utils.deepCopy(self)
if not self.carrierUnit then obj.carrierUnit = Unit.getByName(carrierUnitName)
if not obj.carrierUnit then
local errMsg = 'ERROR: Carrier unit %s is not found in mission.' local errMsg = 'ERROR: Carrier unit %s is not found in mission.'
errMsg = string.format(Localizations:translate(errMsg,'cn'),carrierUnitName) errMsg = string.format(Localizations:translate(errMsg,'cn'),carrierUnitName)
@@ -143,14 +145,24 @@ do
return nil return nil
end end
self:setMorse() -- setmetatable(obj,self)
self:setTACAN() -- self.__index = self
self:setICLS()
self:setLink4()
self:setACLS(true)
self:setATC()
return self obj:setMorse()
obj:setTACAN()
obj:setICLS()
obj:setLink4()
obj:setACLS(true)
obj:setATC()
-- self:setMorse()
-- self:setTACAN()
-- self:setICLS()
-- self:setLink4()
-- self:setACLS(true)
-- self:setATC()
return obj
end end
function BAirboss.findClearPath(from,heading,range) function BAirboss.findClearPath(from,heading,range)
@@ -454,4 +466,8 @@ Airboss_Roosevelt:turnIntoWind()
local Airboss_Sten = BAirboss:New('John C. Stennis') local Airboss_Sten = BAirboss:New('John C. Stennis')
Airboss_Sten:turnIntoWind() Airboss_Sten:turnIntoWind()
trigger.action.outText('Start',20) Utils.Debug("Airboss_Roosevelt: "..Airboss_Roosevelt.carrierUnit:getName())
Utils.Debug("Airboss_Sten: "..Airboss_Sten.carrierUnit:getName())
trigger.action.outText('Start BAirboss',10)