mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-11 19:58:22 +00:00
Update DynamicCargo.lua
Added Destroy-Functionality
This commit is contained in:
@@ -534,7 +534,10 @@ function DYNAMICCARGO:_UpdatePosition()
|
|||||||
---------------
|
---------------
|
||||||
-- REMOVED Cargo
|
-- REMOVED Cargo
|
||||||
---------------
|
---------------
|
||||||
if self.timer and self.timer:IsRunning() then self.timer:Stop() end
|
if self.timer and self.timer:IsRunning() then
|
||||||
|
self.timer:Stop()
|
||||||
|
self.timer=nil
|
||||||
|
end
|
||||||
self:T(self.lid.." dead! " ..self.CargoState.."-> REMOVED")
|
self:T(self.lid.." dead! " ..self.CargoState.."-> REMOVED")
|
||||||
self.CargoState = DYNAMICCARGO.State.REMOVED
|
self.CargoState = DYNAMICCARGO.State.REMOVED
|
||||||
_DATABASE:CreateEventDynamicCargoRemoved(self)
|
_DATABASE:CreateEventDynamicCargoRemoved(self)
|
||||||
@@ -542,6 +545,24 @@ function DYNAMICCARGO:_UpdatePosition()
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [USER] Destroy a DYNAMICCARGO object.
|
||||||
|
-- @param #DYNAMICCARGO self
|
||||||
|
-- @param #boolean GenerateEvent Set to false to remove an item silently. Defaults to true.
|
||||||
|
-- @return #boolean Return Returns nil if the object could not be found, else returns true.
|
||||||
|
function DYNAMICCARGO:Destroy(GenerateEvent)
|
||||||
|
local DCSObject = self:GetDCSObject()
|
||||||
|
if DCSObject then
|
||||||
|
local GenerateEvent = (GenerateEvent ~= nil and GenerateEvent == false) and false or true
|
||||||
|
if GenerateEvent and GenerateEvent == true then
|
||||||
|
self:CreateEventDead( timer.getTime(), DCSObject )
|
||||||
|
end
|
||||||
|
DCSObject:destroy()
|
||||||
|
self:_UpdatePosition()
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
--- [Internal] Track helos for loaded/unloaded decision making.
|
--- [Internal] Track helos for loaded/unloaded decision making.
|
||||||
-- @param Wrapper.Client#CLIENT client
|
-- @param Wrapper.Client#CLIENT client
|
||||||
-- @return #boolean IsIn
|
-- @return #boolean IsIn
|
||||||
|
|||||||
Reference in New Issue
Block a user