hedgewars/uScript.pas
changeset 9788 af04cfdb1684
parent 9764 8dc9d268330f
child 9815 d4621fb76284
equal deleted inserted replaced
9787:0da6ba2f1f93 9788:af04cfdb1684
   835             end
   835             end
   836         else
   836         else
   837             lua_pushnil(L);
   837             lua_pushnil(L);
   838         end;
   838         end;
   839     lc_gethogteamname:= 1
   839     lc_gethogteamname:= 1
       
   840 end;
       
   841 
       
   842 function lc_sethogteamname(L : Plua_State) : LongInt; Cdecl;
       
   843 var gear : PGear;
       
   844 begin
       
   845     if lua_gettop(L) <> 2 then
       
   846         begin
       
   847         LuaParameterCountError('SetHogTeamName', 'gearUid, name', lua_gettop(L));
       
   848         lua_pushnil(L); // return value on stack (nil)
       
   849         end
       
   850     else
       
   851         begin
       
   852         gear := GearByUID(lua_tointeger(L, 1));
       
   853         if (gear <> nil) and ((gear^.Kind = gtHedgehog) or (gear^.Kind = gtGrave)) and (gear^.Hedgehog <> nil) then
       
   854             begin
       
   855             gear^.Hedgehog^.Team^.TeamName := lua_tostring(L, 2);
       
   856 
       
   857             FreeTexture(gear^.Hedgehog^.Team^.NameTagTex);
       
   858             gear^.Hedgehog^.Team^.NameTagTex:= RenderStringTex(gear^.Hedgehog^.Team^.TeamName, gear^.Hedgehog^.Team^.Clan^.Color, fnt16);
       
   859             end
       
   860         else
       
   861             lua_pushnil(L);
       
   862         end;
       
   863     lc_sethogteamname:= 1
   840 end;
   864 end;
   841 
   865 
   842 function lc_gethogname(L : Plua_State) : LongInt; Cdecl;
   866 function lc_gethogname(L : Plua_State) : LongInt; Cdecl;
   843 var gear : PGear;
   867 var gear : PGear;
   844 begin
   868 begin
  2507 lua_register(luaState, _P'GetEffect', @lc_geteffect);
  2531 lua_register(luaState, _P'GetEffect', @lc_geteffect);
  2508 lua_register(luaState, _P'GetHogClan', @lc_gethogclan);
  2532 lua_register(luaState, _P'GetHogClan', @lc_gethogclan);
  2509 lua_register(luaState, _P'GetClanColor', @lc_getclancolor);
  2533 lua_register(luaState, _P'GetClanColor', @lc_getclancolor);
  2510 lua_register(luaState, _P'SetClanColor', @lc_setclancolor);
  2534 lua_register(luaState, _P'SetClanColor', @lc_setclancolor);
  2511 lua_register(luaState, _P'GetHogTeamName', @lc_gethogteamname);
  2535 lua_register(luaState, _P'GetHogTeamName', @lc_gethogteamname);
       
  2536 lua_register(luaState, _P'SetHogTeamName', @lc_sethogteamname);
  2512 lua_register(luaState, _P'GetHogName', @lc_gethogname);
  2537 lua_register(luaState, _P'GetHogName', @lc_gethogname);
  2513 lua_register(luaState, _P'SetHogName', @lc_sethogname);
  2538 lua_register(luaState, _P'SetHogName', @lc_sethogname);
  2514 lua_register(luaState, _P'GetHogLevel', @lc_gethoglevel);
  2539 lua_register(luaState, _P'GetHogLevel', @lc_gethoglevel);
  2515 lua_register(luaState, _P'SetHogLevel', @lc_sethoglevel);
  2540 lua_register(luaState, _P'SetHogLevel', @lc_sethoglevel);
  2516 lua_register(luaState, _P'GetX', @lc_getx);
  2541 lua_register(luaState, _P'GetX', @lc_getx);