hedgewars/HHHandlers.inc
changeset 930 3f61bd3b08fd
parent 928 b9064b48b001
child 931 ab4d98858a40
equal deleted inserted replaced
929:9456e1e77369 930:3f61bd3b08fd
   142                   end;
   142                   end;
   143 
   143 
   144         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
   144         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
   145 
   145 
   146         Power:= 0;
   146         Power:= 0;
   147         if CurAmmoGear <> nil then
   147         if (CurAmmoGear <> nil)
       
   148            and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) = 0){check for dropping ammo from rope} then
   148            begin
   149            begin
       
   150            CurAmmoGear^.Ammo:= @(Ammo^[CurSlot, CurAmmo]);
   149            Message:= Message or gm_Attack;
   151            Message:= Message or gm_Attack;
   150            CurAmmoGear^.Message:= Message
   152            CurAmmoGear^.Message:= Message
   151            end else begin
   153            end else begin
   152            if not CurrentTeam^.ExtDriven and
   154            if not CurrentTeam^.ExtDriven and
   153              ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0) then SendIPC('a');
   155              ((Ammo^[CurSlot, CurAmmo].Propz and ammoprop_Power) <> 0) then SendIPC('a');
   466 	t:= CheckGearNear(Gear, gtCase, 36, 36);
   468 	t:= CheckGearNear(Gear, gtCase, 36, 36);
   467 	if t <> nil then
   469 	if t <> nil then
   468 		PickUp(Gear, t)
   470 		PickUp(Gear, t)
   469 	end;
   471 	end;
   470 
   472 
       
   473 if (CurAmmoGear = nil) then
       
   474 	if (((Gear^.Message and gm_Attack) <> 0)
       
   475 		or ((Gear^.State and gstAttacking) <> 0)) then
       
   476 		Attack(Gear) // should be before others to avoid desync with '/put' msg and changing weapon msgs
       
   477 	else
       
   478 else with PHedgehog(Gear^.Hedgehog)^ do
       
   479 	 if ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0)
       
   480 		and ((Gear^.Message and gm_LJump) <> 0)
       
   481 		and (((Ammo^[CurSlot, CurAmmo].Propz) and ammoprop_AltUse) <> 0) then Attack(Gear);
       
   482 
       
   483 if (CurAmmoGear = nil)
       
   484 	or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) <> 0) then
       
   485 	begin
       
   486 	if ((Gear^.Message and gm_Slot) <> 0) then ChangeAmmo(Gear);
       
   487 
       
   488 	if ((Gear^.Message and gm_Weapon) <> 0) then HHSetWeapon(Gear);
       
   489 
       
   490 	if ((Gear^.Message and gm_Timer) <> 0) then HHSetTimer(Gear);
       
   491 	end;
       
   492 
   471 if CurAmmoGear <> nil then
   493 if CurAmmoGear <> nil then
   472    begin
   494    begin
   473    CurAmmoGear^.Message:= Gear^.Message;
   495    CurAmmoGear^.Message:= Gear^.Message;
   474    exit
   496    exit
   475    end;
   497    end;
   476 
   498 
   477 if ((Gear^.Message and gm_Attack) <> 0) or
       
   478    ((Gear^.State and gstAttacking) <> 0) then Attack(Gear); // should be before others to avoid desync with '/put' msg and changing weapon msgs
       
   479 
       
   480 if ((Gear^.Message and gm_Slot) <> 0) then ChangeAmmo(Gear);
       
   481 
       
   482 if ((Gear^.Message and gm_Weapon) <> 0) then HHSetWeapon(Gear);
       
   483 
       
   484 if ((Gear^.Message and gm_Timer) <> 0) then HHSetTimer(Gear);
       
   485 
   499 
   486 if (Gear^.State and gstMoving) <> 0 then
   500 if (Gear^.State and gstMoving) <> 0 then
   487    begin
   501    begin
   488    if ((Gear^.Message and gm_HJump) <> 0) and
   502    if ((Gear^.Message and gm_HJump) <> 0) and
   489       ((Gear^.State and gstHHJumping) <> 0) and
   503       ((Gear^.State and gstHHJumping) <> 0) and