Apparently every base part had a base tier of 0 this whole time

This commit is contained in:
Anuken
2020-11-13 12:40:23 -05:00
parent 0d015a4dfc
commit 3b3b1520f9
8 changed files with 20 additions and 21 deletions

View File

@@ -9,6 +9,7 @@ import arc.graphics.g2d.*;
import arc.math.*; import arc.math.*;
import arc.util.*; import arc.util.*;
import arc.util.async.*; import arc.util.async.*;
import mindustry.ai.*;
import mindustry.core.*; import mindustry.core.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.EventType.*; import mindustry.game.EventType.*;
@@ -104,6 +105,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
assets.load(schematics); assets.load(schematics);
assets.loadRun("contentinit", ContentLoader.class, () -> content.init(), () -> content.load()); assets.loadRun("contentinit", ContentLoader.class, () -> content.init(), () -> content.load());
assets.loadRun("baseparts", BaseRegistry.class, () -> {}, () -> bases.load());
} }
@Override @Override

View File

@@ -82,7 +82,7 @@ public class BaseRegistry{
} }
schem.tiles.removeAll(s -> s.block.buildVisibility == BuildVisibility.sandboxOnly); schem.tiles.removeAll(s -> s.block.buildVisibility == BuildVisibility.sandboxOnly);
part.tier = schem.tiles.sumf(s -> Mathf.pow(s.block.buildCost / s.block.buildCostMultiplier, 1.2f)); part.tier = schem.tiles.sumf(s -> Mathf.pow(s.block.buildCost / s.block.buildCostMultiplier, 1.4f));
if(part.core != null){ if(part.core != null){
cores.add(part); cores.add(part);
@@ -99,7 +99,9 @@ public class BaseRegistry{
part.centerY = part.schematic.height/2; part.centerY = part.schematic.height/2;
} }
if(part.required != null) reqParts.get(part.required, Seq::new).add(part); if(part.required != null && part.core == null){
reqParts.get(part.required, Seq::new).add(part);
}
}catch(IOException e){ }catch(IOException e){
throw new RuntimeException(e); throw new RuntimeException(e);

View File

@@ -28,7 +28,7 @@ import static mindustry.Vars.*;
@EntityDef(value = {Playerc.class}, serialize = false) @EntityDef(value = {Playerc.class}, serialize = false)
@Component(base = true) @Component(base = true)
abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Drawc{ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Drawc{
static final float deathDelay = 30f; static final float deathDelay = 60f;
@Import float x, y; @Import float x, y;
@@ -130,7 +130,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
} }
}else if(core != null){ }else if(core != null){
//have a small delay before death to prevent the camera from jumping around too quickly //have a small delay before death to prevent the camera from jumping around too quickly
//(this is not for balance) //(this is not for balance, it just looks better this way)
deathTimer += Time.delta; deathTimer += Time.delta;
if(deathTimer >= deathDelay){ if(deathTimer >= deathDelay){
//request spawn - this happens serverside only //request spawn - this happens serverside only

View File

@@ -108,9 +108,6 @@ public class Schematics implements Loadable{
if(shadowBuffer == null){ if(shadowBuffer == null){
Core.app.post(() -> shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8)); Core.app.post(() -> shadowBuffer = new FrameBuffer(maxSchematicSize + padding + 8, maxSchematicSize + padding + 8));
} }
//load base schematics
bases.load();
} }
private void loadLoadouts(){ private void loadLoadouts(){

View File

@@ -10,7 +10,7 @@ import mindustry.type.*;
import static mindustry.content.UnitTypes.*; import static mindustry.content.UnitTypes.*;
public class Waves{ public class Waves{
public static final int waveVersion = 2; public static final int waveVersion = 3;
private Seq<SpawnGroup> spawns; private Seq<SpawnGroup> spawns;
@@ -256,7 +256,8 @@ public class Waves{
} }
public static Seq<SpawnGroup> generate(float difficulty){ public static Seq<SpawnGroup> generate(float difficulty){
return generate(new Rand(), difficulty); //apply power curve to make starting sectors easier
return generate(new Rand(), Mathf.pow(difficulty, 1.12f));
} }
public static Seq<SpawnGroup> generate(Rand rand, float difficulty){ public static Seq<SpawnGroup> generate(Rand rand, float difficulty){
@@ -339,7 +340,7 @@ public class Waves{
step += (int)(rand.random(15, 30) * Mathf.lerp(1f, 0.5f, difficulty)); step += (int)(rand.random(15, 30) * Mathf.lerp(1f, 0.5f, difficulty));
} }
int bossWave = (int)(rand.random(50, 70) * Mathf.lerp(1f, 0.6f, difficulty)); int bossWave = (int)(rand.random(50, 70) * Mathf.lerp(1f, 0.5f, difficulty));
int bossSpacing = (int)(rand.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty)); int bossSpacing = (int)(rand.random(25, 40) * Mathf.lerp(1f, 0.6f, difficulty));
int bossTier = difficulty < 0.5 ? 3 : 4; int bossTier = difficulty < 0.5 ? 3 : 4;

View File

@@ -39,24 +39,22 @@ public class BaseGenerator{
Mathf.rand.setSeed(sector.id); Mathf.rand.setSeed(sector.id);
Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1 && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door)); Seq<Block> wallsSmall = content.blocks().select(b -> b instanceof Wall && b.size == 1 && !b.insulated && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
Seq<Block> wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2 && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door)); Seq<Block> wallsLarge = content.blocks().select(b -> b instanceof Wall && b.size == 2 && !b.insulated && b.buildVisibility == BuildVisibility.shown && !(b instanceof Door));
//sort by cost for correct fraction //sort by cost for correct fraction
wallsSmall.sort(b -> b.buildCost); wallsSmall.sort(b -> b.buildCost);
wallsLarge.sort(b -> b.buildCost); wallsLarge.sort(b -> b.buildCost);
//TODO proper difficulty selection
float bracket = difficulty;
float bracketRange = 0.2f; float bracketRange = 0.2f;
float baseChance = Mathf.lerp(0.7f, 1.9f, difficulty); float baseChance = Mathf.lerp(0.7f, 1.9f, difficulty);
int wallAngle = 70; //180 for full coverage int wallAngle = 70; //180 for full coverage
double resourceChance = 0.5 * baseChance; double resourceChance = 0.5 * baseChance;
double nonResourceChance = 0.0005 * baseChance; double nonResourceChance = 0.0005 * baseChance;
BasePart coreschem = bases.cores.getFrac(bracket); BasePart coreschem = bases.cores.getFrac(difficulty);
int passes = difficulty < 0.4 ? 1 : difficulty < 0.8 ? 2 : 3; int passes = difficulty < 0.4 ? 1 : difficulty < 0.8 ? 2 : 3;
Block wall = wallsSmall.getFrac(bracket), wallLarge = wallsLarge.getFrac(bracket); Block wall = wallsSmall.getFrac(difficulty), wallLarge = wallsLarge.getFrac(difficulty);
for(Tile tile : cores){ for(Tile tile : cores){
tile.clearOverlay(); tile.clearOverlay();
@@ -78,10 +76,10 @@ public class BaseGenerator{
|| (tile.floor().liquidDrop != null && Mathf.chance(nonResourceChance * 2))) && Mathf.chance(resourceChance)){ || (tile.floor().liquidDrop != null && Mathf.chance(nonResourceChance * 2))) && Mathf.chance(resourceChance)){
Seq<BasePart> parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop); Seq<BasePart> parts = bases.forResource(tile.drop() != null ? tile.drop() : tile.floor().liquidDrop);
if(!parts.isEmpty()){ if(!parts.isEmpty()){
tryPlace(parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team); tryPlace(parts.getFrac(difficulty + Mathf.range(bracketRange)), tile.x, tile.y, team);
} }
}else if(Mathf.chance(nonResourceChance)){ }else if(Mathf.chance(nonResourceChance)){
tryPlace(bases.parts.getFrac(bracket + Mathf.range(bracketRange)), tile.x, tile.y, team); tryPlace(bases.parts.getFrac(difficulty + Mathf.range(bracketRange)), tile.x, tile.y, team);
} }
}); });
} }

View File

@@ -431,7 +431,6 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
state.rules.waves = sector.info.waves = true; state.rules.waves = sector.info.waves = true;
state.rules.enemyCoreBuildRadius = 600f; state.rules.enemyCoreBuildRadius = 600f;
//TODO better waves
state.rules.spawns = Waves.generate(difficulty); state.rules.spawns = Waves.generate(difficulty);
} }

View File

@@ -183,10 +183,10 @@ public class Planet extends UnlockableContent{
} }
if(sector.hasEnemyBase()){ if(sector.hasEnemyBase()){
sum += 2f; sum += 2.5f;
} }
sector.threat = sector.preset == null ? Mathf.clamp(sum / 5f) : Mathf.clamp(sector.preset.difficulty / 10f); sector.threat = sector.preset == null ? Math.min(sum / 5f, 1.5f) : Mathf.clamp(sector.preset.difficulty / 10f);
} }
} }