Files
Bubberstation/code/datums/components/temporary_glass_shatter.dm
SkyratBot 16854f2358 [MIRROR] The Voidwalker | New Midround Antagonist (#28832)
* The Voidwalker | New Midround Antagonist

* [MIRROR] The Voidwalker | New Midround Antagonist [MDB IGNORE] (#3755)

* The Voidwalker | New Midround Antagonist

* Update role_preferences.dm

* Update sql_ban_system.dm

* Update _bodyparts.dm

* Update role_preferences.dm

* Update lazy_templates.dm

* Update _bodyparts.dm

* Update _bodyparts.dm

* Grep

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>

---------

Co-authored-by: Time-Green <7501474+Time-Green@users.noreply.github.com>
Co-authored-by: SpaceLoveSs13 <68121607+SpaceLoveSs13@users.noreply.github.com>
Co-authored-by: NovaBot <154629622+NovaBot13@users.noreply.github.com>
Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
2024-07-20 17:44:24 +05:30

31 lines
973 B
Plaintext

/// Component to make an item temporarily break glass
/datum/component/temporary_glass_shatterer/Initialize(...)
. = ..()
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(parent, COMSIG_ITEM_INTERACTING_WITH_ATOM, PROC_REF(on_tap))
/datum/component/temporary_glass_shatterer/proc/on_tap(obj/item/parent, mob/tapper, atom/target)
SIGNAL_HANDLER
if(istype(target, /obj/structure/window))
var/obj/structure/grille/grille = locate(/obj/structure/grille) in get_turf(target)
if(grille?.is_shocked())
target.balloon_alert(tapper, "is shocked!")
return COMPONENT_CANCEL_ATTACK_CHAIN
var/obj/structure/window/window = target
window.temporary_shatter()
else if(istype(target, /obj/structure/grille))
var/obj/structure/grille/grille = target
if(grille.is_shocked())
target.balloon_alert(tapper, "is shocked!")
return COMPONENT_CANCEL_ATTACK_CHAIN
grille.temporary_shatter()
else
return
return COMPONENT_CANCEL_ATTACK_CHAIN