Merge pull request #694 from jack-fractal/recruitment_enhancement

No more posibrain / PAI spam
This commit is contained in:
SoundScopes
2015-08-25 17:11:59 +01:00
3 changed files with 111 additions and 51 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,36 @@
//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(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/test)
if (!test) // no person ?
return
if (!test.client) // is someone actually home?
return
if (!test.client.prefs.be_special & BE_PAI) // do they want to be a pAI?
return
if(test.has_enabled_antagHUD == 1 && config.antag_hud_restricted) // have they activated the antagHUD?
return
if ((jobban_isbanned(test, "Cyborg") || jobban_isbanned(test,"nonhumandept")) && !is_alien_whitelisted(test,"Machine")) // if you can't play as either role that uses posibrains, then you can't get into a posibrain
return
return TRUE
/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
@@ -67,8 +73,20 @@
icon_state = "posibrain-occupied"
return
/obj/item/device/mmi/posibrain/proc/get_possible_uses_string(var/mob/test)
if (!(jobban_isbanned(test, "Cyborg") || jobban_isbanned(test,"nonhumandept")))
if (is_alien_whitelisted(test,"Machine"))
return "This posibrain's personality is compatible with assignment to either a tool-robot or a shell."
else
return "This posibrain's personality is compatible only with tool-robots."
else
if (is_alien_whitelisted(test,"Machine"))
return "This posibrain's personality is compatible only with shells."
else
return "This posibrain's personality is not compatible with any chassis. Something has gone wrong. Please call a bluespace technician to correct the issue."
/obj/item/device/mmi/posibrain/proc/transfer_personality(var/mob/candidate)
var/uses = get_possible_uses_string(candidate)
src.searching = 0
src.brainmob.mind = candidate.mind
src.brainmob.ckey = candidate.ckey
@@ -78,12 +96,43 @@
src.brainmob << "<b>Remember, the purpose of your existence is to serve the crew and the station. Above all else, do no harm.</b>"
src.brainmob << "<b>Use say :b to speak to other artificial intelligences.</b>"
src.brainmob.mind.assigned_role = "Positronic Brain"
var/turf/T = get_turf_or_move(src.loc)
for (var/mob/M in viewers(T))
M.show_message("\blue The positronic brain chimes quietly.")
M.show_message("\blue The positronic brain chimes quietly as it loads a new personality. [uses]")
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