Fixed #8782
This commit is contained in:
@@ -1956,6 +1956,9 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
|||||||
case health -> {
|
case health -> {
|
||||||
health = (float)Mathf.clamp(value, 0, maxHealth);
|
health = (float)Mathf.clamp(value, 0, maxHealth);
|
||||||
healthChanged();
|
healthChanged();
|
||||||
|
if(health <= 0f && !dead()){
|
||||||
|
Call.buildDestroyed(self());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case team -> {
|
case team -> {
|
||||||
Team team = Team.get((int)value);
|
Team team = Team.get((int)value);
|
||||||
|
|||||||
@@ -261,7 +261,12 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
|
|||||||
@Override
|
@Override
|
||||||
public void setProp(LAccess prop, double value){
|
public void setProp(LAccess prop, double value){
|
||||||
switch(prop){
|
switch(prop){
|
||||||
case health -> health = (float)Mathf.clamp(value, 0, maxHealth);
|
case health -> {
|
||||||
|
health = (float)Mathf.clamp(value, 0, maxHealth);
|
||||||
|
if(health <= 0f && !dead){
|
||||||
|
kill();
|
||||||
|
}
|
||||||
|
}
|
||||||
case x -> x = World.unconv((float)value);
|
case x -> x = World.unconv((float)value);
|
||||||
case y -> y = World.unconv((float)value);
|
case y -> y = World.unconv((float)value);
|
||||||
case rotation -> rotation = (float)value;
|
case rotation -> rotation = (float)value;
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ public class GameService{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.on(BlockBuildBeginEvent.class, e -> {
|
Events.on(BlockBuildEndEvent.class, e -> {
|
||||||
if(campaign() && state.rules.sector == SectorPresets.groundZero.sector && e.tile.block() == Blocks.coreNucleus){
|
if(campaign() && state.rules.sector == SectorPresets.groundZero.sector && e.tile.block() == Blocks.coreNucleus){
|
||||||
nucleusGroundZero.complete();
|
nucleusGroundZero.complete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -359,8 +359,14 @@ public class CoreBlock extends StorageBlock{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changeTeam(Team next){
|
public void changeTeam(Team next){
|
||||||
|
if(this.team == next) return;
|
||||||
|
|
||||||
|
state.teams.unregisterCore(this);
|
||||||
|
|
||||||
super.changeTeam(next);
|
super.changeTeam(next);
|
||||||
|
|
||||||
|
state.teams.registerCore(this);
|
||||||
|
|
||||||
Events.fire(new CoreChangeEvent(this));
|
Events.fire(new CoreChangeEvent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user