diff --git a/Moose Development/Moose/Core/Event.lua b/Moose Development/Moose/Core/Event.lua index 003a7195e..9b3d96f15 100644 --- a/Moose Development/Moose/Core/Event.lua +++ b/Moose Development/Moose/Core/Event.lua @@ -184,8 +184,7 @@ EVENT = { ClassName = "EVENT", ClassID = 0, MissionEnd = false, - RegisterSceneryOnEvent = true, - CreateMarkCoordinateOnEvent = true, + CreateMarkCoordinateOnEvent = false, } world.event.S_EVENT_NEW_CARGO = world.event.S_EVENT_MAX + 1000 @@ -1065,36 +1064,6 @@ end do -- Event Creation - --- Creation of a New Cargo Event. - -- @param #EVENT self - -- @param AI.AI_Cargo#AI_CARGO Cargo The Cargo created. - function EVENT:CreateEventNewCargo( Cargo ) - self:F( { Cargo } ) - - local Event = { - id = EVENTS.NewCargo, - time = timer.getTime(), - cargo = Cargo, - } - - world.onEvent( Event ) - end - - --- Creation of a Cargo Deletion Event. - -- @param #EVENT self - -- @param AI.AI_Cargo#AI_CARGO Cargo The Cargo created. - function EVENT:CreateEventDeleteCargo( Cargo ) - self:F( { Cargo } ) - - local Event = { - id = EVENTS.DeleteCargo, - time = timer.getTime(), - cargo = Cargo, - } - - world.onEvent( Event ) - end - --- Creation of a New Zone Event. -- @param #EVENT self -- @param Core.Zone#ZONE_BASE Zone The Zone created. @@ -1363,7 +1332,8 @@ function EVENT:onEvent( Event ) Event.IniDynamicCargoName = Event.IniUnitName Event.IniPlayerName = string.match(Event.IniUnitName,"^(.+)|%d%d:%d%d|PKG%d+") else - Event.IniUnit = CARGO:FindByName( Event.IniDCSUnitName ) + --Event.IniUnit = CARGO:FindByName( Event.IniDCSUnitName ) + Event.IniUnit = STATIC:FindByName( Event.IniDCSUnitName, false ) end Event.IniCoalition = Event.IniDCSUnit:getCoalition() Event.IniCategory = Event.IniDCSUnit:getDesc().category @@ -1376,9 +1346,9 @@ function EVENT:onEvent( Event ) Event.IniDCSUnit = Event.initiator Event.IniDCSUnitName = ( Event.IniDCSUnit and Event.IniDCSUnit.getName ) and Event.IniDCSUnit:getName() or "Scenery no name "..math.random(1,20000) Event.IniUnitName = Event.IniDCSUnitName - if self.RegisterSceneryOnEvent then - Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator ) - end + local ID = (Event.IniDCSUnit and Event.IniDCSUnit.getID) and Event.IniDCSUnit:getID() or Event.IniDCSUnitName + Event.IniUnit = (_SCENERY ~= nil) and _SCENERY[ID] or nil + --Event.IniUnit = SCENERY:Register( Event.IniDCSUnitName, Event.initiator ) Event.IniCategory = (Event.IniDCSUnit and Event.IniDCSUnit.getDesc ) and Event.IniDCSUnit:getDesc().category Event.IniTypeName = (Event.initiator and Event.initiator.isExist and Event.initiator:isExist() and Event.IniDCSUnit and Event.IniDCSUnit.getTypeName) and Event.IniDCSUnit:getTypeName() or "SCENERY" @@ -1482,9 +1452,9 @@ function EVENT:onEvent( Event ) Event.TgtDCSUnitName = Event.TgtDCSUnit.getName and Event.TgtDCSUnit:getName() or nil if Event.TgtDCSUnitName~=nil then Event.TgtUnitName = Event.TgtDCSUnitName - if self.RegisterSceneryOnEvent then - Event.TgtUnit = SCENERY:Register( Event.TgtDCSUnitName, Event.target ) - end + local ID = (Event.TgtDCSUnit and Event.TgtDCSUnit.getID) and Event.TgtDCSUnit:getID() or Event.TgtDCSUnitName + --Event.TgtUnit = SCENERY:Register( Event.TgtDCSUnitName, Event.target ) + Event.TgtUnit = (_SCENERY ~= nil) and _SCENERY[ID] or nil Event.TgtCategory = Event.TgtDCSUnit:getDesc().category Event.TgtTypeName = Event.TgtDCSUnit:getTypeName() end @@ -1525,8 +1495,8 @@ function EVENT:onEvent( Event ) if Event.idx then Event.MarkID=Event.idx Event.MarkVec3=Event.pos - if self.CreateMarkCoordinateOnEvent then - Event.MarkCoordinate=COORDINATE:NewFromVec3(Event.pos) + if self.CreateMarkCoordinateOnEvent == true then + Event.MarkCoordinate=COORDINATE:NewFromVec3(Event.pos) end Event.MarkText=Event.text Event.MarkCoalition=Event.coalition