mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
#CTLD
* Allow save/loadback with precise(r) coordinates for vehicles and troops.
This commit is contained in:
parent
9d5da3388d
commit
ee409c45a0
@ -987,6 +987,7 @@ do
|
|||||||
-- my_ctld.filename = "missionsave.csv" -- example filename
|
-- my_ctld.filename = "missionsave.csv" -- example filename
|
||||||
-- my_ctld.filepath = "C:\\Users\\myname\\Saved Games\\DCS\Missions\\MyMission" -- example path
|
-- my_ctld.filepath = "C:\\Users\\myname\\Saved Games\\DCS\Missions\\MyMission" -- example path
|
||||||
-- my_ctld.eventoninject = true -- fire OnAfterCratesBuild and OnAfterTroopsDeployed events when loading (uses Inject functions)
|
-- my_ctld.eventoninject = true -- fire OnAfterCratesBuild and OnAfterTroopsDeployed events when loading (uses Inject functions)
|
||||||
|
-- my_ctld.useprecisecoordloads = true -- Instead if slightly varyiing the group position, try to maintain it as is
|
||||||
--
|
--
|
||||||
-- Then use an initial load at the beginning of your mission:
|
-- Then use an initial load at the beginning of your mission:
|
||||||
--
|
--
|
||||||
@ -1219,7 +1220,7 @@ CTLD.UnitTypes = {
|
|||||||
|
|
||||||
--- CTLD class version.
|
--- CTLD class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
CTLD.version="1.0.32"
|
CTLD.version="1.0.33"
|
||||||
|
|
||||||
--- Instantiate a new CTLD.
|
--- Instantiate a new CTLD.
|
||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
@ -1312,6 +1313,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
|
|||||||
self.droppedBeacons = {}
|
self.droppedBeacons = {}
|
||||||
self.droppedbeaconref = {}
|
self.droppedbeaconref = {}
|
||||||
self.droppedbeacontimeout = 600
|
self.droppedbeacontimeout = 600
|
||||||
|
self.useprecisecoordloads = true
|
||||||
|
|
||||||
-- Cargo
|
-- Cargo
|
||||||
self.Cargo_Crates = {}
|
self.Cargo_Crates = {}
|
||||||
@ -4794,6 +4796,8 @@ end
|
|||||||
-- @param #CTLD self
|
-- @param #CTLD self
|
||||||
-- @param Core.Zone#ZONE Zone The zone where to drop the troops.
|
-- @param Core.Zone#ZONE Zone The zone where to drop the troops.
|
||||||
-- @param Ops.CTLD#CTLD_CARGO Cargo The #CTLD_CARGO object to spawn.
|
-- @param Ops.CTLD#CTLD_CARGO Cargo The #CTLD_CARGO object to spawn.
|
||||||
|
-- @param #table Surfacetypes (Optional) Table of surface types. Can also be a single surface type. We will try max 1000 times to find the right type!
|
||||||
|
-- @param #boolean PreciseLocation (Optional) Don't try to get a random position in the zone but use the dead center. Caution not to stack up stuff on another!
|
||||||
-- @return #CTLD self
|
-- @return #CTLD self
|
||||||
-- @usage Use this function to pre-populate the field with Vehicles or FOB at a random coordinate in a zone:
|
-- @usage Use this function to pre-populate the field with Vehicles or FOB at a random coordinate in a zone:
|
||||||
-- -- create a matching #CTLD_CARGO type
|
-- -- create a matching #CTLD_CARGO type
|
||||||
@ -4802,7 +4806,7 @@ end
|
|||||||
-- local dropzone = ZONE:New("InjectZone") -- Core.Zone#ZONE
|
-- local dropzone = ZONE:New("InjectZone") -- Core.Zone#ZONE
|
||||||
-- -- and go:
|
-- -- and go:
|
||||||
-- my_ctld:InjectVehicles(dropzone,InjectVehicleType)
|
-- my_ctld:InjectVehicles(dropzone,InjectVehicleType)
|
||||||
function CTLD:InjectVehicles(Zone,Cargo)
|
function CTLD:InjectVehicles(Zone,Cargo,Surfacetypes,PreciseLocation)
|
||||||
self:T(self.lid.." InjectVehicles")
|
self:T(self.lid.." InjectVehicles")
|
||||||
local cargo = Cargo -- #CTLD_CARGO
|
local cargo = Cargo -- #CTLD_CARGO
|
||||||
|
|
||||||
@ -4834,7 +4838,10 @@ end
|
|||||||
local temptable = cargo:GetTemplates() or {}
|
local temptable = cargo:GetTemplates() or {}
|
||||||
local factor = 1.5
|
local factor = 1.5
|
||||||
local zone = Zone
|
local zone = Zone
|
||||||
local randomcoord = zone:GetRandomCoordinate(10,30*factor):GetVec2()
|
local randomcoord = zone:GetRandomCoordinate(10,30*factor,Surfacetypes):GetVec2()
|
||||||
|
if PreciseLocation then
|
||||||
|
randomcoord = zone:GetCoordinate():GetVec2()
|
||||||
|
end
|
||||||
cargo:SetWasDropped(true)
|
cargo:SetWasDropped(true)
|
||||||
local canmove = false
|
local canmove = false
|
||||||
if type == CTLD_CARGO.Enum.VEHICLE then canmove = true end
|
if type == CTLD_CARGO.Enum.VEHICLE then canmove = true end
|
||||||
@ -5463,10 +5470,10 @@ end
|
|||||||
local dropzone = ZONE_RADIUS:New("DropZone",vec2,20)
|
local dropzone = ZONE_RADIUS:New("DropZone",vec2,20)
|
||||||
if cargotype == CTLD_CARGO.Enum.VEHICLE or cargotype == CTLD_CARGO.Enum.FOB then
|
if cargotype == CTLD_CARGO.Enum.VEHICLE or cargotype == CTLD_CARGO.Enum.FOB then
|
||||||
local injectvehicle = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
local injectvehicle = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
||||||
self:InjectVehicles(dropzone,injectvehicle)
|
self:InjectVehicles(dropzone,injectvehicle,self.surfacetypes,self.useprecisecoordloads)
|
||||||
elseif cargotype == CTLD_CARGO.Enum.TROOPS or cargotype == CTLD_CARGO.Enum.ENGINEERS then
|
elseif cargotype == CTLD_CARGO.Enum.TROOPS or cargotype == CTLD_CARGO.Enum.ENGINEERS then
|
||||||
local injecttroops = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
local injecttroops = CTLD_CARGO:New(nil,cargoname,cargotemplates,cargotype,true,true,size,nil,true,mass)
|
||||||
self:InjectTroops(dropzone,injecttroops,self.surfacetypes)
|
self:InjectTroops(dropzone,injecttroops,self.surfacetypes,self.useprecisecoordloads)
|
||||||
end
|
end
|
||||||
elseif (type(groupname) == "string" and groupname == "STATIC") or cargotype == CTLD_CARGO.Enum.REPAIR then
|
elseif (type(groupname) == "string" and groupname == "STATIC") or cargotype == CTLD_CARGO.Enum.REPAIR then
|
||||||
local cargotemplates = dataset[6]
|
local cargotemplates = dataset[6]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user