mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
Fixed more objective bugs
This commit is contained in:
parent
9eacbb45d1
commit
47e639be28
@ -331,6 +331,16 @@ public class NetClient implements ApplicationListener{
|
||||
|
||||
@Remote(variants = Variant.both)
|
||||
public static void setObjectives(MapObjectives executor){
|
||||
//clear old markers
|
||||
for(var objective : state.rules.objectives){
|
||||
for(var marker : objective.markers){
|
||||
if(marker.wasAdded){
|
||||
marker.removed();
|
||||
marker.wasAdded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state.rules.objectives = executor;
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,6 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
|
||||
/** Updates all objectives this executor contains. */
|
||||
public void update(){
|
||||
//TODO am i doing this correctly
|
||||
if(net.client()) return;
|
||||
eachRunning(obj -> {
|
||||
for(var marker : obj.markers){
|
||||
if(!marker.wasAdded){
|
||||
@ -109,7 +107,8 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
}
|
||||
}
|
||||
|
||||
if(obj.update()){
|
||||
//objectives cannot get completed on the client, but they do try to update for timers and such
|
||||
if(obj.update() && !net.client()){
|
||||
obj.completed = true;
|
||||
obj.done();
|
||||
for(var marker : obj.markers){
|
||||
@ -592,7 +591,7 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
||||
/** Marker used for drawing UI to indicate something along with an objective. */
|
||||
public static abstract class ObjectiveMarker{
|
||||
/** Makes sure markers are only added once. */
|
||||
private transient boolean wasAdded;
|
||||
public transient boolean wasAdded;
|
||||
|
||||
/** Called in the overlay draw layer.*/
|
||||
public void draw(){}
|
||||
|
Loading…
Reference in New Issue
Block a user