add smoking to damaged sentries
authoralfadur
Thu, 09 Jul 2020 00:32:53 +0300
changeset 15711 4a8a1dd9528a
parent 15710 7383256f8535
child 15712 b496233ac26d
add smoking to damaged sentries
hedgewars/uConsts.pas
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsList.pas
--- a/hedgewars/uConsts.pas	Thu Jul 09 00:22:40 2020 +0300
+++ b/hedgewars/uConsts.pas	Thu Jul 09 00:32:53 2020 +0300
@@ -211,6 +211,7 @@
 
     // some gear constants
     cBarrelHealth = 60;  // initial barrel health
+    cSentryHealth = 60;  // initial sentry health
     cShotgunRadius = 22; // radius of land a shotgun shot destroys
     cBlowTorchC    = 6;  // blow torch gear radius component (added to cHHRadius to get the full radius)
     cakeDmg =   75;      // default cake damage
--- a/hedgewars/uGearsHandlersMess.pas	Thu Jul 09 00:22:40 2020 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Jul 09 00:32:53 2020 +0300
@@ -7295,6 +7295,12 @@
         exit;
     end;
 
+    if ((Gear^.Health * 100) < random(cSentryHealth * 90)) and ((GameTicks and $FF) = 0) then
+        if Gear^.Health * 2 < cSentryHealth then
+            AddVisualGear(hwRound(Gear^.X) - 8 + Random(16), hwRound(Gear^.Y) - 2, vgtSmoke)
+        else
+            AddVisualGear(hwRound(Gear^.X) - 8 + Random(16), hwRound(Gear^.Y) - 2, vgtSmokeWhite);
+
     if Gear^.dY.isNegative or (TestCollisionYwithGear(Gear, 1) = 0) then
     begin
         doStepFallingGear(Gear);
--- a/hedgewars/uGearsList.pas	Thu Jul 09 00:22:40 2020 +0300
+++ b/hedgewars/uGearsList.pas	Thu Jul 09 00:32:53 2020 +0300
@@ -838,7 +838,7 @@
                 end;
         gtSentry: begin
                 gear^.Radius:= cHHRadius;
-                gear^.Health:= 60;
+                gear^.Health:= cSentryHealth;
                 gear^.Friction:= _0_93;
                 gear^.Elasticity:= _0_05;
                 gear^.Tag:= 0;