Spring.GetGroundExtreme & in-game heightmap changes

Spring.GetGroundExtreme & in-game heightmap changes

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Spring.GetGroundExtreme & in-game heightmap changes

Post by zoggop » 31 Jan 2015, 23:38

I posted this as a mantis bug, but jK is certain Spring.GetGroundExtremes() is fine under all circumstances. To me it appears that Spring.GetGroundExtremes() returns the extremes of the heightmap when it's first loaded only. If the heightmap is changed with lua functions such as Spring.AdjustHeightMap(), or deformed by explosions in such a way as to create a new minimum or maximum, Spring.GetGroundExtremes() will return the same values as it did when the map loaded.

Attached is a screenshot showing a height at cursor of 92, yet a gadget prints the minimum height from Spring.GetGroundExtremes as 108. The height is 92 after a BA commander explosion.

here's the gadget used to test:

Code: Select all

function gadget:GetInfo()
  return {
    name      = "Loony: Heightmap Test",
    desc      = "heightmap test.",
    author    = "zoggop",
    date      = "January 2015",
    license   = "whatever",
    layer     = 10,
    enabled   = true
   }
end

-- synced --------------------------------------------------------------------

if gadgetHandler:IsSyncedCode() then 

function gadget:UnitCreated()
  Spring.Echo(Spring.GetGroundExtremes())
end

end
am i doing something wrong?
Attachments
minimum_height_mismatch.jpg
(97.32 KiB) Not downloaded yet
0 x

Kloot
Spring Developer
Posts: 1865
Joined: 08 Oct 2006, 16:58

Re: Spring.GetGroundExtreme & in-game heightmap changes

Post by Kloot » 31 Jan 2015, 23:48

Not at all, your description of the problem is accurate.

In 99.0 the current extrema will be available as the third and fourth return values of GetGroundExtremes.
0 x

User avatar
zoggop
Posts: 289
Joined: 07 Sep 2010, 18:47

Re: Spring.GetGroundExtreme & in-game heightmap changes

Post by zoggop » 31 Jan 2015, 23:50

ah, excellent. i was just reporting something that's already been addressed then
0 x

Post Reply

Return to “Lua Scripts”