allow damaging sentries
authoralfadur
Thu, 09 Jul 2020 00:22:40 +0300
changeset 15710 7383256f8535
parent 15709 6b04399c84a7
child 15711 4a8a1dd9528a
allow damaging sentries
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsList.pas
hedgewars/uGearsUtils.pas
--- a/hedgewars/uGearsHandlersMess.pas	Wed Jul 08 23:42:42 2020 +0300
+++ b/hedgewars/uGearsHandlersMess.pas	Thu Jul 09 00:22:40 2020 +0300
@@ -1217,7 +1217,7 @@
         begin
         dec(i);
         if Collisions^.ar[i]^.Kind in
-            [gtMine, gtSMine, gtAirMine, gtKnife, gtCase, gtTarget, gtExplosives] then
+            [gtMine, gtSMine, gtAirMine, gtKnife, gtCase, gtTarget, gtExplosives, gtSentry] then
             begin
             Gear^.X := Collisions^.ar[i]^.X;
             Gear^.Y := Collisions^.ar[i]^.Y;
@@ -7286,6 +7286,15 @@
     if CheckGearDrowning(Gear) then
         exit;
 
+    dec(Gear^.Health, Gear^.Damage);
+    Gear^.Damage := 0;
+    if Gear^.Health <= 0 then
+    begin
+        doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
+        DeleteGear(Gear);
+        exit;
+    end;
+
     if Gear^.dY.isNegative or (TestCollisionYwithGear(Gear, 1) = 0) then
     begin
         doStepFallingGear(Gear);
--- a/hedgewars/uGearsList.pas	Wed Jul 08 23:42:42 2020 +0300
+++ b/hedgewars/uGearsList.pas	Thu Jul 09 00:22:40 2020 +0300
@@ -318,7 +318,7 @@
           gtKnife: Gear^.Boom := 40000; // arbitrary scaling factor since impact-based
         gtCreeper: Gear^.Boom := 100;
   gtMinigunBullet: Gear^.Boom := 2;
-         gtSentry: Gear^.Boom := 25;
+         gtSentry: Gear^.Boom := 40;
     end;
 
 case Kind of
@@ -838,9 +838,9 @@
                 end;
         gtSentry: begin
                 gear^.Radius:= cHHRadius;
-                gear^.Health:= 100;
+                gear^.Health:= 60;
                 gear^.Friction:= _0_93;
-                gear^.Elasticity:= _0_5;
+                gear^.Elasticity:= _0_05;
                 gear^.Tag:= 0;
                 gear^.Timer:= 500;
                 gear^.WDTimer:= 0;
--- a/hedgewars/uGearsUtils.pas	Wed Jul 08 23:42:42 2020 +0300
+++ b/hedgewars/uGearsUtils.pas	Thu Jul 09 00:22:40 2020 +0300
@@ -149,7 +149,8 @@
                 gtTarget,
                 gtFlame,
                 gtKnife,
-                gtExplosives: begin
+                gtExplosives,
+                gtSentry: begin
 // Run the calcs only once we know we have a type that will need damage
                         tdX:= Gear^.X-fX;
                         tdY:= Gear^.Y-fY;
@@ -1260,7 +1261,8 @@
             gtKnife,
             gtCase,
             gtTarget,
-            gtExplosives: begin
+            gtExplosives,
+            gtSentry: begin
 //addFileLog('ShotgunShot radius: ' + inttostr(Gear^.Radius) + ', t^.Radius = ' + inttostr(t^.Radius) + ', distance = ' + inttostr(dist) + ', dmg = ' + inttostr(dmg));
                     dmg:= 0;
                     r:= Gear^.Radius + t^.Radius;
@@ -1401,7 +1403,8 @@
             gtKnife,
             gtTarget,
             gtCase,
-            gtExplosives:
+            gtExplosives,
+            gtSentry:
             begin
             if (Ammo^.Kind in [gtFirePunch, gtKamikaze]) and (Gear^.Kind <> gtSMine) then
                 PlaySound(sndFirePunchHit);