hedgewars/uGearsHedgehog.pas
changeset 9670 1954f692e8c6
parent 9664 1e528c58e41d
child 9672 8663d299ba62
--- a/hedgewars/uGearsHedgehog.pas	Sun Nov 03 22:37:41 2013 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Sun Nov 03 22:39:00 2013 +0400
@@ -35,10 +35,22 @@
 uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions,
     uCommands, uLocale, uUtils, uStats, uIO, uScript,
     uGearsList, uCollisions, uRandom, uStore, uTeams,
-    uGearsUtils, uVisualGearsList;
+    uGearsUtils, uVisualGearsList, uChat;
 
 var GHStepTicks: LongWord = 0;
 
+procedure AFKSkip;
+var
+    t: byte;
+begin
+    t:= 0;
+    while (TeamsArray[t] <> CurrentTeam) do inc(t);
+
+    SendHogSpeech(#1 + char(t) + 'AFK');
+
+    ParseCommand('/skip', true)
+end;
+
 // Shouldn't more of this ammo switching stuff be moved to uAmmos ?
 function ChangeAmmo(HHGear: PGear): boolean;
 var slot, i: Longword;
@@ -1056,6 +1068,12 @@
     exit
     end;
 
+if isAFK and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
+    begin
+    AFKSkip;
+    exit
+    end;
+
 if (HHGear^.State and gstAnimation) <> 0 then
     begin
     HHGear^.Message:= 0;
@@ -1296,7 +1314,7 @@
     DeleteGear(Gear);
     exit
     end;
-if GameTicks mod 100 = 0 then CheckIce(Gear);
+if GameTicks mod 128 = 0 then CheckIce(Gear);
 (*
 if Gear^.Hedgehog^.Effects[heFrozen] > 0 then
     begin