hedgewars/uGearsHandlersMess.pas
changeset 15640 8416b08ffdbb
parent 15639 afeffdb4a712
child 15641 8e93ce81e850
equal deleted inserted replaced
15639:afeffdb4a712 15640:8416b08ffdbb
   542            // Disable gfMoreWind for land objects on turn end to prevent bouncing them forever
   542            // Disable gfMoreWind for land objects on turn end to prevent bouncing them forever
   543            // This solution is rather ugly, in that it will occassionally suddenly wind physics
   543            // This solution is rather ugly, in that it will occassionally suddenly wind physics
   544            // while a gear is moving, this can be rather confusing.
   544            // while a gear is moving, this can be rather confusing.
   545            // TODO: Find a way to make gfMoreWind-affected land objects settle more reliably
   545            // TODO: Find a way to make gfMoreWind-affected land objects settle more reliably
   546            // and quickler without touching wind itselvs
   546            // and quickler without touching wind itselvs
   547            ((not (Gear^.Kind in [gtMine, gtAirMine, gtSMine, gtKnife, gtExplosives])) or (TimeNotInTurn < MaxMoreWindTime)) then
   547            ((not (Gear^.Kind in [gtMine, gtAirMine, gtSMine, gtKnife, gtExplosives, gtSentry])) or (TimeNotInTurn < MaxMoreWindTime)) then
   548             Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
   548             Gear^.dX := Gear^.dX + cWindSpeed / Gear^.Density
   549         end;
   549         end;
   550 
   550 
   551     Gear^.X := Gear^.X + Gear^.dX;
   551     Gear^.X := Gear^.X + Gear^.dX;
   552     Gear^.Y := Gear^.Y + Gear^.dY;
   552     Gear^.Y := Gear^.Y + Gear^.dY;
  7172 end;
  7172 end;
  7173 
  7173 
  7174 ////////////////////////////////////////////////////////////////////////////////
  7174 ////////////////////////////////////////////////////////////////////////////////
  7175 procedure doStepSentry(Gear: PGear);
  7175 procedure doStepSentry(Gear: PGear);
  7176 begin
  7176 begin
  7177     CheckGearDrowning(Gear);
  7177     if CheckGearDrowning(Gear) then
  7178     doStepFallingGear(Gear);
  7178         exit;
       
  7179 
       
  7180     if (TestCollisionYKick(Gear, 1) = 0) then
       
  7181     begin
       
  7182         doStepFallingGear(Gear);
       
  7183         exit;
       
  7184     end;
       
  7185 
       
  7186     if (Gear^.Timer > 0) then
       
  7187         dec(Gear^.Timer);
       
  7188 
       
  7189     if (Gear^.Timer = 0) then
       
  7190     begin
       
  7191         if Gear^.Tag <> 0 then
       
  7192         begin
       
  7193             Gear^.Tag := 0;
       
  7194             Gear^.Timer := 1000 + GetRandom(1000);
       
  7195         end
       
  7196         else
       
  7197         begin
       
  7198             Gear^.Tag := GetRandom(2) * 2 - 1;
       
  7199             Gear^.Timer := 1000 + GetRandom(3000);
       
  7200             Gear^.dX.isNegative := Gear^.Tag < 0;
       
  7201             if TestCollisionX(Gear, 1) <> 0 then
       
  7202             begin
       
  7203                 Gear^.Tag := not Gear^.Tag;
       
  7204                 Gear^.dX.isNegative := not Gear^.dX.isNegative;
       
  7205             end
       
  7206         end
       
  7207     end;
       
  7208 
       
  7209     if (Gear^.Tag <> 0) and ((GameTicks and $1F) = 0) then
       
  7210     begin
       
  7211         MakeHedgehogsStep(Gear);
       
  7212         if TestCollisionX(Gear, 1) <> 0 then
       
  7213             Gear^.Timer := 0
       
  7214     end;
  7179 end;
  7215 end;
  7180 
  7216 
  7181 end.
  7217 end.