mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 12:08:28 +01:00
Relaymove Moved To Remote Views (#18714)
* Remote view setting datums * remote view handles relayed move * setting up checks * many fixes * small fixes * default relay behavior * use camera settings * coordinated for overmap shuttle * lock this down * not needed * not needed * inaccurate doc * small fixes * various set machine calls no longer needed * runtime * health hud moved to signal controls * overriding huds * allow signal based huds entirely * uav health icon * fix * oops that's important * more return types * mmis view fix * not needed * protect against instantly deleted ghosts * all of these need remote on enter * these too * order
This commit is contained in:
@@ -37,9 +37,6 @@ Code is pretty much ripped verbatim from nano modules, but with un-needed stuff
|
||||
if(host)
|
||||
host.tgui_close(user)
|
||||
|
||||
/datum/tgui_module/proc/check_eye(mob/user)
|
||||
return -1
|
||||
|
||||
/datum/tgui_module/proc/can_still_topic(mob/user, datum/tgui_state/state)
|
||||
return (tgui_status(user, state) == STATUS_INTERACTIVE)
|
||||
|
||||
|
||||
@@ -70,14 +70,14 @@
|
||||
if(!current_uav)
|
||||
return FALSE
|
||||
|
||||
if(current_uav.check_eye(ui.user) < 0)
|
||||
if(!current_uav.state)
|
||||
to_chat(ui.user,span_warning("The screen freezes for a moment, before returning to the UAV selection menu. It's not able to connect to that UAV."))
|
||||
else
|
||||
if(check_eye(ui.user) < 0)
|
||||
if(get_dist(ui.user, tgui_host()) > 1 || ui.user.blinded)
|
||||
return FALSE
|
||||
else if(!viewing_uav(ui.user))
|
||||
if(!viewers) viewers = list() // List must exist for pass by reference to work
|
||||
start_coordinated_remoteview(ui.user, current_uav, viewers)
|
||||
start_coordinated_remoteview(ui.user, current_uav, viewers, /datum/remote_view_config/uav_control)
|
||||
else
|
||||
ui.user.reset_perspective()
|
||||
return TRUE
|
||||
@@ -173,17 +173,12 @@
|
||||
if(issilicon(user)) //Too complicated for me to want to mess with at the moment
|
||||
to_chat(user, span_warning("Regulations prevent you from controlling several corporeal forms at the same time!"))
|
||||
return
|
||||
|
||||
if(!current_uav)
|
||||
return
|
||||
|
||||
if(!user.check_current_machine(tgui_host()))
|
||||
user.set_machine(tgui_host())
|
||||
current_uav.add_master(user)
|
||||
LAZYDISTINCTADD(viewers, WEAKREF(user))
|
||||
|
||||
/datum/tgui_module/uav/unlook(mob/user)
|
||||
user.unset_machine()
|
||||
if(current_uav)
|
||||
current_uav.remove_master(user)
|
||||
LAZYREMOVE(viewers, WEAKREF(user))
|
||||
@@ -192,45 +187,77 @@
|
||||
. = ..()
|
||||
user.reset_perspective()
|
||||
|
||||
/datum/tgui_module/uav/check_eye(mob/user)
|
||||
if(get_dist(user, tgui_host()) > 1 || user.blinded || !current_uav)
|
||||
user.reset_perspective()
|
||||
return -1
|
||||
|
||||
var/viewflag = current_uav.check_eye(user)
|
||||
if(viewflag < 0) //camera doesn't work
|
||||
user.reset_perspective()
|
||||
return -1
|
||||
|
||||
return viewflag
|
||||
|
||||
////
|
||||
//// Relaying movements to the UAV
|
||||
//// Settings for remote view
|
||||
////
|
||||
/datum/tgui_module/uav/relaymove(var/mob/user, direction)
|
||||
if(current_uav)
|
||||
return current_uav.relaymove(user, direction, signal_strength)
|
||||
/datum/remote_view_config/uav_control
|
||||
relay_movement = TRUE
|
||||
override_health_hud = TRUE
|
||||
var/original_health_hud_icon
|
||||
|
||||
////
|
||||
//// The effects when looking through a UAV
|
||||
////
|
||||
/datum/tgui_module/uav/apply_visual(mob/M)
|
||||
if(!M.client)
|
||||
/datum/remote_view_config/uav_control/handle_relay_movement( datum/component/remote_view/owner_component, mob/host_mob, direction)
|
||||
var/datum/tgui_module/uav/tgui_owner = owner_component.get_coordinator()
|
||||
if(tgui_owner?.current_uav)
|
||||
return tgui_owner.current_uav.relaymove(host_mob, direction, tgui_owner.signal_strength)
|
||||
return FALSE
|
||||
|
||||
/datum/remote_view_config/uav_control/handle_apply_visuals( datum/component/remote_view/owner_component, mob/host_mob)
|
||||
var/datum/tgui_module/uav/tgui_owner = owner_component.get_coordinator()
|
||||
if(!tgui_owner)
|
||||
return
|
||||
if(WEAKREF(M) in viewers)
|
||||
M.overlay_fullscreen("fishbed",/atom/movable/screen/fullscreen/fishbed)
|
||||
M.overlay_fullscreen("scanlines",/atom/movable/screen/fullscreen/scanline)
|
||||
|
||||
if(signal_strength <= 1)
|
||||
M.overlay_fullscreen("whitenoise",/atom/movable/screen/fullscreen/noise)
|
||||
else
|
||||
M.clear_fullscreen("whitenoise", 0)
|
||||
if(get_dist(host_mob, tgui_owner.tgui_host()) > 1 || !tgui_owner.current_uav)
|
||||
host_mob.reset_perspective()
|
||||
return
|
||||
// Apply hud
|
||||
host_mob.overlay_fullscreen("fishbed",/atom/movable/screen/fullscreen/fishbed)
|
||||
host_mob.overlay_fullscreen("scanlines",/atom/movable/screen/fullscreen/scanline)
|
||||
if(tgui_owner.signal_strength <= 1)
|
||||
host_mob.overlay_fullscreen("whitenoise",/atom/movable/screen/fullscreen/noise)
|
||||
else
|
||||
remove_visual(M)
|
||||
host_mob.clear_fullscreen("whitenoise", 0)
|
||||
|
||||
/datum/tgui_module/uav/remove_visual(mob/M)
|
||||
if(!M.client)
|
||||
return
|
||||
M.clear_fullscreen("fishbed",0)
|
||||
M.clear_fullscreen("scanlines",0)
|
||||
M.clear_fullscreen("whitenoise",0)
|
||||
/datum/remote_view_config/uav_control/handle_remove_visuals( datum/component/remote_view/owner_component, mob/host_mob)
|
||||
// Clear hud
|
||||
host_mob.clear_fullscreen("fishbed",0)
|
||||
host_mob.clear_fullscreen("scanlines",0)
|
||||
host_mob.clear_fullscreen("whitenoise",0)
|
||||
|
||||
// We are responsible for restoring the health UI's icons on removal
|
||||
/datum/remote_view_config/uav_control/attached_to_mob( datum/component/remote_view/owner_component, mob/host_mob)
|
||||
original_health_hud_icon = host_mob.healths?.icon
|
||||
|
||||
/datum/remote_view_config/uav_control/detatch_from_mob( datum/component/remote_view/owner_component, mob/host_mob)
|
||||
if(host_mob.healths && original_health_hud_icon)
|
||||
host_mob.healths.icon = original_health_hud_icon
|
||||
host_mob.healths.appearance = null
|
||||
|
||||
// Show the uav health instead of the mob's while it is viewing
|
||||
/datum/remote_view_config/uav_control/handle_hud_health( datum/component/remote_view/owner_component, mob/host_mob)
|
||||
var/datum/tgui_module/uav/tgui_owner = owner_component.get_coordinator()
|
||||
|
||||
var/mutable_appearance/MA = new (host_mob.healths)
|
||||
MA.icon = 'icons/mob/screen1_robot_minimalist.dmi'
|
||||
MA.cut_overlays()
|
||||
|
||||
if(!tgui_owner?.current_uav)
|
||||
MA.icon_state = "health7"
|
||||
else
|
||||
switch(tgui_owner.current_uav.health)
|
||||
if(100 to INFINITY)
|
||||
MA.icon_state = "health0"
|
||||
if(80 to 100)
|
||||
MA.icon_state = "health1"
|
||||
if(60 to 80)
|
||||
MA.icon_state = "health2"
|
||||
if(40 to 60)
|
||||
MA.icon_state = "health3"
|
||||
if(20 to 40)
|
||||
MA.icon_state = "health4"
|
||||
if(0 to 20)
|
||||
MA.icon_state = "health5"
|
||||
else
|
||||
MA.icon_state = "health6"
|
||||
|
||||
host_mob.healths.icon_state = "blank"
|
||||
host_mob.healths.appearance = MA
|
||||
return COMSIG_COMPONENT_HANDLED_HEALTH_ICON
|
||||
|
||||
@@ -73,13 +73,6 @@
|
||||
/datum/tgui_module/ship/proc/viewing_overmap(mob/user)
|
||||
return (WEAKREF(user) in viewers)
|
||||
|
||||
/datum/tgui_module/ship/check_eye(var/mob/user)
|
||||
if(!get_dist(user, tgui_host()) > 1 || user.blinded || !linked)
|
||||
user.reset_perspective()
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
|
||||
// Navigation
|
||||
/datum/tgui_module/ship/nav
|
||||
name = "Navigation Display"
|
||||
@@ -136,11 +129,11 @@
|
||||
return FALSE
|
||||
|
||||
if(action == "viewing")
|
||||
if(check_eye(ui.user) < 0)
|
||||
if(!get_dist(ui.user, src) > 1 || ui.user.blinded || !linked)
|
||||
return FALSE
|
||||
else if(!viewing_overmap(ui.user))
|
||||
if(!viewers) viewers = list() // List must exist for pass by reference to work
|
||||
start_coordinated_remoteview(ui.user, linked, viewers)
|
||||
start_coordinated_remoteview(ui.user, linked, viewers, /datum/remote_view_config/overmap_ship_control)
|
||||
else
|
||||
ui.user.reset_perspective()
|
||||
return TRUE
|
||||
@@ -406,11 +399,11 @@
|
||||
. = TRUE
|
||||
|
||||
if("manual")
|
||||
if(check_eye(ui.user) < 0)
|
||||
if(ui.user.blinded || !linked)
|
||||
return FALSE
|
||||
else if(!viewing_overmap(ui.user))
|
||||
if(!viewers) viewers = list()
|
||||
start_coordinated_remoteview(ui.user, linked, viewers)
|
||||
start_coordinated_remoteview(ui.user, linked, viewers, /datum/remote_view_config/overmap_ship_control)
|
||||
else
|
||||
ui.user.reset_perspective()
|
||||
. = TRUE
|
||||
@@ -479,3 +472,23 @@
|
||||
return
|
||||
/datum/tgui_module/ship/fullmonty/attempt_hook_up()
|
||||
return
|
||||
|
||||
////
|
||||
//// Settings for remote view
|
||||
////
|
||||
/datum/remote_view_config/overmap_ship_control
|
||||
relay_movement = TRUE
|
||||
|
||||
/datum/remote_view_config/overmap_ship_control/handle_relay_movement( datum/component/remote_view/owner_component, mob/host_mob, direction)
|
||||
var/datum/tgui_module/ship/tgui_owner = owner_component.get_coordinator()
|
||||
if(tgui_owner?.linked)
|
||||
return tgui_owner.relaymove(host_mob, direction)
|
||||
return FALSE
|
||||
|
||||
/datum/remote_view_config/overmap_ship_control/handle_apply_visuals( datum/component/remote_view/owner_component, mob/host_mob)
|
||||
var/datum/tgui_module/ship/tgui_owner = owner_component.get_coordinator()
|
||||
if(!tgui_owner)
|
||||
return
|
||||
if(get_dist(host_mob, tgui_owner.tgui_host()) > 1 || !tgui_owner.linked)
|
||||
host_mob.reset_perspective()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user