mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2026-08-18 13:15:19 +00:00
"On landing" actions no longer triggered when player lands away from an airfield
This commit is contained in:
@@ -225,11 +225,9 @@ do
|
||||
if not event.initiator then return end -- No event initiator
|
||||
if Object.getCategory(event.initiator) ~= Object.Category.UNIT then return end -- Initiator isn't an unit
|
||||
if event.initiator:getCoalition() ~= TUM.settings.getPlayerCoalition() then return end -- Not a friendly
|
||||
if not event.place then return end -- Not landed at an airbase (e.g. helicopter landing on the ground)
|
||||
|
||||
local baseName = "AIRBASE"
|
||||
if event.place then
|
||||
baseName = event.place:getName():upper()
|
||||
end
|
||||
local baseName = event.place:getName():upper()
|
||||
|
||||
if TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) or not event.initiator:getPlayerName() then
|
||||
doAmbientChatter("atcSafeLanding", {event.initiator:getCallsign(), baseName}, baseName.." ATC", 1)
|
||||
|
||||
@@ -68,7 +68,10 @@ do
|
||||
local runwayTouchEvent = { id = world.event.S_EVENT_RUNWAY_TOUCH, initiator = playerUnit }
|
||||
TUM.onEvent(runwayTouchEvent)
|
||||
|
||||
local landingEvent = { id = world.event.S_EVENT_LAND, initiator = playerUnit }
|
||||
local friendlyAirbases = coalition.getAirbases(TUM.settings.getPlayerCoalition())
|
||||
if not friendlyAirbases or #friendlyAirbases == 0 then return end
|
||||
|
||||
local landingEvent = { id = world.event.S_EVENT_LAND, place = friendlyAirbases[1], initiator = playerUnit }
|
||||
timer.scheduleFunction(TUM.onEvent, landingEvent, timer.getTime() + 1)
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ do
|
||||
-- @param event A DCS World event, possibly a S_EVENT_LAND event
|
||||
-------------------------------------
|
||||
local function removeAIAircraftOnLandEvent(event)
|
||||
if event.id ~= world.event.S_EVENT_LAND then return end
|
||||
if not event.initiator then return end
|
||||
if Object.getCategory(event.initiator) ~= Object.Category.UNIT then return end -- Not an unit
|
||||
if event.initiator:getPlayerName() then return end -- Don't remove player aircraft, that would cause horrendous bugs
|
||||
@@ -73,6 +72,8 @@ do
|
||||
-- @param event The DCS World event
|
||||
-------------------------------------
|
||||
function TUM.mizCleaner.onEvent(event)
|
||||
removeAIAircraftOnLandEvent(event)
|
||||
if event.id == world.event.S_EVENT_LAND and event.place then
|
||||
removeAIAircraftOnLandEvent(event)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -335,7 +335,7 @@ do
|
||||
return
|
||||
end
|
||||
|
||||
if event.id == world.event.S_EVENT_LAND then
|
||||
if event.id == world.event.S_EVENT_LAND and event.place then
|
||||
onLandEvent(event)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -177,7 +177,7 @@ do
|
||||
if not event.initiator:getPlayerName() then return end
|
||||
if TUM.mission.getStatus() == TUM.mission.status.NONE then return end -- Mission not in progress, no wingman needed
|
||||
TUM.wingmen.create()
|
||||
elseif event.id == world.event.S_EVENT_LAND then -- Remove wingmen on player landing
|
||||
elseif event.id == world.event.S_EVENT_LAND and event.place then -- Remove wingmen on player landing
|
||||
if not event.initiator:getPlayerName() then return end
|
||||
TUM.wingmen.removeAll()
|
||||
elseif event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then -- Remove wingmen when player takes control of a new unit
|
||||
|
||||
Reference in New Issue
Block a user