mirror of
https://github.com/spencershepard/RotorOps.git
synced 2025-11-10 15:45:30 +00:00
convoy_assaulter object
This commit is contained in:
parent
1d99f0f032
commit
2ab00504dc
@ -1,5 +1,5 @@
|
|||||||
RotorOps = {}
|
RotorOps = {}
|
||||||
RotorOps.version = "1.4.1"
|
RotorOps.version = "1.4.2"
|
||||||
local debug = false
|
local debug = false
|
||||||
|
|
||||||
|
|
||||||
@ -115,6 +115,7 @@ local zone_defenders_flags = {
|
|||||||
local clear_text_index = 0
|
local clear_text_index = 0
|
||||||
RotorOps.farp_names = {}
|
RotorOps.farp_names = {}
|
||||||
RotorOps.convoy_suppressor = nil
|
RotorOps.convoy_suppressor = nil
|
||||||
|
RotorOps.convoy_assaulter = nil
|
||||||
RotorOps.convoy_status = "none"
|
RotorOps.convoy_status = "none"
|
||||||
|
|
||||||
|
|
||||||
@ -343,6 +344,11 @@ function RotorOps.eventHandler:onEvent(event)
|
|||||||
if event.initiator:hasAttribute("Tanks") then
|
if event.initiator:hasAttribute("Tanks") then
|
||||||
env.info("ROTOROPS: convoy unit killed by armor. Should suppress convoy")
|
env.info("ROTOROPS: convoy unit killed by armor. Should suppress convoy")
|
||||||
RotorOps.convoy_suppressor = event.initiator
|
RotorOps.convoy_suppressor = event.initiator
|
||||||
|
else
|
||||||
|
env.info("ROTOROPS: convoy unit killed by non-armor.")
|
||||||
|
RotorOps.convoy_assaulter = event.initiator
|
||||||
|
--set a timer to nullify the convoy assaulter; in case it was a passing attack
|
||||||
|
timer.scheduleFunction(function() RotorOps.convoy_assaulter = nil end, nil, timer.getTime() + 300)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1127,23 +1133,31 @@ function RotorOps.assessUnitsInZone(var)
|
|||||||
RotorOps.ai_attacking_vehicle_groups = RotorOps.groupsFromUnits(attacking_vehicles)
|
RotorOps.ai_attacking_vehicle_groups = RotorOps.groupsFromUnits(attacking_vehicles)
|
||||||
|
|
||||||
local halt_convoy = false
|
local halt_convoy = false
|
||||||
RotorOps.convoy_status = "enroute"
|
local convoy_status = "enroute"
|
||||||
|
|
||||||
if #attacking_ground_units > 0 and not RotorOps.defending and RotorOps.halt_convoy_without_airsupport then
|
if #attacking_ground_units > 0 and not RotorOps.defending and RotorOps.halt_convoy_without_airsupport then
|
||||||
if RotorOps.convoy_suppressor then
|
if RotorOps.convoy_suppressor then
|
||||||
if RotorOps.convoy_suppressor:isExist() then
|
if RotorOps.convoy_suppressor:isExist() then
|
||||||
halt_convoy = true
|
halt_convoy = true
|
||||||
RotorOps.convoy_status = "suppressed"
|
convoy_status = "suppressed"
|
||||||
else
|
else
|
||||||
RotorOps.convoy_suppressor = nil
|
RotorOps.convoy_suppressor = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif not RotorOps.predAirSupportNearActive() then
|
elseif not RotorOps.predAirSupportNearActive() then
|
||||||
RotorOps.convoy_status = "waiting_for_escort"
|
convoy_status = "waiting_for_escort"
|
||||||
halt_convoy = true
|
halt_convoy = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if RotorOps.convoy_assaulter then
|
||||||
|
if RotorOps.convoy_assaulter:isExist() then
|
||||||
|
convoy_status = "under_attack"
|
||||||
|
else
|
||||||
|
RotorOps.convoy_assaulter = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for index, group in pairs(RotorOps.ai_defending_infantry_groups) do
|
for index, group in pairs(RotorOps.ai_defending_infantry_groups) do
|
||||||
if group and not isStaticGroup(group) then
|
if group and not isStaticGroup(group) then
|
||||||
RotorOps.aiTask(group, "patrol")
|
RotorOps.aiTask(group, "patrol")
|
||||||
@ -1156,7 +1170,7 @@ function RotorOps.assessUnitsInZone(var)
|
|||||||
RotorOps.aiTask(group, "guard")
|
RotorOps.aiTask(group, "guard")
|
||||||
else
|
else
|
||||||
RotorOps.aiTask(group, "clear_zone", RotorOps.active_zone)
|
RotorOps.aiTask(group, "clear_zone", RotorOps.active_zone)
|
||||||
RotorOps.convoy_status = "clearing_zone"
|
convoy_status = "clearing_zone"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1167,7 +1181,7 @@ function RotorOps.assessUnitsInZone(var)
|
|||||||
RotorOps.aiTask(group, "guard")
|
RotorOps.aiTask(group, "guard")
|
||||||
else
|
else
|
||||||
RotorOps.aiTask(group, "clear_zone", RotorOps.active_zone)
|
RotorOps.aiTask(group, "clear_zone", RotorOps.active_zone)
|
||||||
RotorOps.convoy_status = "clearing_zone"
|
convoy_status = "clearing_zone"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1269,6 +1283,10 @@ function RotorOps.assessUnitsInZone(var)
|
|||||||
trigger.action.setUserFlag(RotorOps.staged_units_flag, percent_staged_remain)
|
trigger.action.setUserFlag(RotorOps.staged_units_flag, percent_staged_remain)
|
||||||
trigger.action.setUserFlag('ROPS_ATTACKERS', percent_staged_remain)
|
trigger.action.setUserFlag('ROPS_ATTACKERS', percent_staged_remain)
|
||||||
|
|
||||||
|
if #staged_units_remaining == 0 then
|
||||||
|
convoy_status = "destroyed"
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--is the game finished?
|
--is the game finished?
|
||||||
if all_zones_clear then
|
if all_zones_clear then
|
||||||
@ -1379,6 +1397,8 @@ function RotorOps.assessUnitsInZone(var)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--Update the convoy status
|
||||||
|
RotorOps.convoy_status = convoy_status
|
||||||
|
|
||||||
|
|
||||||
--zone status display
|
--zone status display
|
||||||
@ -1402,9 +1422,12 @@ function RotorOps.assessUnitsInZone(var)
|
|||||||
body = "Convoy enroute to " .. RotorOps.active_zone
|
body = "Convoy enroute to " .. RotorOps.active_zone
|
||||||
elseif RotorOps.convoy_status == "suppressed" then
|
elseif RotorOps.convoy_status == "suppressed" then
|
||||||
local supressor_type = RotorOps.convoy_suppressor:getTypeName() or "enemy units"
|
local supressor_type = RotorOps.convoy_suppressor:getTypeName() or "enemy units"
|
||||||
body = "Convoy pinned down by "..supressor_type.."!"
|
local grid = mist.tostringMGRS(coord.LLtoMGRS(coord.LOtoLL(RotorOps.convoy_suppressor:getPosition().p)), 4) or "unknown location"
|
||||||
|
body = "Convoy pinned down by "..supressor_type.." at "..grid
|
||||||
|
elseif RotorOps.convoy_status == "under_attack" then
|
||||||
|
body = "Convoy under attack!"
|
||||||
end
|
end
|
||||||
if #staged_units_remaining == 0 then
|
if RotorOps.convoy_status == "destroyed" then
|
||||||
body = "Convoy has been destroyed."
|
body = "Convoy has been destroyed."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
|
|
||||||
RotorOpsPerks = {}
|
RotorOpsPerks = {}
|
||||||
RotorOpsPerks.version = "1.5.3"
|
RotorOpsPerks.version = "1.5.4"
|
||||||
env.warning('ROTOROPS PERKS STARTED: '..RotorOpsPerks.version)
|
env.warning('ROTOROPS PERKS STARTED: '..RotorOpsPerks.version)
|
||||||
trigger.action.outText('ROTOROPS PERKS STARTED: '..RotorOpsPerks.version, 10)
|
trigger.action.outText('ROTOROPS PERKS STARTED: '..RotorOpsPerks.version, 10)
|
||||||
RotorOpsPerks.perks = {}
|
RotorOpsPerks.perks = {}
|
||||||
@ -1124,7 +1124,7 @@ function handle:onEvent(e)
|
|||||||
env.warning('KILL: initiator is not a unit')
|
env.warning('KILL: initiator is not a unit')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if e.initiator:getCoalition() and e.initiator:getCoalition() ~= e.target:getCoalition() then
|
if e.initiator:getCoalition() and e.target:getCoalition() and e.initiator:getCoalition() ~= e.target:getCoalition() then
|
||||||
debugMsg('KILL: initiator groupname: ' .. e.initiator:getGroup():getName())
|
debugMsg('KILL: initiator groupname: ' .. e.initiator:getGroup():getName())
|
||||||
|
|
||||||
local initiator_group_name = e.initiator:getGroup():getName()
|
local initiator_group_name = e.initiator:getGroup():getName()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user