Regen projector phase boost / Menu tweaks
This commit is contained in:
@@ -1624,6 +1624,8 @@ public class Blocks{
|
|||||||
|
|
||||||
consumes.liquid(Liquids.hydrogen, 1f / 60f);
|
consumes.liquid(Liquids.hydrogen, 1f / 60f);
|
||||||
|
|
||||||
|
consumes.item(Items.phaseFabric).boost();
|
||||||
|
|
||||||
healPercent = 4f / 60f;
|
healPercent = 4f / 60f;
|
||||||
|
|
||||||
Color col = Color.valueOf("8ca9e8");
|
Color col = Color.valueOf("8ca9e8");
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ public class MenuRenderer implements Disposable{
|
|||||||
new Block[]{Blocks.sand, Blocks.sandWall},
|
new Block[]{Blocks.sand, Blocks.sandWall},
|
||||||
new Block[]{Blocks.shale, Blocks.shaleWall},
|
new Block[]{Blocks.shale, Blocks.shaleWall},
|
||||||
new Block[]{Blocks.ice, Blocks.iceWall},
|
new Block[]{Blocks.ice, Blocks.iceWall},
|
||||||
new Block[]{Blocks.moss, Blocks.sporePine}
|
new Block[]{Blocks.moss, Blocks.sporePine},
|
||||||
|
new Block[]{Blocks.dirt, Blocks.dirtWall},
|
||||||
|
new Block[]{Blocks.dacite, Blocks.daciteWall}
|
||||||
);
|
);
|
||||||
Block[] selected2 = Structs.select(
|
Block[] selected2 = Structs.select(
|
||||||
new Block[]{Blocks.basalt, Blocks.duneWall},
|
new Block[]{Blocks.basalt, Blocks.duneWall},
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ public class RegenProjector extends Block{
|
|||||||
public int range = 14;
|
public int range = 14;
|
||||||
//per frame
|
//per frame
|
||||||
public float healPercent = 12f / 60f;
|
public float healPercent = 12f / 60f;
|
||||||
|
public float optionalMultiplier = 2f;
|
||||||
|
public float optionalUseTime = 60f * 8f;
|
||||||
|
|
||||||
public DrawBlock drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawSideRegion(true));
|
public DrawBlock drawer = new DrawMulti(new DrawRegion("-bottom"), new DrawSideRegion(true));
|
||||||
|
|
||||||
@@ -80,10 +82,20 @@ public class RegenProjector extends Block{
|
|||||||
drawer.load(this);
|
drawer.load(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setStats(){
|
||||||
|
stats.timePeriod = optionalUseTime;
|
||||||
|
super.setStats();
|
||||||
|
|
||||||
|
stats.add(Stat.repairTime, (int)(1f / (healPercent / 100f) / 60f), StatUnit.seconds);
|
||||||
|
stats.add(Stat.range, range, StatUnit.blocks);
|
||||||
|
stats.add(Stat.boostEffect, optionalMultiplier, StatUnit.timesSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
public class RegenProjectorBuild extends Building{
|
public class RegenProjectorBuild extends Building{
|
||||||
public Seq<Building> targets = new Seq<>();
|
public Seq<Building> targets = new Seq<>();
|
||||||
public int lastChange = -2;
|
public int lastChange = -2;
|
||||||
public float warmup, totalTime;
|
public float warmup, totalTime, optionalTimer;
|
||||||
public boolean didRegen = false;
|
public boolean didRegen = false;
|
||||||
|
|
||||||
public void updateTargets(){
|
public void updateTargets(){
|
||||||
@@ -110,6 +122,13 @@ public class RegenProjector extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(consValid()){
|
if(consValid()){
|
||||||
|
if(cons.optionalValid() && (optionalTimer += Time.delta) >= optionalUseTime){
|
||||||
|
cons.trigger();
|
||||||
|
optionalUseTime = 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float healAmount = (cons.optionalValid() ? optionalMultiplier : 1f) * healPercent;
|
||||||
|
|
||||||
//use Math.max to prevent stacking
|
//use Math.max to prevent stacking
|
||||||
for(var build : targets){
|
for(var build : targets){
|
||||||
if(!build.damaged() || build.isHealSuppressed()) continue;
|
if(!build.damaged() || build.isHealSuppressed()) continue;
|
||||||
@@ -119,7 +138,7 @@ public class RegenProjector extends Block{
|
|||||||
int pos = build.pos();
|
int pos = build.pos();
|
||||||
//TODO periodic effect
|
//TODO periodic effect
|
||||||
float value = mendMap.get(pos);
|
float value = mendMap.get(pos);
|
||||||
mendMap.put(pos, Math.min(Math.max(value, healPercent * edelta() * build.block.health / 100f), build.block.health - build.health));
|
mendMap.put(pos, Math.min(Math.max(value, healAmount * edelta() * build.block.health / 100f), build.block.health - build.health));
|
||||||
|
|
||||||
if(value <= 0 && Mathf.chanceDelta(effectChance * build.block.size * build.block.size)){
|
if(value <= 0 && Mathf.chanceDelta(effectChance * build.block.size * build.block.size)){
|
||||||
effect.at(build.x + Mathf.range(build.block.size * tilesize/2f - 1f), build.y + Mathf.range(build.block.size * tilesize/2f - 1f));
|
effect.at(build.x + Mathf.range(build.block.size * tilesize/2f - 1f), build.y + Mathf.range(build.block.size * tilesize/2f - 1f));
|
||||||
|
|||||||
Reference in New Issue
Block a user