WIP map objective system
This commit is contained in:
@@ -435,6 +435,22 @@ public class Logic implements ApplicationListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO objectives clientside???
|
||||||
|
|
||||||
|
//update objectives; do not get completed clientside
|
||||||
|
if(state.rules.objectives.size > 0){
|
||||||
|
var first = state.rules.objectives.first();
|
||||||
|
first.update();
|
||||||
|
if(!net.client() && first.complete()){
|
||||||
|
state.rules.objectives.remove(0);
|
||||||
|
|
||||||
|
//TODO call packet for this?
|
||||||
|
if(net.server()){
|
||||||
|
Call.setRules(state.rules);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
|
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
|
||||||
if(!isWaitingWave()){
|
if(!isWaitingWave()){
|
||||||
state.wavetime = Math.max(state.wavetime - Time.delta, 0);
|
state.wavetime = Math.max(state.wavetime - Time.delta, 0);
|
||||||
|
|||||||
29
core/src/mindustry/game/MapObjectives.java
Normal file
29
core/src/mindustry/game/MapObjectives.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package mindustry.game;
|
||||||
|
|
||||||
|
import arc.func.*;
|
||||||
|
import arc.struct.*;
|
||||||
|
import arc.util.*;
|
||||||
|
|
||||||
|
public class MapObjectives{
|
||||||
|
public static Seq<Prov<MapObjective>> allObjectiveTypes = Seq.with();
|
||||||
|
|
||||||
|
public abstract class MapObjective{
|
||||||
|
|
||||||
|
public boolean complete(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Reset internal state, if any. */
|
||||||
|
public void reset(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public @Nullable String details(){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import arc.util.*;
|
|||||||
import arc.util.serialization.*;
|
import arc.util.serialization.*;
|
||||||
import arc.util.serialization.Json.*;
|
import arc.util.serialization.Json.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.game.MapObjectives.*;
|
||||||
import mindustry.graphics.g3d.*;
|
import mindustry.graphics.g3d.*;
|
||||||
import mindustry.io.*;
|
import mindustry.io.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
@@ -115,6 +116,8 @@ public class Rules{
|
|||||||
public ObjectSet<String> researched = new ObjectSet<>();
|
public ObjectSet<String> researched = new ObjectSet<>();
|
||||||
/** Block containing these items as requirements are hidden. */
|
/** Block containing these items as requirements are hidden. */
|
||||||
public ObjectSet<Item> hiddenBuildItems = Items.erekirOnlyItems.asSet();
|
public ObjectSet<Item> hiddenBuildItems = Items.erekirOnlyItems.asSet();
|
||||||
|
/** Campaign-only map objectives. */
|
||||||
|
public Seq<MapObjective> objectives = new Seq<>();
|
||||||
/** HIGHLY UNSTABLE/EXPERIMENTAL. DO NOT USE THIS. */
|
/** HIGHLY UNSTABLE/EXPERIMENTAL. DO NOT USE THIS. */
|
||||||
public boolean fog = false;
|
public boolean fog = false;
|
||||||
/** If fog = true, this is whether static (black) fog is enabled. */
|
/** If fog = true, this is whether static (black) fog is enabled. */
|
||||||
|
|||||||
@@ -242,6 +242,12 @@ public class JsonIO{
|
|||||||
var i = filter.get();
|
var i = filter.get();
|
||||||
json.addClassTag(Strings.camelize(i.getClass().getSimpleName().replace("Filter", "")), i.getClass());
|
json.addClassTag(Strings.camelize(i.getClass().getSimpleName().replace("Filter", "")), i.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//use short names for all objective types
|
||||||
|
for(var obj : MapObjectives.allObjectiveTypes){
|
||||||
|
var i = obj.get();
|
||||||
|
json.addClassTag(Strings.camelize(i.getClass().getSimpleName().replace("Objective", "")), i.getClass());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class CustomJson extends Json{
|
static class CustomJson extends Json{
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class LExecutor{
|
|||||||
public static final int
|
public static final int
|
||||||
maxGraphicsBuffer = 256,
|
maxGraphicsBuffer = 256,
|
||||||
maxDisplayBuffer = 1024,
|
maxDisplayBuffer = 1024,
|
||||||
maxTextBuffer = 256;
|
maxTextBuffer = 400;
|
||||||
|
|
||||||
public LInstruction[] instructions = {};
|
public LInstruction[] instructions = {};
|
||||||
public Var[] vars = {};
|
public Var[] vars = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user