Bugfixes
This commit is contained in:
@@ -749,6 +749,7 @@ public class Player extends Unit implements BuilderTrait, ShooterTrait{
|
||||
dead = true;
|
||||
target = null;
|
||||
moveTarget = null;
|
||||
spawner = lastSpawner = null;
|
||||
health = maxHealth();
|
||||
boostHeat = drownTime = hitTime = 0f;
|
||||
mech = (isMobile ? Mechs.starterMobile : Mechs.starterDesktop);
|
||||
|
||||
@@ -128,17 +128,19 @@ public class PowerGraph{
|
||||
Consumers consumes = consumer.block().consumes;
|
||||
if(consumes.has(ConsumePower.class)){
|
||||
ConsumePower consumePower = consumes.get(ConsumePower.class);
|
||||
if(!otherConsumersAreValid(consumer, consumePower)){
|
||||
consumer.entity.power.satisfaction = 0.0f; // Only supply power if the consumer would get valid that way
|
||||
//if(!otherConsumersAreValid(consumer, consumePower)){
|
||||
// consumer.entity.power.satisfaction = 0.0f; // Only supply power if the consumer would get valid that way
|
||||
//}else{
|
||||
|
||||
//currently satisfies power even if it's not required yet
|
||||
if(consumePower.isBuffered){
|
||||
// Add an equal percentage of power to all buffers, based on the global power coverage in this graph
|
||||
float maximumRate = consumePower.requestedPower(consumer.block(), consumer.entity()) * coverage * consumer.entity.delta();
|
||||
consumer.entity.power.satisfaction = Mathf.clamp(consumer.entity.power.satisfaction + maximumRate / consumePower.powerCapacity);
|
||||
}else{
|
||||
if(consumePower.isBuffered){
|
||||
// Add an equal percentage of power to all buffers, based on the global power coverage in this graph
|
||||
float maximumRate = consumePower.requestedPower(consumer.block(), consumer.entity()) * coverage * consumer.entity.delta();
|
||||
consumer.entity.power.satisfaction = Mathf.clamp(consumer.entity.power.satisfaction + maximumRate / consumePower.powerCapacity);
|
||||
}else{
|
||||
consumer.entity.power.satisfaction = coverage;
|
||||
}
|
||||
consumer.entity.power.satisfaction = coverage;
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -246,14 +248,12 @@ public class PowerGraph{
|
||||
}
|
||||
}
|
||||
|
||||
//currently ignores all other consumers and consumes power anyway.
|
||||
private boolean otherConsumersAreValid(Tile tile, Consume consumePower){
|
||||
/*
|
||||
for(Consume cons : tile.block().consumes.all()){
|
||||
if(cons != consumePower && !cons.isOptional() && !cons.valid(tile.block(), tile.entity())){
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user