From adea747fb05a526391de800f2ce7c23701dcdd41 Mon Sep 17 00:00:00 2001 From: Ben10Omintrix <138636438+Ben10Omintrix@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:25:57 +0200 Subject: [PATCH] holograms now momentarily glitch out when u interact with them (#89689) ## About The Pull Request adds a new visual effect for holograms ,such as holosigns and several holoanimals, where they'll glitch out when walked through, attacked, or when a thrown object passes through them https://github.com/user-attachments/assets/5c18e48e-6ea5-4e57-a7d4-6a9323e317f5 ## Why It's Good For The Game i think its good for the sake of immersion. also, if pai players feel like this might get annoying i have no problems excluding them from this effect. ## Changelog :cl: add: adds a new glitch-out effect for holograms when they're interacted with /:cl: --- code/datums/components/holographic_nature.dm | 55 +++++++++++++++++++ code/game/machinery/hologram.dm | 4 ++ code/game/objects/structures/holosign.dm | 1 + code/modules/economy/holopay.dm | 1 + .../mob/living/basic/pets/orbie/orbie.dm | 1 + .../mob/living/basic/space_fauna/carp/carp.dm | 4 ++ code/modules/pai/pai.dm | 1 + tgstation.dme | 1 + 8 files changed, 68 insertions(+) create mode 100644 code/datums/components/holographic_nature.dm diff --git a/code/datums/components/holographic_nature.dm b/code/datums/components/holographic_nature.dm new file mode 100644 index 00000000000..9f9dace845b --- /dev/null +++ b/code/datums/components/holographic_nature.dm @@ -0,0 +1,55 @@ +/* + * 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) + if(isliving(parent)) + RegisterSignal(parent, COMSIG_MOB_APPLY_DAMAGE, PROC_REF(on_mob_damaged)) + return + + var/atom/atom_parent = parent + if(isobj(atom_parent) && atom_parent.uses_integrity) + RegisterSignal(parent, COMSIG_ATOM_TAKE_DAMAGE, PROC_REF(on_object_damaged)) + +/datum/component/holographic_nature/proc/on_mob_damaged(mob/living/source, damage_amount, damagetype, def_zone, blocked, wound_bonus, bare_wound_bonus, sharpness, attack_direction, attacking_item) + SIGNAL_HANDLER + if(damagetype == BURN || damagetype == BRUTE) + apply_effects() + +/datum/component/holographic_nature/proc/on_object_damaged(obj/source, damage, damage_type, ...) + SIGNAL_HANDLER + if(damage_type == BURN || damage_type == BRUTE) + apply_effects() + +/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(isprojectile(thing) || thing.density) + 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/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index 2a4cfeab6d6..4cd06739c14 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -873,6 +873,10 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ var/mob/living/Impersonation var/datum/holocall/HC +/obj/effect/overlay/holo_pad_hologram/Initialize(mapload) + . = ..() + AddComponent(/datum/component/holographic_nature) + /obj/effect/overlay/holo_pad_hologram/Destroy() Impersonation = null if(!QDELETED(HC)) diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm index 6d86b5f7a30..ca4b515f01d 100644 --- a/code/game/objects/structures/holosign.dm +++ b/code/game/objects/structures/holosign.dm @@ -21,6 +21,7 @@ /obj/structure/holosign/Initialize(mapload, source_projector) . = ..() + AddComponent(/datum/component/holographic_nature) create_vis_overlay() if(source_projector) projector = source_projector diff --git a/code/modules/economy/holopay.dm b/code/modules/economy/holopay.dm index 301a4a5d6f8..d23e94a0921 100644 --- a/code/modules/economy/holopay.dm +++ b/code/modules/economy/holopay.dm @@ -31,6 +31,7 @@ /obj/structure/holopay/Initialize(mapload) . = ..() + AddComponent(/datum/component/holographic_nature) register_context() /obj/structure/holopay/add_context(atom/source, list/context, obj/item/held_item, mob/user) diff --git a/code/modules/mob/living/basic/pets/orbie/orbie.dm b/code/modules/mob/living/basic/pets/orbie/orbie.dm index 202bc84d37e..2ca8abce065 100644 --- a/code/modules/mob/living/basic/pets/orbie/orbie.dm +++ b/code/modules/mob/living/basic/pets/orbie/orbie.dm @@ -48,6 +48,7 @@ /mob/living/basic/orbie/Initialize(mapload) . = ..() + AddComponent(/datum/component/holographic_nature) var/static/list/food_types = list(/obj/item/food/virtual_chocolate) AddComponent(/datum/component/obeys_commands, pet_commands) AddElement(/datum/element/basic_eating, food_types = food_types) diff --git a/code/modules/mob/living/basic/space_fauna/carp/carp.dm b/code/modules/mob/living/basic/space_fauna/carp/carp.dm index bc70e6dc03a..777fe42e276 100644 --- a/code/modules/mob/living/basic/space_fauna/carp/carp.dm +++ b/code/modules/mob/living/basic/space_fauna/carp/carp.dm @@ -186,6 +186,10 @@ cell_line = NONE regenerate_colour = "#ffffff" +/mob/living/basic/carp/holographic/Initialize(mapload, mob/tamer) + . = ..() + AddComponent(/datum/component/holographic_nature) + /// Holocarp don't eat food /mob/living/basic/carp/holographic/setup_eating() return FALSE diff --git a/code/modules/pai/pai.dm b/code/modules/pai/pai.dm index 1f1bcb067d3..94b6f38067a 100644 --- a/code/modules/pai/pai.dm +++ b/code/modules/pai/pai.dm @@ -206,6 +206,7 @@ /mob/living/silicon/pai/Initialize(mapload) . = ..() + AddComponent(/datum/component/holographic_nature) if(istype(loc, /obj/item/modular_computer)) give_messenger_ability() START_PROCESSING(SSfastprocess, src) diff --git a/tgstation.dme b/tgstation.dme index d0a338fab03..db6de89e924 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1315,6 +1315,7 @@ #include "code\datums\components\hide_highest_offset.dm" #include "code\datums\components\hide_weather_planes.dm" #include "code\datums\components\holderloving.dm" +#include "code\datums\components\holographic_nature.dm" #include "code\datums\components\igniter.dm" #include "code\datums\components\infective.dm" #include "code\datums\components\interaction_booby_trap.dm"