mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Version 1.01
Impostors
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
-- Copyright (c) 2021, 2022 by Christian Franz and cf/x AG
|
||||
--
|
||||
cfxZones = {}
|
||||
cfxZones.version = "2.7.9"
|
||||
cfxZones.version = "2.8.1"
|
||||
--[[-- VERSION HISTORY
|
||||
- 2.2.4 - getCoalitionFromZoneProperty
|
||||
- getStringFromZoneProperty
|
||||
@@ -80,7 +80,8 @@ cfxZones.version = "2.7.9"
|
||||
- unpulse
|
||||
- 2.7.9 - getFlagValue QoL for <none>
|
||||
- setFlagValue QoL for <none>
|
||||
|
||||
- 2.8.0 - new allGroupNamesInZone()
|
||||
- 2.8.1 - new zonesLinkedToUnit()
|
||||
|
||||
--]]--
|
||||
cfxZones.verbose = false
|
||||
@@ -599,6 +600,22 @@ function cfxZones.allGroupsInZone(theZone, categ) -- categ is optional, must be
|
||||
return inZones
|
||||
end
|
||||
|
||||
function cfxZones.allGroupNamesInZone(theZone, categ) -- categ is optional, must be code
|
||||
-- warning: does not check for exiting!
|
||||
--trigger.action.outText("Zone " .. theZone.name .. " radius " .. theZone.radius, 30)
|
||||
local inZones = {}
|
||||
local coals = {0, 1, 2} -- all coalitions
|
||||
for idx, coa in pairs(coals) do
|
||||
local allGroups = coalition.getGroups(coa, categ)
|
||||
for key, group in pairs(allGroups) do -- iterate all groups
|
||||
if cfxZones.isGroupPartiallyInZone(group, theZone) then
|
||||
table.insert(inZones, group:getName())
|
||||
end
|
||||
end
|
||||
end
|
||||
return inZones
|
||||
end
|
||||
|
||||
function cfxZones.allStaticsInZone(theZone) -- categ is optional, must be code
|
||||
-- warning: does not check for exiting!
|
||||
local inZones = {}
|
||||
@@ -1928,6 +1945,17 @@ function cfxZones.linkUnitToZone(theUnit, theZone, dx, dy) -- note: dy is really
|
||||
theZone.dy = dy
|
||||
end
|
||||
|
||||
function cfxZones.zonesLinkedToUnit(theUnit) -- returns all zones linked to this unit
|
||||
if not theUnit then return {} end
|
||||
local linkedZones = {}
|
||||
for idx, theZone in pairs (cfxZones.zones) do
|
||||
if theZone.linkedUnit == theUnit then
|
||||
table.insert(linkedZones, theZone)
|
||||
end
|
||||
end
|
||||
return linkedZones
|
||||
end
|
||||
|
||||
function cfxZones.updateMovingZones()
|
||||
cfxZones.updateSchedule = timer.scheduleFunction(cfxZones.updateMovingZones, {}, timer.getTime() + 1/cfxZones.ups)
|
||||
-- simply scan all cfx zones for the linkedUnit property and if there
|
||||
|
||||
Reference in New Issue
Block a user