mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] tgstation/tgstation#89689 - holograms now wibble when penetrated (#11020)
Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
43e29d4d3a
commit
654b85c258
38
code/datums/components/holographic_nature.dm
Normal file
38
code/datums/components/holographic_nature.dm
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* A component given to holographic objects to make them glitch out when passed through
|
||||
*/
|
||||
#define GLITCH_DURATION 0.45 SECONDS
|
||||
#define GLITCH_REMOVAL_DURATION 0.25 SECONDS
|
||||
|
||||
/datum/component/holographic_nature
|
||||
///cooldown before we can glitch out again
|
||||
COOLDOWN_DECLARE(glitch_cooldown)
|
||||
///list of signals we apply to our turf
|
||||
var/static/list/loc_connections = list(
|
||||
COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
|
||||
)
|
||||
|
||||
/datum/component/holographic_nature/Initialize()
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
/datum/component/holographic_nature/RegisterWithParent()
|
||||
AddComponent(/datum/component/connect_loc_behalf, parent, loc_connections)
|
||||
|
||||
/datum/component/holographic_nature/proc/on_entered(atom/movable/source, atom/movable/thing)
|
||||
SIGNAL_HANDLER
|
||||
var/atom/movable/movable_parent = parent
|
||||
if(!isturf(movable_parent.loc))
|
||||
return
|
||||
if(thing.density || thing.throwing)
|
||||
apply_effects()
|
||||
|
||||
/datum/component/holographic_nature/proc/apply_effects()
|
||||
if(!COOLDOWN_FINISHED(src, glitch_cooldown))
|
||||
return
|
||||
COOLDOWN_START(src, glitch_cooldown, GLITCH_DURATION + GLITCH_REMOVAL_DURATION)
|
||||
apply_wibbly_filters(parent)
|
||||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(remove_wibbly_filters), parent, GLITCH_REMOVAL_DURATION), GLITCH_DURATION)
|
||||
|
||||
#undef GLITCH_DURATION
|
||||
#undef GLITCH_REMOVAL_DURATION
|
||||
@@ -6,6 +6,10 @@
|
||||
color = HOLO_ORIGINAL_COLOR //This is the blue from icons.dm that it was before.
|
||||
desc = "A hologram representing an AI persona."
|
||||
|
||||
/obj/effect/overlay/aiholo/Initialize(mapload)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/holographic_nature)
|
||||
|
||||
/obj/effect/overlay/aiholo/Destroy()
|
||||
drop_prey()
|
||||
for(var/mob/M in contents)
|
||||
|
||||
@@ -531,6 +531,7 @@
|
||||
#include "code\datums\components\connect_loc_behalf.dm"
|
||||
#include "code\datums\components\connect_mob_behalf.dm"
|
||||
#include "code\datums\components\connect_range_ch.dm"
|
||||
#include "code\datums\components\holographic_nature.dm"
|
||||
#include "code\datums\components\material_container.dm"
|
||||
#include "code\datums\components\orbiter.dm"
|
||||
#include "code\datums\components\overlay_lighting.dm"
|
||||
|
||||
Reference in New Issue
Block a user