hedgewars/uGearsHandlersMess.pas
changeset 15737 e0cdb6ae88ab
parent 15736 7a4b719ac611
child 15738 d5fce8a02092
--- a/hedgewars/uGearsHandlersMess.pas	Sat Jul 11 01:09:56 2020 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Jul 11 02:12:02 2020 +0300
@@ -141,7 +141,7 @@
 procedure doStepMinigunWork(Gear: PGear);
 procedure doStepMinigun(Gear: PGear);
 procedure doStepMinigunBullet(Gear: PGear);
-procedure doStepSentry(Gear: PGear);
+procedure doStepSentryDeploy(Gear: PGear);
 
 var
     upd: Longword;
@@ -7286,7 +7286,7 @@
     end;
 end;
 
-procedure doStepSentry(Gear: PGear);
+procedure doStepSentryLand(Gear: PGear);
 var HHGear, bullet: PGear;
     distX, distY, invDistance: HwFloat;
 const sentry_Idle = 0;
@@ -7471,4 +7471,20 @@
     end
 end;
 
+procedure doStepSentryDeploy(Gear: PGear);
+begin
+    Gear^.Tag := -1;
+    if Gear^.dY.isNegative or (TestCollisionYwithGear(Gear, 1) = 0) then
+        doStepFallingGear(Gear)
+    else
+    begin
+        if Gear^.Timer > 0 then dec(Gear^.Timer);
+        if Gear^.Timer = 0 then
+        begin
+            Gear^.Tag := 0;
+            Gear^.doStep := @doStepSentryLand;
+        end;
+    end;
+end;
+
 end.