mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
Fixes observe issues with parallax (#25561)
This fixes #25479 plus a runtime that happens when you observe a mob whose player has ghosted that results in a comically incorrect HUD for the observer. HUDs are a fucking mess still to the surprise of nobody
This commit is contained in:
@@ -141,10 +141,9 @@
|
||||
/datum/hud/proc/show_hud(version = 0,mob/viewmob)
|
||||
if(!ismob(mymob))
|
||||
return 0
|
||||
if(!mymob.client)
|
||||
return 0
|
||||
|
||||
var/mob/screenmob = viewmob || mymob
|
||||
if(!screenmob.client)
|
||||
return 0
|
||||
|
||||
screenmob.client.screen = list()
|
||||
|
||||
@@ -166,7 +165,7 @@
|
||||
if(infodisplay.len)
|
||||
screenmob.client.screen += infodisplay
|
||||
|
||||
mymob.client.screen += hide_actions_toggle
|
||||
screenmob.client.screen += hide_actions_toggle
|
||||
|
||||
if(action_intent)
|
||||
action_intent.screen_loc = initial(action_intent.screen_loc) //Restore intent selection to the original position
|
||||
@@ -210,7 +209,7 @@
|
||||
mymob.update_action_buttons(1)
|
||||
reorganize_alerts()
|
||||
mymob.reload_fullscreen()
|
||||
create_parallax()
|
||||
update_parallax_pref(screenmob)
|
||||
|
||||
|
||||
/datum/hud/human/show_hud(version = 0,mob/viewmob)
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
var/parallax_layers_max = 3
|
||||
var/parallax_animate_timer
|
||||
|
||||
/datum/hud/proc/create_parallax()
|
||||
var/client/C = mymob.client
|
||||
if (!apply_parallax_pref())
|
||||
/datum/hud/proc/create_parallax(mob/viewmob)
|
||||
var/mob/screenmob = viewmob || mymob
|
||||
var/client/C = screenmob.client
|
||||
if (!apply_parallax_pref(viewmob)) //don't want shit computers to crash when specing someone with insane parallax, so use the viewer's pref
|
||||
return
|
||||
|
||||
if(!length(C.parallax_layers_cached))
|
||||
@@ -27,7 +28,10 @@
|
||||
C.parallax_layers.len = C.parallax_layers_max
|
||||
|
||||
C.screen |= (C.parallax_layers)
|
||||
var/obj/screen/plane_master/PM = plane_masters["[PLANE_SPACE]"]
|
||||
var/obj/screen/plane_master/PM = screenmob.hud_used.plane_masters["[PLANE_SPACE]"]
|
||||
if(screenmob != mymob)
|
||||
C.screen -= locate(/obj/screen/plane_master/parallax_white) in C.screen
|
||||
C.screen += PM
|
||||
PM.color = list(
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
@@ -37,15 +41,20 @@
|
||||
)
|
||||
|
||||
|
||||
/datum/hud/proc/remove_parallax()
|
||||
var/client/C = mymob.client
|
||||
/datum/hud/proc/remove_parallax(mob/viewmob)
|
||||
var/mob/screenmob = viewmob || mymob
|
||||
var/client/C = screenmob.client
|
||||
C.screen -= (C.parallax_layers_cached)
|
||||
var/obj/screen/plane_master/PM = plane_masters["[PLANE_SPACE]"]
|
||||
var/obj/screen/plane_master/PM = screenmob.hud_used.plane_masters["[PLANE_SPACE]"]
|
||||
if(screenmob != mymob)
|
||||
C.screen -= locate(/obj/screen/plane_master/parallax_white) in C.screen
|
||||
C.screen += PM
|
||||
PM.color = initial(PM.color)
|
||||
C.parallax_layers = null
|
||||
|
||||
/datum/hud/proc/apply_parallax_pref()
|
||||
var/client/C = mymob.client
|
||||
/datum/hud/proc/apply_parallax_pref(mob/viewmob)
|
||||
var/mob/screenmob = viewmob || mymob
|
||||
var/client/C = screenmob.client
|
||||
if(C.prefs)
|
||||
var/pref = C.prefs.parallax
|
||||
if (isnull(pref))
|
||||
@@ -75,9 +84,9 @@
|
||||
C.parallax_layers_max = 3
|
||||
return TRUE
|
||||
|
||||
/datum/hud/proc/update_parallax_pref()
|
||||
remove_parallax()
|
||||
create_parallax()
|
||||
/datum/hud/proc/update_parallax_pref(mob/viewmob)
|
||||
remove_parallax(viewmob)
|
||||
create_parallax(viewmob)
|
||||
|
||||
// This sets which way the current shuttle is moving (returns true if the shuttle has stopped moving so the caller can append their animation)
|
||||
/datum/hud/proc/set_parallax_movedir(new_parallax_movedir, skip_windups)
|
||||
|
||||
@@ -1210,12 +1210,12 @@ var/list/preferences_datums = list()
|
||||
if("parallaxup")
|
||||
parallax = Wrap(parallax + 1, PARALLAX_INSANE, PARALLAX_DISABLE + 1)
|
||||
if (parent && parent.mob && parent.mob.hud_used)
|
||||
parent.mob.hud_used.update_parallax_pref()
|
||||
parent.mob.hud_used.update_parallax_pref(parent.mob)
|
||||
|
||||
if("parallaxdown")
|
||||
parallax = Wrap(parallax - 1, PARALLAX_INSANE, PARALLAX_DISABLE + 1)
|
||||
if (parent && parent.mob && parent.mob.hud_used)
|
||||
parent.mob.hud_used.update_parallax_pref()
|
||||
parent.mob.hud_used.update_parallax_pref(parent.mob)
|
||||
|
||||
if("save")
|
||||
save_preferences()
|
||||
|
||||
@@ -805,7 +805,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
if(mob_eye.hud_used)
|
||||
LAZYINITLIST(mob_eye.observers)
|
||||
mob_eye.observers |= src
|
||||
mob_eye.hud_used.show_hud(1,src)
|
||||
mob_eye.hud_used.show_hud(mob_eye.hud_used.hud_version, src)
|
||||
observetarget = mob_eye
|
||||
|
||||
/mob/dead/observer/verb/register_pai_candidate()
|
||||
|
||||
Reference in New Issue
Block a user