hedgewars/uScript.pas
changeset 15017 d610d1c9fd55
parent 14927 9d6a25239d00
child 15032 b181ff6367c9
equal deleted inserted replaced
15016:ba49de0c0e38 15017:d610d1c9fd55
  2628     if CheckLuaParamCount(L, 4, 'AddHog', 'hogname, botlevel, health, hat') then
  2628     if CheckLuaParamCount(L, 4, 'AddHog', 'hogname, botlevel, health, hat') then
  2629         begin
  2629         begin
  2630         hatName:= lua_tostring(L, 4);
  2630         hatName:= lua_tostring(L, 4);
  2631         ParseCommand('addhh ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 3) + ' ' + lua_tostring(L, 1), true, true);
  2631         ParseCommand('addhh ' + lua_tostring(L, 2) + ' ' + lua_tostring(L, 3) + ' ' + lua_tostring(L, 1), true, true);
  2632         ParseCommand('hat ' + hatName, true, true);
  2632         ParseCommand('hat ' + hatName, true, true);
  2633         lua_pushnumber(L, CurrentHedgehog^.Gear^.uid);
  2633         if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then
       
  2634             lua_pushnumber(L, CurrentHedgehog^.Gear^.uid)
       
  2635         else
       
  2636             OutError('Lua error: AddHog: Error adding hog. Maybe function was called outside of onGameInit.', true);
  2634         end
  2637         end
  2635     else
  2638     else
  2636         lua_pushnil(L);
  2639         lua_pushnil(L);
  2637     lc_addhog:= 1;
  2640     lc_addhog:= 1;
  2638 end;
  2641 end;
  2653             begin
  2656             begin
  2654             hatName:= Hat;
  2657             hatName:= Hat;
  2655             ParseCommand('addhh ' + IntToStr(BotLevel) + ' ' + lua_tostring(L, 1) + ' ' + Name, true, true);
  2658             ParseCommand('addhh ' + IntToStr(BotLevel) + ' ' + lua_tostring(L, 1) + ' ' + Name, true, true);
  2656             ParseCommand('hat ' + hatName, true, true);
  2659             ParseCommand('hat ' + hatName, true, true);
  2657             end;
  2660             end;
  2658         lua_pushnumber(L, CurrentHedgehog^.Gear^.uid);
  2661         if (CurrentHedgehog <> nil) and (CurrentHedgehog^.Gear <> nil) then
       
  2662             lua_pushnumber(L, CurrentHedgehog^.Gear^.uid)
       
  2663         else
       
  2664             OutError('Lua error: AddMissionHog: Error adding hog. Maybe function was called outside of onGameInit.', true);
  2659         end
  2665         end
  2660     else
  2666     else
  2661         lua_pushnil(L);
  2667         lua_pushnil(L);
  2662     lc_addmissionhog:= 1;
  2668     lc_addmissionhog:= 1;
  2663 end;
  2669 end;