Page 1 of 1

heightmap functions

Posted: 30 Jan 2015, 03:36
by zoggop
did something change that the wiki no longer reflects? i remember using these functions in map gadgets, but now:

Code: Select all

[f=0000050][f=0000122] Error: LuaRules::RunCallIn: error = 2, Initialize, [Internal Lua error: Call failure] error = 2, LuaRules/gadgets.lua, [string "LuaRules/Gadgets/heightmaptest.lua"]:14: attempt to call field 'AdjustHeightMap' (a nil value)
stack traceback:
	[C]: in function 'Include'
	[string "LuaRules/draw.lua"]:9: in main chunk
[f=0000122] Error: LuaRules loading failed

Code: Select all

function gadget:GetInfo()
  return {
    name      = "Loony: Heightmap Test",
    desc      = "Tries to adjust the heightmap.",
    author    = "zoggop",
    date      = "January 2015",
    license   = "whatever",
    layer     = -3,
    enabled   = true
   }
end

function gadget:Initialize()
  Spring.AdjustHeightMap(100, 100, 200, 200, 50)
end
edit: it works when luarules are loaded the first time, but not when they're reloaded with a console command

Re: heightmap functions

Posted: 30 Jan 2015, 03:45
by gajop
Shouldn't it have a check to see if it's synced?

Code: Select all

if (gadgetHandler:IsSyncedCode()) then 

-- your callin

end

Re: heightmap functions

Posted: 30 Jan 2015, 03:51
by zoggop
lol, indeed. thanks