Stability Fix

Possible fix for intermittent crashes
This commit is contained in:
Ciaran Fisher
2015-06-21 16:09:03 +01:00
parent 79acf60bcb
commit 7d317812c5
+24 -6
View File
@@ -10,7 +10,7 @@
See https://github.com/ciribob/DCS-CTLD for a user manual and the latest version See https://github.com/ciribob/DCS-CTLD for a user manual and the latest version
Version: 1.20 - 21/06/2015 - Crates in Zone now works for Spawned crates and Ones added by the mission editor Version: 1.21 - 21/06/2015 - Crates in Zone now works for Spawned crates and Ones added by the mission editor
- Enabled multi crate units - Enabled multi crate units
- Added new parameter for the number of launchers to spawn a HAWK with - Added new parameter for the number of launchers to spawn a HAWK with
@@ -704,7 +704,10 @@ end
-- --
--end --end
function ctld.spawnCrate(_args) function ctld.spawnCrate(_arguments)
local _status,_err = pcall(
function(_args)
-- use the cargo weight to guess the type of unit as no way to add description :( -- use the cargo weight to guess the type of unit as no way to add description :(
@@ -779,6 +782,13 @@ function ctld.spawnCrate(_args)
else else
env.info("Couldn't find crate item to spawn") env.info("Couldn't find crate item to spawn")
end end
end
, _arguments)
if (not _status) then
env.error(string.format("CTLD ERROR: %s", _err))
end
end end
function ctld.troopsOnboard(_heli, _troops) function ctld.troopsOnboard(_heli, _troops)
@@ -1633,7 +1643,10 @@ end
function ctld.unpackCrates(_args) function ctld.unpackCrates(_arguments)
local _status,_err = pcall(
function(_args)
-- trigger.action.outText("Unpack Crates".._args[1],10) -- trigger.action.outText("Unpack Crates".._args[1],10)
@@ -1673,7 +1686,7 @@ function ctld.unpackCrates(_args)
-- ctld.spawnCrateStatic( _heli:getCoalition(),mist.getNextUnitId(),{x=100,z=100},_crateName,100) -- ctld.spawnCrateStatic( _heli:getCoalition(),mist.getNextUnitId(),{x=100,z=100},_crateName,100)
--remove crate --remove crate
_crate.crateUnit:destroy() -- _crate.crateUnit:destroy()
local _spawnedGroups = ctld.spawnCrateGroup(_heli, { _cratePoint }, { _crate.details.unit }) local _spawnedGroups = ctld.spawnCrateGroup(_heli, { _cratePoint }, { _crate.details.unit })
@@ -1700,6 +1713,11 @@ function ctld.unpackCrates(_args)
ctld.displayMessageToGroup(_heli, "No friendly crates close enough to unpack", 20) ctld.displayMessageToGroup(_heli, "No friendly crates close enough to unpack", 20)
end end
end end
end, _arguments)
if (not _status) then
env.error(string.format("CTLD ERROR: %s", _err))
end
end end
@@ -2383,7 +2401,7 @@ function ctld.unpackHawk(_heli, _nearestCrate, _nearbyCrates)
end end
--destroy --destroy
_hawkPart.crateUnit:destroy() -- _hawkPart.crateUnit:destroy()
end end
-- HAWK READY! -- HAWK READY!
@@ -2440,7 +2458,7 @@ function ctld.unpackMultiCrate(_heli, _nearestCrate, _nearbyCrates)
end end
--destroy --destroy
_crate.crateUnit:destroy() -- _crate.crateUnit:destroy()
end end