Freezer allows to freeze sticky mines (currently only disables them)
authorWuzzy <almikes@aol.com>
Sat, 22 Apr 2017 18:00:57 +0200
changeset 12304 6b25d117a904
parent 12303 91ebbadc461d
child 12305 6486a012987e
Freezer allows to freeze sticky mines (currently only disables them)
ChangeLog.txt
hedgewars/uGearsHandlersMess.pas
--- a/ChangeLog.txt	Sat Apr 22 04:17:51 2017 +0200
+++ b/ChangeLog.txt	Sat Apr 22 18:00:57 2017 +0200
@@ -10,6 +10,7 @@
 
 Game engine:
  + New weapon: rubber duck
+ + Freezer can now freeze sticky mines
  + Improved hedgehog spawns on maps that lack land mass or free space
  + AI hedgehogs can now use Bee and Vampirism
  + Divided Teams mode will now work with more than 2 teams (Hint: you probably want to set world edges to "wrap" in such games)
--- a/hedgewars/uGearsHandlersMess.pas	Sat Apr 22 04:17:51 2017 +0200
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Apr 22 18:00:57 2017 +0200
@@ -1988,14 +1988,14 @@
 
     if ((Gear^.State and gsttmpFlag) <> 0) and (Gear^.Health <> 0) then
         begin
-        if ((Gear^.State and gstAttacking) = 0) then
+        if ((Gear^.State and gstAttacking) = 0) and ((Gear^.State and gstFrozen) = 0) then
             begin
             if ((GameTicks and $1F) = 0) then
 // FIXME - values taken from mine.  use a gear val and set both to same
                if CheckGearNear(Gear, gtHedgehog, 46, 32) <> nil then
                     Gear^.State := Gear^.State or gstAttacking
             end
-        else // gstAttacking <> 0
+        else if (Gear^.State and gstFrozen) = 0 then // gstAttacking <> 0
             begin
             AllInactive := false;
             if Gear^.Timer = 0 then
@@ -6038,7 +6038,7 @@
                     while iter <> nil do
                         begin
                         if (iter^.State and gstFrozen = 0) and
-                           ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine)) and
+                           ((iter^.Kind = gtExplosives) or (iter^.Kind = gtCase) or (iter^.Kind = gtMine) or (iter^.Kind = gtSMine)) and
                            (abs(LongInt(iter^.X.Round) - target.x) + abs(LongInt(iter^.Y.Round) - target.y) + 2 < 2 * iceRadius)
                            and (Distance(iter^.X - int2hwFloat(target.x), iter^.Y - int2hwFloat(target.y)) < int2hwFloat(iceRadius * 2)) then
                             begin
@@ -6066,6 +6066,15 @@
                                 iter^.Damage := 0;
                                 iter^.State := iter^.State and (not gstAttacking)
                                 end
+                            else if iter^.Kind = gtSMine then // disabe sticky mine
+                                begin
+                                iter^.State:= iter^.State or gstFrozen;
+                                vg:= AddVisualGear(hwRound(iter^.X) - 2  + Random(4), hwRound(iter^.Y) - 2 - Random(2), vgtSmoke);
+                                if vg <> nil then
+                                    vg^.Scale:= 0.4;
+                                PlaySound(sndVaporize);
+                                iter^.State := iter^.State and (not gstAttacking)
+                                end
                             else if iter^.Kind = gtCase then
                                 begin
                                 DeleteCI(iter);