mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] Fixes ship sensors and adds failsafes. (#10438)
Co-authored-by: Cameron Lennox <killer65311@gmail.com>
This commit is contained in:
committed by
GitHub
parent
1fc7ba386b
commit
279e1614ff
@@ -34,6 +34,8 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
|
||||
|
||||
/obj/machinery/computer/ship/proc/display_reconnect_dialog(var/mob/user, var/flavor)
|
||||
var/datum/browser/popup = new (user, "[src]", "[src]")
|
||||
if(viewing_overmap(user))
|
||||
unlook(user, TRUE)
|
||||
popup.set_content("<center>" + span_bold(span_red("Error")) + "<br>Unable to connect to [flavor].<br><a href='byond://?src=\ref[src];sync=1'>Reconnect</a></center>")
|
||||
popup.open()
|
||||
|
||||
@@ -66,11 +68,13 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
|
||||
// Management of mob view displacement. look to shift view to the ship on the overmap; unlook to shift back.
|
||||
|
||||
/obj/machinery/computer/ship/proc/look(var/mob/user)
|
||||
if(linked)
|
||||
apply_visual(user)
|
||||
user.reset_view(linked)
|
||||
if(linked.real_appearance)
|
||||
user.client?.images += linked.real_appearance
|
||||
if(!linked)
|
||||
return
|
||||
|
||||
apply_visual(user)
|
||||
user.reset_view(linked)
|
||||
if(linked.real_appearance)
|
||||
user.client?.images += linked.real_appearance
|
||||
user.set_machine(src)
|
||||
if(isliving(user))
|
||||
var/mob/living/L = user
|
||||
@@ -78,14 +82,16 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
|
||||
L.handle_vision()
|
||||
user.set_viewsize(world.view + extra_view)
|
||||
user.AddComponent(/datum/component/recursive_move)
|
||||
RegisterSignal(user, COMSIG_OBSERVER_MOVED, /obj/machinery/computer/ship/proc/unlook, override = TRUE) //This needs override or else it will spam runtimes because it is called repeatedly.
|
||||
RegisterSignal(user, COMSIG_OBSERVER_MOVED, /obj/machinery/computer/ship/proc/unlook)
|
||||
// TODO GLOB.stat_set_event.register(user, src, /obj/machinery/computer/ship/proc/unlook)
|
||||
LAZYDISTINCTADD(viewers, WEAKREF(user))
|
||||
|
||||
/obj/machinery/computer/ship/proc/unlook(var/mob/user)
|
||||
/obj/machinery/computer/ship/proc/unlook(var/mob/user, forced)
|
||||
if(!linked && !forced) //If we have no linked computer, return early. Forcing is for when we do a one-time action that we want to clear the UI.
|
||||
return
|
||||
user.reset_view()
|
||||
if(linked?.real_appearance)
|
||||
user.client?.images -= linked.real_appearance
|
||||
if(linked && linked.real_appearance && user.client)
|
||||
user.client.images -= linked.real_appearance
|
||||
if(isliving(user))
|
||||
var/mob/living/L = user
|
||||
L.looking_elsewhere = 0
|
||||
@@ -100,16 +106,13 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
|
||||
|
||||
/obj/machinery/computer/ship/tgui_status(mob/user)
|
||||
. = ..()
|
||||
if(. > STATUS_DISABLED)
|
||||
if(viewing_overmap(user))
|
||||
look(user)
|
||||
return
|
||||
unlook(user)
|
||||
if(viewing_overmap(user) && (user.machine != src))
|
||||
unlook(user, TRUE)
|
||||
|
||||
/obj/machinery/computer/ship/tgui_close(mob/user)
|
||||
. = ..()
|
||||
user.unset_machine()
|
||||
unlook(user)
|
||||
unlook(user, TRUE)
|
||||
|
||||
/obj/machinery/computer/ship/check_eye(var/mob/user)
|
||||
if(!get_dist(user, src) > 1 || user.blinded || !linked)
|
||||
@@ -124,5 +127,5 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
|
||||
for(var/datum/weakref/W in viewers)
|
||||
var/M = W.resolve()
|
||||
if(M)
|
||||
unlook(M)
|
||||
unlook(M, TRUE)
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user