mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] Motion tracker subsystem (#10232)
Co-authored-by: Cameron Lennox <killer65311@gmail.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
775c8313f3
commit
dba0bf4304
@@ -141,6 +141,7 @@
|
||||
domutcheck(M,null)
|
||||
M.UpdateAppearance()
|
||||
visible_message("\The [src.name] flashes violently before disintegrating!")
|
||||
SSmotiontracker.ping(src,100)
|
||||
spawn(0)
|
||||
qdel(s)
|
||||
qdel(src)
|
||||
@@ -158,6 +159,7 @@
|
||||
if(istype(M))
|
||||
M.Stun(30)
|
||||
visible_message("\The [src.name] flashes violently before disintegrating!")
|
||||
SSmotiontracker.ping(src,100)
|
||||
spawn(0)
|
||||
qdel(s)
|
||||
qdel(src)
|
||||
@@ -173,6 +175,7 @@
|
||||
if(!target.blocks_air)
|
||||
target.assume_gas(GAS_N2O, 30)
|
||||
visible_message("\The [src.name] detonates!")
|
||||
SSmotiontracker.ping(src,100)
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
|
||||
@@ -188,6 +191,7 @@
|
||||
target.assume_gas(GAS_PHORON, 30)
|
||||
target.hotspot_expose(1000, CELL_VOLUME)
|
||||
visible_message("\The [src.name] detonates!")
|
||||
SSmotiontracker.ping(src,100)
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
|
||||
@@ -229,6 +233,7 @@
|
||||
return
|
||||
src.fragmentate(O, 20, 7, list(/obj/item/projectile/bullet/pellet/fragment)) //only 20 weak fragments because you're stepping directly on it
|
||||
visible_message("\The [src.name] detonates!")
|
||||
SSmotiontracker.ping(src,100)
|
||||
spawn(0)
|
||||
qdel(s)
|
||||
qdel(src)
|
||||
@@ -258,6 +263,7 @@
|
||||
s.set_up(3, 1, src)
|
||||
s.start()
|
||||
visible_message("\The [src.name] flashes violently before disintegrating!")
|
||||
SSmotiontracker.ping(src,100)
|
||||
empulse(loc, 2, 4, 7, 10, 1) // As strong as an EMP grenade
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
@@ -279,6 +285,7 @@
|
||||
M.adjust_fire_stacks(5)
|
||||
M.fire_act()
|
||||
visible_message("\The [src.name] bursts into flames!")
|
||||
SSmotiontracker.ping(src,100)
|
||||
spawn(0)
|
||||
qdel(src)
|
||||
|
||||
@@ -300,6 +307,7 @@
|
||||
else
|
||||
explosion(loc, 0, 0, 2, 2)
|
||||
visible_message("\The [src.name] detonates!")
|
||||
SSmotiontracker.ping(src,100)
|
||||
|
||||
qdel(s)
|
||||
qdel(src)
|
||||
|
||||
27
code/game/objects/effects/motion_echo.dm
Normal file
27
code/game/objects/effects/motion_echo.dm
Normal file
@@ -0,0 +1,27 @@
|
||||
/image/motion_echo
|
||||
plane = PLANE_FULLSCREEN
|
||||
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|
||||
appearance_flags = (RESET_COLOR|PIXEL_SCALE|KEEP_APART)
|
||||
var/list/clients = list()
|
||||
|
||||
/image/motion_echo/New(icon, loc, icon_state, layer, dir)
|
||||
. = ..()
|
||||
QDEL_IN(src, 2 SECONDS)
|
||||
|
||||
/image/motion_echo/proc/place_from_root(var/turf/At)
|
||||
var/rand_limit = 12
|
||||
pixel_x += ((At.x - loc.x) * 32) + rand(-rand_limit,rand_limit)
|
||||
pixel_y += ((At.y - loc.y) * 32) + rand(-rand_limit,rand_limit)
|
||||
|
||||
/image/motion_echo/proc/append_client(var/datum/weakref/C)
|
||||
var/client/CW = C?.resolve()
|
||||
if(CW)
|
||||
CW.images += src
|
||||
clients.Add(C)
|
||||
|
||||
/image/motion_echo/Destroy(force)
|
||||
. = ..()
|
||||
for(var/datum/weakref/C in clients)
|
||||
var/client/CW = C?.resolve()
|
||||
if(CW)
|
||||
CW.images -= src
|
||||
@@ -223,6 +223,7 @@
|
||||
|
||||
if(prob(50))
|
||||
src.visible_message(span_notice("You hear something squeezing through the ventilation ducts."),2)
|
||||
SSmotiontracker.ping(src,10)
|
||||
sleep(travel_time)
|
||||
|
||||
if(!exit_vent || exit_vent.welded)
|
||||
@@ -269,6 +270,7 @@
|
||||
walk_to(src, target_atom, 5)
|
||||
if(prob(25))
|
||||
src.visible_message(span_notice("\The [src] skitters[pick(" away"," around","")]."))
|
||||
SSmotiontracker.ping(src,10)
|
||||
else if(amount_grown < 75 && prob(5))
|
||||
//vent crawl!
|
||||
for(var/obj/machinery/atmospherics/unary/vent_pump/v in view(7,src))
|
||||
|
||||
49
code/game/objects/items/devices/scanners/motion_tracker.dm
Normal file
49
code/game/objects/items/devices/scanners/motion_tracker.dm
Normal file
@@ -0,0 +1,49 @@
|
||||
/obj/item/motiontracker
|
||||
name = "Motion Tracker"
|
||||
desc = "The \"Vibromaster V1.7\", a handheld motion tracker. Often picks up nearby vibrations as motion however."
|
||||
icon = 'icons/obj/device_alt.dmi'
|
||||
icon_state = "pinoff"
|
||||
item_state = "analyzer"
|
||||
w_class = ITEMSIZE_SMALL
|
||||
slot_flags = SLOT_BELT
|
||||
throwforce = 5
|
||||
throw_speed = 4
|
||||
throw_range = 20
|
||||
|
||||
matter = list(MAT_STEEL = 30,MAT_GLASS = 20)
|
||||
origin_tech = list(TECH_MAGNET = 1, TECH_DATA = 1)
|
||||
|
||||
pickup_sound = 'sound/items/pickup/device.ogg'
|
||||
drop_sound = 'sound/items/drop/device.ogg'
|
||||
|
||||
/obj/item/motiontracker/Initialize(mapload)
|
||||
RegisterSignal(SSmotiontracker, COMSIG_MOVABLE_MOTIONTRACKER, PROC_REF(handle_motion_tracking))
|
||||
. = ..()
|
||||
|
||||
/obj/item/motiontracker/Destroy(force, ...)
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.motiontracker_subscribe()
|
||||
UnregisterSignal(SSmotiontracker, COMSIG_MOVABLE_MOTIONTRACKER)
|
||||
. = ..()
|
||||
|
||||
/obj/item/motiontracker/proc/handle_motion_tracking(mob/source, var/datum/weakref/RW, var/turf/T)
|
||||
SIGNAL_HANDLER
|
||||
SHOULD_NOT_OVERRIDE(TRUE)
|
||||
PRIVATE_PROC(TRUE)
|
||||
var/atom/echo_source = RW?.resolve()
|
||||
var/atom/scan_pos = src
|
||||
if(!isturf(loc))
|
||||
scan_pos = loc
|
||||
if(!echo_source || get_dist(scan_pos,echo_source) > SSmotiontracker.max_range || scan_pos.z != echo_source.z)
|
||||
return
|
||||
flick("pinondirect",src)
|
||||
|
||||
/obj/item/motiontracker/Moved(atom/old_loc, direction, forced, movetime)
|
||||
. = ..()
|
||||
if(ismob(old_loc))
|
||||
var/mob/M = old_loc
|
||||
M.motiontracker_unsubscribe()
|
||||
if(ismob(loc))
|
||||
var/mob/M = loc
|
||||
M.motiontracker_subscribe()
|
||||
@@ -87,6 +87,7 @@
|
||||
var/turf/T = get_turf(src)
|
||||
if(T)
|
||||
T.hotspot_expose(700,125)
|
||||
SSmotiontracker.ping(src,100)
|
||||
|
||||
|
||||
/obj/item/grenade/attackby(obj/item/W as obj, mob/user as mob)
|
||||
|
||||
@@ -131,6 +131,7 @@
|
||||
span_danger("You step on \the [src]!"),
|
||||
span_infoplain(span_bold("You hear a loud metallic snap!"))
|
||||
)
|
||||
SSmotiontracker.ping(src,100) // Clunk!
|
||||
attack_mob(L)
|
||||
if(!has_buckled_mobs())
|
||||
anchored = FALSE
|
||||
|
||||
Reference in New Issue
Block a user