mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-15 04:01:41 +00:00
* Refactors most spans into span procs * AA * a * AAAAAAAAAAAAAAAAAAAAAA * Update species.dm Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Gandalf <jzo123@hotmail.com>
33 lines
956 B
Plaintext
33 lines
956 B
Plaintext
/*
|
|
* An element for making tools fragile, giving them a chance of
|
|
* "snapping into tiny pieces" after they've been used.
|
|
*/
|
|
|
|
/datum/element/easily_fragmented
|
|
element_flags = ELEMENT_BESPOKE | ELEMENT_DETACH
|
|
id_arg_index = 2
|
|
|
|
var/break_chance
|
|
|
|
/datum/element/easily_fragmented/Attach(datum/target, break_chance)
|
|
. = ..()
|
|
if(!isitem(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
src.break_chance = break_chance
|
|
|
|
RegisterSignal(target, COMSIG_ITEM_AFTERATTACK, .proc/on_afterattack)
|
|
|
|
/datum/element/easily_fragmented/Detach(datum/target)
|
|
. = ..()
|
|
UnregisterSignal(target, COMSIG_ITEM_AFTERATTACK)
|
|
|
|
/datum/element/easily_fragmented/proc/on_afterattack(datum/source, atom/target, mob/user, proximity_flag, click_parameters)
|
|
SIGNAL_HANDLER
|
|
|
|
var/obj/item/item = source
|
|
|
|
if(prob(break_chance))
|
|
user.visible_message(span_danger("[user]'s [item.name] snap[item.p_s()] into tiny pieces in [user.p_their()] hand."))
|
|
item.deconstruct(disassembled = FALSE)
|