Batched building health update packet
This commit is contained in:
@@ -1762,13 +1762,13 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
@MethodPriority(100)
|
||||
@Override
|
||||
public void heal(){
|
||||
indexer.notifyBuildHealed(self());
|
||||
healthChanged();
|
||||
}
|
||||
|
||||
@MethodPriority(100)
|
||||
@Override
|
||||
public void heal(float amount){
|
||||
indexer.notifyBuildHealed(self());
|
||||
healthChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1779,7 +1779,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
@Replace
|
||||
@Override
|
||||
public void kill(){
|
||||
Call.tileDestroyed(self());
|
||||
Call.buildDestroyed(self());
|
||||
}
|
||||
|
||||
@Replace
|
||||
@@ -1796,13 +1796,27 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
damage = Damage.applyArmor(damage, block.armor) / dm;
|
||||
}
|
||||
|
||||
Call.tileDamage(self(), health - handleDamage(damage));
|
||||
//TODO handle this better on the client.
|
||||
if(!net.client()){
|
||||
health -= handleDamage(damage);
|
||||
}
|
||||
|
||||
healthChanged();
|
||||
|
||||
if(health <= 0){
|
||||
Call.tileDestroyed(self());
|
||||
Call.buildDestroyed(self());
|
||||
}
|
||||
}
|
||||
|
||||
public void healthChanged(){
|
||||
//server-side, health updates are batched.
|
||||
if(net.server()){
|
||||
netServer.buildHealthUpdate(self());
|
||||
}
|
||||
|
||||
indexer.notifyHealthChanged(self());
|
||||
}
|
||||
|
||||
@Override
|
||||
public double sense(LAccess sensor){
|
||||
return switch(sensor){
|
||||
|
||||
@@ -84,14 +84,14 @@ public class RegionPart extends DrawPart{
|
||||
//can be null
|
||||
var region = drawRegion ? regions[Math.min(i, regions.length - 1)] : null;
|
||||
float sign = (i == 0 ? 1 : -1) * params.sideMultiplier;
|
||||
Tmp.v1.set((x + mx) * sign, y + my).rotateRadExact((params.rotation - 90) * Mathf.degRad);
|
||||
Tmp.v1.set((x + mx) * sign * Draw.xscl, (y + my) * Draw.yscl).rotateRadExact((params.rotation - 90) * Mathf.degRad);
|
||||
|
||||
float
|
||||
rx = params.x + Tmp.v1.x,
|
||||
ry = params.y + Tmp.v1.y,
|
||||
rot = mr * sign + params.rotation - 90;
|
||||
|
||||
Draw.xscl = sign;
|
||||
Draw.xscl *= sign;
|
||||
|
||||
if(outline && drawRegion){
|
||||
Draw.z(prevZ + outlineLayerOffset);
|
||||
@@ -115,7 +115,7 @@ public class RegionPart extends DrawPart{
|
||||
Drawf.additive(heat, heatColor.write(Tmp.c1).a(heatProgress.getClamp(params) * heatColor.a), rx, ry, rot, turretShading ? Layer.turretHeat : Draw.z() + heatLayerOffset);
|
||||
}
|
||||
|
||||
Draw.xscl = 1f;
|
||||
Draw.xscl *= sign;
|
||||
}
|
||||
|
||||
Draw.z(z);
|
||||
|
||||
Reference in New Issue
Block a user