Skip to content

Commit

Permalink
Deleted redundant classes. Commented out ApplicationTests for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Acemany committed Nov 6, 2024
1 parent e02c3b4 commit 2d898c1
Show file tree
Hide file tree
Showing 26 changed files with 62 additions and 737 deletions.
2 changes: 1 addition & 1 deletion core/src/mindustryV4/content/Blocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ public void drawShadow(Tile tile){}
}};

launchPad = new LaunchPad("launch-pad"){{
requirements(Category.effect, () -> world.isZone(), ItemStack.with(Items.copper, 500, Items.titanium, 200, Items.silicon, 200, Items.lead, 200));
requirements(Category.effect, () -> !world.getMap().custom, ItemStack.with(Items.copper, 500, Items.titanium, 200, Items.silicon, 200, Items.lead, 200));
size = 3;
itemCapacity = 100;
launchTime = 60f * 8;
Expand Down
5 changes: 0 additions & 5 deletions core/src/mindustryV4/core/ContentLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public class ContentLoader{
new UnitTypes(),
new Blocks(),
new TechTree(),
//new Zones(),

//these are not really content classes, but this makes initialization easier
new ColorMapper(),
Expand Down Expand Up @@ -208,10 +207,6 @@ public BulletType bullet(int id){
return (BulletType) getByID(ContentType.bullet, id);
}

public Array<Zone> zones(){
return getBy(ContentType.zone);
}

/**
* Registers sync IDs for all types of sync entities.
* Do not register units here!
Expand Down
4 changes: 2 additions & 2 deletions core/src/mindustryV4/core/Control.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ public Control(){
Effects.shake(5, 6, Core.camera.position.x, Core.camera.position.y);
//the restart dialog can show info for any number of scenarios
Call.onGameOver(event.winner);
if(state.rules.zone != -1){
/*if(state.rules.zone != -1){
//remove zone save on game over
if(saves.getZoneSlot() != null){
saves.getZoneSlot().delete();
}
}
}*/
});

//autohost for pvp sectors
Expand Down
8 changes: 1 addition & 7 deletions core/src/mindustryV4/core/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@
*/
public class Logic implements ApplicationListener{

public Logic(){
Events.on(WaveEvent.class, event -> {
if(world.isZone()){
world.getZone().updateWave(state.wave);
}
});
}
public Logic(){}

@Override
public void init(){
Expand Down
2 changes: 0 additions & 2 deletions core/src/mindustryV4/core/UI.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public class UI implements ApplicationListener{
public DatabaseDialog database;
public ContentInfoDialog content;
public SectorsDialog sectors;
public DeployDialog deploy;
public TechTreeDialog tech;

public Cursor drillCursor, unloadCursor;
Expand Down Expand Up @@ -179,7 +178,6 @@ public void init(){
localplayers = new LocalPlayerDialog();
content = new ContentInfoDialog();
sectors = new SectorsDialog();
deploy = new DeployDialog();
tech = new TechTreeDialog();

Group group = Core.scene.root;
Expand Down
26 changes: 0 additions & 26 deletions core/src/mindustryV4/core/World.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import mindustryV4.type.ContentType;
import mindustryV4.type.Item;
import mindustryV4.type.ItemStack;
import mindustryV4.type.Zone;
import mindustryV4.world.*;

import static mindustryV4.Vars.*;
Expand Down Expand Up @@ -208,31 +207,6 @@ public boolean isGenerating(){
return generating;
}

public boolean isZone(){
return getZone() != null;
}

public Zone getZone(){
return content.getByID(ContentType.zone, state.rules.zone);
}

public void playZone(Zone zone){
ui.loadAnd(() -> {
logic.reset();
state.rules = zone.rules.get();
state.rules.zone = zone.id;
loadGenerator(zone.generator);
for(Tile core : state.teams.get(defaultTeam).cores){
for(ItemStack stack : zone.getStartingItems()){
core.entity.items.add(stack.item, stack.amount);
}
}
state.set(State.playing);
control.saves.zoneSave();
logic.play();
});
}

public void loadGenerator(Generator generator){
beginMapLoad();

Expand Down
19 changes: 0 additions & 19 deletions core/src/mindustryV4/game/EventType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,10 @@
import mindustryV4.core.GameState.State;
import mindustryV4.entities.type.*;
import mindustryV4.entities.traits.BuilderTrait;
import mindustryV4.type.Zone;
import mindustryV4.world.Tile;

public class EventType{

/**Called when a zone's requirements are met.*/
public static class ZoneCompleteEvent implements Event{
public final Zone zone;

public ZoneCompleteEvent(Zone zone){
this.zone = zone;
}
}

/**Called when a zone's requirements are met.*/
public static class ZoneConfigureCompleteEvent implements Event{
public final Zone zone;

public ZoneConfigureCompleteEvent(Zone zone){
this.zone = zone;
}
}

/**Called when the game is first loaded.*/
public static class GameLoadEvent implements Event{

Expand Down
56 changes: 18 additions & 38 deletions core/src/mindustryV4/game/Saves.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import mindustryV4.io.SaveMeta;
import mindustryV4.maps.Map;
import mindustryV4.type.ContentType;
import mindustryV4.type.Zone;

import java.io.IOException;
import java.text.SimpleDateFormat;
Expand All @@ -33,6 +32,7 @@ public class Saves{
private float time;
private long totalPlaytime;
private long lastTimestamp;

public Saves(){
Events.on(StateChangeEvent.class, event -> {
if(event.to == State.menu){
Expand Down Expand Up @@ -67,14 +67,11 @@ public void update(){
SaveSlot current = this.current;

if(current != null && !state.is(State.menu)
&& !(state.isPaused() && scene.hasDialog())){
if(current != null && !state.is(State.menu)
&& !(state.isPaused() && scene.hasDialog())){
if(lastTimestamp != 0){
totalPlaytime += Time.timeSinceMillis(lastTimestamp);
}
lastTimestamp = Time.millis();
&& !(state.isPaused() && scene.hasDialog())){
if(lastTimestamp != 0){
totalPlaytime += Time.timeSinceMillis(lastTimestamp);
}
lastTimestamp = Time.millis();
}

if(!state.is(State.menu) && !state.gameOver && current != null && current.isAutosave()){
Expand Down Expand Up @@ -110,16 +107,6 @@ public boolean isSaving(){
return saving;
}

public void zoneSave(){
SaveSlot slot = new SaveSlot(-1);
slot.setName("zone");
saves.remove(s -> s.index == -1);
saves.add(slot);
saveMap.put(slot.index, slot);
slot.save();
saveSlots();
}

public SaveSlot addSave(String name){
SaveSlot slot = new SaveSlot(nextSlot);
nextSlot++;
Expand All @@ -144,13 +131,8 @@ public SaveSlot importSave(FileHandle file) throws IOException{
return slot;
}

public SaveSlot getZoneSlot(){
SaveSlot slot = getByID(-1);
return slot == null || slot.getZone() == null ? null : slot;
}

public SaveSlot getByID(int id){
return saveMap.get(id);
public SaveSlot getByID(int id){
return saveMap.get(id);
}

public Array<SaveSlot> getSaveSlots(){
Expand Down Expand Up @@ -186,20 +168,22 @@ public void load() throws SaveException{

public void save(){
long time = totalPlaytime;
long prev = totalPlaytime;
totalPlaytime = time;
long prev = totalPlaytime;
totalPlaytime = time;

SaveIO.saveToSlot(index);
meta = SaveIO.getData(index);
if(!state.is(State.menu)){
current = this;
}
renderer.fog.writeFog();

SaveIO.saveToSlot(index);
meta = SaveIO.getData(index);
if(!state.is(State.menu)){
current = this;
}

totalPlaytime = prev;
totalPlaytime = prev;
}

public boolean isHidden(){
return getZone() != null;
return getMap() != null;
}

public String getPlayTime(){
Expand All @@ -226,10 +210,6 @@ public String getName(){
Core.settings.save();
}

public Zone getZone(){
return content.getByID(ContentType.zone, meta.rules.zone);
}

public int getBuild(){
return meta.build;
}
Expand Down
5 changes: 2 additions & 3 deletions core/src/mindustryV4/game/Stats.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import io.anuke.arc.math.Mathf;
import mindustryV4.type.Item;
import mindustryV4.type.ItemType;
import mindustryV4.type.Zone;

@Serialize
public class Stats{
Expand All @@ -25,7 +24,7 @@ public class Stats{
/**Friendly buildings destroyed.*/
public int buildingsDestroyed;

public RankResult calculateRank(Zone zone, boolean launched){
/*public RankResult calculateRank(Zone zone, boolean launched){
float score = 0;
//each new launch period adds onto the rank 1.5 'points'
Expand Down Expand Up @@ -53,7 +52,7 @@ public RankResult calculateRank(Zone zone, boolean launched){
String sign = Math.abs((rankIndex + 0.5f) - score) < 0.2f || rank.name().contains("S") ? "" : (rankIndex + 0.5f) < score ? "-" : "+";
return new RankResult(rank, sign);
}
}*/

public static class RankResult{
public final Rank rank;
Expand Down
5 changes: 0 additions & 5 deletions core/src/mindustryV4/io/versions/Save16.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import mindustryV4.io.SaveFileVersion;
import mindustryV4.maps.Map;
import mindustryV4.type.ContentType;
import mindustryV4.type.Zone;

import java.io.*;

Expand All @@ -27,10 +26,6 @@ public void read(DataInputStream stream) throws IOException{

//general state
state.rules = Serialization.readRules(stream);
//load zone spawn patterns if applicable
if(content.getByID(ContentType.zone, state.rules.zone) != null){
state.rules.spawns = content.<Zone>getByID(ContentType.zone, state.rules.zone).rules.get().spawns;
}
String mapname = stream.readUTF();
Map map = world.maps.getByName(mapname);
if(map == null) map = new Map(Strings.capitalize(mapname), 1, 1);
Expand Down
1 change: 0 additions & 1 deletion core/src/mindustryV4/type/ContentType.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ public enum ContentType {
unit,
weather,
effect,
zone,
loadout
}
Loading

0 comments on commit 2d898c1

Please sign in to comment.