mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #11043 from VOREStation/Arokha/uavview
Make UAVs not work at impossible distances
This commit is contained in:
committed by
Chompstation Bot
parent
796c58e062
commit
85b0fbdd30
@@ -840,7 +840,11 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
|||||||
//Move the objects. Not forceMove because the object isn't "moving" really, it's supposed to be on the "same" turf.
|
//Move the objects. Not forceMove because the object isn't "moving" really, it's supposed to be on the "same" turf.
|
||||||
for(var/obj/O in T)
|
for(var/obj/O in T)
|
||||||
O.loc = X
|
O.loc = X
|
||||||
O.update_light()
|
if(O.light_system == STATIC_LIGHT)
|
||||||
|
O.update_light()
|
||||||
|
else
|
||||||
|
var/datum/component/overlay_lighting/OL = O.GetComponent(/datum/component/overlay_lighting)
|
||||||
|
OL?.on_parent_moved(O, T, O.dir, TRUE)
|
||||||
if(z_level_change) // The objects still need to know if their z-level changed.
|
if(z_level_change) // The objects still need to know if their z-level changed.
|
||||||
O.onTransitZ(T.z, X.z)
|
O.onTransitZ(T.z, X.z)
|
||||||
|
|
||||||
|
|||||||
@@ -378,6 +378,7 @@
|
|||||||
|
|
||||||
/atom/movable/proc/onTransitZ(old_z,new_z)
|
/atom/movable/proc/onTransitZ(old_z,new_z)
|
||||||
GLOB.z_moved_event.raise_event(src, old_z, new_z)
|
GLOB.z_moved_event.raise_event(src, old_z, new_z)
|
||||||
|
SEND_SIGNAL(src, COMSIG_MOVABLE_Z_CHANGED, old_z, new_z)
|
||||||
for(var/item in src) // Notify contents of Z-transition. This can be overridden IF we know the items contents do not care.
|
for(var/item in src) // Notify contents of Z-transition. This can be overridden IF we know the items contents do not care.
|
||||||
var/atom/movable/AM = item
|
var/atom/movable/AM = item
|
||||||
AM.onTransitZ(old_z,new_z)
|
AM.onTransitZ(old_z,new_z)
|
||||||
|
|||||||
@@ -97,8 +97,10 @@
|
|||||||
return
|
return
|
||||||
// Can disasemble or reassemble from packed or off (and this one takes time)
|
// Can disasemble or reassemble from packed or off (and this one takes time)
|
||||||
if("(Dis)Assemble")
|
if("(Dis)Assemble")
|
||||||
if(can_transition_to(state == UAV_PACKED ? UAV_OFF : UAV_PACKED, user) && do_after(user, 10 SECONDS, src))
|
if(can_transition_to(state == UAV_PACKED ? UAV_OFF : UAV_PACKED, user))
|
||||||
return toggle_packed(user)
|
user.visible_message("<b>[user]</b> starts [state == UAV_PACKED ? "unpacking" : "packing"] [src].", "You start [state == UAV_PACKED ? "unpacking" : "packing"] [src].")
|
||||||
|
if(do_after(user, 10 SECONDS, src))
|
||||||
|
return toggle_packed(user)
|
||||||
// Can toggle power from on and off
|
// Can toggle power from on and off
|
||||||
if("Toggle Power")
|
if("Toggle Power")
|
||||||
if(can_transition_to(state == UAV_ON ? UAV_OFF : UAV_ON, user))
|
if(can_transition_to(state == UAV_ON ? UAV_OFF : UAV_ON, user))
|
||||||
|
|||||||
@@ -13,11 +13,11 @@
|
|||||||
|
|
||||||
if(current_uav)
|
if(current_uav)
|
||||||
if(QDELETED(current_uav))
|
if(QDELETED(current_uav))
|
||||||
set_current(null)
|
clear_current()
|
||||||
else if(signal_test_counter-- <= 0)
|
else if(signal_test_counter-- <= 0)
|
||||||
signal_strength = get_signal_to(current_uav)
|
signal_strength = get_signal_to(current_uav)
|
||||||
if(!signal_strength)
|
if(!signal_strength)
|
||||||
set_current(null)
|
clear_current()
|
||||||
else // Don't reset counter until we find a UAV that's actually in range we can stay connected to
|
else // Don't reset counter until we find a UAV that's actually in range we can stay connected to
|
||||||
signal_test_counter = 20
|
signal_test_counter = 20
|
||||||
|
|
||||||
@@ -95,16 +95,33 @@
|
|||||||
|
|
||||||
signal_strength = 0
|
signal_strength = 0
|
||||||
current_uav = U
|
current_uav = U
|
||||||
|
RegisterSignal(U, COMSIG_MOVABLE_Z_CHANGED, .proc/current_uav_changed_z)
|
||||||
|
|
||||||
if(LAZYLEN(viewers))
|
if(LAZYLEN(viewers))
|
||||||
for(var/weakref/W in viewers)
|
for(var/weakref/W in viewers)
|
||||||
var/M = W.resolve()
|
var/M = W.resolve()
|
||||||
if(M)
|
if(M)
|
||||||
if(current_uav)
|
look(M)
|
||||||
to_chat(M, "<span class='warning'>You're disconnected from the UAV's camera!</span>")
|
|
||||||
unlook(M)
|
/datum/tgui_module/uav/proc/clear_current()
|
||||||
else
|
if(!current_uav)
|
||||||
look(M)
|
return
|
||||||
|
|
||||||
|
UnregisterSignal(current_uav, COMSIG_MOVABLE_Z_CHANGED)
|
||||||
|
signal_strength = 0
|
||||||
|
current_uav = null
|
||||||
|
|
||||||
|
if(LAZYLEN(viewers))
|
||||||
|
for(var/weakref/W in viewers)
|
||||||
|
var/M = W.resolve()
|
||||||
|
if(M)
|
||||||
|
to_chat(M, "<span class='warning'>You're disconnected from the UAV's camera!</span>")
|
||||||
|
unlook(M)
|
||||||
|
|
||||||
|
/datum/tgui_module/uav/proc/current_uav_changed_z(old_z, new_z)
|
||||||
|
signal_strength = get_signal_to(current_uav)
|
||||||
|
if(!signal_strength)
|
||||||
|
clear_current()
|
||||||
|
|
||||||
////
|
////
|
||||||
//// Finding signal strength between us and the UAV
|
//// Finding signal strength between us and the UAV
|
||||||
@@ -130,6 +147,7 @@
|
|||||||
var/list/zlevels_in_range = using_map.get_map_levels(their_z, FALSE)
|
var/list/zlevels_in_range = using_map.get_map_levels(their_z, FALSE)
|
||||||
var/list/zlevels_in_long_range = using_map.get_map_levels(their_z, TRUE, om_range = DEFAULT_OVERMAP_RANGE) - zlevels_in_range
|
var/list/zlevels_in_long_range = using_map.get_map_levels(their_z, TRUE, om_range = DEFAULT_OVERMAP_RANGE) - zlevels_in_range
|
||||||
var/their_signal = 0
|
var/their_signal = 0
|
||||||
|
// Measure z-distance between the AM passed in and the nearest relay
|
||||||
for(var/relay in ntnet_global.relays)
|
for(var/relay in ntnet_global.relays)
|
||||||
var/obj/machinery/ntnet_relay/R = relay
|
var/obj/machinery/ntnet_relay/R = relay
|
||||||
if(!R.operable())
|
if(!R.operable())
|
||||||
@@ -144,7 +162,8 @@
|
|||||||
their_signal = 1
|
their_signal = 1
|
||||||
break
|
break
|
||||||
|
|
||||||
if(!their_signal) //They have no NTnet at all
|
// AM passed in has no NTnet at all
|
||||||
|
if(!their_signal)
|
||||||
if(get_z(host) == their_z && (get_dist(host, AM) < adhoc_range))
|
if(get_z(host) == their_z && (get_dist(host, AM) < adhoc_range))
|
||||||
return 1 //We can connect (with weak signal) in same z without ntnet, within 30 turfs
|
return 1 //We can connect (with weak signal) in same z without ntnet, within 30 turfs
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user