From 32201dda7260dfccd17b8238d54af39b5375351c Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 31 May 2018 16:45:45 -0400 Subject: [PATCH] Implemented nuclear reactor 'heating' --- core/src/io/anuke/mindustry/Vars.java | 2 +- .../anuke/mindustry/core/ContentLoader.java | 6 +++--- .../blocks/types/power/NuclearReactor.java | 21 ++++++++++--------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/core/src/io/anuke/mindustry/Vars.java b/core/src/io/anuke/mindustry/Vars.java index d75b9ebac4..a02210dba2 100644 --- a/core/src/io/anuke/mindustry/Vars.java +++ b/core/src/io/anuke/mindustry/Vars.java @@ -24,7 +24,7 @@ import io.anuke.ucore.util.OS; import java.util.Locale; 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 public static boolean mobile; public static boolean ios; diff --git a/core/src/io/anuke/mindustry/core/ContentLoader.java b/core/src/io/anuke/mindustry/core/ContentLoader.java index 2d5dd7fd3f..0623a07ef5 100644 --- a/core/src/io/anuke/mindustry/core/ContentLoader.java +++ b/core/src/io/anuke/mindustry/core/ContentLoader.java @@ -32,12 +32,12 @@ public class ContentLoader { //items new Items(), - //liquids - new Liquids(), - //status effects new StatusEffects(), + //liquids + new Liquids(), + //bullets new ArtilleryBullets(), new FlakBullets(), diff --git a/core/src/io/anuke/mindustry/world/blocks/types/power/NuclearReactor.java b/core/src/io/anuke/mindustry/world/blocks/types/power/NuclearReactor.java index af36a767f3..675aa6ecab 100644 --- a/core/src/io/anuke/mindustry/world/blocks/types/power/NuclearReactor.java +++ b/core/src/io/anuke/mindustry/world/blocks/types/power/NuclearReactor.java @@ -32,9 +32,9 @@ public class NuclearReactor extends LiquidBurnerGenerator { protected Item generateItem; protected Color coolColor = new Color(1, 1, 1, 0f); 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 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 smokeThreshold = 0.3f; //threshold at which block starts smoking protected int explosionRadius = 19; @@ -83,16 +83,17 @@ public class NuclearReactor extends LiquidBurnerGenerator { } if(entity.liquids.amount > 0){ - //TODO steam when cooling large amounts? - float liquidPower = 1f; - if(liquidPower > 0){ //is coolant - float pow = coolantPower * entity.liquids.liquid.heatCapacity; - float maxCool = Math.min(entity.liquids.amount, entity.heat / pow); //max that can be cooled in terms of liquid - entity.heat -= maxCool * pow; - entity.liquids.amount -= maxCool; + if(entity.liquids.liquid.temperature <= 0.5f){ //is coolant + float pow = coolantPower * entity.liquids.liquid.heatCapacity; //heat depleted per unit of liquid + float maxUsed = Math.min(entity.liquids.amount, entity.heat / pow); //max that can be cooled in terms of liquid + entity.heat -= maxUsed * pow; + entity.liquids.amount -= maxUsed; }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; } }