Skip to content

Commit

Permalink
squadron: set location correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jtoppins committed Feb 2, 2021
1 parent 2c76beb commit 70f0948
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/dct/assets/Airbase.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/dct/assets/Squadron.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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: "..
Expand Down

0 comments on commit 70f0948

Please sign in to comment.