Loading...
  OR  Zero-K Name:    Password:   

inverted idea

3 posts, 199 views
Post comment
Filter:    Player:  
sort
8 days ago
will this work?
function gadget:GetInfo()
    return {
        name      = "Invert Map",
        desc      = "Invert Map Height",
        author    = "SmokeDragon",
        date      = "2025-09-14",
        license   = "MIT",
        layer     = 0,
        enabled   = true
    }
end

if not gadgetHandler:IsSyncedCode() then
    return
end

function gadget:Initialize()
    local mapSizeX = Game.mapSizeX
    local mapSizeZ = Game.mapSizeZ
    local step = 8

    for x = 0, mapSizeX, step do
        for z = 0, mapSizeZ, step do
            local h = Spring.GetGroundHeight(x, z)
            Spring.SetHeightMap(x, z, -h)
        end
    end

    Spring.RecalculatePathMap()
end
+0 / -0
It would in a less developed game. Here you will need to also expose a table to GG that is used by ZK as follows.
local function GetGroundOrigHeightOverride(x, z, xOff, zOff)
	if GG.mapgen_origHeight and GG.mapgen_origHeight[x] and GG.mapgen_origHeight[x][z] then
		return GG.mapgen_origHeight[x][z] - (Spring.GetGameRulesParam("waterlevel") or 0)
	end
	return spGetGroundOrigHeight(x +  (xOff or 0), z + (zOff or 0))
end


I would also recommend that you find the average height of the map, and flip heights around it, rather than around zero.
+1 / -0
7 days ago
thank you! =)
+0 / -0