Motion tracker subsystem (#17215)

* Motion tracker basics

* force unsubscribe on destroy

* remove tracking on destroy too

* missing include

* use new art

* logging

* per client echos

* toggle verb

* vis things not needed, and reset vis option if resubbed

* blind and deaf should affect this

* feedback on toggle

* teshari gain vibration sense, lose listen in

* xenochi too

xenochi also get vibration sense

---------

Co-authored-by: Willburd <7099514+Willburd@users.noreply.github.com>
This commit is contained in:
Cameron Lennox
2025-02-26 18:37:18 -05:00
committed by GitHub
co-authored by Willburd
parent d371702ccc
commit 636dd0a3a6
25 changed files with 274 additions and 7 deletions
+1
View File
@@ -79,6 +79,7 @@
src.visible_message(span_infoplain(span_bold("\The [src.name]") + " [deathmessage]"))
set_stat(DEAD)
SSmotiontracker.ping(src,80)
update_canmove()
@@ -191,18 +191,14 @@
var/obj/item/clothing/glasses/V = rig.visor.vision.glasses
compiled_vis |= V.enables_planes
//VOREStation Add - NIF Support
if(nif)
compiled_vis |= nif.planes_visible()
//event hud
if(vantag_hud)
compiled_vis |= VIS_CH_VANTAG
//VOREStation Add End
//Vore Stomach addition start. This goes here.
if(stomach_vision)
compiled_vis += VIS_CH_STOMACH
//Vore Stomach addition end
if(!compiled_vis.len && !vis_enabled.len)
return //Nothin' doin'.
@@ -123,6 +123,7 @@
var/emp_dmg_mod = 1 // Multiplier to all EMP damage sustained by the mob, if it's EMP-sensitive
var/emp_stun_mod = 1 // Multiplier to all EMP disorient/etc. sustained by the mob, if it's EMP-sensitive
var/vision_flags = SEE_SELF // Same flags as glasses.
var/has_vibration_sense = FALSE // Motion tracker subsystem
// Death vars.
var/meat_type = /obj/item/reagent_containers/food/snacks/meat/human
@@ -17,6 +17,7 @@
base_species = "Xenochimera"
selects_bodytype = SELECTS_BODYTYPE_CUSTOM
digi_allowed = TRUE
has_vibration_sense = TRUE
num_alternate_languages = 3
species_language = null
@@ -26,7 +27,7 @@
icobase_tail = 1
inherent_verbs = list(
/mob/living/carbon/human/proc/reconstitute_form,
/mob/living/carbon/human/proc/sonar_ping,
///mob/living/carbon/human/proc/sonar_ping,
/mob/living/carbon/human/proc/tie_hair)
virus_immune = 1 // They practically ARE one.
@@ -53,6 +53,7 @@
pass_flags = PASSTABLE
holder_type = /obj/item/holder/human
// short_sighted = 1
has_vibration_sense = TRUE
gluttonous = 1
blood_volume = 400
hunger_factor = 0.2
@@ -134,7 +135,7 @@
)
inherent_verbs = list(
/mob/living/carbon/human/proc/sonar_ping,
///mob/living/carbon/human/proc/sonar_ping,
/mob/living/proc/hide
)
@@ -20,7 +20,7 @@
vore_belly_default_variant = "T" //Teshari belly sprite
inherent_verbs = list(
/mob/living/carbon/human/proc/sonar_ping,
///mob/living/carbon/human/proc/sonar_ping,
/mob/living/proc/hide,
/mob/living/proc/toggle_pass_table
)
@@ -365,3 +365,24 @@
is_genetrait = TRUE
hidden = FALSE
activation_message="Your body feels mundane."
/datum/trait/positive/vibration_sense
name = "Vibration Sense"
desc = "Allows you to sense subtle vibrations nearby, even if the source cannot be seen."
cost = 2
var_changes = list("has_vibration_sense" = TRUE)
// Traitgenes edit begin - Made into a gene trait
is_genetrait = TRUE
hidden = FALSE
activation_message="Your ears ring, and hear everything..."
// Traitgenes edit end
/datum/trait/positive/vibration_sense/apply(datum/species/S, mob/living/carbon/human/H, trait_prefs)
. = ..()
H.motiontracker_subscribe()
/datum/trait/positive/vibration_sense/unapply(datum/species/S, mob/living/carbon/human/H, trait_prefs)
. = ..()
H.motiontracker_unsubscribe()
@@ -269,6 +269,8 @@ default behaviour is:
/mob/living/Moved(var/atom/oldloc, direct, forced, movetime)
. = ..()
handle_footstep(loc)
if(!forced && movetime)
SSmotiontracker?.ping(src) // Incase of before init "turf enter gravity" this is ?, unfortunately.
// Begin VOREstation edit
if(is_shifted)
is_shifted = FALSE
+2
View File
@@ -39,6 +39,8 @@
vore_selected = null // from code/modules/vore/eating/mob_vr
focus = null
motiontracker_unsubscribe(TRUE) // Force unsubscribe
if(mind)
if(mind.current == src)
mind.current = null
+2
View File
@@ -243,3 +243,5 @@
var/list/resistances
var/custom_footstep = FOOTSTEP_MOB_SHOE
VAR_PRIVATE/is_motion_tracking = FALSE // Prevent multiple unsubs and resubs, also used to check if the vis layer is enabled, use has_motiontracking() to get externally.
VAR_PRIVATE/wants_to_see_motion_echos = TRUE
+48
View File
@@ -0,0 +1,48 @@
/mob/proc/has_motiontracking() // USE THIS
return is_motion_tracking
// Subscribing and unsubscribingto the motion tracker subsystem
/mob/proc/motiontracker_subscribe()
if(!is_motion_tracking)
is_motion_tracking = TRUE
wants_to_see_motion_echos = TRUE
RegisterSignal(SSmotiontracker, COMSIG_MOVABLE_MOTIONTRACKER, PROC_REF(handle_motion_tracking))
add_verb(src,/mob/proc/toggle_motion_echo_vis)
/mob/proc/motiontracker_unsubscribe(var/destroying = FALSE)
if(is_motion_tracking)
is_motion_tracking = FALSE
UnregisterSignal(SSmotiontracker, COMSIG_MOVABLE_MOTIONTRACKER)
remove_verb(src,/mob/proc/toggle_motion_echo_vis)
/mob/living/carbon/human/motiontracker_unsubscribe(destroying = FALSE)
// Block unsub if our species has vibration senses
if(!destroying && species?.has_vibration_sense)
return
. = ..()
// For COMSIG_MOVABLE_MOTIONTRACKER
/mob/proc/handle_motion_tracking(mob/source, var/datum/weakref/RW, var/turf/T)
SIGNAL_HANDLER
SHOULD_NOT_OVERRIDE(TRUE)
PRIVATE_PROC(TRUE)
if(!client || !wants_to_see_motion_echos || stat || is_deaf())
return
var/atom/echo_source = RW?.resolve()
if(!echo_source || get_dist(src,echo_source) > SSmotiontracker.max_range || src.z != echo_source.z)
return
// Blind characters see all pings around them. Otherwise remove the closest, or any we can see. Pings behind walls or in the dark are always visible
if(!is_blind() && (get_dist(src,echo_source) < SSmotiontracker.min_range || (T.get_lumcount() >= 0.20 && can_see(src, T, 7)) ))
return
var/echos = 1
if(prob(30))
echos = rand(1,3)
SSmotiontracker.queue_echo(get_turf(src),T,echos,client ? WEAKREF(client) : null)
/mob/proc/toggle_motion_echo_vis()
set name = "Toggle Vibration Senses"
set desc = "Toggle the visibility of pings revealed by vibration senses or motion trackers."
set category = "Abilities.General"
wants_to_see_motion_echos = !wants_to_see_motion_echos
to_chat(src,"You will [wants_to_see_motion_echos ? "now" : "no longer"] see echos")