From a209582b8a8f82ef55d9111e38f8d24cbbd54bb3 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Sun, 6 Aug 2017 03:21:24 -0500 Subject: [PATCH 1/4] Fixes areastring grabbing area subtypes --- code/__HELPERS/unsorted.dm | 12 ++++++++++++ .../machinery/porta_turret/portable_turret.dm.rej | 14 ++++++++++++++ code/modules/power/apc.dm.rej | 14 ++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 code/game/machinery/porta_turret/portable_turret.dm.rej create mode 100644 code/modules/power/apc.dm.rej diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index aab766f9e4..e94fc9f4b0 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -605,6 +605,18 @@ Turf and target are separate in case you want to teleport some distance from a t GLOB.sortedAreas.Add(src) sortTim(GLOB.sortedAreas, /proc/cmp_name_asc) +//Takes: Area type as a text string from a variable. +//Returns: Instance for the area in the world. +/proc/get_area_instance_from_text(areatext) + var/areainstance = null + if(istext(areatext)) + areatext = text2path(areatext) + for(var/V in GLOB.sortedAreas) + var/area/A = V + if(A.type == areatext) + areainstance = V + return areainstance + //Takes: Area type as text string or as typepath OR an instance of the area. //Returns: A list of all areas of that type in the world. /proc/get_areas(areatype, subtypes=TRUE) diff --git a/code/game/machinery/porta_turret/portable_turret.dm.rej b/code/game/machinery/porta_turret/portable_turret.dm.rej new file mode 100644 index 0000000000..c91133b09c --- /dev/null +++ b/code/game/machinery/porta_turret/portable_turret.dm.rej @@ -0,0 +1,14 @@ +diff a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm (rejected hunks) +@@ -669,11 +669,7 @@ + return + + if(control_area) +- control_area = text2path(control_area) //resolves the string to path, then filters out instances generated by subtypes of the path in sortedAreas +- for(var/V in GLOB.sortedAreas) +- var/area/B = V +- if(B.type == control_area) +- control_area = V ++ control_area = get_area_instance_from_text(control_area) + if(control_area == null) + control_area = get_area(src) + stack_trace("Bad control_area path for [src], [src.control_area]") diff --git a/code/modules/power/apc.dm.rej b/code/modules/power/apc.dm.rej new file mode 100644 index 0000000000..0164f12908 --- /dev/null +++ b/code/modules/power/apc.dm.rej @@ -0,0 +1,14 @@ +diff a/code/modules/power/apc.dm b/code/modules/power/apc.dm (rejected hunks) +@@ -178,11 +178,7 @@ + + //if area isn't specified use current + if(areastring) +- areastring = text2path(areastring) //resolves the string to path, then filters out instances generated by subtypes of the path in sortedAreas +- for(var/V in GLOB.sortedAreas) +- var/area/B = V +- if(B.type == areastring) +- src.area = V ++ src.area = get_area_instance_from_text(areastring) + if(!src.area) + src.area = A + stack_trace("Bad areastring path for [src], [src.areastring]") From 29b867ad0ebf4b650994132dbf7dba0bbf2ee92b Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 14 Aug 2017 18:42:52 -0500 Subject: [PATCH 2/4] Update portable_turret.dm --- code/game/machinery/porta_turret/portable_turret.dm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 038f0e0eba..f88578bbf9 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -667,14 +667,13 @@ ..() if(!mapload) return - if(control_area && istext(control_area)) - for(var/V in GLOB.sortedAreas) - var/area/A = V - if(A.name == control_area) - control_area = A - break - if(!control_area) + if(control_area) + control_area = get_area_instance_from_text(control_area) + if(control_area == null) + control_area = get_area(src) + stack_trace("Bad control_area path for [src], [src.control_area]") + else if(!control_area) control_area = get_area(src) for(var/obj/machinery/porta_turret/T in control_area) From 78ad83ddec537aa6004e98f06adfd7c6180c0ee0 Mon Sep 17 00:00:00 2001 From: LetterJay Date: Mon, 14 Aug 2017 18:44:51 -0500 Subject: [PATCH 3/4] Update apc.dm --- code/modules/power/apc.dm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index e36c639eb9..da09564bd3 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -177,15 +177,18 @@ var/area/A = src.loc.loc //if area isn't specified use current - if(isarea(A) && src.areastring == null) + if(areastring) + src.area = get_area_instance_from_text(areastring) + if(!src.area) + src.area = A + stack_trace("Bad areastring path for [src], [src.areastring]") + else if(isarea(A) && src.areastring == null) src.area = A - else - src.area = get_area_by_name(areastring) update_icon() make_terminal() - addtimer(CALLBACK(src, .proc/update), 5) +addtimer(CALLBACK(src, .proc/update), 5) /obj/machinery/power/apc/examine(mob/user) ..() From 61b8c488729f7b2fb8bff0c7cf9da67b1869a249 Mon Sep 17 00:00:00 2001 From: kevinz000 Date: Tue, 29 Aug 2017 09:29:45 -0700 Subject: [PATCH 4/4] sync --- code/__HELPERS/unsorted.dm | 1 + .../machinery/porta_turret/portable_turret.dm.rej | 1 - code/modules/power/apc.dm | 2 +- code/modules/power/apc.dm.rej | 14 -------------- 4 files changed, 2 insertions(+), 16 deletions(-) delete mode 100644 code/game/machinery/porta_turret/portable_turret.dm.rej delete mode 100644 code/modules/power/apc.dm.rej diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 918fd0b28c..b682c7d373 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1266,6 +1266,7 @@ proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types()) #define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255))) #define QDEL_IN(item, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/qdel, item), time, TIMER_STOPPABLE) +#define QDEL_IN_CLIENT_TIME(item, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/qdel, item), time, TIMER_STOPPABLE | TIMER_CLIENT_TIME) #define QDEL_NULL(item) qdel(item); item = null #define QDEL_LIST(L) if(L) { for(var/I in L) qdel(I); L.Cut(); } #define QDEL_LIST_IN(L, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/______qdel_list_wrapper, L), time, TIMER_STOPPABLE) diff --git a/code/game/machinery/porta_turret/portable_turret.dm.rej b/code/game/machinery/porta_turret/portable_turret.dm.rej deleted file mode 100644 index f6c4fd068e..0000000000 --- a/code/game/machinery/porta_turret/portable_turret.dm.rej +++ /dev/null @@ -1 +0,0 @@ -delete me \ No newline at end of file diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 8b8cb7589a..3b070f1384 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -195,7 +195,7 @@ make_terminal() -addtimer(CALLBACK(src, .proc/update), 5) + addtimer(CALLBACK(src, .proc/update), 5) /obj/machinery/power/apc/examine(mob/user) ..() diff --git a/code/modules/power/apc.dm.rej b/code/modules/power/apc.dm.rej deleted file mode 100644 index 0164f12908..0000000000 --- a/code/modules/power/apc.dm.rej +++ /dev/null @@ -1,14 +0,0 @@ -diff a/code/modules/power/apc.dm b/code/modules/power/apc.dm (rejected hunks) -@@ -178,11 +178,7 @@ - - //if area isn't specified use current - if(areastring) -- areastring = text2path(areastring) //resolves the string to path, then filters out instances generated by subtypes of the path in sortedAreas -- for(var/V in GLOB.sortedAreas) -- var/area/B = V -- if(B.type == areastring) -- src.area = V -+ src.area = get_area_instance_from_text(areastring) - if(!src.area) - src.area = A - stack_trace("Bad areastring path for [src], [src.areastring]")