# HG changeset patch # User nemo # Date 1291911160 18000 # Node ID ba5da3388110652e18dc404acaa5461bccc93696 # Parent 1eea498d12e0d467a4b3a4717a9977d843610cc2 add missing setter for botlevel diff -r 1eea498d12e0 -r ba5da3388110 hedgewars/uScript.pas --- a/hedgewars/uScript.pas Thu Dec 09 10:24:04 2010 -0500 +++ b/hedgewars/uScript.pas Thu Dec 09 11:12:40 2010 -0500 @@ -456,6 +456,20 @@ lc_gethoglevel := 1; end; +function lc_sethoglevel(L : Plua_State) : LongInt; Cdecl; +var gear : PGear; +begin + if lua_gettop(L) <> 2 then + LuaError('Lua: Wrong number of parameters passed to SetHogLevel!') + else + begin + gear:= GearByUID(lua_tointeger(L, 1)); + if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then + gear^.Hedgehog^.BotLevel:= lua_tointeger(L, 2); + end; + lc_sethoglevel:= 0 +end; + function lc_gethogclan(L : Plua_State) : LongInt; Cdecl; var gear : PGear; begin @@ -1385,6 +1399,7 @@ lua_register(luaState, 'GetHogTeamName', @lc_gethogteamname); lua_register(luaState, 'GetHogName', @lc_gethogname); lua_register(luaState, 'GetHogLevel', @lc_gethoglevel); +lua_register(luaState, 'SetHogLevel', @lc_sethoglevel); lua_register(luaState, 'GetX', @lc_getx); lua_register(luaState, 'GetY', @lc_gety); lua_register(luaState, 'CopyPV', @lc_copypv);