hedgewars/uGearsHedgehog.pas
changeset 10970 7341e0c3f966
parent 10942 5d7dd938dedc
child 11046 47a8c19ecb60
equal deleted inserted replaced
10969:98cab7f366c3 10970:7341e0c3f966
   211 procedure Attack(Gear: PGear);
   211 procedure Attack(Gear: PGear);
   212 var xx, yy, newDx, newDy, lx, ly: hwFloat;
   212 var xx, yy, newDx, newDy, lx, ly: hwFloat;
   213     speech: PVisualGear;
   213     speech: PVisualGear;
   214     newGear:  PGear;
   214     newGear:  PGear;
   215     CurWeapon: PAmmo;
   215     CurWeapon: PAmmo;
       
   216     usedAmmoType: TAmmoType;
   216     altUse: boolean;
   217     altUse: boolean;
   217     elastic: hwFloat;
   218     elastic: hwFloat;
   218 begin
   219 begin
   219 newGear:= nil;
   220 newGear:= nil;
   220 bShowFinger:= false;
   221 bShowFinger:= false;
   221 CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
   222 CurWeapon:= GetCurAmmoEntry(Gear^.Hedgehog^);
   222 with Gear^,
   223 with Gear^,
   223     Gear^.Hedgehog^ do
   224     Gear^.Hedgehog^ do
   224         begin
   225         begin
       
   226         usedAmmoType:= CurAmmoType;
   225         if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstChooseTarget)) = 0) and (((State and gstMoving) = 0)
   227         if ((State and gstHHDriven) <> 0) and ((State and (gstAttacked or gstChooseTarget)) = 0) and (((State and gstMoving) = 0)
   226         or (Power > 0)
   228         or (Power > 0)
   227         or (CurAmmoType = amTeleport)
   229         or (CurAmmoType = amTeleport)
   228         or
   230         or
   229         // Allow attacks while moving on ammo with AltAttack
   231         // Allow attacks while moving on ammo with AltAttack
   507                 end
   509                 end
   508             end
   510             end
   509         else
   511         else
   510             Message:= Message and (not gmAttack);
   512             Message:= Message and (not gmAttack);
   511 
   513 
   512     ScriptCall('onHogAttack', ord(CurAmmoType));
   514     ScriptCall('onHogAttack', ord(usedAmmoType));
   513     end; // of with Gear^, Gear^.Hedgehog^ do
   515     end; // of with Gear^, Gear^.Hedgehog^ do
   514 
   516 
   515     TargetPoint.X := NoPointX;
   517     TargetPoint.X := NoPointX;
   516 end;
   518 end;
   517 
   519