diff --git a/code/datums/components/holographic_nature.dm b/code/datums/components/holographic_nature.dm new file mode 100644 index 0000000000..41db9e9a1a --- /dev/null +++ b/code/datums/components/holographic_nature.dm @@ -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 diff --git a/code/modules/vore/eating/silicon_vr.dm b/code/modules/vore/eating/silicon_vr.dm index e66d46d37e..449067ad55 100644 --- a/code/modules/vore/eating/silicon_vr.dm +++ b/code/modules/vore/eating/silicon_vr.dm @@ -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) diff --git a/vorestation.dme b/vorestation.dme index c2f47545e3..1f15a90f9e 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -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"