mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-14 02:43:16 +00:00
* New Lavaland Monster: Bileworms * Update living.dm * Update space_dragon.dm * Update mining_mobs.dm * Update kinetic_crusher.dm Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com> Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
43 lines
1.6 KiB
Plaintext
43 lines
1.6 KiB
Plaintext
/**
|
|
* Crusher Loot; which makes the attached mob drop a crusher trophy of some type if the majority damage was from a crusher!
|
|
*
|
|
* Used for all the mobs droppin' crusher trophies
|
|
*/
|
|
/datum/element/crusher_loot
|
|
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
|
|
id_arg_index = 2
|
|
/// Path of the trophy dropped
|
|
var/trophy_type
|
|
/// chance to drop the trophy, lowered by the mob only taking partial crusher damage instead of full
|
|
/// for example, 25% would mean ~4 mobs need to die before you find one.
|
|
/// but it would be more if you didn't deal full crusher damage to them.
|
|
var/drop_mod
|
|
/// If true, will immediately spawn the item instead of putting it in butcher loot.
|
|
var/drop_immediately
|
|
|
|
/datum/element/crusher_loot/Attach(datum/target, trophy_type, drop_mod = 25, drop_immediately = FALSE)
|
|
. = ..()
|
|
|
|
if(!isliving(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
RegisterSignal(target, COMSIG_LIVING_DEATH, .proc/on_death)
|
|
|
|
src.trophy_type = trophy_type
|
|
src.drop_mod = drop_mod
|
|
src.drop_immediately = drop_immediately
|
|
|
|
/datum/element/crusher_loot/Detach(datum/target)
|
|
UnregisterSignal(target, COMSIG_LIVING_DEATH)
|
|
return ..()
|
|
|
|
/datum/element/crusher_loot/proc/on_death(mob/living/target, gibbed)
|
|
SIGNAL_HANDLER
|
|
|
|
var/datum/status_effect/crusher_damage/damage = target.has_status_effect(/datum/status_effect/crusher_damage)
|
|
if(damage && prob((damage.total_damage/target.maxHealth) * drop_mod)) //on average, you'll need to kill 4 creatures before getting the item. by default.
|
|
if(drop_immediately)
|
|
new trophy_type(get_turf(target))
|
|
else
|
|
target.butcher_results[trophy_type] = 1
|