Make sure objectives aren't modified in editor

This commit is contained in:
Anuken
2022-04-14 16:47:09 -04:00
parent 422e910615
commit 29810c0445
3 changed files with 7 additions and 2 deletions

View File

@@ -478,7 +478,9 @@ public class Logic implements ApplicationListener{
}
//TODO objectives clientside???
updateObjectives();
if(!state.isEditor()){
updateObjectives();
}
if(state.rules.waves && state.rules.waveTimer && !state.gameOver){
if(!isWaitingWave()){

View File

@@ -19,6 +19,7 @@ import mindustry.*;
import mindustry.content.*;
import mindustry.core.GameState.*;
import mindustry.game.*;
import mindustry.game.MapObjectives.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.io.*;
@@ -325,6 +326,8 @@ public class MapEditorDialog extends Dialog implements Disposable{
public @Nullable Map save(){
boolean isEditor = state.rules.editor;
state.rules.editor = false;
state.rules.objectiveFlags.clear();
state.rules.objectives.each(MapObjective::reset);
String name = editor.tags.get("name", "").trim();
editor.tags.put("rules", JsonIO.write(state.rules));
editor.tags.remove("width");

View File

@@ -118,7 +118,7 @@ public class Rules{
public ObjectSet<Item> hiddenBuildItems = Items.erekirOnlyItems.asSet();
/** Campaign-only map objectives. */
public Seq<MapObjective> objectives = new Seq<>();
/** Flags set by objectives. Used in world processors. */
/** Flags set by objectives. Used in world processors. n*/
public ObjectSet<String> objectiveFlags = new ObjectSet<>();
/** HIGHLY UNSTABLE/EXPERIMENTAL. DO NOT USE THIS. */
public boolean fog = false;