From 91cc83e445e349139f55ddd4b55e4cfa2682b744 Mon Sep 17 00:00:00 2001 From: Lzimann Date: Sun, 2 Apr 2017 19:54:09 -0300 Subject: [PATCH 1/4] Cleans up posibrain code a bit --- .../clock_cult/clock_items/soul_vessel.dm | 18 ++-- code/modules/mob/living/brain/posibrain.dm | 83 +++++++++---------- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm b/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm index 505f068d368..28ee5008fcc 100644 --- a/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm +++ b/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm @@ -18,16 +18,16 @@ The purpose of your existence is to further the goals of the servants and Ratvar himself. Above all else, serve Ratvar." new_mob_message = "The soul vessel emits a jet of steam before its cogwheel smooths out." dead_message = "Its cogwheel, scratched and dented, lies motionless." - fluff_names = list("Judge", "Guard", "Servant", "Smith", "Auger") + possible_names = list("Judge", "Guard", "Servant", "Smith", "Auger") autoping = FALSE resistance_flags = FIRE_PROOF | ACID_PROOF force_replace_ai_name = TRUE -/obj/item/device/mmi/posibrain/soul_vessel/New() +/obj/item/device/mmi/posibrain/soul_vessel/Initialize() ..() - radio.on = 0 + radio.on = FALSE laws = new /datum/ai_laws/ratvar() - braintype = picked_fluff_name + braintype = picked_name all_clockwork_objects += src /obj/item/device/mmi/posibrain/soul_vessel/Destroy() @@ -48,14 +48,16 @@ /obj/item/device/mmi/posibrain/soul_vessel/attack_self(mob/living/user) if(!is_servant_of_ratvar(user)) to_chat(user, "You fiddle around with [src], to no avail.") - return 0 + return FALSE ..() /obj/item/device/mmi/posibrain/soul_vessel/attack(mob/living/target, mob/living/carbon/human/user) if(!is_servant_of_ratvar(user) || !ishuman(target)) ..() return - if(used || (brainmob && brainmob.key)) + if(QDELETED(brainmob)) + return + if(brainmob.key) to_chat(user, "\"This vessel is filled, friend. Provide it with a body.\"") return if(is_servant_of_ratvar(target)) @@ -94,8 +96,8 @@ if(!prev_fakedeath) H.status_flags &= ~FAKEDEATH H.apply_status_effect(STATUS_EFFECT_SIGILMARK) //let them be affected by vitality matrices - picked_fluff_name = "Slave" - braintype = picked_fluff_name + picked_name = "Slave" + braintype = picked_name brainmob.timeofhostdeath = H.timeofdeath user.visible_message("[user] presses [src] to [H]'s head, ripping through the skull and carefully extracting the brain!", \ "You extract [H]'s consciousness from [H.p_their()] body, trapping it in the soul vessel.") diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 6708f7c11e0..3438522510f 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -1,4 +1,4 @@ -var/global/posibrain_notif_cooldown = 0 +var/global/global_posibrain_notify_cooldown = 0 /obj/item/device/mmi/posibrain name = "positronic brain" @@ -7,9 +7,9 @@ var/global/posibrain_notif_cooldown = 0 icon_state = "posibrain" w_class = WEIGHT_CLASS_NORMAL origin_tech = "biotech=3;programming=3;plasmatech=2" - var/notified = 0 + var/next_ask var/askDelay = 600 //one minute - var/used = 0 //Prevents split personality virus. May be reset if personality deletion code is added. + var/searching = FALSE brainmob = null req_access = list(access_robotics) mecha = null//This does not appear to be used outside of reference in mecha.dm. @@ -25,9 +25,8 @@ var/global/posibrain_notif_cooldown = 0 Remember, the purpose of your existence is to serve the crew and the station. Above all else, do no harm." var/new_mob_message = "The positronic brain chimes quietly." var/dead_message = "It appears to be completely inactive. The reset light is blinking." - var/list/fluff_names - var/picked_fluff_name //which fluff name we picked - + var/list/possible_names = list() //If you leave this blank, it will use the global posibrain names + var/picked_name /obj/item/device/mmi/posibrain/Topic(href, href_list) if(href_list["activate"]) @@ -36,42 +35,42 @@ var/global/posibrain_notif_cooldown = 0 activate(ghost) /obj/item/device/mmi/posibrain/proc/ping_ghosts(msg, newlymade) - if(newlymade || !posibrain_notif_cooldown) + if(newlymade || global_posibrain_notify_cooldown <= world.time) notify_ghosts("[name] [msg] in [get_area(src)]!", ghost_sound = !newlymade ? 'sound/effects/ghost2.ogg':null, enter_link = "(Click to enter)", source = src, action = NOTIFY_ATTACK, flashwindow = FALSE) if(!newlymade) - posibrain_notif_cooldown = 1 - addtimer(CALLBACK(src, .proc/reset_posibrain_cooldown), askDelay) - -/obj/item/device/mmi/posibrain/proc/reset_posibrain_cooldown() - posibrain_notif_cooldown = 0 + global_posibrain_notify_cooldown = world.time + askDelay /obj/item/device/mmi/posibrain/attack_self(mob/user) - if(brainmob && !brainmob.key && !notified) - //Start the process of requesting a new ghost. - to_chat(user, begin_activation_message) - ping_ghosts("requested", FALSE) - notified = 1 - used = 0 - update_icon() - spawn(askDelay) //Seperate from the global cooldown. - notified = 0 - update_icon() - if(brainmob.client) - visible_message(success_message) - else - visible_message(fail_message) - - return //Code for deleting personalities recommended here. + if(!brainmob || brainmob.key) + return + if(next_ask > world.time) + return + //Start the process of requesting a new ghost. + to_chat(user, begin_activation_message) + ping_ghosts("requested", FALSE) + next_ask = world.time + askDelay + searching = TRUE + addtimer(CALLBACK(src, .proc/check_success), askDelay) +/obj/item/device/mmi/posibrain/proc/check_success() + searching = FALSE + update_icon() + if(QDELETED(brainmob)) + return + if(brainmob.client) + visible_message(success_message) + else + visible_message(fail_message) /obj/item/device/mmi/posibrain/attack_ghost(mob/user) activate(user) //Two ways to activate a positronic brain. A clickable link in the ghost notif, or simply clicking the object itself. /obj/item/device/mmi/posibrain/proc/activate(mob/user) - if(used || (brainmob && brainmob.key) || jobban_isbanned(user,"posibrain")) + if(QDELETED(brainmob)) + return + if(brainmob.key || jobban_isbanned(user,"posibrain")) return - var/posi_ask = alert("Become a [name]? (Warning, You can no longer be cloned, and all past lives will be forgotten!)","Are you positive?","Yes","No") if(posi_ask == "No" || QDELETED(src)) return @@ -97,10 +96,11 @@ var/global/posibrain_notif_cooldown = 0 update_icon() /obj/item/device/mmi/posibrain/proc/transfer_personality(mob/candidate) - if(used || (brainmob && brainmob.key)) //Prevents hostile takeover if two ghosts get the prompt or link for the same brain. + if(QDELETED(brainmob)) + return + if(brainmob.key) //Prevents hostile takeover if two ghosts get the prompt or link for the same brain. to_chat(candidate, "This brain has already been taken! Please try your possession again later!") return FALSE - notified = 0 if(candidate.mind && !isobserver(candidate)) candidate.mind.transfer_to(brainmob) else @@ -114,7 +114,6 @@ var/global/posibrain_notif_cooldown = 0 visible_message(new_mob_message) update_icon() - used = 1 return TRUE @@ -124,7 +123,7 @@ var/global/posibrain_notif_cooldown = 0 if(brainmob && brainmob.key) switch(brainmob.stat) if(CONSCIOUS) - if(!src.brainmob.client) + if(!brainmob.client) msg = "It appears to be in stand-by mode." //afk if(DEAD) msg = "It appears to be completely inactive." @@ -133,27 +132,27 @@ var/global/posibrain_notif_cooldown = 0 to_chat(user, msg) -/obj/item/device/mmi/posibrain/New() +/obj/item/device/mmi/posibrain/Initialize() + ..() brainmob = new(src) - if(!fluff_names || !fluff_names.len) - picked_fluff_name = pick(posibrain_names) + var/new_name + if(!LAZYLEN(possible_names)) + new_name = pick(posibrain_names) else - picked_fluff_name = pick(fluff_names) - brainmob.name = "[picked_fluff_name]-[rand(100, 999)]" + new_name = pick(possible_names) + brainmob.name = "[new_name]-[rand(100, 999)]" brainmob.real_name = brainmob.name brainmob.loc = src brainmob.container = src if(autoping) ping_ghosts("created", TRUE) - ..() - /obj/item/device/mmi/posibrain/attackby(obj/item/O, mob/user) return /obj/item/device/mmi/posibrain/update_icon() - if(notified) + if(searching) icon_state = "[initial(icon_state)]-searching" return if(brainmob && brainmob.key) From 4e7f8a7bcb85c54e2d42adcc0baa7f7dd4897459 Mon Sep 17 00:00:00 2001 From: Lzimann Date: Wed, 5 Apr 2017 22:39:01 -0300 Subject: [PATCH 2/4] Stupid proc --- code/controllers/subsystem/garbage.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index b69b53ee9b7..9855a9e5bd6 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -924,7 +924,7 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage SearchVar(department_radio_keys) SearchVar(crit_allowed_modes) SearchVar(ventcrawl_machinery) - SearchVar(posibrain_notif_cooldown) + SearchVar(global_posibrain_notify_cooldown) SearchVar(NO_SLIP_WHEN_WALKING) SearchVar(SLIDE) SearchVar(GALOSHES_DONT_HELP) From d94a18e989873a092da4ffc29864cb170c5f8008 Mon Sep 17 00:00:00 2001 From: Lzimann Date: Thu, 6 Apr 2017 10:41:03 -0300 Subject: [PATCH 3/4] Defaults possible_names to null --- code/modules/mob/living/brain/posibrain.dm | 2 +- tgstation.dme | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 3438522510f..055f2d80a9f 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -25,7 +25,7 @@ var/global/global_posibrain_notify_cooldown = 0 Remember, the purpose of your existence is to serve the crew and the station. Above all else, do no harm." var/new_mob_message = "The positronic brain chimes quietly." var/dead_message = "It appears to be completely inactive. The reset light is blinking." - var/list/possible_names = list() //If you leave this blank, it will use the global posibrain names + var/list/possible_names //If you leave this blank, it will use the global posibrain names var/picked_name /obj/item/device/mmi/posibrain/Topic(href, href_list) diff --git a/tgstation.dme b/tgstation.dme index 9320e6ce63a..ff883f7277f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -154,14 +154,14 @@ #include "code\controllers\subsystem\atoms.dm" #include "code\controllers\subsystem\augury.dm" #include "code\controllers\subsystem\communications.dm" -#include "code\controllers\subsystem\diseases.dm" +#include "code\controllers\subsystem\disease.dm" #include "code\controllers\subsystem\events.dm" #include "code\controllers\subsystem\fire_burning.dm" #include "code\controllers\subsystem\garbage.dm" #include "code\controllers\subsystem\icon_smooth.dm" #include "code\controllers\subsystem\inbounds.dm" #include "code\controllers\subsystem\ipintel.dm" -#include "code\controllers\subsystem\jobs.dm" +#include "code\controllers\subsystem\job.dm" #include "code\controllers\subsystem\lighting.dm" #include "code\controllers\subsystem\machines.dm" #include "code\controllers\subsystem\mapping.dm" @@ -175,8 +175,8 @@ #include "code\controllers\subsystem\ping.dm" #include "code\controllers\subsystem\radio.dm" #include "code\controllers\subsystem\religion.dm" -#include "code\controllers\subsystem\server_maintenance.dm" -#include "code\controllers\subsystem\shuttles.dm" +#include "code\controllers\subsystem\server_maint.dm" +#include "code\controllers\subsystem\shuttle.dm" #include "code\controllers\subsystem\spacedrift.dm" #include "code\controllers\subsystem\squeak.dm" #include "code\controllers\subsystem\stickyban.dm" @@ -184,14 +184,14 @@ #include "code\controllers\subsystem\tgui.dm" #include "code\controllers\subsystem\throwing.dm" #include "code\controllers\subsystem\ticker.dm" -#include "code\controllers\subsystem\time_tracking.dm" +#include "code\controllers\subsystem\time_track.dm" #include "code\controllers\subsystem\timer.dm" -#include "code\controllers\subsystem\title_screen.dm" -#include "code\controllers\subsystem\voting.dm" +#include "code\controllers\subsystem\title.dm" +#include "code\controllers\subsystem\vote.dm" #include "code\controllers\subsystem\weather.dm" #include "code\controllers\subsystem\processing\fastprocess.dm" #include "code\controllers\subsystem\processing\flightpacks.dm" -#include "code\controllers\subsystem\processing\objects.dm" +#include "code\controllers\subsystem\processing\obj.dm" #include "code\controllers\subsystem\processing\overlays.dm" #include "code\controllers\subsystem\processing\processing.dm" #include "code\datums\action.dm" @@ -205,7 +205,6 @@ #include "code\datums\dog_fashion.dm" #include "code\datums\emotes.dm" #include "code\datums\forced_movement.dm" -#include "code\datums\gas_overrides.dm" #include "code\datums\hud.dm" #include "code\datums\map_config.dm" #include "code\datums\martial.dm" @@ -1027,6 +1026,7 @@ #include "code\modules\atmospherics\environmental\LINDA_turf_tile.dm" #include "code\modules\atmospherics\gasmixtures\gas_mixture.dm" #include "code\modules\atmospherics\gasmixtures\gas_types.dm" +#include "code\modules\atmospherics\gasmixtures\reactions.dm" #include "code\modules\atmospherics\gasmixtures\space_mixture.dm" #include "code\modules\atmospherics\machinery\airalarm.dm" #include "code\modules\atmospherics\machinery\atmosmachinery.dm" @@ -1389,8 +1389,6 @@ #include "code\modules\mapping\map_template.dm" #include "code\modules\mapping\reader.dm" #include "code\modules\mapping\ruins.dm" -#include "code\modules\mapping\swapmaps.dm" -#include "code\modules\mapping\writer.dm" #include "code\modules\mining\abandoned_crates.dm" #include "code\modules\mining\aux_base.dm" #include "code\modules\mining\aux_base_camera.dm" From 05b5b848ef3103217bce9f339825e047a4d5bb1a Mon Sep 17 00:00:00 2001 From: Lzimann Date: Sat, 8 Apr 2017 19:50:17 -0300 Subject: [PATCH 4/4] Fix thing --- code/modules/mob/living/brain/posibrain.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 1862045189f..a075c80e5cb 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -1,4 +1,4 @@ -GLOBAL_VAR(global_posibrain_notify_cooldown) +GLOBAL_VAR(posibrain_notify_cooldown) /obj/item/device/mmi/posibrain name = "positronic brain"