Minor status effect/liquid bugfixes
This commit is contained in:
@@ -105,8 +105,8 @@ public class Player extends Unit{
|
||||
|
||||
@Override
|
||||
public void onDeath(){
|
||||
super.onDeath();
|
||||
dead = true;
|
||||
drownTime = 0f;
|
||||
if(Net.active()){
|
||||
NetEvents.handleUnitDeath(this);
|
||||
}
|
||||
@@ -193,8 +193,6 @@ public class Player extends Unit{
|
||||
public void update(){
|
||||
hitTime = Math.max(0f, hitTime - Timers.delta());
|
||||
|
||||
status.update(this);
|
||||
|
||||
if(!isLocal){
|
||||
interpolate();
|
||||
return;
|
||||
@@ -265,7 +263,7 @@ public class Player extends Unit{
|
||||
|
||||
velocity.add(movement);
|
||||
|
||||
updateVelocity(0.4f, speed);
|
||||
updateVelocityStatus(0.4f, speed);
|
||||
|
||||
if(!movement.isZero()){
|
||||
walktime += Timers.delta() * velocity.len()*(1f/0.5f)/speed * getFloorOn().speedMultiplier;
|
||||
|
||||
@@ -28,6 +28,11 @@ public class StatusController {
|
||||
}
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
current = StatusEffects.none;
|
||||
time = 0f;
|
||||
}
|
||||
|
||||
public void update(Unit unit){
|
||||
time = Math.max(time - Timers.delta(), 0);
|
||||
|
||||
|
||||
@@ -34,16 +34,24 @@ public abstract class Unit extends SyncEntity {
|
||||
return other instanceof Bullet && state.teams.areEnemies((((Bullet) other).team), team);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath() {
|
||||
drownTime = 0f;
|
||||
status.clear();
|
||||
}
|
||||
|
||||
public Floor getFloorOn(){
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
return (Floor)(tile == null || (!(tile.floor() instanceof Floor)) ? Blocks.defaultFloor : tile.floor());
|
||||
}
|
||||
|
||||
public void updateVelocity(float drag, float maxVelocity){
|
||||
public void updateVelocityStatus(float drag, float maxVelocity){
|
||||
Floor floor = getFloorOn();
|
||||
|
||||
velocity.limit(maxVelocity);
|
||||
|
||||
status.update(this);
|
||||
|
||||
if(isFlying()) {
|
||||
x += velocity.x / getMass();
|
||||
y += velocity.y / getMass();
|
||||
|
||||
@@ -79,6 +79,7 @@ public class BaseUnit extends Unit {
|
||||
|
||||
@Override
|
||||
public void onDeath(){
|
||||
super.onDeath();
|
||||
type.onDeath(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,11 +72,7 @@ public abstract class UnitType {
|
||||
|
||||
updateTargeting(unit);
|
||||
|
||||
//TODO logic
|
||||
|
||||
unit.status.update(unit);
|
||||
|
||||
unit.updateVelocity(drag, maxVelocity);
|
||||
unit.updateVelocityStatus(drag, maxVelocity);
|
||||
|
||||
if(unit.target != null) behavior(unit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user