Minigun: Move attack timer to Karma to make gear type more Lua-friendly
authorWuzzy <Wuzzy2@mail.ru>
Sat, 10 Mar 2018 01:46:51 +0100
changeset 13154 44351ea57b71
parent 13153 2a53b598c1ae
child 13155 25de976a7b9a
Minigun: Move attack timer to Karma to make gear type more Lua-friendly
hedgewars/uGearsHandlersMess.pas
hedgewars/uGearsList.pas
--- a/hedgewars/uGearsHandlersMess.pas	Sat Mar 10 01:28:15 2018 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Sat Mar 10 01:46:51 2018 +0100
@@ -6741,7 +6741,7 @@
         HHGear^.Message := HHGear^.Message and (not (gmUp or gmDown));
         HHGear^.State := HHGear^.State or gstNotKickable;
 
-        Gear^.Timer := 3451;
+        Gear^.Timer := Gear^.Karma;
         Gear^.WDTimer := 0; // Order of the next bullet;
         ClearHitOrder();
         Gear^.doStep := @doStepMinigunWork
--- a/hedgewars/uGearsList.pas	Sat Mar 10 01:28:15 2018 +0100
+++ b/hedgewars/uGearsList.pas	Sat Mar 10 01:46:51 2018 +0100
@@ -746,8 +746,12 @@
                 gear^.Density:= _0_5;
                 gear^.AdvBounce:= 1;
                 end;
-       gtMinigun: begin
-                if gear^.Timer = 0 then gear^.Timer:= 601;
+     gtMinigun: begin
+                // Timer. First, it's the timer before shooting. Then it will become the shooting timer and is set to Karma
+                if gear^.Timer = 0 then
+                    gear^.Timer:= 601;
+                // minigun shooting time. 1 bullet is fired every 50ms
+                gear^.Karma:= 3451;
                 end;
  gtMinigunBullet: begin
                 gear^.Radius:= 1;