Fixed more objective bugs
This commit is contained in:
@@ -331,6 +331,16 @@ public class NetClient implements ApplicationListener{
|
|||||||
|
|
||||||
@Remote(variants = Variant.both)
|
@Remote(variants = Variant.both)
|
||||||
public static void setObjectives(MapObjectives executor){
|
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;
|
state.rules.objectives = executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,8 +99,6 @@ public class MapObjectives implements Iterable<MapObjective>, Eachable<MapObject
|
|||||||
|
|
||||||
/** Updates all objectives this executor contains. */
|
/** Updates all objectives this executor contains. */
|
||||||
public void update(){
|
public void update(){
|
||||||
//TODO am i doing this correctly
|
|
||||||
if(net.client()) return;
|
|
||||||
eachRunning(obj -> {
|
eachRunning(obj -> {
|
||||||
for(var marker : obj.markers){
|
for(var marker : obj.markers){
|
||||||
if(!marker.wasAdded){
|
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.completed = true;
|
||||||
obj.done();
|
obj.done();
|
||||||
for(var marker : obj.markers){
|
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. */
|
/** Marker used for drawing UI to indicate something along with an objective. */
|
||||||
public static abstract class ObjectiveMarker{
|
public static abstract class ObjectiveMarker{
|
||||||
/** Makes sure markers are only added once. */
|
/** Makes sure markers are only added once. */
|
||||||
private transient boolean wasAdded;
|
public transient boolean wasAdded;
|
||||||
|
|
||||||
/** Called in the overlay draw layer.*/
|
/** Called in the overlay draw layer.*/
|
||||||
public void draw(){}
|
public void draw(){}
|
||||||
|
|||||||
Reference in New Issue
Block a user