Cleans up posibrain code (#29008)

* Cleans up posibrain code

* Tweaks at maintainer request

* I'm soorryyyyy!

* then uninformed they shall be!
This commit is contained in:
Ashe Higgs
2017-07-06 10:43:05 -04:00
committed by Jordan Brown
parent ec0f0ca7c7
commit 5f79b40bcd
2 changed files with 11 additions and 4 deletions

View File

@@ -25,6 +25,7 @@ GLOBAL_VAR(posibrain_notify_cooldown)
Remember, the purpose of your existence is to serve the crew and the station. Above all else, do no harm.</b>"
var/new_mob_message = "<span class='notice'>The positronic brain chimes quietly.</span>"
var/dead_message = "<span class='deadsay'>It appears to be completely inactive. The reset light is blinking.</span>"
var/recharge_message = "<span class='warning'>The positronic brain isn't ready to activate again yet! Give it some time to recharge.</span>"
var/list/possible_names //If you leave this blank, it will use the global posibrain names
var/picked_name
@@ -41,15 +42,20 @@ GLOBAL_VAR(posibrain_notify_cooldown)
GLOB.posibrain_notify_cooldown = world.time + askDelay
/obj/item/device/mmi/posibrain/attack_self(mob/user)
if(!brainmob || brainmob.key)
if(!brainmob)
brainmob = new(src)
if(is_occupied())
to_chat(user, "<span class='warning'>This [name] is already active!</span>")
return
if(next_ask > world.time)
to_chat(user, recharge_message)
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
update_icon()
addtimer(CALLBACK(src, .proc/check_success), askDelay)
/obj/item/device/mmi/posibrain/proc/check_success()
@@ -80,7 +86,7 @@ GLOBAL_VAR(posibrain_notify_cooldown)
return
if(is_occupied() || 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
@@ -109,7 +115,7 @@ GLOBAL_VAR(posibrain_notify_cooldown)
if(QDELETED(brainmob))
return
if(is_occupied()) //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!")
to_chat(candidate, "<span class='warning'>This [name] was taken over before you could get to it! Perhaps it might be available later?</span>")
return FALSE
if(candidate.mind && !isobserver(candidate))
candidate.mind.transfer_to(brainmob)
@@ -123,7 +129,7 @@ GLOBAL_VAR(posibrain_notify_cooldown)
GLOB.living_mob_list += brainmob
visible_message(new_mob_message)
update_icon()
check_success()
return TRUE