Fixed more wide water / Unit command JSON support
This commit is contained in:
@@ -16,6 +16,7 @@ import arc.util.serialization.*;
|
||||
import arc.util.serialization.Json.*;
|
||||
import arc.util.serialization.Jval.*;
|
||||
import mindustry.*;
|
||||
import mindustry.ai.*;
|
||||
import mindustry.ai.types.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.content.TechTree.*;
|
||||
@@ -104,6 +105,18 @@ public class ContentParser{
|
||||
readFields(effect, data);
|
||||
return effect;
|
||||
});
|
||||
put(UnitCommand.class, (type, data) -> {
|
||||
if(data.isString()){
|
||||
var cmd = UnitCommand.all.find(u -> u.name.equals(data.asString()));
|
||||
if(cmd != null){
|
||||
return cmd;
|
||||
}else{
|
||||
throw new IllegalArgumentException("Unknown unit command name: " + data.asString());
|
||||
}
|
||||
}else{
|
||||
throw new IllegalArgumentException("Unit commands must be strings.");
|
||||
}
|
||||
});
|
||||
put(BulletType.class, (type, data) -> {
|
||||
if(data.isString()){
|
||||
return field(Bullets.class, data);
|
||||
|
||||
Reference in New Issue
Block a user