Tweaks
This commit is contained in:
@@ -45,12 +45,11 @@ public class EntityGroup<T extends Entityc> implements Iterable<T>{
|
||||
array.sort(comp);
|
||||
}
|
||||
|
||||
public void updatePhysics(){
|
||||
collisions.updatePhysics((EntityGroup<? extends Hitboxc>)this);
|
||||
}
|
||||
|
||||
public void update(){
|
||||
|
||||
if(useTree()){
|
||||
collisions.updatePhysics((EntityGroup<? extends Hitboxc>)this);
|
||||
}
|
||||
|
||||
each(Entityc::update);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import mindustry.gen.*;
|
||||
abstract class HealthComp implements Entityc{
|
||||
static final float hitDuration = 9f;
|
||||
|
||||
float health, maxHealth, hitTime;
|
||||
float health, maxHealth = 1f, hitTime;
|
||||
boolean dead;
|
||||
|
||||
boolean isValid(){
|
||||
|
||||
@@ -99,6 +99,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc{
|
||||
this.unit = unit;
|
||||
if(unit != Nulls.unit){
|
||||
unit.team(team);
|
||||
unit.controller(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
||||
@Override
|
||||
public void controller(UnitController controller){
|
||||
this.controller = controller;
|
||||
controller.unit(this);
|
||||
if(controller.unit() != this) controller.unit(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,6 +58,10 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
||||
@Override
|
||||
public void type(UnitDef type){
|
||||
this.type = type;
|
||||
maxHealth(type.health);
|
||||
heal();
|
||||
drag(type.drag);
|
||||
hitSize(type.hitsize);
|
||||
controller(type.createController());
|
||||
setupWeapons(type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user