Merge pull request #6128 from Crazylemon64/pai_resting_fix

Fixes a few pAI bugs
This commit is contained in:
Fox McCloud
2017-01-10 03:01:49 -05:00
committed by GitHub
6 changed files with 43 additions and 15 deletions
+22 -6
View File
@@ -395,9 +395,22 @@ proc/get_radio_key_from_channel(var/channel)
return
var/atom/whisper_loc = get_whisper_loc()
var/list/listening = hearers(message_range, whisper_loc)
var/list/listening = hear(message_range, whisper_loc)
listening |= src
var/list/hearturfs = list()
//Pass whispers on to anything inside the immediate listeners.
// This comes before the ghosts do so that ghosts don't act as whisper relays
for(var/atom/L in listening)
if(ismob(L))
for(var/mob/C in L.contents)
if(isliving(C))
listening += C
hearturfs += get_turf(L)
if(isobj(L))
hearturfs += get_turf(L)
//ghosts
for(var/mob/M in dead_mob_list) //does this include players who joined as observers as well?
if(!M.client)
@@ -405,11 +418,14 @@ proc/get_radio_key_from_channel(var/channel)
if(M.stat == DEAD && M.client && M.get_preference(CHAT_GHOSTEARS))
listening |= M
//Pass whispers on to anything inside the immediate listeners.
for(var/mob/L in listening)
for(var/mob/C in L.contents)
if(isliving(C))
listening += C
// This, in tandem with "hearturfs", lets nested mobs hear whispers that are in range
// Grifted from saycode above.
for(var/mob/M in player_list)
if(!M.client || isnewplayer(M))
continue //skip monkeys and leavers
if(get_turf(M) in hearturfs)
listening |= M
//pass on the message to objects that can hear us.
for(var/obj/O in view(message_range, whisper_loc))
@@ -24,6 +24,5 @@
//Read as: I have no idea what I'm doing but asking for help got me nowhere so this is what you get. - Nodrak
if(mind) qdel(mind)
living_mob_list -= src
ghostize()
if(icon_state != "[chassis]_dead" || cleanWipe)
qdel(src)
+8 -3
View File
@@ -114,6 +114,11 @@
C.toff = 1
..()
/mob/living/silicon/pai/update_icons()
if(stat == DEAD)
icon_state = "[chassis]_dead"
else
icon_state = resting ? "[chassis]_rest" : "[chassis]"
// this function shows the information about being silenced as a pAI in the Status panel
/mob/living/silicon/pai/proc/show_silenced()
@@ -420,17 +425,17 @@
set category = "IC"
// Pass lying down or getting up to our pet human, if we're in a rig.
if(istype(src.loc,/obj/item/device/paicard))
if(stat == CONSCIOUS && istype(src.loc,/obj/item/device/paicard))
resting = 0
var/obj/item/weapon/rig/rig = src.get_rig()
if(istype(rig))
rig.force_rest(src)
else
resting = !resting
icon_state = resting ? "[chassis]_rest" : "[chassis]"
to_chat(src, "<span class='notice'>You are now [resting ? "resting" : "getting up"]</span>")
canmove = !resting
update_icons()
update_canmove()
//Overriding this will stop a number of headaches down the track.
/mob/living/silicon/pai/attackby(obj/item/weapon/W as obj, mob/user as mob, params)
@@ -28,6 +28,9 @@ var/datum/paiController/paiController // Global handler for pAI candidates
if("signup" in href_list)
var/mob/dead/observer/O = locate(href_list["signup"])
if(!O) return
if(!(O in respawnable_list))
to_chat(O, "You've given up your ability to respawn!")
return
if(!check_recruit(O)) return
recruitWindow(O)
return
@@ -361,6 +364,8 @@ var/datum/paiController/paiController // Global handler for pAI candidates
return 0
if(O.has_enabled_antagHUD == 1 && config.antag_hud_restricted)
return 0
if(!(O in respawnable_list))
return 0
if(O.client)
return 1
return 0
+7 -4
View File
@@ -6,8 +6,11 @@
/mob/living/silicon/pai/get_whisper_loc()
if(loc == card) // currently in its card?
if(istype(card.loc, /mob/living))
return card.loc // allow a pai being held or in pocket to whisper
var/atom/movable/whisper_loc = card
if(istype(card.loc, /obj/item/device/pda)) // Step up 1 level if in a PDA
whisper_loc = card.loc
if(istype(whisper_loc.loc, /mob/living))
return whisper_loc.loc // allow a pai being held or in pocket to whisper
else
return card // allow a pai in its card to whisper
return ..()
return whisper_loc // allow a pai in its card to whisper
return ..()
+1 -1
View File
@@ -15,7 +15,7 @@
return STATUS_UPDATE // Ghosts can view updates
/mob/living/silicon/pai/default_can_use_topic(var/src_object)
if(src_object == src && !stat)
if((src_object == src || src_object == radio) && stat == CONSCIOUS)
return STATUS_INTERACTIVE
else
return ..()