mirror of
https://github.com/akaAgar/the-universal-mission-for-dcs-world.git
synced 2025-11-25 19:31:01 +00:00
"On landing" actions no longer triggered when player lands away from an airfield
This commit is contained in:
parent
92a00160ef
commit
591ec6e10a
@ -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 datalinked now showing on SA pages
|
||||||
- [x] AWACS can now detect enemy helicopters
|
- [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] 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
|
- Extras
|
||||||
- [ ] GitHub page
|
- [ ] GitHub page
|
||||||
- Improvements
|
- Improvements
|
||||||
|
|||||||
@ -225,11 +225,9 @@ do
|
|||||||
if not event.initiator then return end -- No event initiator
|
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 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 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"
|
local baseName = event.place:getName():upper()
|
||||||
if event.place then
|
|
||||||
baseName = event.place:getName():upper()
|
|
||||||
end
|
|
||||||
|
|
||||||
if TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) or not event.initiator:getPlayerName() then
|
if TUM.settings.getValue(TUM.settings.id.MULTIPLAYER) or not event.initiator:getPlayerName() then
|
||||||
doAmbientChatter("atcSafeLanding", {event.initiator:getCallsign(), baseName}, baseName.." ATC", 1)
|
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 }
|
local runwayTouchEvent = { id = world.event.S_EVENT_RUNWAY_TOUCH, initiator = playerUnit }
|
||||||
TUM.onEvent(runwayTouchEvent)
|
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)
|
timer.scheduleFunction(TUM.onEvent, landingEvent, timer.getTime() + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,6 @@ do
|
|||||||
-- @param event A DCS World event, possibly a S_EVENT_LAND event
|
-- @param event A DCS World event, possibly a S_EVENT_LAND event
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
local function removeAIAircraftOnLandEvent(event)
|
local function removeAIAircraftOnLandEvent(event)
|
||||||
if event.id ~= world.event.S_EVENT_LAND then return end
|
|
||||||
if not event.initiator 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 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
|
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
|
-- @param event The DCS World event
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
function TUM.mizCleaner.onEvent(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
|
||||||
end
|
end
|
||||||
|
|||||||
@ -335,7 +335,7 @@ do
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if event.id == world.event.S_EVENT_LAND then
|
if event.id == world.event.S_EVENT_LAND and event.place then
|
||||||
onLandEvent(event)
|
onLandEvent(event)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@ -177,7 +177,7 @@ do
|
|||||||
if not event.initiator:getPlayerName() then return end
|
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
|
if TUM.mission.getStatus() == TUM.mission.status.NONE then return end -- Mission not in progress, no wingman needed
|
||||||
TUM.wingmen.create()
|
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
|
if not event.initiator:getPlayerName() then return end
|
||||||
TUM.wingmen.removeAll()
|
TUM.wingmen.removeAll()
|
||||||
elseif event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then -- Remove wingmen when player takes control of a new unit
|
elseif event.id == world.event.S_EVENT_PLAYER_ENTER_UNIT then -- Remove wingmen when player takes control of a new unit
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user