hedgewars/uScript.pas
changeset 12389 1adc078355d1
parent 12376 2b1dd699b371
child 12459 a675a94b5cc1
equal deleted inserted replaced
12388:e3d9abcc427a 12389:1adc078355d1
  1636                 prevgear^.Z := cHHZ;
  1636                 prevgear^.Z := cHHZ;
  1637                 prevgear^.Message:= prevgear^.Message or gmRemoveFromList or gmAddToList;
  1637                 prevgear^.Message:= prevgear^.Message or gmRemoveFromList or gmAddToList;
  1638                 end;
  1638                 end;
  1639 
  1639 
  1640             SwitchCurrentHedgehog(gear^.Hedgehog);
  1640             SwitchCurrentHedgehog(gear^.Hedgehog);
       
  1641             AmmoMenuInvalidated:= true;
  1641             CurrentTeam:= CurrentHedgehog^.Team;
  1642             CurrentTeam:= CurrentHedgehog^.Team;
       
  1643 
       
  1644             repeat
       
  1645                 CurrentTeam^.CurrHedgehog := (CurrentTeam^.CurrHedgehog + 1) mod CurrentTeam^.HedgehogsNumber
       
  1646             until
       
  1647                 CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear = CurrentHedgehog^.Gear;
  1642 
  1648 
  1643             gear^.State:= gear^.State or gstHHDriven;
  1649             gear^.State:= gear^.State or gstHHDriven;
  1644             gear^.Active := true;
  1650             gear^.Active := true;
  1645             gear^.Z := cCurrHHZ;
  1651             gear^.Z := cCurrHHZ;
  1646             gear^.Message:= gear^.Message or gmRemoveFromList or gmAddToList;
  1652             gear^.Message:= gear^.Message or gmRemoveFromList or gmAddToList;
  1935             end;
  1941             end;
  1936         end;
  1942         end;
  1937     lc_sendstat:= 0
  1943     lc_sendstat:= 0
  1938 end;
  1944 end;
  1939 
  1945 
       
  1946 function lc_sendgameresultoff(L : Plua_State) : LongInt; Cdecl;
       
  1947 begin
       
  1948     L:= L; // avoid compiler hint
       
  1949     uStats.SendGameResultOn := false;
       
  1950     lc_sendgameresultoff:= 0
       
  1951 end;
       
  1952 
       
  1953 function lc_sendrankingstatsoff(L : Plua_State) : LongInt; Cdecl;
       
  1954 begin
       
  1955     L:= L; // avoid compiler hint
       
  1956     uStats.SendRankingStatsOn := false;
       
  1957     lc_sendrankingstatsoff:= 0
       
  1958 end;
       
  1959 
       
  1960 function lc_sendachievementsstatsoff(L : Plua_State) : LongInt; Cdecl;
       
  1961 begin
       
  1962     L:= L; // avoid compiler hint
       
  1963     uStats.SendAchievementsStatsOn := false;
       
  1964     lc_sendachievementsstatsoff:= 0
       
  1965 end;
       
  1966 
  1940 function lc_sendhealthstatsoff(L : Plua_State) : LongInt; Cdecl;
  1967 function lc_sendhealthstatsoff(L : Plua_State) : LongInt; Cdecl;
  1941 begin
  1968 begin
  1942     L:= L; // avoid compiler hint
  1969     L:= L; // avoid compiler hint
  1943     uStats.SendHealthStatsOn := false;
  1970     uStats.SendHealthStatsOn := false;
  1944     lc_sendhealthstatsoff:= 0
  1971     lc_sendhealthstatsoff:= 0
  2518 var gear: PGear;
  2545 var gear: PGear;
  2519 begin
  2546 begin
  2520     if CheckLuaParamCount(L, 1, 'HideHog', 'gearUid') then
  2547     if CheckLuaParamCount(L, 1, 'HideHog', 'gearUid') then
  2521         begin
  2548         begin
  2522         gear:= GearByUID(Trunc(lua_tonumber(L, 1)));
  2549         gear:= GearByUID(Trunc(lua_tonumber(L, 1)));
  2523         HideHog(gear^.hedgehog)
  2550         if (gear <> nil) and (gear^.hedgehog <> nil) then
  2524         end;
  2551             begin
  2525     lc_hidehog := 0;
  2552             HideHog(gear^.hedgehog);
       
  2553             lua_pushboolean(L, true);
       
  2554             end
       
  2555         else
       
  2556             lua_pushboolean(L, false);
       
  2557         end;
       
  2558     lc_hidehog := 1;
  2526 end;
  2559 end;
  2527 
  2560 
  2528 function lc_restorehog(L: Plua_State): LongInt; Cdecl;
  2561 function lc_restorehog(L: Plua_State): LongInt; Cdecl;
  2529 var i, h: LongInt;
  2562 var i, h: LongInt;
  2530     uid: LongWord;
  2563     uid: LongWord;
  3407 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole);
  3440 lua_register(luaState, _P'WriteLnToConsole', @lc_writelntoconsole);
  3408 lua_register(luaState, _P'GetGearType', @lc_getgeartype);
  3441 lua_register(luaState, _P'GetGearType', @lc_getgeartype);
  3409 lua_register(luaState, _P'EndGame', @lc_endgame);
  3442 lua_register(luaState, _P'EndGame', @lc_endgame);
  3410 lua_register(luaState, _P'EndTurn', @lc_endturn);
  3443 lua_register(luaState, _P'EndTurn', @lc_endturn);
  3411 lua_register(luaState, _P'SendStat', @lc_sendstat);
  3444 lua_register(luaState, _P'SendStat', @lc_sendstat);
       
  3445 lua_register(luaState, _P'SendGameResultOff', @lc_sendgameresultoff);
       
  3446 lua_register(luaState, _P'SendRankingStatsOff', @lc_sendrankingstatsoff);
       
  3447 lua_register(luaState, _P'SendAchievementsStatsOff', @lc_sendachievementsstatsoff);
  3412 lua_register(luaState, _P'SendHealthStatsOff', @lc_sendhealthstatsoff);
  3448 lua_register(luaState, _P'SendHealthStatsOff', @lc_sendhealthstatsoff);
  3413 lua_register(luaState, _P'FindPlace', @lc_findplace);
  3449 lua_register(luaState, _P'FindPlace', @lc_findplace);
  3414 lua_register(luaState, _P'SetGearPosition', @lc_setgearposition);
  3450 lua_register(luaState, _P'SetGearPosition', @lc_setgearposition);
  3415 lua_register(luaState, _P'GetGearPosition', @lc_getgearposition);
  3451 lua_register(luaState, _P'GetGearPosition', @lc_getgearposition);
  3416 lua_register(luaState, _P'SetGearTarget', @lc_setgeartarget);
  3452 lua_register(luaState, _P'SetGearTarget', @lc_setgeartarget);