Re-implemented some units / Bugfixes

This commit is contained in:
Anuken
2020-05-19 14:58:04 -04:00
parent 8c6e8d8bcb
commit 77c0163a79
39 changed files with 924 additions and 834 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 184 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 B

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 296 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

After

Width:  |  Height:  |  Size: 724 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 KiB

After

Width:  |  Height:  |  Size: 740 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 837 KiB

After

Width:  |  Height:  |  Size: 836 KiB

View File

@@ -1233,7 +1233,7 @@ public class Blocks implements ContentList{
waterExtractor = new SolidPump("water-extractor"){{ waterExtractor = new SolidPump("water-extractor"){{
requirements(Category.production, ItemStack.with(Items.copper, 25, Items.graphite, 25, Items.lead, 20)); requirements(Category.production, ItemStack.with(Items.copper, 25, Items.graphite, 25, Items.lead, 20));
result = Liquids.water; result = Liquids.water;
pumpAmount = 0.13f; pumpAmount = 0.11f;
size = 2; size = 2;
liquidCapacity = 30f; liquidCapacity = 30f;
rotateSpeed = 1.4f; rotateSpeed = 1.4f;

View File

@@ -563,6 +563,7 @@ public class Bullets implements ContentList{
damage = 2; damage = 2;
speed = 2.1f; speed = 2.1f;
drag = 0.02f; drag = 0.02f;
shootEffect = Fx.shootSmall;
}}; }};
oilShot = new LiquidBulletType(Liquids.oil){{ oilShot = new LiquidBulletType(Liquids.oil){{

View File

@@ -33,7 +33,7 @@ public class SectorPresets implements ContentList{
conditionWave = 10; conditionWave = 10;
launchPeriod = 5; launchPeriod = 5;
requirements = with( requirements = with(
new ZoneWave(groundZero, 60), new SectorWave(groundZero, 60),
//new Unlock(Blocks.daggerFactory), //new Unlock(Blocks.daggerFactory),
//new Unlock(Blocks.draugFactory), //new Unlock(Blocks.draugFactory),
new Unlock(Blocks.door), new Unlock(Blocks.door),
@@ -46,7 +46,7 @@ public class SectorPresets implements ContentList{
startingItems = list(copper, 250); startingItems = list(copper, 250);
conditionWave = 10; conditionWave = 10;
requirements = with( requirements = with(
new ZoneWave(groundZero, 10), new SectorWave(groundZero, 10),
new Unlock(Blocks.junction), new Unlock(Blocks.junction),
new Unlock(Blocks.router) new Unlock(Blocks.router)
); );
@@ -56,7 +56,7 @@ public class SectorPresets implements ContentList{
startingItems = list(copper, 100); startingItems = list(copper, 100);
conditionWave = 10; conditionWave = 10;
requirements = with( requirements = with(
new ZoneWave(frozenForest, 10), new SectorWave(frozenForest, 10),
new Unlock(Blocks.mender), new Unlock(Blocks.mender),
new Unlock(Blocks.combustionGenerator) new Unlock(Blocks.combustionGenerator)
); );
@@ -68,8 +68,8 @@ public class SectorPresets implements ContentList{
conditionWave = 20; conditionWave = 20;
launchPeriod = 20; launchPeriod = 20;
requirements = with( requirements = with(
new ZoneWave(groundZero, 20), new SectorWave(groundZero, 20),
new ZoneWave(craters, 15), new SectorWave(craters, 15),
new Unlock(Blocks.graphitePress), new Unlock(Blocks.graphitePress),
new Unlock(Blocks.combustionGenerator), new Unlock(Blocks.combustionGenerator),
new Unlock(Blocks.kiln), new Unlock(Blocks.kiln),
@@ -83,7 +83,7 @@ public class SectorPresets implements ContentList{
conditionWave = 10; conditionWave = 10;
launchPeriod = 10; launchPeriod = 10;
requirements = with( requirements = with(
new ZoneWave(frozenForest, 15), new SectorWave(frozenForest, 15),
new Unlock(Blocks.pneumaticDrill), new Unlock(Blocks.pneumaticDrill),
new Unlock(Blocks.powerNode), new Unlock(Blocks.powerNode),
new Unlock(Blocks.turbineGenerator) new Unlock(Blocks.turbineGenerator)
@@ -93,7 +93,7 @@ public class SectorPresets implements ContentList{
fungalPass = new SectorPreset("fungalPass", starter, 21){{ fungalPass = new SectorPreset("fungalPass", starter, 21){{
startingItems = list(copper, 250, lead, 250, Items.metaglass, 100, Items.graphite, 100); startingItems = list(copper, 250, lead, 250, Items.metaglass, 100, Items.graphite, 100);
requirements = with( requirements = with(
new ZoneWave(stainedMountains, 15), new SectorWave(stainedMountains, 15),
//new Unlock(Blocks.daggerFactory), //new Unlock(Blocks.daggerFactory),
//new Unlock(Blocks.crawlerFactory), //new Unlock(Blocks.crawlerFactory),
new Unlock(Blocks.door), new Unlock(Blocks.door),
@@ -107,7 +107,7 @@ public class SectorPresets implements ContentList{
launchPeriod = 4; launchPeriod = 4;
loadout = Loadouts.basicNucleus; loadout = Loadouts.basicNucleus;
requirements = with( requirements = with(
new ZoneWave(craters, 40), new SectorWave(craters, 40),
new Launched(fungalPass), new Launched(fungalPass),
new Unlock(Blocks.cultivator), new Unlock(Blocks.cultivator),
new Unlock(Blocks.sporePress) new Unlock(Blocks.sporePress)
@@ -122,7 +122,7 @@ public class SectorPresets implements ContentList{
conditionWave = 15; conditionWave = 15;
launchPeriod = 10; launchPeriod = 10;
requirements = with( requirements = with(
new ZoneWave(ruinousShores, 20), new SectorWave(ruinousShores, 20),
new Unlock(Blocks.coalCentrifuge), new Unlock(Blocks.coalCentrifuge),
new Unlock(Blocks.conduit), new Unlock(Blocks.conduit),
new Unlock(Blocks.wave) new Unlock(Blocks.wave)
@@ -135,7 +135,7 @@ public class SectorPresets implements ContentList{
conditionWave = 3; conditionWave = 3;
launchPeriod = 2; launchPeriod = 2;
requirements = with( requirements = with(
new ZoneWave(tarFields, 20), new SectorWave(tarFields, 20),
new Unlock(Blocks.thermalGenerator), new Unlock(Blocks.thermalGenerator),
new Unlock(Blocks.thoriumReactor) new Unlock(Blocks.thoriumReactor)
); );

View File

@@ -3,6 +3,7 @@ package mindustry.content;
import arc.math.*; import arc.math.*;
import arc.struct.*; import arc.struct.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.game.Objectives.*;
import mindustry.type.*; import mindustry.type.*;
import mindustry.world.*; import mindustry.world.*;
@@ -336,7 +337,7 @@ public class TechTree implements ContentList{
requirements = new ItemStack[block.requirements.length]; requirements = new ItemStack[block.requirements.length];
for(int i = 0; i < requirements.length; i++){ for(int i = 0; i < requirements.length; i++){
requirements[i] = new ItemStack(block.requirements[i].item, 40 + Mathf.round(Mathf.pow(block.requirements[i].amount, 1.25f) * 6, 10)); requirements[i] = new ItemStack(block.requirements[i].item, 40 + Mathf.round(Mathf.pow(block.requirements[i].amount, 1.25f) * 20, 10));
} }
}else{ }else{
requirements = ItemStack.empty; requirements = ItemStack.empty;
@@ -355,11 +356,20 @@ public class TechTree implements ContentList{
} }
public static class TechNode{ public static class TechNode{
static TechNode context; private static TechNode context;
/** Requirement node. */
public TechNode parent; public TechNode parent;
public final UnlockableContent content; /** Content to be researched. */
public final ItemStack[] requirements; public UnlockableContent content;
/** Item requirements for this content. */
public ItemStack[] requirements;
/** Extra objectives needed to research this. TODO implement */
public Objective[] objectives = {};
/** Turns required to research this content. */
//TODO keep track of turns that have been used so far
public int turns = 1;
/** Nodes that depend on this node. */
public final Array<TechNode> children = new Array<>(); public final Array<TechNode> children = new Array<>();
TechNode(TechNode ccontext, UnlockableContent content, ItemStack[] requirements, Runnable children){ TechNode(TechNode ccontext, UnlockableContent content, ItemStack[] requirements, Runnable children){

View File

@@ -3,6 +3,7 @@ package mindustry.content;
import arc.struct.*; import arc.struct.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import mindustry.ctype.*; import mindustry.ctype.*;
import mindustry.entities.bullet.*;
import mindustry.gen.*; import mindustry.gen.*;
import mindustry.type.*; import mindustry.type.*;
@@ -63,6 +64,72 @@ public class UnitTypes implements ContentList{
}}; }};
crawler = new UnitType("crawler"){{
speed = 0.65f;
drag = 0.3f;
hitsize = 8f;
mass = 1.75f;
health = 120;
weapons.add(new Weapon(){{
reload = 12f;
shootCone = 180f;
ejectEffect = Fx.none;
shootSound = Sounds.explosion;
bullet = new BombBulletType(2f, 3f, "clear"){{
hitEffect = Fx.pulverize;
lifetime = 30f;
speed = 1.1f;
splashDamageRadius = 55f;
instantDisappear = true;
splashDamage = 30f;
killShooter = true;
}};
}});
}};
fortress = new UnitType("fortress"){{
speed = 0.38f;
speed = 0.15f;
drag = 0.4f;
mass = 5f;
hitsize = 10f;
rotateSpeed = 3f;
targetAir = false;
health = 750;
weapons.add(new Weapon("artillery"){{
y = 1f;
x = 9f;
reload = 60f;
alternate = true;
recoil = 4f;
shake = 2f;
ejectEffect = Fx.shellEjectMedium;
bullet = Bullets.artilleryUnit;
shootSound = Sounds.artillery;
}});
}};
eruptor = new UnitType("eruptor"){{
speed = 0.4f;
drag = 0.4f;
mass = 5f;
hitsize = 9f;
rotateSpeed = 3f;
targetAir = false;
health = 600;
immunities = ObjectSet.with(StatusEffects.burning, StatusEffects.melting);
weapons.add(new Weapon("eruption"){{
shootY = 3f;
reload = 10f;
alternate = true;
ejectEffect = Fx.none;
bullet = Bullets.eruptorShot;
recoil = 1f;
x = 7f;
shootSound = Sounds.flame;
}});
}};
wraith = new UnitType("wraith"){{ wraith = new UnitType("wraith"){{
speed = 3f; speed = 3f;
accel = 0.08f; accel = 0.08f;
@@ -152,6 +219,7 @@ public class UnitTypes implements ContentList{
recoil = 2f; recoil = 2f;
bullet = Bullets.healBulletBig; bullet = Bullets.healBulletBig;
shootSound = Sounds.pew; shootSound = Sounds.pew;
}}); }});
}}; }};
@@ -171,49 +239,6 @@ public class UnitTypes implements ContentList{
}}; }};
/* /*
crawler = new UnitType("crawler", GroundUnit::new){{
maxVelocity = 1.27f;
speed = 0.285f;
drag = 0.4f;
hitsize = 8f;
mass = 1.75f;
health = 120;
weapons.add(new Weapon(){{
reload = 12f;
ejectEffect = Fx.none;
shootSound = Sounds.explosion;
bullet = new BombBulletType(2f, 3f, "clear"){{
hitEffect = Fx.pulverize;
lifetime = 30f;
speed = 1.1f;
splashDamageRadius = 55f;
instantDisappear = true;
splashDamage = 30f;
killShooter = true;
}};
}});
}};
titan = new UnitType("titan", GroundUnit::new){{
maxVelocity = 0.8f;
speed = 0.22f;
drag = 0.4f;
mass = 3.5f;
hitsize = 9f;
range = 10f;
rotatespeed = 0.1f;
health = 460;
immunities.add(StatusEffects.burning);
weapons.add(new Weapon("flamethrower"){{
shootSound = Sounds.flame;
length = 1f;
reload = 14f;
alternate = true;
recoil = 1f;
ejectEffect = Fx.none;
bullet = Bullets.basicFlame;
}});
}};
fortress = new UnitType("fortress", GroundUnit::new){{ fortress = new UnitType("fortress", GroundUnit::new){{
maxVelocity = 0.78f; maxVelocity = 0.78f;

View File

@@ -175,12 +175,6 @@ public class Control implements ApplicationListener, Loadable{
Effects.shake(5f, 5f, core); Effects.shake(5f, 5f, core);
}); });
}); });
Events.on(UnitDestroyEvent.class, e -> {
if(state.isCampaign()){
data.unlockContent(e.unit.type());
}
});
} }
@Override @Override

View File

@@ -30,6 +30,7 @@ public class GameState{
/** Current game state. */ /** Current game state. */
private State state = State.menu; private State state = State.menu;
//TODO optimize
public Unitc boss(){ public Unitc boss(){
return Groups.unit.find(u -> u.isBoss() && u.team() == rules.waveTeam); return Groups.unit.find(u -> u.isBoss() && u.team() == rules.waveTeam);
} }

View File

@@ -111,6 +111,15 @@ public class Logic implements ApplicationListener{
universe.runTurn(); universe.runTurn();
} }
}); });
//disable new waves after the boss spawns
Events.on(WaveEvent.class, e -> {
//only works for preset sectors so far
if(state.isCampaign() && state.boss() != null && state.rules.sector.preset != null){
state.rules.waitEnemies = true;
}
});
} }
/** Handles the event of content being used by either the player or some block. */ /** Handles the event of content being used by either the player or some block. */
@@ -123,7 +132,8 @@ public class Logic implements ApplicationListener{
/** Adds starting items, resets wave time, and sets state to playing. */ /** Adds starting items, resets wave time, and sets state to playing. */
public void play(){ public void play(){
state.set(State.playing); state.set(State.playing);
state.wavetime = state.rules.waveSpacing * 2; //grace period of 2x wave time before game starts //grace period of 2x wave time before game starts
state.wavetime = state.rules.waveSpacing * 2;
Events.fire(new PlayEvent()); Events.fire(new PlayEvent());
//add starting items //add starting items
@@ -160,7 +170,7 @@ public class Logic implements ApplicationListener{
Events.fire(new WaveEvent()); Events.fire(new WaveEvent());
} }
private void checkGameOver(){ private void checkGameState(){
//campaign maps do not have a 'win' state! //campaign maps do not have a 'win' state!
if(state.isCampaign()){ if(state.isCampaign()){
//gameover only when cores are dead //gameover only when cores are dead
@@ -174,6 +184,22 @@ public class Logic implements ApplicationListener{
//if yes, waves get disabled //if yes, waves get disabled
state.rules.waves = false; state.rules.waves = false;
} }
//check if there is a boss present
Unitc boss = state.boss();
//if this was a boss wave and there is no boss anymore, then it's a victory
if(state.rules.sector.preset != null && boss == null && state.rules.waves && state.rules.waitEnemies){
//the sector has been conquered - waves get disabled
state.rules.waves = false;
//fire capture event
Events.fire(new SectorCaptureEvent(state.rules.sector));
//save, just in case
if(!headless){
control.saves.saveSector(state.rules.sector);
}
}
}else{ }else{
if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){ if(!state.rules.attackMode && state.teams.playerCores().size == 0 && !state.gameOver){
state.gameOver = true; state.gameOver = true;
@@ -233,7 +259,7 @@ public class Logic implements ApplicationListener{
Sector sector = state.rules.sector; Sector sector = state.rules.sector;
//TODO what about containers, do they get launched too? //TODO containers must be launched too
Time.runTask(30f, () -> { Time.runTask(30f, () -> {
for(Tilec entity : state.teams.playerCores()){ for(Tilec entity : state.teams.playerCores()){
for(Item item : content.items()){ for(Item item : content.items()){
@@ -252,7 +278,7 @@ public class Logic implements ApplicationListener{
//run a turn, since launching takes up a turn //run a turn, since launching takes up a turn
universe.runTurn(); universe.runTurn();
//TODO needs extra damage to prevent player from landing immediately afterwards //TODO needs extra damage to prevent player from landing immediately afterwards
sector.setTurnsPassed(sector.getTurnsPassed() + 1); sector.setTurnsPassed(sector.getTurnsPassed() + 3);
Events.fire(new LaunchEvent()); Events.fire(new LaunchEvent());
//manually fire game over event now //manually fire game over event now
@@ -291,7 +317,7 @@ public class Logic implements ApplicationListener{
} }
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){ if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
if(!state.rules.waitForWaveToEnd || state.enemies == 0){ if(!state.rules.waitEnemies || state.enemies == 0){
state.wavetime = Math.max(state.wavetime - Time.delta(), 0); state.wavetime = Math.max(state.wavetime - Time.delta(), 0);
} }
} }
@@ -304,7 +330,7 @@ public class Logic implements ApplicationListener{
} }
if(!net.client() && !world.isInvalidMap() && !state.isEditor() && state.rules.canGameOver){ if(!net.client() && !world.isInvalidMap() && !state.isEditor() && state.rules.canGameOver){
checkGameOver(); checkGameState();
} }
} }
} }

View File

@@ -222,6 +222,9 @@ public class World{
} }
}); });
//reset rules
setSectorRules(sector);
if(state.rules.defaultTeam.core() != null){ if(state.rules.defaultTeam.core() != null){
sector.setSpawnPosition(state.rules.defaultTeam.core().pos()); sector.setSpawnPosition(state.rules.defaultTeam.core().pos());
} }
@@ -231,6 +234,8 @@ public class World{
state.map = new Map(StringMap.of("name", sector.planet.localizedName + "; Sector " + sector.id)); state.map = new Map(StringMap.of("name", sector.planet.localizedName + "; Sector " + sector.id));
state.rules.sector = sector; state.rules.sector = sector;
state.rules.weather.clear();
if(sector.is(SectorAttribute.rainy)){ if(sector.is(SectorAttribute.rainy)){
state.rules.weather.add(new WeatherEntry(Weathers.rain)); state.rules.weather.add(new WeatherEntry(Weathers.rain));
} }

View File

@@ -99,7 +99,7 @@ public class WaveInfoDialog extends FloatingDialog{
}}).width(390f).growY(); }}).width(390f).growY();
cont.table(Tex.clear, m -> { cont.table(Tex.clear, m -> {
m.add("$waves.preview").color(Color.lightGray).growX().center().get().setAlignment(Align.center, Align.center); m.add("$waves.preview").color(Color.lightGray).wrap().growX().center().get().setAlignment(Align.center, Align.center);
m.row(); m.row();
m.button("-", () -> { m.button("-", () -> {
}).update(t -> { }).update(t -> {

View File

@@ -16,6 +16,6 @@ abstract class LegsComp implements Posc, Flyingc, Hitboxc, Unitc, Legsc, Elevati
public void update(){ public void update(){
float len = vel().len(); float len = vel().len();
baseRotation = Angles.moveToward(baseRotation, vel().angle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed)); baseRotation = Angles.moveToward(baseRotation, vel().angle(), type().baseRotateSpeed * Mathf.clamp(len / type().speed));
walkTime += Time.delta()*len/1f; walkTime += Time.delta()*len*2f;
} }
} }

View File

@@ -97,7 +97,7 @@ abstract class WeaponsComp implements Teamc, Posc, Rotc{
float rotation = this.rotation - 90; float rotation = this.rotation - 90;
//shoot if applicable //shoot if applicable
if(mount.reload <= 0.0001f && Angles.within(weapon.rotate ? mount.rotation : this.rotation, mount.targetRotation, 1.5f)){ if(mount.reload <= 0.0001f && Angles.within(weapon.rotate ? mount.rotation : this.rotation, mount.targetRotation, mount.weapon.shootCone)){
for(int i : (weapon.mirror && !weapon.alternate ? Mathf.signs : Mathf.one)){ for(int i : (weapon.mirror && !weapon.alternate ? Mathf.signs : Mathf.one)){
i *= Mathf.sign(weapon.flipped) * (mount.weapon.mirror ? Mathf.sign(mount.side) : 1); i *= Mathf.sign(weapon.flipped) * (mount.weapon.mirror ? Mathf.sign(mount.side) : 1);

View File

@@ -110,6 +110,15 @@ public class EventType{
} }
} }
/** Called when a sector is conquered, e.g. a boss or base is defeated. */
public static class SectorCaptureEvent{
public final Sector sector;
public SectorCaptureEvent(Sector sector){
this.sector = sector;
}
}
/** Called when the player withdraws items from a block. */ /** Called when the player withdraws items from a block. */
public static class WithdrawEvent{ public static class WithdrawEvent{
public final Tilec tile; public final Tilec tile;

View File

@@ -51,15 +51,15 @@ public class Objectives{
} }
} }
public static class ZoneWave extends ZoneObjective{ public static class SectorWave extends SectorObjective{
public int wave; public int wave;
public ZoneWave(SectorPreset zone, int wave){ public SectorWave(SectorPreset zone, int wave){
this.preset = zone; this.preset = zone;
this.wave = wave; this.wave = wave;
} }
protected ZoneWave(){} protected SectorWave(){}
@Override @Override
public boolean complete(){ public boolean complete(){
@@ -72,7 +72,7 @@ public class Objectives{
} }
} }
public static class Launched extends ZoneObjective{ public static class Launched extends SectorObjective{
public Launched(SectorPreset zone){ public Launched(SectorPreset zone){
this.preset = zone; this.preset = zone;
@@ -91,7 +91,7 @@ public class Objectives{
} }
} }
public abstract static class ZoneObjective implements Objective{ public abstract static class SectorObjective implements Objective{
public @NonNull SectorPreset preset; public @NonNull SectorPreset preset;
} }
@@ -112,7 +112,7 @@ public class Objectives{
} }
default SectorPreset zone(){ default SectorPreset zone(){
return this instanceof ZoneObjective ? ((ZoneObjective)this).preset : null; return this instanceof SectorObjective ? ((SectorObjective)this).preset : null;
} }
} }
} }

View File

@@ -1,9 +1,8 @@
package mindustry.game; package mindustry.game;
import arc.util.ArcAnnotate.*;
import mindustry.annotations.Annotations.*;
import arc.struct.*;
import arc.graphics.*; import arc.graphics.*;
import arc.struct.*;
import arc.util.ArcAnnotate.*;
import mindustry.content.*; import mindustry.content.*;
import mindustry.io.*; import mindustry.io.*;
import mindustry.type.*; import mindustry.type.*;
@@ -67,8 +66,8 @@ public class Rules{
public boolean limitedRespawns = false; public boolean limitedRespawns = false;
/** How many times player can respawn during one wave. */ /** How many times player can respawn during one wave. */
public int respawns = 5; public int respawns = 5;
/** Hold wave timer until all enemies are destroyed. */ /** Whether to pause the wave timer until all enemies are destroyed. */
public boolean waitForWaveToEnd = false; public boolean waitEnemies = false;
/** Determinates if gamemode is attack mode */ /** Determinates if gamemode is attack mode */
public boolean attackMode = false; public boolean attackMode = false;
/** Whether this is the editor gamemode. */ /** Whether this is the editor gamemode. */

View File

@@ -60,9 +60,9 @@ public class FileMapGenerator implements WorldGenerator{
} }
//add random decoration //add random decoration
if(Mathf.chance(0.015) && !tile.floor().isLiquid && tile.block() == Blocks.air){ //if(Mathf.chance(0.015) && !tile.floor().isLiquid && tile.block() == Blocks.air){
tile.setBlock(tile.floor().decoration); // tile.setBlock(tile.floor().decoration);
} //}
} }
if(!anyCores){ if(!anyCores){

View File

@@ -87,7 +87,7 @@ public class ContentParser{
return sound; return sound;
}); });
put(Objectives.Objective.class, (type, data) -> { put(Objectives.Objective.class, (type, data) -> {
Class<? extends Objectives.Objective> oc = data.has("type") ? resolve(data.getString("type"), "mindustry.game.Objectives") : ZoneWave.class; Class<? extends Objectives.Objective> oc = data.has("type") ? resolve(data.getString("type"), "mindustry.game.Objectives") : SectorWave.class;
data.remove("type"); data.remove("type");
Objectives.Objective obj = make(oc); Objectives.Objective obj = make(oc);
readFields(obj, data); readFields(obj, data);

View File

@@ -18,7 +18,7 @@ public class SectorPreset extends UnlockableContent{
public @NonNull FileMapGenerator generator; public @NonNull FileMapGenerator generator;
public @NonNull Planet planet; public @NonNull Planet planet;
public @NonNull Sector sector; public @NonNull Sector sector;
public Array<Objectives.Objective> requirements = new Array<>(); public Array<Objective> requirements = new Array<>();
public Cons<Rules> rules = rules -> {}; public Cons<Rules> rules = rules -> {};
public boolean alwaysUnlocked; public boolean alwaysUnlocked;
@@ -91,13 +91,13 @@ public class SectorPreset extends UnlockableContent{
} }
public void updateObjectives(Runnable closure){ public void updateObjectives(Runnable closure){
Array<ZoneObjective> incomplete = content.zones() Array<SectorObjective> incomplete = content.zones()
.flatMap(z -> z.requirements) .flatMap(z -> z.requirements)
.select(o -> o.zone() == this && !o.complete()) .select(o -> o.zone() == this && !o.complete())
.as(ZoneObjective.class); .as(SectorObjective.class);
closure.run(); closure.run();
for(ZoneObjective objective : incomplete){ for(SectorObjective objective : incomplete){
if(objective.complete()){ if(objective.complete()){
Events.fire(new ZoneRequireCompleteEvent(objective.preset, content.zones().find(z -> z.requirements.contains(objective)), objective)); Events.fire(new ZoneRequireCompleteEvent(objective.preset, content.zones().find(z -> z.requirements.contains(objective)), objective));
} }

View File

@@ -48,6 +48,8 @@ public class Weapon{
public float lengthRand = 0f; public float lengthRand = 0f;
/** delay in ticks between shots */ /** delay in ticks between shots */
public float shotDelay = 0; public float shotDelay = 0;
/** The half-radius of the cone in which shooting will start. */
public float shootCone = 1.5f;
/** whether shooter rotation is ignored when shooting. */ /** whether shooter rotation is ignored when shooting. */
public boolean ignoreRotation = false; public boolean ignoreRotation = false;
/** if turnCursor is false for a mech, how far away will the weapon target. */ /** if turnCursor is false for a mech, how far away will the weapon target. */
@@ -66,7 +68,7 @@ public class Weapon{
} }
public void load(){ public void load(){
region = Core.atlas.find(name + "-equip", Core.atlas.find(name, Core.atlas.find("clear"))); region = Core.atlas.find(name, Core.atlas.find("clear"));
} }
} }

View File

@@ -130,7 +130,7 @@ public class CustomRulesDialog extends FloatingDialog{
title("$rules.title.waves"); title("$rules.title.waves");
check("$rules.waves", b -> rules.waves = b, () -> rules.waves); check("$rules.waves", b -> rules.waves = b, () -> rules.waves);
check("$rules.wavetimer", b -> rules.waveTimer = b, () -> rules.waveTimer); check("$rules.wavetimer", b -> rules.waveTimer = b, () -> rules.waveTimer);
check("$rules.waitForWaveToEnd", b -> rules.waitForWaveToEnd = b, () -> rules.waitForWaveToEnd); check("$rules.waitForWaveToEnd", b -> rules.waitEnemies = b, () -> rules.waitEnemies);
number("$rules.wavespacing", false, f -> rules.waveSpacing = f * 60f, () -> rules.waveSpacing / 60f, () -> true); number("$rules.wavespacing", false, f -> rules.waveSpacing = f * 60f, () -> rules.waveSpacing / 60f, () -> true);
number("$rules.dropzoneradius", false, f -> rules.dropZoneRadius = f * tilesize, () -> rules.dropZoneRadius / tilesize, () -> true); number("$rules.dropzoneradius", false, f -> rules.dropZoneRadius = f * tilesize, () -> rules.dropZoneRadius / tilesize, () -> true);

View File

@@ -283,13 +283,14 @@ public class PlanetDialog extends FloatingDialog{
if(selectAlpha > 0.01f){ if(selectAlpha > 0.01f){
if(sec.unlocked()){ if(sec.unlocked()){
float stroke = 0.026f; Color color =
if(sec.hasBase()){ sec.hasBase() ? Team.sharded.color :
drawSelection(sec, Tmp.c1.set(Team.sharded.color).mul(0.8f).a(selectAlpha), stroke, -0.005f); sec.preset != null ? Team.derelict.color :
}else if(sec.preset != null){ sec.hasEnemyBase() ? Team.crux.color :
drawSelection(sec, Tmp.c1.set(Team.derelict.color).mul(0.8f).a(selectAlpha), stroke, -0.005f); null;
}else if(sec.hasEnemyBase()){
drawSelection(sec, Tmp.c1.set(Team.crux.color).mul(0.8f).a(selectAlpha), stroke, -0.005f); if(color != null){
drawSelection(sec, Tmp.c1.set(color).mul(0.8f).a(selectAlpha), 0.026f, -0.001f);
} }
}else{ }else{
draw(sec, Tmp.c1.set(shadowColor).mul(1, 1, 1, selectAlpha), -0.001f); draw(sec, Tmp.c1.set(shadowColor).mul(1, 1, 1, selectAlpha), -0.001f);
@@ -312,12 +313,9 @@ public class PlanetDialog extends FloatingDialog{
//render arcs //render arcs
if(selected != null && selected.preset != null){ if(selected != null && selected.preset != null){
for(Objective o : selected.preset.requirements){ for(Objective o : selected.preset.requirements){
if(o instanceof ZoneObjective){ if(o instanceof SectorObjective){
SectorPreset preset = ((ZoneObjective)o).preset; SectorPreset preset = ((SectorObjective)o).preset;
drawArc(planet, selected.tile.v, preset.sector.tile.v);
if(true){
drawArc(planet, selected.tile.v, preset.sector.tile.v);
}
} }
} }
} }

View File

@@ -49,6 +49,11 @@ public class HudFragment extends Fragment{
showToast("New turn: [accent]" + universe.getTurn() + "[]" + (attacked > 0 ? "\n[scarlet]" + Iconc.warning + " " + attacked + " sectors attacked!": "")); showToast("New turn: [accent]" + universe.getTurn() + "[]" + (attacked > 0 ? "\n[scarlet]" + Iconc.warning + " " + attacked + " sectors attacked!": ""));
}); });
//TODO details and stuff
Events.on(SectorCaptureEvent.class, e ->{
showToast("Sector[accent] captured[]!");
});
//TODO tear this all down //TODO tear this all down
//menu at top left //menu at top left
parent.fill(cont -> { parent.fill(cont -> {
@@ -625,7 +630,7 @@ public class HudFragment extends Fragment{
} }
if(state.rules.waveTimer){ if(state.rules.waveTimer){
builder.append((state.rules.waitForWaveToEnd && state.enemies > 0 ? Core.bundle.get("wave.waveInProgress") : ( waitingf.get((int)(state.wavetime/60))))); builder.append((state.rules.waitEnemies && state.enemies > 0 ? Core.bundle.get("wave.waveInProgress") : ( waitingf.get((int)(state.wavetime/60)))));
}else if(state.enemies == 0){ }else if(state.enemies == 0){
builder.append(Core.bundle.get("waiting")); builder.append(Core.bundle.get("waiting"));
} }

View File

@@ -246,9 +246,9 @@ public class Generators{
Image image = ImagePacker.get(type.region); Image image = ImagePacker.get(type.region);
if(type.constructor.get() instanceof Legsc){ if(type.constructor.get() instanceof Legsc){
image.draw(type.baseRegion); image.drawCenter(type.baseRegion);
image.draw(type.legRegion); image.drawCenter(type.legRegion);
image.draw(type.legRegion, true, false); image.drawCenter(type.legRegion, true, false);
} }
image.draw(type.region); image.draw(type.region);

View File

@@ -68,6 +68,7 @@ class Image{
graphics.fillRect(x, y, 1, 1); graphics.fillRect(x, y, 1, 1);
} }
/** Draws a region at the top left corner. */ /** Draws a region at the top left corner. */
void draw(TextureRegion region){ void draw(TextureRegion region){
draw(region, 0, 0, false, false); draw(region, 0, 0, false, false);