public virtual IAreaJob CreateAreaJob(Players.Player owner, JSONNode node) { Vector3Int min = Vector3Int.invalidPos; Vector3Int max = Vector3Int.invalidPos; JSONNode child; if (node.TryGetChild("min", out child)) { min.x = child.GetAsOrDefault("x", -1); min.y = child.GetAsOrDefault("y", -1); min.z = child.GetAsOrDefault("z", -1); } if (node.TryGetChild("max", out child)) { max.x = child.GetAsOrDefault("x", -1); max.y = child.GetAsOrDefault("y", -1); max.z = child.GetAsOrDefault("z", -1); } JSONNode args; if (node.TryGetChild("arguments", out args)) { if (args.NodeType == NodeType.Value && args.GetAs <string>() == "none") { return(null); } } ConstructionArea area = (ConstructionArea)CreateAreaJob(owner, min, max); area.SetArgument(args); return(area); }
// need to parse some additional data that the default one doesn't public override IAreaJob CreateAreaJob(Colony owner, JSONNode node) { Vector3Int min = new Vector3Int() { x = node.GetAsOrDefault("x-", int.MinValue), y = node.GetAsOrDefault("y-", int.MinValue), z = node.GetAsOrDefault("z-", int.MinValue) }; Vector3Int max = min + new Vector3Int() { x = node.GetAsOrDefault("xd", 0), y = node.GetAsOrDefault("yd", 0), z = node.GetAsOrDefault("zd", 0) }; JSONNode args; if (!node.TryGetChild("args", out args)) { return(null); } ConstructionArea area = (ConstructionArea)CreateAreaJob(owner, min, max, true); area.SetArgument(args); return(area); }