From 63e472050c1deb7d945fdf499684d19c2e2959a9 Mon Sep 17 00:00:00 2001 From: r-esistor <38401208+r-esistor@users.noreply.github.com> Date: Mon, 21 May 2018 03:10:35 -0400 Subject: [PATCH 1/2] Circuit Labels (sorta understanding git edition) (#37633) * Customizable circuit names/descriptions * Circuit descriptions are now copied * Prevents code injection through the desc --- code/modules/integrated_electronics/core/assemblies.dm | 2 +- .../integrated_electronics/core/saved_circuits.dm | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm index 0844070dd6..72c34b90cc 100644 --- a/code/modules/integrated_electronics/core/assemblies.dm +++ b/code/modules/integrated_electronics/core/assemblies.dm @@ -3,7 +3,7 @@ /obj/item/electronic_assembly name = "electronic assembly" - obj_flags = CAN_BE_HIT + obj_flags = CAN_BE_HIT | UNIQUE_RENAME desc = "It's a case, for building small electronics with." w_class = WEIGHT_CLASS_SMALL icon = 'icons/obj/assemblies/electronic_setups.dmi' diff --git a/code/modules/integrated_electronics/core/saved_circuits.dm b/code/modules/integrated_electronics/core/saved_circuits.dm index b389b0d2d9..bc85cc4d9a 100644 --- a/code/modules/integrated_electronics/core/saved_circuits.dm +++ b/code/modules/integrated_electronics/core/saved_circuits.dm @@ -124,6 +124,10 @@ // Save modified name if(initial(name) != name) assembly_params["name"] = name + + // Save modified description + if(initial(desc) != desc) + assembly_params["desc"] = desc // Save panel status if(opened) @@ -142,6 +146,8 @@ // Validate name and color if(assembly_params["name"] && !reject_bad_name(assembly_params["name"], TRUE)) return "Bad assembly name." + if(assembly_params["desc"] && !reject_bad_text(assembly_params["desc"], TRUE)) + return "Bad assembly description." if(assembly_params["detail_color"] && !(assembly_params["detail_color"] in color_whitelist)) return "Bad assembly color." @@ -151,6 +157,10 @@ // Load modified name, if any. if(assembly_params["name"]) name = assembly_params["name"] + + // Load modified description, if any. + if(assembly_params["desc"]) + desc = assembly_params["desc"] // Load panel status if(assembly_params["opened"])