mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-20 17:07:54 +00:00
CTLD Enhancements
This commit is contained in:
@@ -183,6 +183,7 @@ do
|
|||||||
-- my_ctld.placeCratesAhead = false -- place crates straight ahead of the helicopter, in a random way. If true, crates are more neatly sorted.
|
-- my_ctld.placeCratesAhead = false -- place crates straight ahead of the helicopter, in a random way. If true, crates are more neatly sorted.
|
||||||
-- my_ctld.nobuildinloadzones = true -- forbid players to build stuff in LOAD zones if set to `true`
|
-- my_ctld.nobuildinloadzones = true -- forbid players to build stuff in LOAD zones if set to `true`
|
||||||
-- my_ctld.movecratesbeforebuild = true -- crates must be moved once before they can be build. Set to false for direct builds.
|
-- my_ctld.movecratesbeforebuild = true -- crates must be moved once before they can be build. Set to false for direct builds.
|
||||||
|
-- my_ctld.useaircraftheadingforbuilds = false -- Matches the heading of the spawned groups from a crate build to the aircraft heading when starting the build. Default is false for template heading.
|
||||||
-- my_ctld.surfacetypes = {land.SurfaceType.LAND,land.SurfaceType.ROAD,land.SurfaceType.RUNWAY,land.SurfaceType.SHALLOW_WATER} -- surfaces for loading back objects.
|
-- my_ctld.surfacetypes = {land.SurfaceType.LAND,land.SurfaceType.ROAD,land.SurfaceType.RUNWAY,land.SurfaceType.SHALLOW_WATER} -- surfaces for loading back objects.
|
||||||
-- my_ctld.nobuildmenu = false -- if set to true effectively enforces to have engineers build/repair stuff for you.
|
-- my_ctld.nobuildmenu = false -- if set to true effectively enforces to have engineers build/repair stuff for you.
|
||||||
-- my_ctld.RadioSound = "beacon.ogg" -- -- this sound will be hearable if you tune in the beacon frequency. Add the sound file to your miz.
|
-- my_ctld.RadioSound = "beacon.ogg" -- -- this sound will be hearable if you tune in the beacon frequency. Add the sound file to your miz.
|
||||||
@@ -2037,7 +2038,7 @@ function CTLD:_C130DcAutoRegisterEntry(SetId, Cargo)
|
|||||||
|
|
||||||
local pos = Cargo:GetPositionable()
|
local pos = Cargo:GetPositionable()
|
||||||
local pname = pos and pos.GetName and pos:GetName() or nil
|
local pname = pos and pos.GetName and pos:GetName() or nil
|
||||||
local pcoord = pos and pos.GetCoordinate and pos:GetCoordinate() or nil
|
local pcoord = pos and pos.GetCoord and pos:GetCoord() or nil
|
||||||
local entryId = string.format("%s#%d", SetId, #setData.entries + 1)
|
local entryId = string.format("%s#%d", SetId, #setData.entries + 1)
|
||||||
local entry = {
|
local entry = {
|
||||||
id = entryId,
|
id = entryId,
|
||||||
@@ -3125,14 +3126,14 @@ end
|
|||||||
function CTLD:_FindRepairNearby(Group, Unit, Repairtype)
|
function CTLD:_FindRepairNearby(Group, Unit, Repairtype)
|
||||||
self:T(self.lid .. " _FindRepairNearby")
|
self:T(self.lid .. " _FindRepairNearby")
|
||||||
--self:T({Group:GetName(),Unit:GetName(),Repairtype})
|
--self:T({Group:GetName(),Unit:GetName(),Repairtype})
|
||||||
local unitcoord = Unit:GetCoordinate()
|
local unitcoord = Unit:GetCoord()
|
||||||
|
|
||||||
-- find nearest group of deployed groups
|
-- find nearest group of deployed groups
|
||||||
local nearestGroup = nil
|
local nearestGroup = nil
|
||||||
local nearestGroupIndex = -1
|
local nearestGroupIndex = -1
|
||||||
local nearestDistance = 10000
|
local nearestDistance = 10000
|
||||||
for k,v in pairs(self.DroppedTroops) do
|
for k,v in pairs(self.DroppedTroops) do
|
||||||
local distance = self:_GetDistance(v:GetCoordinate(),unitcoord)
|
local distance = self:_GetDistance(v:GetCoord(),unitcoord)
|
||||||
local unit = v:GetUnit(1) -- Wrapper.Unit#UNIT
|
local unit = v:GetUnit(1) -- Wrapper.Unit#UNIT
|
||||||
local desc = unit:GetDesc() or nil
|
local desc = unit:GetDesc() or nil
|
||||||
if distance < nearestDistance and distance ~= -1 and not desc.attributes.Infantry then
|
if distance < nearestDistance and distance ~= -1 and not desc.attributes.Infantry then
|
||||||
@@ -3277,7 +3278,7 @@ end
|
|||||||
local capabilities = self:_GetUnitCapabilities(Unit)
|
local capabilities = self:_GetUnitCapabilities(Unit)
|
||||||
local cantroops = capabilities.troops -- #boolean
|
local cantroops = capabilities.troops -- #boolean
|
||||||
local trooplimit = capabilities.trooplimit -- #number
|
local trooplimit = capabilities.trooplimit -- #number
|
||||||
local unitcoord = unit:GetCoordinate()
|
local unitcoord = unit:GetCoord()
|
||||||
|
|
||||||
-- find nearest group of deployed troops
|
-- find nearest group of deployed troops
|
||||||
local nearestGroup = nil
|
local nearestGroup = nil
|
||||||
@@ -3288,7 +3289,7 @@ end
|
|||||||
local distancekeys = {}
|
local distancekeys = {}
|
||||||
local extractdistance = self.CrateDistance * self.ExtractFactor
|
local extractdistance = self.CrateDistance * self.ExtractFactor
|
||||||
for k,v in pairs(self.DroppedTroops) do
|
for k,v in pairs(self.DroppedTroops) do
|
||||||
local distance = self:_GetDistance(v:GetCoordinate(),unitcoord)
|
local distance = self:_GetDistance(v:GetCoord(),unitcoord)
|
||||||
local TNow = timer.getTime()
|
local TNow = timer.getTime()
|
||||||
local vtime = v.ExtractTime or TNow-310
|
local vtime = v.ExtractTime or TNow-310
|
||||||
if distance <= extractdistance and distance ~= -1 and (TNow - vtime > 300) then
|
if distance <= extractdistance and distance ~= -1 and (TNow - vtime > 300) then
|
||||||
@@ -3376,7 +3377,7 @@ end
|
|||||||
self:_UpdateUnitCargoMass(Unit)
|
self:_UpdateUnitCargoMass(Unit)
|
||||||
local groupname = nearestGroup:GetName()
|
local groupname = nearestGroup:GetName()
|
||||||
self:__TroopsExtracted(running,Group, Unit, nearestGroup, groupname)
|
self:__TroopsExtracted(running,Group, Unit, nearestGroup, groupname)
|
||||||
local coord = Unit:GetCoordinate() or Group:GetCoordinate() -- Core.Point#COORDINATE
|
local coord = Unit:GetCoord() or Group:GetCoord() -- Core.Point#COORDINATE
|
||||||
local Point
|
local Point
|
||||||
if coord then
|
if coord then
|
||||||
local heading = unit:GetHeading() or 0
|
local heading = unit:GetHeading() or 0
|
||||||
@@ -3806,6 +3807,7 @@ function CTLD:_C130GetUnits(Group, Unit, Name)
|
|||||||
if canmove then
|
if canmove then
|
||||||
SPAWN:NewWithAlias(_template,alias)
|
SPAWN:NewWithAlias(_template,alias)
|
||||||
:InitRandomizeUnits(true,10,2)
|
:InitRandomizeUnits(true,10,2)
|
||||||
|
:InitCoalition(self.coalition)
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits, 70)
|
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits, 70)
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
:OnSpawnGroup(function(grp,TimeStamp)
|
:OnSpawnGroup(function(grp,TimeStamp)
|
||||||
@@ -3819,6 +3821,7 @@ function CTLD:_C130GetUnits(Group, Unit, Name)
|
|||||||
SPAWN:NewWithAlias(_template,alias)
|
SPAWN:NewWithAlias(_template,alias)
|
||||||
:InitRandomizeUnits(true,10,2)
|
:InitRandomizeUnits(true,10,2)
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
|
:InitCoalition(self.coalition)
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits, 70)
|
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits, 70)
|
||||||
:OnSpawnGroup(function(grp,TimeStamp)
|
:OnSpawnGroup(function(grp,TimeStamp)
|
||||||
grp.spawntime = TimeStamp or timer.getTime()
|
grp.spawntime = TimeStamp or timer.getTime()
|
||||||
@@ -3972,7 +3975,7 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppress
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- get position and heading of heli
|
-- get position and heading of heli
|
||||||
local position = Unit:GetCoordinate()
|
local position = Unit:GetCoord()
|
||||||
local heading = Unit:GetHeading() + 1
|
local heading = Unit:GetHeading() + 1
|
||||||
local height = Unit:GetHeight()
|
local height = Unit:GetHeight()
|
||||||
local droppedcargo = {}
|
local droppedcargo = {}
|
||||||
@@ -4389,7 +4392,7 @@ end
|
|||||||
function CTLD:_C130RemoveUnitsNearby(_group,_unit)
|
function CTLD:_C130RemoveUnitsNearby(_group,_unit)
|
||||||
self:T(self.lid .. " _C130RemoveUnitsNearby")
|
self:T(self.lid .. " _C130RemoveUnitsNearby")
|
||||||
if not _group or not _unit then return self end
|
if not _group or not _unit then return self end
|
||||||
local location = _group:GetCoordinate()
|
local location = _group:GetCoord()
|
||||||
if not location then return self end
|
if not location then return self end
|
||||||
local capabilities = self:_GetUnitCapabilities(_unit)
|
local capabilities = self:_GetUnitCapabilities(_unit)
|
||||||
local innerDist = (capabilities.length and capabilities.length/2) or 15
|
local innerDist = (capabilities.length and capabilities.length/2) or 15
|
||||||
@@ -4533,7 +4536,7 @@ end
|
|||||||
function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight, ignoretype, ignoreHercInner)
|
function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight, ignoretype, ignoreHercInner)
|
||||||
self:T(self.lid .. " _FindCratesNearby")
|
self:T(self.lid .. " _FindCratesNearby")
|
||||||
local finddist = _dist
|
local finddist = _dist
|
||||||
local location = _group:GetCoordinate()
|
local location = _group:GetCoord()
|
||||||
local existingcrates = self.Spawned_Cargo -- #table
|
local existingcrates = self.Spawned_Cargo -- #table
|
||||||
-- cycle
|
-- cycle
|
||||||
local index = 0
|
local index = 0
|
||||||
@@ -5159,7 +5162,6 @@ function CTLD:_UnloadTroops(Group, Unit)
|
|||||||
-- unload troops
|
-- unload troops
|
||||||
local name = cargo:GetName() or "none"
|
local name = cargo:GetName() or "none"
|
||||||
local temptable = cargo:GetTemplates() or {}
|
local temptable = cargo:GetTemplates() or {}
|
||||||
local position = Group:GetCoordinate()
|
|
||||||
local zoneradius = self.troopdropzoneradius or 100 -- drop zone radius
|
local zoneradius = self.troopdropzoneradius or 100 -- drop zone radius
|
||||||
local factor = 1
|
local factor = 1
|
||||||
if IsHerc then
|
if IsHerc then
|
||||||
@@ -5196,6 +5198,7 @@ function CTLD:_UnloadTroops(Group, Unit)
|
|||||||
local Positions = self:_GetUnitPositions(randomcoord,rad,heading,_template)
|
local Positions = self:_GetUnitPositions(randomcoord,rad,heading,_template)
|
||||||
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
|
:InitCoalition(self.coalition)
|
||||||
:InitSetUnitAbsolutePositions(Positions)
|
:InitSetUnitAbsolutePositions(Positions)
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
||||||
:OnSpawnGroup(function(grp) grp.spawntime = timer.getTime() end)
|
:OnSpawnGroup(function(grp) grp.spawntime = timer.getTime() end)
|
||||||
@@ -5506,8 +5509,8 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
|
|||||||
local required = Crate:GetCratesNeeded()
|
local required = Crate:GetCratesNeeded()
|
||||||
local template = Crate:GetTemplates()
|
local template = Crate:GetTemplates()
|
||||||
local ctype = Crate:GetType()
|
local ctype = Crate:GetType()
|
||||||
local ccoord = Crate:GetPositionable():GetCoordinate() -- Core.Point#COORDINATE
|
local ccoord = Crate:GetPositionable():GetCoord() -- Core.Point#COORDINATE
|
||||||
local distToUnit=Unit and ccoord:Get2DDistance(Unit:GetCoordinate())or 0
|
local distToUnit=Unit and ccoord:Get2DDistance(Unit:GetCoord())or 0
|
||||||
local isHercDrop=Crate:WasDropped(true)
|
local isHercDrop=Crate:WasDropped(true)
|
||||||
if not isHercDrop and distToUnit>baseDist then
|
if not isHercDrop and distToUnit>baseDist then
|
||||||
elseif self:IsC130J(Unit) and distToUnit<15 then
|
elseif self:IsC130J(Unit) and distToUnit<15 then
|
||||||
@@ -5526,6 +5529,7 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
|
|||||||
object.Found = 1
|
object.Found = 1
|
||||||
object.Template = template
|
object.Template = template
|
||||||
object.CanBuild = false
|
object.CanBuild = false
|
||||||
|
object.Heading = Unit:GetHeading()
|
||||||
object.Type = ctype -- #CTLD_CARGO.Enum
|
object.Type = ctype -- #CTLD_CARGO.Enum
|
||||||
object.Coord = ccoord:GetVec2()
|
object.Coord = ccoord:GetVec2()
|
||||||
buildables[name] = object
|
buildables[name] = object
|
||||||
@@ -5611,7 +5615,7 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
|
|||||||
local sep = self.buildPairSeparation or 25
|
local sep = self.buildPairSeparation or 25
|
||||||
local hdg = (Unit:GetHeading()+180)%360
|
local hdg = (Unit:GetHeading()+180)%360
|
||||||
local lat = (hdg+90)%360
|
local lat = (hdg+90)%360
|
||||||
local base = Unit:GetCoordinate():Translate(20,hdg)
|
local base = Unit:GetCoord():Translate(20,hdg)
|
||||||
|
|
||||||
if full == 1 then
|
if full == 1 then
|
||||||
local cratesNow, numberNow = self:_FindCratesNearby(Group,Unit, finddist,true,true, not Engineering)
|
local cratesNow, numberNow = self:_FindCratesNearby(Group,Unit, finddist,true,true, not Engineering)
|
||||||
@@ -5645,7 +5649,7 @@ function CTLD:_BuildCrates(Group, Unit,Engineering,MultiDrop,NotifyGroup)
|
|||||||
self:_RefreshPackMenus(Group,Unit)
|
self:_RefreshPackMenus(Group,Unit)
|
||||||
local off = start + (n-1)*sep
|
local off = start + (n-1)*sep
|
||||||
local coord = base:Translate(off,lat):GetVec2()
|
local coord = base:Translate(off,lat):GetVec2()
|
||||||
local b = { Name=build.Name, Required=build.Required, Template=build.Template, CanBuild=true, Type=build.Type, Coord=coord }
|
local b = { Name=build.Name, Required=build.Required, Template=build.Template, CanBuild=true, Type=build.Type, Coord=coord, Heading=build.Heading }
|
||||||
if self.buildtime and self.buildtime > 0 then
|
if self.buildtime and self.buildtime > 0 then
|
||||||
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,b,false,Group:GetCoordinate(),MultiDrop)
|
local buildtimer = TIMER:New(self._BuildObjectFromCrates,self,Group,Unit,b,false,Group:GetCoordinate(),MultiDrop)
|
||||||
buildtimer:Start(self.buildtime)
|
buildtimer:Start(self.buildtime)
|
||||||
@@ -5827,12 +5831,12 @@ function CTLD:_LoadPackedCratesByIds(Group, Unit, crateIds, cargoName)
|
|||||||
|
|
||||||
local matchingCrates = {}
|
local matchingCrates = {}
|
||||||
local finddist = self.CrateDistance or 35
|
local finddist = self.CrateDistance or 35
|
||||||
local location = Group:GetCoordinate()
|
local location = Group:GetCoord()
|
||||||
for _, crateObj in pairs(self.Spawned_Cargo or {}) do
|
for _, crateObj in pairs(self.Spawned_Cargo or {}) do
|
||||||
if crateObj and idLookup[crateObj:GetID()] then
|
if crateObj and idLookup[crateObj:GetID()] then
|
||||||
local pos = crateObj:GetPositionable()
|
local pos = crateObj:GetPositionable()
|
||||||
if pos and pos:IsAlive() then
|
if pos and pos:IsAlive() then
|
||||||
local dist = location:Get2DDistance(pos:GetCoordinate())
|
local dist = location:Get2DDistance(pos:GetCoord())
|
||||||
if dist <= finddist then
|
if dist <= finddist then
|
||||||
matchingCrates[#matchingCrates + 1] = crateObj
|
matchingCrates[#matchingCrates + 1] = crateObj
|
||||||
end
|
end
|
||||||
@@ -5942,12 +5946,12 @@ function CTLD:_RemovePackedCratesByIds(Group, Unit, crateIds)
|
|||||||
|
|
||||||
local crates = {}
|
local crates = {}
|
||||||
local finddist = self.CrateDistance or 35
|
local finddist = self.CrateDistance or 35
|
||||||
local location = Group:GetCoordinate()
|
local location = Group:GetCoord()
|
||||||
for _, entry in pairs(self.Spawned_Cargo or {}) do
|
for _, entry in pairs(self.Spawned_Cargo or {}) do
|
||||||
if entry and idLookup[entry:GetID()] then
|
if entry and idLookup[entry:GetID()] then
|
||||||
local pos = entry:GetPositionable()
|
local pos = entry:GetPositionable()
|
||||||
if pos and pos:IsAlive() then
|
if pos and pos:IsAlive() then
|
||||||
local dist = location:Get2DDistance(pos:GetCoordinate())
|
local dist = location:Get2DDistance(pos:GetCoord())
|
||||||
if dist <= finddist then
|
if dist <= finddist then
|
||||||
crates[#crates + 1] = entry
|
crates[#crates + 1] = entry
|
||||||
end
|
end
|
||||||
@@ -6197,24 +6201,24 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation,Mult
|
|||||||
for _,_template in pairs(temptable) do
|
for _,_template in pairs(temptable) do
|
||||||
self.TroopCounter = self.TroopCounter + 1
|
self.TroopCounter = self.TroopCounter + 1
|
||||||
local alias = string.format("%s-%d", _template, math.random(1,100000))
|
local alias = string.format("%s-%d", _template, math.random(1,100000))
|
||||||
|
local spawn = SPAWN:NewWithAlias(_template,alias)
|
||||||
|
:InitDelayOff()
|
||||||
|
:InitCoalition(self.coalition)
|
||||||
|
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
||||||
|
:OnSpawnGroup(function(grp) grp.spawntime = timer.getTime() end)
|
||||||
if canmove then
|
if canmove then
|
||||||
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
--spawn:InitRandomizeUnits(true,20,2)
|
||||||
--:InitRandomizeUnits(true,20,2)
|
|
||||||
:InitDelayOff()
|
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
|
||||||
:OnSpawnGroup(function(grp) grp.spawntime = timer.getTime() end)
|
|
||||||
:SpawnFromVec2(randomcoord)
|
|
||||||
else -- don't random position of e.g. SAM units build as FOB
|
|
||||||
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
|
||||||
:InitDelayOff()
|
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
|
||||||
:OnSpawnGroup(function(grp) grp.spawntime = timer.getTime() end)
|
|
||||||
:SpawnFromVec2(randomcoord)
|
|
||||||
end
|
end
|
||||||
|
if Build.Heading and self.buildcrateswithaircraftheading then
|
||||||
|
spawn:InitGroupHeading(Build.Heading)
|
||||||
|
end
|
||||||
|
local spawnedGroup = spawn:SpawnFromVec2(randomcoord)
|
||||||
|
self.DroppedTroops[self.TroopCounter] = spawnedGroup
|
||||||
|
|
||||||
if Repair then
|
if Repair then
|
||||||
self:__CratesRepaired(1,Group,Unit,self.DroppedTroops[self.TroopCounter])
|
self:__CratesRepaired(1,Group,Unit,spawnedGroup)
|
||||||
else
|
else
|
||||||
self:__CratesBuild(1,Group,Unit,self.DroppedTroops[self.TroopCounter])
|
self:__CratesBuild(1,Group,Unit,spawnedGroup)
|
||||||
end
|
end
|
||||||
end -- template loop
|
end -- template loop
|
||||||
|
|
||||||
@@ -6244,14 +6248,11 @@ end
|
|||||||
-- @param Wrapper.Group#GROUP Group The Group to move.
|
-- @param Wrapper.Group#GROUP Group The Group to move.
|
||||||
function CTLD:_MoveGroupToZone(Group)
|
function CTLD:_MoveGroupToZone(Group)
|
||||||
self:T(self.lid .. " _MoveGroupToZone")
|
self:T(self.lid .. " _MoveGroupToZone")
|
||||||
local groupname = Group:GetName() or "none"
|
|
||||||
local groupcoord = Group:GetCoordinate()
|
|
||||||
-- Get closest zone of type
|
-- Get closest zone of type
|
||||||
local outcome, name, zone, distance = self:IsUnitInZone(Group,CTLD.CargoZoneType.MOVE)
|
local outcome, name, zone, distance = self:IsUnitInZone(Group,CTLD.CargoZoneType.MOVE)
|
||||||
self:T({canmove=outcome, name=name, zone=zone, dist=distance,max=self.movetroopsdistance})
|
self:T({canmove=outcome, name=name, zone=zone, dist=distance,max=self.movetroopsdistance})
|
||||||
if (distance <= self.movetroopsdistance) and outcome == true and zone~= nil then
|
if (distance <= self.movetroopsdistance) and outcome == true and zone~= nil then
|
||||||
-- yes, we can ;)
|
-- yes, we can ;)
|
||||||
local groupname = Group:GetName()
|
|
||||||
local zonecoord = zone:GetRandomCoordinate(20,125) -- Core.Point#COORDINATE
|
local zonecoord = zone:GetRandomCoordinate(20,125) -- Core.Point#COORDINATE
|
||||||
local formation = self:_GetVehicleFormation()
|
local formation = self:_GetVehicleFormation()
|
||||||
--local coordinate = zonecoord:GetVec2()
|
--local coordinate = zonecoord:GetVec2()
|
||||||
@@ -7934,6 +7935,7 @@ function CTLD:_UnloadSingleTroopByID(Group, Unit, chunkID, qty)
|
|||||||
local Positions = self:_GetUnitPositions(randomcoord, rad, heading, _template)
|
local Positions = self:_GetUnitPositions(randomcoord, rad, heading, _template)
|
||||||
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template, alias)
|
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template, alias)
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
|
:InitCoalition(self.coalition)
|
||||||
:InitSetUnitAbsolutePositions(Positions)
|
:InitSetUnitAbsolutePositions(Positions)
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
||||||
:OnSpawnGroup(function(grp) grp.spawntime = timer.getTime() end)
|
:OnSpawnGroup(function(grp) grp.spawntime = timer.getTime() end)
|
||||||
@@ -9081,7 +9083,7 @@ function CTLD:SmokePositionNow(Unit, Flare, SmokeColor)
|
|||||||
end
|
end
|
||||||
local FlareColor = self.FlareColor or FLARECOLOR.Red
|
local FlareColor = self.FlareColor or FLARECOLOR.Red
|
||||||
-- table of #CTLD.CargoZone table
|
-- table of #CTLD.CargoZone table
|
||||||
local unitcoord = Unit:GetCoordinate() -- Core.Point#COORDINATE
|
local unitcoord = Unit:GetCoord() -- Core.Point#COORDINATE
|
||||||
local Group = Unit:GetGroup()
|
local Group = Unit:GetGroup()
|
||||||
if Flare then
|
if Flare then
|
||||||
unitcoord:Flare(FlareColor, 90)
|
unitcoord:Flare(FlareColor, 90)
|
||||||
@@ -9100,7 +9102,7 @@ end
|
|||||||
function CTLD:SmokeZoneNearBy(Unit, Flare)
|
function CTLD:SmokeZoneNearBy(Unit, Flare)
|
||||||
self:T(self.lid .. " SmokeZoneNearBy")
|
self:T(self.lid .. " SmokeZoneNearBy")
|
||||||
-- table of #CTLD.CargoZone table
|
-- table of #CTLD.CargoZone table
|
||||||
local unitcoord = Unit:GetCoordinate()
|
local unitcoord = Unit:GetCoord()
|
||||||
local Group = Unit:GetGroup()
|
local Group = Unit:GetGroup()
|
||||||
local smokedistance = self.smokedistance
|
local smokedistance = self.smokedistance
|
||||||
local smoked = false
|
local smoked = false
|
||||||
@@ -9237,7 +9239,7 @@ end
|
|||||||
-- get speed and height
|
-- get speed and height
|
||||||
local uspeed = Unit:GetVelocityMPS()
|
local uspeed = Unit:GetVelocityMPS()
|
||||||
local uheight = Unit:GetHeight()
|
local uheight = Unit:GetHeight()
|
||||||
local ucoord = Unit:GetCoordinate()
|
local ucoord = Unit:GetCoord()
|
||||||
if not ucoord then
|
if not ucoord then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -9266,7 +9268,7 @@ end
|
|||||||
-- get speed and height
|
-- get speed and height
|
||||||
local uspeed = Unit:GetVelocityMPS()
|
local uspeed = Unit:GetVelocityMPS()
|
||||||
local uheight = Unit:GetHeight()
|
local uheight = Unit:GetHeight()
|
||||||
local ucoord = Unit:GetCoordinate()
|
local ucoord = Unit:GetCoord()
|
||||||
if not ucoord then
|
if not ucoord then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -9358,7 +9360,7 @@ end
|
|||||||
minheight = 5.1 -- herc is 5m AGL on the ground
|
minheight = 5.1 -- herc is 5m AGL on the ground
|
||||||
end
|
end
|
||||||
local uheight = Unit:GetHeight()
|
local uheight = Unit:GetHeight()
|
||||||
local ucoord = Unit:GetCoordinate()
|
local ucoord = Unit:GetCoord()
|
||||||
if not ucoord then
|
if not ucoord then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -10144,6 +10146,7 @@ end
|
|||||||
local alias = string.format("%s-%d", _template, math.random(1,100000))
|
local alias = string.format("%s-%d", _template, math.random(1,100000))
|
||||||
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
||||||
:InitRandomizeUnits(randompositions,20,2)
|
:InitRandomizeUnits(randompositions,20,2)
|
||||||
|
:InitCoalition(self.coalition)
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
:OnSpawnGroup(function(grp,TimeStamp) grp.spawntime = TimeStamp or timer.getTime() end,TimeStamp)
|
:OnSpawnGroup(function(grp,TimeStamp) grp.spawntime = TimeStamp or timer.getTime() end,TimeStamp)
|
||||||
@@ -10298,6 +10301,7 @@ end
|
|||||||
if canmove then
|
if canmove then
|
||||||
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
||||||
:InitRandomizeUnits(true,20,2)
|
:InitRandomizeUnits(true,20,2)
|
||||||
|
:InitCoalition(self.coalition)
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
:OnSpawnGroup(function(grp,TimeStamp) grp.spawntime = TimeStamp or timer.getTime() end,TimeStamp)
|
:OnSpawnGroup(function(grp,TimeStamp) grp.spawntime = TimeStamp or timer.getTime() end,TimeStamp)
|
||||||
@@ -10305,6 +10309,7 @@ end
|
|||||||
else -- don't random position of e.g. SAM units build as FOB
|
else -- don't random position of e.g. SAM units build as FOB
|
||||||
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
self.DroppedTroops[self.TroopCounter] = SPAWN:NewWithAlias(_template,alias)
|
||||||
:InitDelayOff()
|
:InitDelayOff()
|
||||||
|
:InitCoalition(self.coalition)
|
||||||
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
:InitValidateAndRepositionGroundUnits(self.validateAndRepositionUnits)
|
||||||
:OnSpawnGroup(function(grp,TimeStamp) grp.spawntime = TimeStamp or timer.getTime() end,TimeStamp)
|
:OnSpawnGroup(function(grp,TimeStamp) grp.spawntime = TimeStamp or timer.getTime() end,TimeStamp)
|
||||||
:SpawnFromVec2(randomcoord)
|
:SpawnFromVec2(randomcoord)
|
||||||
@@ -10586,7 +10591,7 @@ end
|
|||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
if Unit and Unit:IsPlayer() and self.PlayerTaskQueue then
|
if Unit and Unit:IsPlayer() and self.PlayerTaskQueue then
|
||||||
local playername = Unit:GetPlayerName()
|
local playername = Unit:GetPlayerName()
|
||||||
local dropcoord = Troops:GetCoordinate() or COORDINATE:New(0,0,0)
|
local dropcoord = Troops:GetCoord() or COORDINATE:New(0,0,0)
|
||||||
local dropvec2 = dropcoord:GetVec2()
|
local dropvec2 = dropcoord:GetVec2()
|
||||||
self.PlayerTaskQueue:ForEach(
|
self.PlayerTaskQueue:ForEach(
|
||||||
function (Task)
|
function (Task)
|
||||||
@@ -10643,7 +10648,7 @@ end
|
|||||||
for _,_cargo in pairs(Cargotable) do
|
for _,_cargo in pairs(Cargotable) do
|
||||||
local Vehicle = _cargo.Positionable
|
local Vehicle = _cargo.Positionable
|
||||||
if Vehicle then
|
if Vehicle then
|
||||||
local dropcoord = Vehicle:GetCoordinate() or COORDINATE:New(0,0,0)
|
local dropcoord = Vehicle:GetCoord() or COORDINATE:New(0,0,0)
|
||||||
local dropvec2 = dropcoord:GetVec2()
|
local dropvec2 = dropcoord:GetVec2()
|
||||||
self.PlayerTaskQueue:ForEach(
|
self.PlayerTaskQueue:ForEach(
|
||||||
function (Task)
|
function (Task)
|
||||||
@@ -10708,7 +10713,7 @@ end
|
|||||||
self:T({From, Event, To})
|
self:T({From, Event, To})
|
||||||
if Unit and Unit:IsPlayer() and self.PlayerTaskQueue then
|
if Unit and Unit:IsPlayer() and self.PlayerTaskQueue then
|
||||||
local playername = Unit:GetPlayerName()
|
local playername = Unit:GetPlayerName()
|
||||||
local dropcoord = Vehicle:GetCoordinate() or COORDINATE:New(0,0,0)
|
local dropcoord = Vehicle:GetCoord() or COORDINATE:New(0,0,0)
|
||||||
local dropvec2 = dropcoord:GetVec2()
|
local dropvec2 = dropcoord:GetVec2()
|
||||||
self.PlayerTaskQueue:ForEach(
|
self.PlayerTaskQueue:ForEach(
|
||||||
function (Task)
|
function (Task)
|
||||||
|
|||||||
Reference in New Issue
Block a user