View Issue Details

IDProjectCategoryView StatusLast Update
0006290Spring engineGeneralpublic2019-09-02 19:32
ReporterAntero Assigned To 
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version104.0 +git 
Summary0006290: Heightmap changes are not available for widgets/gadgets before GameSetup
DescriptionWhen playing on a map that has a gadget that generates the heightmap, the generated heightmap isn't available for other gadgets/widgets until GameSetup. This can be worked around, but would be handier if the heightmap was available during initialization.

For example, the startbox drawer widget in BA/ZK relies on Spring.GetGroundExtremes, and because of this boxes are drawn underground on a generated map. If the widget is reloaded when the game is running, the boxes are drawn correctly on the terrain.
TagsNo tags attached.
Attached Files
Checked infolog.txt for ErrorsYes

Activities

Antero

2019-08-31 20:35

reporter   ~0020103

For reference, this was tested with https://springfiles.com/spring/spring-maps/randommapgen12x12

The attachment contains the gadget that makes the heightmap.

The relevant parts of the gadget: https://pastebin.com/PhELTSxK
randommapgen_mapgen.lua (Attachment missing)

Kloot

2019-08-31 20:48

developer   ~0020104

Last edited: 2019-08-31 20:48

LuaGaia map gadgets are loaded after LuaRules.

While flipping them around would be trivial, I don't particularly want to change the ordering at this point in Spring's life without very good arguments, sorry.

Antero

2019-08-31 23:03

reporter   ~0020107

This randommapgen_mapgen is a LuaRules gadget btw (layer -100, before startbox drawing). No LuaGaia involved in these scenarios. Just wanted to clarify.

Feel free to close in any case if you think it's not worth it. This thing can be worked around by overriding Spring.GetGroundExtremes values or delaying things until GameSetup(), and I don't have any strong arguments.

Kloot

2019-09-02 19:32

developer   ~0020108

Spring.GetGroundExtremes returns *four* arguments (https://springrts.com/phpbb/viewtopic.php?p=565531#p565531), not two (as assumed by https://github.com/ZeroK-RTS/Zero-K/blob/46d9b8c1f78ef57e24991c63791ead8cb4ce5f59/LuaUI/Widgets/minimap_startbox_new.lua#L146 and other ZK code), so no need for any delaying hacks.

Moving the randommapgen_mapgen.lua gadget to a much lower layer will make the changed heightmap extrema available to other gadgets as well.

Issue History

Date Modified Username Field Change
2019-08-31 20:14 Antero New Issue
2019-08-31 20:35 Antero File Added: randommapgen_mapgen.lua
2019-08-31 20:35 Antero Note Added: 0020103
2019-08-31 20:48 Kloot Note Added: 0020104
2019-08-31 20:48 Kloot Note Edited: 0020104
2019-08-31 23:03 Antero Note Added: 0020107
2019-09-02 19:32 Kloot Status new => closed
2019-09-02 19:32 Kloot Resolution open => no change required
2019-09-02 19:32 Kloot Note Added: 0020108