New block stats / Junction bugfixes

This commit is contained in:
Anuken
2019-05-02 23:10:41 -04:00
parent eaa2ad4f05
commit b2408b1a7c
17 changed files with 44 additions and 40 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -376,6 +376,7 @@ blocks.drillspeed = Base Drill Speed
blocks.boosteffect = Boost Effect blocks.boosteffect = Boost Effect
blocks.maxunits = Max Active Units blocks.maxunits = Max Active Units
blocks.health = Health blocks.health = Health
blocks.buildtime = Build Time
blocks.inaccuracy = Inaccuracy blocks.inaccuracy = Inaccuracy
blocks.shots = Shots blocks.shots = Shots
blocks.reload = Shots/Second blocks.reload = Shots/Second
@@ -447,7 +448,7 @@ setting.sensitivity.name = Controller Sensitivity
setting.saveinterval.name = Save Interval setting.saveinterval.name = Save Interval
setting.seconds = {0} Seconds setting.seconds = {0} Seconds
setting.fullscreen.name = Fullscreen setting.fullscreen.name = Fullscreen
setting.borderless.name = Borderless Window setting.borderlesswindow.name = Borderless Window[LIGHT_GRAY] (may require restart)
setting.fps.name = Show FPS setting.fps.name = Show FPS
setting.vsync.name = VSync setting.vsync.name = VSync
setting.lasers.name = Show Power Lasers setting.lasers.name = Show Power Lasers

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 KiB

After

Width:  |  Height:  |  Size: 404 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 KiB

After

Width:  |  Height:  |  Size: 306 KiB

View File

@@ -899,7 +899,7 @@ public class Blocks implements ContentList{
itemBridge = new BufferedItemBridge("bridge-conveyor"){{ itemBridge = new BufferedItemBridge("bridge-conveyor"){{
requirements(Category.distribution, ItemStack.with(Items.lead, 8, Items.copper, 8)); requirements(Category.distribution, ItemStack.with(Items.lead, 8, Items.copper, 8));
range = 4; range = 4;
speed = 60f; speed = 70f;
bufferCapacity = 15; bufferCapacity = 15;
}}; }};
@@ -1104,7 +1104,7 @@ public class Blocks implements ContentList{
size = 4; size = 4;
health = 900; health = 900;
powerProduction = 110f; powerProduction = 110f;
itemDuration = 40f; itemDuration = 60f;
consumes.power(25f); consumes.power(25f);
consumes.item(Items.blastCompound); consumes.item(Items.blastCompound);
consumes.liquid(Liquids.cryofluid, 0.26f); consumes.liquid(Liquids.cryofluid, 0.26f);

View File

@@ -1,7 +1,5 @@
package io.anuke.mindustry.entities.effect; package io.anuke.mindustry.entities.effect;
import io.anuke.annotations.Annotations.Loc;
import io.anuke.annotations.Annotations.Remote;
import io.anuke.arc.collection.IntMap; import io.anuke.arc.collection.IntMap;
import io.anuke.arc.math.Mathf; import io.anuke.arc.math.Mathf;
import io.anuke.arc.math.geom.Geometry; import io.anuke.arc.math.geom.Geometry;
@@ -74,11 +72,6 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
} }
} }
@Remote(called = Loc.server)
public static void onFireRemoved(int fireid){
fireGroup.removeByID(fireid);
}
@Override @Override
public float lifetime(){ public float lifetime(){
return lifetime; return lifetime;
@@ -94,18 +87,17 @@ public class Fire extends TimedEntity implements SaveTrait, SyncTrait, Poolable{
Effects.effect(Fx.fireSmoke, x + Mathf.range(4f), y + Mathf.range(4f)); Effects.effect(Fx.fireSmoke, x + Mathf.range(4f), y + Mathf.range(4f));
} }
if(Net.client()){
return;
}
time = Mathf.clamp(time + Time.delta(), 0, lifetime()); time = Mathf.clamp(time + Time.delta(), 0, lifetime());
if(time >= lifetime() || tile == null){ if(time >= lifetime() || tile == null){
Call.onFireRemoved(getID());
remove(); remove();
return; return;
} }
if(Net.client()){
return;
}
TileEntity entity = tile.target().entity; TileEntity entity = tile.target().entity;
boolean damage = entity != null; boolean damage = entity != null;

View File

@@ -190,10 +190,16 @@ public class SettingsMenuDialog extends SettingsDialog{
} }
}); });
graphics.checkPref("borderlesswindow", false, b -> Core.graphics.setUndecorated(b));
Core.graphics.setVSync(Core.settings.getBool("vsync")); Core.graphics.setVSync(Core.settings.getBool("vsync"));
if(Core.settings.getBool("fullscreen")){ if(Core.settings.getBool("fullscreen")){
Core.graphics.setFullscreenMode(Core.graphics.getDisplayMode()); Core.graphics.setFullscreenMode(Core.graphics.getDisplayMode());
} }
if(Core.settings.getBool("borderlesswindow")){
Core.graphics.setUndecorated(true);
}
}else{ }else{
graphics.checkPref("landscape", false, b -> { graphics.checkPref("landscape", false, b -> {
if(b){ if(b){

View File

@@ -409,6 +409,7 @@ public class Block extends BlockStorage{
public void setStats(){ public void setStats(){
stats.add(BlockStat.size, "{0}x{0}", size); stats.add(BlockStat.size, "{0}x{0}", size);
stats.add(BlockStat.health, health, StatUnit.none); stats.add(BlockStat.health, health, StatUnit.none);
stats.add(BlockStat.buildTime, buildCost / 60, StatUnit.seconds);
consumes.display(stats); consumes.display(stats);

View File

@@ -72,7 +72,7 @@ public class Junction extends Block{
if(entity == null || relative == -1 || entity.buffers[relative].full()) if(entity == null || relative == -1 || entity.buffers[relative].full())
return false; return false;
Tile to = tile.getNearby(relative); Tile to = tile.getNearby(relative);
return to != null; return to != null && to.target().block().hasItems;
} }
@Override @Override

View File

@@ -43,8 +43,8 @@ public class LiquidJunction extends LiquidBlock{
dir = (dir + 4) % 4; dir = (dir + 4) % 4;
Tile to = tile.getNearby(dir).target(); Tile to = tile.getNearby(dir).target();
if(to.block().hasLiquids && to.block().acceptLiquid(to, tile, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount))){ if(to.block().hasLiquids && to.block().acceptLiquid(to, tile, liquid, amount)){
to.block().handleLiquid(to, tile, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount)); to.block().handleLiquid(to, tile, liquid, amount);
} }
} }
@@ -55,6 +55,6 @@ public class LiquidJunction extends LiquidBlock{
Tile to = dest.getNearby(dir); Tile to = dest.getNearby(dir);
if(to == null) return false; if(to == null) return false;
to = to.target(); to = to.target();
return to != null && to.entity != null && to.block().hasLiquids && to.block().acceptLiquid(to, dest, liquid, Math.min(to.block().liquidCapacity - to.entity.liquids.get(liquid) - 0.00001f, amount)); return to != null && to.entity != null && to.block().hasLiquids && to.block().acceptLiquid(to, dest, liquid, amount);
} }
} }

View File

@@ -258,6 +258,10 @@ public class Drill extends Block{
return new DrillEntity(); return new DrillEntity();
} }
public int tier(){
return tier;
}
public Item getDrop(Tile tile){ public Item getDrop(Tile tile){
return tile.drop(); return tile.drop();
} }

View File

@@ -135,6 +135,14 @@ public class GenericCrafter extends Block{
return itemCapacity; return itemCapacity;
} }
public Item outputItem(){
return outputItem == null ? null : outputItem.item;
}
public Liquid outputLiquid(){
return outputLiquid == null ? null : outputLiquid.liquid;
}
public static class GenericCrafterEntity extends TileEntity{ public static class GenericCrafterEntity extends TileEntity{
public float progress; public float progress;
public float totalProgress; public float totalProgress;

View File

@@ -25,11 +25,6 @@ import io.anuke.mindustry.world.meta.*;
import java.io.*; import java.io.*;
public class UnitFactory extends Block{ public class UnitFactory extends Block{
//for attack mode
protected float gracePeriodMultiplier = 15f;
protected float speedupTime = 60f * 60f * 20;
protected float maxSpeedup = 2f;
protected UnitType type; protected UnitType type;
protected float produceTime = 1000f; protected float produceTime = 1000f;
protected float launchVelocity = 0f; protected float launchVelocity = 0f;
@@ -164,26 +159,16 @@ public class UnitFactory extends Block{
entity.warmup += entity.delta(); entity.warmup += entity.delta();
} }
if(!tile.isEnemyCheat()){ //player-made spawners have default behavior
//player-made spawners have default behavior if(entity.cons.valid() || tile.isEnemyCheat()){
if(entity.cons.valid()){ entity.time += entity.delta() * entity.speedScl * Vars.state.rules.unitBuildSpeedMultiplier;
entity.time += entity.delta() * entity.speedScl * Vars.state.rules.unitBuildSpeedMultiplier; entity.buildTime += entity.delta() * entity.power.satisfaction * Vars.state.rules.unitBuildSpeedMultiplier;
entity.buildTime += entity.delta() * entity.power.satisfaction * Vars.state.rules.unitBuildSpeedMultiplier;
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
}else{
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
}
//check if grace period had passed
}else if(entity.warmup > produceTime * gracePeriodMultiplier){
float speedMultiplier = Math.min(0.1f + (entity.warmup - produceTime * gracePeriodMultiplier) / speedupTime, maxSpeedup);
entity.time += entity.delta() * entity.speedScl;
//otherwise, it's an enemy, cheat by not requiring resources
entity.buildTime += entity.delta() * speedMultiplier;
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f); entity.speedScl = Mathf.lerpDelta(entity.speedScl, 1f, 0.05f);
}else{ }else{
entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f); entity.speedScl = Mathf.lerpDelta(entity.speedScl, 0f, 0.05f);
} }
if(entity.buildTime >= produceTime){ if(entity.buildTime >= produceTime){
entity.buildTime = 0f; entity.buildTime = 0f;

View File

@@ -8,6 +8,7 @@ import java.util.Locale;
public enum BlockStat{ public enum BlockStat{
health(StatCategory.general), health(StatCategory.general),
size(StatCategory.general), size(StatCategory.general),
buildTime(StatCategory.general),
itemCapacity(StatCategory.items), itemCapacity(StatCategory.items),
itemsMoved(StatCategory.items), itemsMoved(StatCategory.items),

View File

@@ -1,5 +1,7 @@
package io.anuke.mindustry.world.meta; package io.anuke.mindustry.world.meta;
import io.anuke.arc.Core;
/** A specific category for a stat. */ /** A specific category for a stat. */
public enum StatCategory{ public enum StatCategory{
general, general,
@@ -8,5 +10,9 @@ public enum StatCategory{
items, items,
crafting, crafting,
shooting, shooting,
optional, optional;
public String localized(){
return Core.bundle.get("category." + name());
}
} }