From 5d5938cc91ddb7a99d48c6f4a8960f8f59f1a882 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 21 Feb 2017 22:52:31 -0800 Subject: [PATCH 1/6] Prevents AI upload use off-station --- code/modules/computer3/computers/law.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/computer3/computers/law.dm b/code/modules/computer3/computers/law.dm index 533a600a4eb..fd6e0f795b2 100644 --- a/code/modules/computer3/computers/law.dm +++ b/code/modules/computer3/computers/law.dm @@ -24,7 +24,7 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) - if(is_away_level(user.z)) + if(!is_station_level(user.z)) to_chat(user, "Unable to establish a connection: You're too far away from the station!") return if(istype(module, /obj/item/weapon/aiModule)) From 7d64003b0239b146585d867ab09b8a2011e095c4 Mon Sep 17 00:00:00 2001 From: Kyep Date: Tue, 21 Feb 2017 22:53:44 -0800 Subject: [PATCH 2/6] Also, borgs --- code/modules/computer3/computers/law.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/modules/computer3/computers/law.dm b/code/modules/computer3/computers/law.dm index fd6e0f795b2..dd88322a8ab 100644 --- a/code/modules/computer3/computers/law.dm +++ b/code/modules/computer3/computers/law.dm @@ -60,6 +60,9 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) if(istype(module, /obj/item/weapon/aiModule)) + if(!is_station_level(user.z)) + to_chat(user, "Unable to establish a connection: You're too far away from the station!") + return module.install(src) else return ..() From 2aa227255397ca4af809e19247d9648bad04a6d4 Mon Sep 17 00:00:00 2001 From: Kyep Date: Wed, 22 Feb 2017 22:50:23 -0800 Subject: [PATCH 3/6] Changes to same zlevel check --- code/__HELPERS/unsorted.dm | 30 +++++++++++++++++-------- code/modules/computer3/computers/law.dm | 4 ++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 930e8244eb6..6b546345398 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -297,6 +297,18 @@ Turf and target are seperate in case you want to teleport some distance from a t . += A return . +/proc/active_ais_samezlevel(/mob/M) + . = list() + for(var/mob/living/silicon/ai/A in living_mob_list) + if(A.stat == DEAD) + continue + if(A.control_disabled == 1) + continue + if(A.z != M.z) + continue + . += A + return . + //Find an active ai with the least borgs. VERBOSE PROCNAME HUH! /proc/select_active_ai_with_fewest_borgs() var/mob/living/silicon/ai/selected @@ -308,7 +320,7 @@ Turf and target are seperate in case you want to teleport some distance from a t return selected /proc/select_active_ai(var/mob/user) - var/list/ais = active_ais() + var/list/ais = active_ais_samezlevel(user) if(ais.len) if(user) . = input(usr,"AI signals detected:", "AI selection") in ais else . = pick(ais) @@ -550,17 +562,17 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl var/turf/current = get_turf(source) var/turf/target_turf = get_turf(target) var/steps = 1 - + if(current != target_turf) - current = get_step_towards(current, target_turf) + current = get_step_towards(current, target_turf) while(current != target_turf) - if(steps > length) + if(steps > length) return 0 - if(current.opacity) + if(current.opacity) return 0 for(var/thing in current) var/atom/A = thing - if(A.opacity) + if(A.opacity) return 0 current = get_step_towards(current, target_turf) steps++ @@ -1863,7 +1875,7 @@ var/global/list/g_fancy_list_of_types = null pois[name] = A return pois - + /proc/flash_color(mob_or_client, flash_color="#960000", flash_time=20) var/client/C if(istype(mob_or_client, /mob)) @@ -1881,7 +1893,7 @@ var/global/list/g_fancy_list_of_types = null C.color = flash_color spawn(0) animate(C, color = initial(C.color), time = flash_time) - + #define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255))) /proc/make_bit_triplet() @@ -1891,4 +1903,4 @@ var/global/list/g_fancy_list_of_types = null var/num = pick(num_sample) num_sample -= num result += (1 << num) - return result + return result diff --git a/code/modules/computer3/computers/law.dm b/code/modules/computer3/computers/law.dm index dd88322a8ab..534efe3a9eb 100644 --- a/code/modules/computer3/computers/law.dm +++ b/code/modules/computer3/computers/law.dm @@ -24,7 +24,7 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) - if(!is_station_level(user.z)) + if(is_away_level(user.z)) to_chat(user, "Unable to establish a connection: You're too far away from the station!") return if(istype(module, /obj/item/weapon/aiModule)) @@ -60,7 +60,7 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) if(istype(module, /obj/item/weapon/aiModule)) - if(!is_station_level(user.z)) + if(is_away_level(user.z)) to_chat(user, "Unable to establish a connection: You're too far away from the station!") return module.install(src) From 8ca28e434976aee0d59a90bfe68b3549a11766b0 Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 23 Feb 2017 01:15:53 -0800 Subject: [PATCH 4/6] Fox requests --- code/__HELPERS/unsorted.dm | 14 +------------- code/game/machinery/computer/law.dm | 11 ++++++++--- code/modules/computer3/computers/law.dm | 12 +++++++----- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 6b546345398..e1abd1fb8d1 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -297,18 +297,6 @@ Turf and target are seperate in case you want to teleport some distance from a t . += A return . -/proc/active_ais_samezlevel(/mob/M) - . = list() - for(var/mob/living/silicon/ai/A in living_mob_list) - if(A.stat == DEAD) - continue - if(A.control_disabled == 1) - continue - if(A.z != M.z) - continue - . += A - return . - //Find an active ai with the least borgs. VERBOSE PROCNAME HUH! /proc/select_active_ai_with_fewest_borgs() var/mob/living/silicon/ai/selected @@ -320,7 +308,7 @@ Turf and target are seperate in case you want to teleport some distance from a t return selected /proc/select_active_ai(var/mob/user) - var/list/ais = active_ais_samezlevel(user) + var/list/ais = active_ais(user) if(ais.len) if(user) . = input(usr,"AI signals detected:", "AI selection") in ais else . = pick(ais) diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index 125a5fc06ad..c592ea401de 100644 --- a/code/game/machinery/computer/law.dm +++ b/code/game/machinery/computer/law.dm @@ -29,10 +29,11 @@ attackby(obj/item/weapon/O as obj, mob/user as mob, params) - if(is_away_level(user.z)) - to_chat(user, "Unable to establish a connection: You're too far away from the station!") - return if(istype(O, /obj/item/weapon/aiModule)) + var/turf/T = get_turf(current) + if(T.z != z) + to_chat(user, "Unable to establish a connection: You're too far away from the target silicon!") + return var/datum/game_mode/nations/mode = get_nations_mode() if(!mode) var/obj/item/weapon/aiModule/M = O @@ -74,6 +75,10 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) if(istype(module, /obj/item/weapon/aiModule)) + var/turf/T = get_turf(current) + if(T.z != z) + to_chat(user, "Unable to establish a connection: You're too far away from the target silicon!") + return var/datum/game_mode/nations/mode = get_nations_mode() if(!mode) module.install(src) diff --git a/code/modules/computer3/computers/law.dm b/code/modules/computer3/computers/law.dm index 534efe3a9eb..f76158d86e5 100644 --- a/code/modules/computer3/computers/law.dm +++ b/code/modules/computer3/computers/law.dm @@ -24,10 +24,11 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) - if(is_away_level(user.z)) - to_chat(user, "Unable to establish a connection: You're too far away from the station!") - return if(istype(module, /obj/item/weapon/aiModule)) + var/turf/T = get_turf(current) + if(T.z != z) + to_chat(user, "Unable to establish a connection: You're too far away from the target silicon!") + return module.install(src) else return ..() @@ -60,8 +61,9 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) if(istype(module, /obj/item/weapon/aiModule)) - if(is_away_level(user.z)) - to_chat(user, "Unable to establish a connection: You're too far away from the station!") + var/turf/T = get_turf(current) + if(T.z != z) + to_chat(user, "Unable to establish a connection: You're too far away from the target silicon!") return module.install(src) else From 9abb78ae8841d6c235a1f38f515aafd78e994fa0 Mon Sep 17 00:00:00 2001 From: Kyep Date: Thu, 23 Feb 2017 01:54:08 -0800 Subject: [PATCH 5/6] Revert unsorted --- code/__HELPERS/unsorted.dm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index e1abd1fb8d1..930e8244eb6 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -308,7 +308,7 @@ Turf and target are seperate in case you want to teleport some distance from a t return selected /proc/select_active_ai(var/mob/user) - var/list/ais = active_ais(user) + var/list/ais = active_ais() if(ais.len) if(user) . = input(usr,"AI signals detected:", "AI selection") in ais else . = pick(ais) @@ -550,17 +550,17 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl var/turf/current = get_turf(source) var/turf/target_turf = get_turf(target) var/steps = 1 - + if(current != target_turf) - current = get_step_towards(current, target_turf) + current = get_step_towards(current, target_turf) while(current != target_turf) - if(steps > length) + if(steps > length) return 0 - if(current.opacity) + if(current.opacity) return 0 for(var/thing in current) var/atom/A = thing - if(A.opacity) + if(A.opacity) return 0 current = get_step_towards(current, target_turf) steps++ @@ -1863,7 +1863,7 @@ var/global/list/g_fancy_list_of_types = null pois[name] = A return pois - + /proc/flash_color(mob_or_client, flash_color="#960000", flash_time=20) var/client/C if(istype(mob_or_client, /mob)) @@ -1881,7 +1881,7 @@ var/global/list/g_fancy_list_of_types = null C.color = flash_color spawn(0) animate(C, color = initial(C.color), time = flash_time) - + #define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255))) /proc/make_bit_triplet() @@ -1891,4 +1891,4 @@ var/global/list/g_fancy_list_of_types = null var/num = pick(num_sample) num_sample -= num result += (1 << num) - return result + return result From c4e7d346bd30858c1ccae251166d5589ba1fb43e Mon Sep 17 00:00:00 2001 From: Kyep Date: Sun, 26 Feb 2017 04:59:04 -0800 Subject: [PATCH 6/6] Crazy request --- code/game/machinery/computer/law.dm | 4 ++-- code/modules/computer3/computers/law.dm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/game/machinery/computer/law.dm b/code/game/machinery/computer/law.dm index c592ea401de..6541c897447 100644 --- a/code/game/machinery/computer/law.dm +++ b/code/game/machinery/computer/law.dm @@ -31,7 +31,7 @@ attackby(obj/item/weapon/O as obj, mob/user as mob, params) if(istype(O, /obj/item/weapon/aiModule)) var/turf/T = get_turf(current) - if(T.z != z) + if(!atoms_share_level(T, src)) to_chat(user, "Unable to establish a connection: You're too far away from the target silicon!") return var/datum/game_mode/nations/mode = get_nations_mode() @@ -76,7 +76,7 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) if(istype(module, /obj/item/weapon/aiModule)) var/turf/T = get_turf(current) - if(T.z != z) + if(!atoms_share_level(T, src)) to_chat(user, "Unable to establish a connection: You're too far away from the target silicon!") return var/datum/game_mode/nations/mode = get_nations_mode() diff --git a/code/modules/computer3/computers/law.dm b/code/modules/computer3/computers/law.dm index f76158d86e5..e36aca935ec 100644 --- a/code/modules/computer3/computers/law.dm +++ b/code/modules/computer3/computers/law.dm @@ -26,7 +26,7 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) if(istype(module, /obj/item/weapon/aiModule)) var/turf/T = get_turf(current) - if(T.z != z) + if(!atoms_share_level(T, src)) to_chat(user, "Unable to establish a connection: You're too far away from the target silicon!") return module.install(src) @@ -62,7 +62,7 @@ attackby(obj/item/weapon/aiModule/module as obj, mob/user as mob, params) if(istype(module, /obj/item/weapon/aiModule)) var/turf/T = get_turf(current) - if(T.z != z) + if(!atoms_share_level(T, src)) to_chat(user, "Unable to establish a connection: You're too far away from the target silicon!") return module.install(src)