Opened 6 years ago
Last modified 5 years ago
#4836 new defect
Trigger scripts in Atlas not unloaded after changing the map
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Should Have | Milestone: | Backlog |
Component: | Atlas editor | Keywords: | |
Cc: | historic_bruno | Patch: |
Description
Reproduce:
- Start atlas
- Select the random map Danubius and generate
- Select a different random map and generate
Result:
WARNING: JavaScript warning: maps/scripts/TriggerHelper.js line 36 Script value conversion check failed: v.isNumber() (got type undefined) WARNING: JavaScript warning: maps/scripts/TriggerHelper.js line 37 Script value conversion check failed: v.isNumber() (got type undefined) ERROR: tried to create entity from a source without position WARNING: JavaScript warning: maps/random/danubius_triggers.js line 402 reference to undefined property TriggerHelper.SpawnUnits(...)[0] WARNING: JavaScript warning: maps/scripts/TriggerHelper.js line 36 Script value conversion check failed: v.isNumber() (got type undefined) WARNING: JavaScript warning: maps/scripts/TriggerHelper.js line 37 Script value conversion check failed: v.isNumber() (got type undefined) ERROR: tried to create entity from a source without position WARNING: JavaScript warning: maps/random/danubius_triggers.js line 467 Script value conversion check failed: v.isNumber() (got type undefined) WARNING: JavaScript warning: maps/random/danubius_triggers.js line 467 Script value conversion check failed: v.isNumber() (got type undefined)
- Survival of the fittest does not throw warnings.
- Danubius shouldn't spawn units when loading the file, but
OnInitGame
, as these spawned units are deleted right after deserializing a savegame. - wiki:Triggers#Datainitialisation should add the braces around init code and have a recommendation to do every action in
OnInitGame
. - After improving the TriggerScripts, Atlas is still bugged because it still executes the TriggerScript file of a different map
Change History (4)
follow-up: 2 comment:1 by , 6 years ago
Owner: | set to |
---|
comment:2 by , 6 years ago
Replying to elexis:
In
selectMap
ofgamesetup.js
, we still have a whitelist of properties that must be deleted:Deleting the existing settings is would fix the issue for any arbitrary setting that we don't want to persist. I expect that the Atlas GUI values are never replaced with the ranom map settings, so deleting them wouldn't imply loss of the chosen settings in the GUI.
Do you suggest to add the removing logic from gamesetup.js
to the Atlas?
comment:3 by , 5 years ago
Cc: | added |
---|
trompetin17 and I discussed a solution at some length on IRC (starting at 03:09)
comment:4 by , 5 years ago
Adding more information about the solution, JSON Schema
map_optionalsettings.json: { random: [ "" , "" , ""], scenario: [ "", "", "" ] }
Note:
See TracTickets
for help on using tickets.
The random map generation button in Atlas calls
MapSidebar::OnRandomGenerate
ofMap.cpp
.It contains this TODO from r9566:
The three data sources are (1) the existing settings (2) the GUI and (3) the map JSON data.
Hence the TriggerScript array of the map settings array is persisted when changing the map. This problem holds some similarity to the gamesetup persist-match-settings issues (that exists in between gamesetup restarts and when switching the selected random map script).
In
selectMap
ofgamesetup.js
, we still have a whitelist of properties that must be deleted:Deleting the existing settings is would fix the issue for any arbitrary setting that we don't want to persist. I expect that the Atlas GUI values are never replaced with the ranom map settings, so deleting them wouldn't imply loss of the chosen settings in the GUI.