Implemented nuclear reactor 'heating'
This commit is contained in:
@@ -24,7 +24,7 @@ import io.anuke.ucore.util.OS;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class Vars{
|
public class Vars{
|
||||||
public static final boolean testMobile = true;
|
public static final boolean testMobile = false;
|
||||||
//shorthand for whether or not this is running on android or ios
|
//shorthand for whether or not this is running on android or ios
|
||||||
public static boolean mobile;
|
public static boolean mobile;
|
||||||
public static boolean ios;
|
public static boolean ios;
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ public class ContentLoader {
|
|||||||
//items
|
//items
|
||||||
new Items(),
|
new Items(),
|
||||||
|
|
||||||
//liquids
|
|
||||||
new Liquids(),
|
|
||||||
|
|
||||||
//status effects
|
//status effects
|
||||||
new StatusEffects(),
|
new StatusEffects(),
|
||||||
|
|
||||||
|
//liquids
|
||||||
|
new Liquids(),
|
||||||
|
|
||||||
//bullets
|
//bullets
|
||||||
new ArtilleryBullets(),
|
new ArtilleryBullets(),
|
||||||
new FlakBullets(),
|
new FlakBullets(),
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ public class NuclearReactor extends LiquidBurnerGenerator {
|
|||||||
protected Item generateItem;
|
protected Item generateItem;
|
||||||
protected Color coolColor = new Color(1, 1, 1, 0f);
|
protected Color coolColor = new Color(1, 1, 1, 0f);
|
||||||
protected Color hotColor = Color.valueOf("ff9575a3");
|
protected Color hotColor = Color.valueOf("ff9575a3");
|
||||||
protected int fuelUseTime = 130; //time to consume 1 fuel
|
protected int fuelUseTime = 120; //time to consume 1 fuel
|
||||||
protected float powerMultiplier = 0.45f; //power per frame, depends on full capacity
|
protected float powerMultiplier = 0.45f; //power per frame, depends on full capacity
|
||||||
protected float heating = 0.007f; //heating per frame
|
protected float heating = 0.009f; //heating per frame
|
||||||
protected float coolantPower = 0.015f; //how much heat decreases per coolant unit
|
protected float coolantPower = 0.015f; //how much heat decreases per coolant unit
|
||||||
protected float smokeThreshold = 0.3f; //threshold at which block starts smoking
|
protected float smokeThreshold = 0.3f; //threshold at which block starts smoking
|
||||||
protected int explosionRadius = 19;
|
protected int explosionRadius = 19;
|
||||||
@@ -83,16 +83,17 @@ public class NuclearReactor extends LiquidBurnerGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(entity.liquids.amount > 0){
|
if(entity.liquids.amount > 0){
|
||||||
//TODO steam when cooling large amounts?
|
|
||||||
float liquidPower = 1f;
|
|
||||||
|
|
||||||
if(liquidPower > 0){ //is coolant
|
if(entity.liquids.liquid.temperature <= 0.5f){ //is coolant
|
||||||
float pow = coolantPower * entity.liquids.liquid.heatCapacity;
|
float pow = coolantPower * entity.liquids.liquid.heatCapacity; //heat depleted per unit of liquid
|
||||||
float maxCool = Math.min(entity.liquids.amount, entity.heat / pow); //max that can be cooled in terms of liquid
|
float maxUsed = Math.min(entity.liquids.amount, entity.heat / pow); //max that can be cooled in terms of liquid
|
||||||
entity.heat -= maxCool * pow;
|
entity.heat -= maxUsed * pow;
|
||||||
entity.liquids.amount -= maxCool;
|
entity.liquids.amount -= maxUsed;
|
||||||
}else{ //is heater
|
}else{ //is heater
|
||||||
//TODO
|
float heat = coolantPower * entity.liquids.liquid.heatCapacity / 4f; //heat created per unit of liquid
|
||||||
|
float maxUsed = Math.min(entity.liquids.amount, (1f - entity.heat) / heat); //max liquid used
|
||||||
|
entity.heat += maxUsed * heat;
|
||||||
|
entity.liquids.amount -= maxUsed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user