Add marker instruction to world processors (#9087)

* Basic implementation of world processor marker control

* Add line marker, some marker control fixes

* Add remote for setting markers, add marker writer/reader to TypeIO

* Add sides cap to ShapeTextMarker's draw() method

* Marker instruction code refactor, revert accident auto-formatting, fix marker control bugs

* Cleanup LMarkerControl.java

* Remove deleted marker controls from MapObjectives

* Marker control method refactor, fix minimap marker rendering

* Refactor, proper double comparsion in MapObjectives

* Fix line marker's color not changing through world processors
This commit is contained in:
ApsZoldat
2023-09-27 17:17:59 -04:00
committed by GitHub
parent 6310d54b53
commit 8c777e79fa
9 changed files with 400 additions and 2 deletions
+15
View File
@@ -6,6 +6,7 @@ import arc.math.geom.*;
import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import arc.util.serialization.*;
import mindustry.ai.*;
import mindustry.ai.types.*;
import mindustry.annotations.Annotations.*;
@@ -16,6 +17,7 @@ import mindustry.entities.abilities.*;
import mindustry.entities.bullet.*;
import mindustry.entities.units.*;
import mindustry.game.*;
import mindustry.game.MapObjectives.*;
import mindustry.gen.*;
import mindustry.logic.*;
import mindustry.net.Administration.*;
@@ -655,6 +657,19 @@ public class TypeIO{
return JsonIO.read(MapObjectives.class, string);
}
public static void writeObjectiveMarker(Writes write, ObjectiveMarker marker){
String string = JsonIO.json.toJson(marker, MapObjectives.ObjectiveMarker.class);
byte[] bytes = string.getBytes(charset);
write.i(bytes.length);
write.b(bytes);
}
public static ObjectiveMarker readObjectiveMarker(Reads read){
int length = read.i();
String string = new String(read.b(new byte[length]), charset);
return JsonIO.read(MapObjectives.ObjectiveMarker.class, string);
}
public static void writeVecNullable(Writes write, @Nullable Vec2 v){
if(v == null){
write.f(Float.NaN);