/// <summary> /// Processes one object and its parameters /// </summary> /// <param name="line"></param> public static void ProcessObject(ref string line) { GroupCollection g = Regex(@"^(.+)\{(.+)\}", line); if (g == null) { return; } string path = g[1].Value; string stringtags = g[2].Value; Objtype objtype = GetType(path); if (objtype == Objtype.Null) { return; } var tags = new List <string>(stringtags.Split(new[] { "; " }, StringSplitOptions.None)); for (int i = 0; i < tags.Count; i++) { string tag = tags[i]; GroupCollection g2 = Regex(@"^(.+)[ ]=[ ](.+)", tag); if (g2 == null) { continue; } string name = g2[1].Value; string value = g2[2].Value.Trim(new[] { '"' }); //Removes icon_state from heaters/freezers if (objtype == Objtype.Temp) { if (name == "icon_state") { tags.RemoveAt(i); i--; } continue; } //General removal of tags we shouldn't have if (name == "pipe_color" || name == "color" || name == "level" || (objtype != Objtype.Pump && name == "name") || (objtype == Objtype.Pump && name == "icon_state")) { tags.RemoveAt(i); i--; continue; } //Processes icon_state into correct path if (name == "icon_state") { ProcessIconstate(ref path, value, objtype); tags.RemoveAt(i); i--; continue; } //Fixes up injector if (objtype == Objtype.Injector && name == "on") { path = "/obj/machinery/atmospherics/unary/outlet_injector/on"; tags.RemoveAt(i); i--; } } stringtags = String.Join("; ", tags); line = String.Format("{0}{{{1}}}", path, stringtags); }
/// <summary> /// Updates an objects path with its corresponding icon_state /// </summary> /// <param name="path">Object path to change</param> /// <param name="iconstate">Iconstate it has</param> /// <param name="objtype">Type of the object</param> public static void ProcessIconstate(ref string path, string iconstate, Objtype objtype) { switch (objtype) { case Objtype.Pipe: switch (iconstate) { case "intact": path = "/obj/machinery/atmospherics/pipe/simple/general/visible"; return; case "intact-f": path = "/obj/machinery/atmospherics/pipe/simple/general/hidden"; return; case "intact-b": path = "/obj/machinery/atmospherics/pipe/simple/supply/visible"; return; case "intact-b-f": path = "/obj/machinery/atmospherics/pipe/simple/supply/hidden"; return; case "intact-r": path = "/obj/machinery/atmospherics/pipe/simple/scrubbers/visible"; return; case "intact-r-f": path = "/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden"; return; case "intact-y": path = "/obj/machinery/atmospherics/pipe/simple/yellow/visible"; return; case "intact-y-f": path = "/obj/machinery/atmospherics/pipe/simple/yellow/hidden"; return; case "intact-g": path = "/obj/machinery/atmospherics/pipe/simple/green/visible"; return; case "intact-g-f": path = "/obj/machinery/atmospherics/pipe/simple/green/hidden"; return; case "intact-c": path = "/obj/machinery/atmospherics/pipe/simple/cyan/visible"; return; case "intact-c-f": path = "/obj/machinery/atmospherics/pipe/simple/cyan/hidden"; return; case "intact-p": path = "/obj/machinery/atmospherics/pipe/simple/supplymain/visible"; return; case "intact-p-f": path = "/obj/machinery/atmospherics/pipe/simple/supplymain/hidden"; return; } return; case Objtype.Manifold: switch (iconstate) { case "manifold": path = "/obj/machinery/atmospherics/pipe/manifold/general/visible"; return; case "manifold-f": path = "/obj/machinery/atmospherics/pipe/manifold/general/hidden"; return; case "manifold-b": path = "/obj/machinery/atmospherics/pipe/manifold/supply/visible"; return; case "manifold-b-f": path = "/obj/machinery/atmospherics/pipe/manifold/supply/hidden"; return; case "manifold-r": path = "/obj/machinery/atmospherics/pipe/manifold/scrubbers/visible"; return; case "manifold-r-f": path = "/obj/machinery/atmospherics/pipe/manifold/scrubbers/hidden"; return; case "manifold-c": path = "/obj/machinery/atmospherics/pipe/manifold/cyan/visible"; return; case "manifold-c-f": path = "/obj/machinery/atmospherics/pipe/manifold/cyan/hidden"; return; case "manifold-y": path = "/obj/machinery/atmospherics/pipe/manifold/yellow/visible"; return; case "manifold-y-f": path = "/obj/machinery/atmospherics/pipe/manifold/yellow/hidden"; return; case "manifold-g": path = "/obj/machinery/atmospherics/pipe/manifold/green/visible"; return; case "manifold-g-f": path = "/obj/machinery/atmospherics/pipe/manifold/green/hidden"; return; case "manifold-p": path = "/obj/machinery/atmospherics/pipe/manifold/supplymain/visible"; return; case "manifold-p-f": path = "/obj/machinery/atmospherics/pipe/manifold/supplymain/hidden"; return; } return; } }