mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-25 05:51:47 -08:00
Fixed #10807
This commit is contained in:
parent
2b4c87fb22
commit
f1390f3933
1 changed files with 4 additions and 1 deletions
|
|
@ -35,7 +35,7 @@ import static mindustry.logic.GlobalVars.*;
|
|||
@Component(base = true)
|
||||
abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, Itemsc, Rotc, Unitc, Weaponsc, Drawc, Syncc, Shieldc, Displayable, Ranged, Minerc, Builderc, Senseable, Settable{
|
||||
private static final Vec2 tmp1 = new Vec2(), tmp2 = new Vec2();
|
||||
static final float warpDst = 30f;
|
||||
static final float warpDst = 20f;
|
||||
|
||||
@Import boolean dead, disarmed;
|
||||
@Import float x, y, rotation, maxHealth, drag, armor, hitSize, health, shield, ammo, dragMultiplier, armorOverride, speedMultiplier;
|
||||
|
|
@ -647,6 +647,9 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||
if(y > top) dy -= (y - top)/warpDst;
|
||||
|
||||
velAddNet(dx * Time.delta, dy * Time.delta);
|
||||
float margin = tilesize * 2f;
|
||||
x = Mathf.clamp(x, left - margin, right - tilesize + margin);
|
||||
y = Mathf.clamp(y, bot - margin, top - tilesize + margin);
|
||||
}
|
||||
|
||||
//clamp position if not flying
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue