From 70f0948e19bde80956f2ccda270d0c105cfca5a1 Mon Sep 17 00:00:00 2001 From: Jonathan Toppins Date: Mon, 1 Feb 2021 21:05:14 -0500 Subject: [PATCH] squadron: set location correctly It appears some assets do not have a location, which does not conform to the Asset specification. The following error is seen when the location is not set correctly. Attempt to always set the location of the squadron. 2021-02-02 00:22:16.915 ERROR SCRIPTING: DCT|Theater: protected call - [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\utils.lua"]:95: attempt to index local 'point' (a nil value) stack traceback: [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:363: in function <[string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:361> [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\utils.lua"]:95: in function 'centroid' [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\templates\Region.lua"]:151: in function 'addAndSpawnAsset' [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\templates\Region.lua"]:260: in function '_generate' [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\templates\Region.lua"]:278: in function 'generate' [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:188: in function 'loadOrGenerate' [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:209: in function <[string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:206> (tail call): ? [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Command.lua"]:45: in function 'execute' [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:342: in function '_exec' [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:366: in function <[string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:365> [C]: in function 'xpcall' [string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:369: in function <[string "C:\Users\chris\Saved Games\DCS.openbeta\Mods\tech\DCT\lua\dct\Theater.lua"]:360> --- src/dct/assets/Airbase.lua | 1 + src/dct/assets/Squadron.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/src/dct/assets/Airbase.lua b/src/dct/assets/Airbase.lua index e4a45a98..5a5438cb 100644 --- a/src/dct/assets/Airbase.lua +++ b/src/dct/assets/Airbase.lua @@ -364,6 +364,7 @@ function AirbaseAsset:generate(assetmgr, region) "not supported type", self.name, tplname, tpl.objtype)) if tpl.coalition == self.owner then tpl.airbase = self.name + tpl.location = self:getLocation() local asset = assetmgr:factory(tpl.objtype)(tpl, region) assetmgr:add(asset) self:addSubordinate(asset) diff --git a/src/dct/assets/Squadron.lua b/src/dct/assets/Squadron.lua index 7d639712..712a2e01 100644 --- a/src/dct/assets/Squadron.lua +++ b/src/dct/assets/Squadron.lua @@ -26,6 +26,7 @@ function Squadron:_completeinit(template, region) self.ato = utils.deepcopy(template.ato) self.payloadlimits = utils.deepcopy(template.payloadlimits) self.airbase = template.airbase + self._location = template.location self._logger:debug("payloadlimits: ".. require("libs.json"):encode_pretty(self.payloadlimits)) self._logger:debug("ato: "..