hedgewars/uScript.pas
changeset 4372 3836973380b9
parent 4371 ae172b2b03ed
child 4373 fe0e3903bb9e
equal deleted inserted replaced
4371:ae172b2b03ed 4372:3836973380b9
   297     if lua_gettop(L) <> 1 then
   297     if lua_gettop(L) <> 1 then
   298         LuaError('Lua: Wrong number of parameters passed to GetHogLevel!')
   298         LuaError('Lua: Wrong number of parameters passed to GetHogLevel!')
   299     else begin
   299     else begin
   300         gear := GearByUID(lua_tointeger(L, 1));
   300         gear := GearByUID(lua_tointeger(L, 1));
   301         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   301         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   302             lua_pushinteger(L, PHedgehog(gear^.Hedgehog)^.BotLevel)
   302             lua_pushinteger(L, gear^.Hedgehog^.BotLevel)
   303         else
   303         else
   304             lua_pushnil(L);
   304             lua_pushnil(L);
   305     end;
   305     end;
   306     lc_gethoglevel := 1;
   306     lc_gethoglevel := 1;
   307 end;
   307 end;
   317     else
   317     else
   318         begin
   318         begin
   319         gear:= GearByUID(lua_tointeger(L, 1));
   319         gear:= GearByUID(lua_tointeger(L, 1));
   320         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   320         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   321             begin
   321             begin
   322             lua_pushinteger(L, PHedgehog(gear^.Hedgehog)^.Team^.Clan^.ClanIndex)
   322             lua_pushinteger(L, gear^.Hedgehog^.Team^.Clan^.ClanIndex)
   323             end
   323             end
   324         else
   324         else
   325             lua_pushnil(L);
   325             lua_pushnil(L);
   326         end;
   326         end;
   327     lc_gethogclan:= 1
   327     lc_gethogclan:= 1
   338     else
   338     else
   339         begin
   339         begin
   340         gear:= GearByUID(lua_tointeger(L, 1));
   340         gear:= GearByUID(lua_tointeger(L, 1));
   341         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   341         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   342             begin
   342             begin
   343             lua_pushstring(L, str2pchar(PHedgehog(gear^.Hedgehog)^.Team^.TeamName))
   343             lua_pushstring(L, str2pchar(gear^.Hedgehog^.Team^.TeamName))
   344             end
   344             end
   345         else
   345         else
   346             lua_pushnil(L);
   346             lua_pushnil(L);
   347         end;
   347         end;
   348     lc_gethogteamname:= 1
   348     lc_gethogteamname:= 1
   359     else
   359     else
   360         begin
   360         begin
   361         gear:= GearByUID(lua_tointeger(L, 1));
   361         gear:= GearByUID(lua_tointeger(L, 1));
   362         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   362         if (gear <> nil) and (gear^.Kind = gtHedgehog) and (gear^.Hedgehog <> nil) then
   363             begin
   363             begin
   364             lua_pushstring(L, str2pchar(PHedgehog(gear^.Hedgehog)^.Name))
   364             lua_pushstring(L, str2pchar(gear^.Hedgehog^.Name))
   365             end
   365             end
   366         else
   366         else
   367             lua_pushnil(L);
   367             lua_pushnil(L);
   368         end;
   368         end;
   369     lc_gethogname:= 1
   369     lc_gethogname:= 1
   568     if lua_gettop(L) <> 3 then
   568     if lua_gettop(L) <> 3 then
   569         LuaError('Lua: Wrong number of parameters passed to SetEffect!')
   569         LuaError('Lua: Wrong number of parameters passed to SetEffect!')
   570     else begin
   570     else begin
   571         gear := GearByUID(lua_tointeger(L, 1));
   571         gear := GearByUID(lua_tointeger(L, 1));
   572         if gear <> nil then
   572         if gear <> nil then
   573             PHedgehog(gear^.Hedgehog)^.Effects[THogEffect(lua_tointeger(L, 2))]:= lua_tointeger(L, 3) <> 0;
   573             gear^.Hedgehog^.Effects[THogEffect(lua_tointeger(L, 2))]:= lua_tointeger(L, 3) <> 0;
   574     end;
   574     end;
   575     lc_seteffect := 0;
   575     lc_seteffect := 0;
   576 end;
   576 end;
   577 
   577 
   578 function lc_setstate(L : Plua_State) : LongInt; Cdecl;
   578 function lc_setstate(L : Plua_State) : LongInt; Cdecl;