This commit is contained in:
Anuken
2019-02-14 10:00:17 -05:00
parent 8c6c4c2630
commit 66766b43c7
9 changed files with 993 additions and 970 deletions

View File

@@ -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);

View File

@@ -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;
}