No more posibrain / PAI spam

This is nicked from paradise. Changes the recruitment pop-ups to
discrete chat messages.
This commit is contained in:
jack-fractal
2015-08-15 11:43:23 -04:00
parent 4d6f5afa0a
commit d7d3ced394
3 changed files with 94 additions and 47 deletions
@@ -76,6 +76,27 @@
if(target)
ManualFollow(target)
if (href_list["follow"])
var/atom/target = locate(href_list["follow"])
if(target)
ManualFollow(target)
if (href_list["jump"])
var/mob/target = locate(href_list["jump"])
var/mob/A = usr;
A << "Teleporting to [target]..."
if(target && target != usr)
spawn(0)
var/turf/pos = get_turf(A)
var/turf/T=get_turf(target)
if(T != pos)
if(!T)
return
if(!client)
return
loc = T
following = null
..()
/mob/dead/attackby(obj/item/W, mob/user)
@@ -11,6 +11,7 @@
construction_time = 75
var/searching = 0
var/askDelay = 10 * 60 * 1
var/list/ghost_volunteers[0]
req_access = list(access_robotics)
locked = 0
mecha = null//This does not appear to be used outside of reference in mecha.dm.
@@ -23,31 +24,34 @@
//Start the process of searching for a new user.
user << "\blue You carefully locate the manual activation switch and start the positronic brain's boot process."
icon_state = "posibrain-searching"
ghost_volunteers.Cut()
src.searching = 1
src.request_player()
spawn(600) reset_search()
spawn(600)
if(ghost_volunteers.len)
var/mob/dead/observer/O = pick(ghost_volunteers)
if(istype(O) && O.client && O.key)
transfer_personality(O)
reset_search()
/obj/item/device/mmi/posibrain/proc/request_player()
for(var/mob/dead/observer/O in player_list)
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
continue
if(jobban_isbanned(O, "pAI"))
continue
if(O.client)
if(O.client.prefs.be_special & BE_PAI)
question(O.client)
/obj/item/device/mmi/posibrain/proc/question(var/client/C)
spawn(0)
if(!C) return
var/response = alert(C, "Someone is requesting a personality for a positronic brain. Would you like to play as one?", "Positronic brain request", "Yes", "No", "Never for this round")
if(!C || brainmob.key || 0 == searching) return //handle logouts that happen whilst the alert is waiting for a response, and responses issued after a brain has been located.
if(response == "Yes")
transfer_personality(C.mob)
else if (response == "Never for this round")
C.prefs.be_special ^= BE_PAI
if(O.client && O.client.prefs.be_special & BE_PAI && !jobban_isbanned(O, "Cyborg") && !jobban_isbanned(O,"nonhumandept"))
if(check_observer(O))
O << "\blue <b>\A [src] has been activated. (<a href='?src=\ref[O];jump=\ref[src]'>Teleport</a> | <a href='?src=\ref[src];signup=\ref[O]'>Sign Up</a>)"
/obj/item/device/mmi/posibrain/proc/check_observer(var/mob/dead/observer/O)
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
return 0
if(jobban_isbanned(O, "Cyborg") || jobban_isbanned(O,"nonhumandept"))
return 0
if(O.client)
return 1
return 0
/obj/item/device/mmi/posibrain/transfer_identity(var/mob/living/carbon/H)
/*
Positronic brains should have posibrain-like name, instead of human-MMIlike names. -- ATL
@@ -83,7 +87,39 @@
for (var/mob/M in viewers(T))
M.show_message("\blue The positronic brain chimes quietly.")
icon_state = "posibrain-occupied"
/obj/item/device/mmi/posibrain/Topic(href,href_list)
if("signup" in href_list)
var/mob/dead/observer/O = locate(href_list["signup"])
if(!O) return
volunteer(O)
/obj/item/device/mmi/posibrain/proc/volunteer(var/mob/dead/observer/O)
if(!searching)
O << "Not looking for a ghost, yet."
return
if(!istype(O))
O << "\red Error."
return
if(O in ghost_volunteers)
O << "\blue Removed from registration list."
ghost_volunteers.Remove(O)
return
if(!check_observer(O))
O << "\red You cannot be \a [src]."
return
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
O << "\red Upon using the antagHUD you forfeited the ability to join the round."
return
if(jobban_isbanned(O, "Cyborg") || jobban_isbanned(O,"nonhumandept"))
O << "\red You are job banned from this role."
return
O.<< "\blue You've been added to the list of ghosts that may become this [src]. Click again to unvolunteer."
ghost_volunteers.Add(O)
/obj/item/device/mmi/posibrain/proc/reset_search() //We give the players sixty seconds to decide, then reset the timer.
if(src.brainmob && src.brainmob.key) return
+19 -29
View File
@@ -26,6 +26,13 @@ var/datum/paiController/paiController // Global handler for pAI candidates
var/askDelay = 10 * 60 * 1 // One minute [ms * sec * min]
/datum/paiController/Topic(href, href_list[])
if("signup" in href_list)
var/mob/dead/observer/O = locate(href_list["signup"])
if(!O) return
if(!check_recruit(O)) return
recruitWindow(O)
return
if(href_list["download"])
var/datum/paiCandidate/candidate = locate(href_list["candidate"])
var/obj/item/device/paicard/card = locate(href_list["device"])
@@ -346,33 +353,16 @@ var/datum/paiController/paiController // Global handler for pAI candidates
/datum/paiController/proc/requestRecruits(var/mob/user)
inquirer = user
for(var/mob/dead/observer/O in player_list)
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
continue
if(jobban_isbanned(O, "pAI"))
continue
if(asked.Find(O.key))
if(world.time < asked[O.key] + askDelay)
continue
else
asked.Remove(O.key)
if(O.client)
if(O.client.prefs.be_special & BE_PAI)
question(O.client)
/datum/paiController/proc/question(var/client/C)
spawn(0)
if(!C) return
asked.Add(C.key)
asked[C.key] = world.time
var/response = alert(C, "[inquirer] is requesting a pAI personality. Would you like to play as a personal AI?", "pAI Request", "Yes", "No", "Never for this round")
if(!C) return //handle logouts that happen whilst the alert is waiting for a response.
if(response == "Yes")
recruitWindow(C.mob)
else if (response == "Never for this round")
var/warning = alert(C, "Are you sure? This action will be undoable and you will need to wait until next round.", "You sure?", "Yes", "No")
if(warning == "Yes")
asked[C.key] = INFINITY
else
question(C)
if(O.client && O.client.prefs.be_special & BE_PAI)
if(check_recruit(O))
O << "\blue <b>A pAI card is looking for personalities. (<a href='?src=\ref[src];signup=\ref[O]'>Sign Up</a>)</b>"
/datum/paiController/proc/check_recruit(var/mob/dead/observer/O)
if(jobban_isbanned(O, "pAI") || jobban_isbanned(O,"nonhumandept"))
return
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
return
if(O.client)
return TRUE