diff --git a/README.md b/README.md index 5e5a778..559edf5 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ Please also note that PvP is not supported at the moment and that the mission wi - [x] AWACS datalinked now showing on SA pages - [x] AWACS can now detect enemy helicopters - [x] Added missing net.allow_unsafe_api value in autoexec.cfg that prevented some advanced scripts from working + - [x] "On landing" actions (medal/promotions check, AI wingmen removal, etc) no longer triggered when player lands away from an airfield (e.g. in a Harrier on a helicopter) - Extras - [ ] GitHub page - Improvements diff --git a/Script/The Universal Mission/AmbientRadio.lua b/Script/The Universal Mission/AmbientRadio.lua index e8f7922..c7d9624 100644 --- a/Script/The Universal Mission/AmbientRadio.lua +++ b/Script/The Universal Mission/AmbientRadio.lua @@ -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) diff --git a/Script/The Universal Mission/DebugMenu.lua b/Script/The Universal Mission/DebugMenu.lua index d3074ec..e98407a 100644 --- a/Script/The Universal Mission/DebugMenu.lua +++ b/Script/The Universal Mission/DebugMenu.lua @@ -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 diff --git a/Script/The Universal Mission/MizCleaner.lua b/Script/The Universal Mission/MizCleaner.lua index 15acf13..dd621ef 100644 --- a/Script/The Universal Mission/MizCleaner.lua +++ b/Script/The Universal Mission/MizCleaner.lua @@ -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 diff --git a/Script/The Universal Mission/PlayerScore.lua b/Script/The Universal Mission/PlayerScore.lua index fc19417..81b7678 100644 --- a/Script/The Universal Mission/PlayerScore.lua +++ b/Script/The Universal Mission/PlayerScore.lua @@ -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 diff --git a/Script/The Universal Mission/Wingmen.lua b/Script/The Universal Mission/Wingmen.lua index 10f1b52..9a9e87e 100644 --- a/Script/The Universal Mission/Wingmen.lua +++ b/Script/The Universal Mission/Wingmen.lua @@ -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