[s] Fix observers being able to manipulate their target's screens (#38097)

* Fix observers being able to move the action button toggle button

* Fix observers using the target's ambient occlusion preference
This commit is contained in:
Tad Hardesty
2018-05-27 22:30:49 -07:00
committed by Emmett Gaines
parent e3abe61609
commit 6465c98c41
3 changed files with 46 additions and 8 deletions

View File

@@ -11,7 +11,24 @@
var/id
var/ordered = TRUE //If the button gets placed into the default bar
/obj/screen/movable/action_button/proc/can_use(mob/user)
if (linked_action)
return linked_action.owner == user
else if (isobserver(user))
var/mob/dead/observer/O = user
return !O.observetarget
else
return TRUE
/obj/screen/movable/action_button/MouseDrop()
if (!can_use(usr))
return
return ..()
/obj/screen/movable/action_button/Click(location,control,params)
if (!can_use(usr))
return
var/list/modifiers = params2list(params)
if(modifiers["shift"])
if(locked)
@@ -44,6 +61,9 @@
var/show_state = "show"
/obj/screen/movable/action_button/hide_toggle/Click(location,control,params)
if (!can_use(usr))
return
var/list/modifiers = params2list(params)
if(modifiers["shift"])
if(locked)

View File

@@ -73,6 +73,12 @@
static_inventory += using
/datum/hud/ghost/show_hud(version = 0, mob/viewmob)
// don't show this HUD if observing; show the HUD of the observee
var/mob/dead/observer/O = mymob
if (istype(O) && O.observetarget)
plane_masters_update()
return FALSE
. = ..()
if(!.)
return

View File

@@ -131,7 +131,7 @@
update_sight()
//Version denotes which style should be displayed. blank or 0 means "next version"
/datum/hud/proc/show_hud(version = 0,mob/viewmob)
/datum/hud/proc/show_hud(version = 0, mob/viewmob)
if(!ismob(mymob))
return FALSE
var/mob/screenmob = viewmob || mymob
@@ -195,19 +195,30 @@
if(infodisplay.len)
screenmob.client.screen -= infodisplay
for(var/thing in plane_masters)
var/obj/screen/plane_master/PM = plane_masters[thing]
PM.backdrop(screenmob)
screenmob.client.screen += PM
hud_version = display_hud_version
persistent_inventory_update(screenmob)
screenmob.update_action_buttons(1)
reorganize_alerts()
screenmob.reload_fullscreen()
update_parallax_pref(screenmob)
// ensure observers get an accurate and up-to-date view
if (!viewmob)
plane_masters_update()
for(var/M in mymob.observers)
show_hud(hud_version, M)
else if (viewmob.hud_used)
viewmob.hud_used.plane_masters_update()
return TRUE
/datum/hud/proc/plane_masters_update()
// Plane masters are always shown to OUR mob, never to observers
for(var/thing in plane_masters)
var/obj/screen/plane_master/PM = plane_masters[thing]
PM.backdrop(mymob)
mymob.client.screen += PM
/datum/hud/human/show_hud(version = 0,mob/viewmob)
. = ..()
if(!.)
@@ -268,8 +279,9 @@
i++
for(var/obj/screen/human/equip/E in static_inventory)
E.screen_loc = ui_equip_position(mymob)
if(mymob.hud_used)
show_hud(HUD_STYLE_STANDARD,mymob)
if(ismob(mymob) && mymob.hud_used == src)
show_hud(hud_version)
/datum/hud/proc/update_locked_slots()
return