diff --git a/code/datums/components/item_killsound.dm b/code/datums/components/item_killsound.dm new file mode 100644 index 00000000000..f6e5b4d9b76 --- /dev/null +++ b/code/datums/components/item_killsound.dm @@ -0,0 +1,41 @@ +/datum/component/item_killsound + /// list of allowed types, not null/empty + var/list/allowed_mobs + /// list of blacklisted types + var/list/blacklisted_mobs + var/killsound + var/killsound_volume = 100 + /** + * on true will act as replacement for mob's death sound, + * otherwise it will just play sound on death + */ + var/replace_default_death_sound + +/datum/component/item_killsound/Initialize( + allowed_mobs, + blacklisted_mobs, + killsound, + killsound_volume = 100, + replace_default_death_sound = FALSE +) + src.allowed_mobs = allowed_mobs + src.blacklisted_mobs = blacklisted_mobs + src.killsound = killsound + src.killsound_volume = killsound_volume + src.replace_default_death_sound = replace_default_death_sound + +/datum/component/item_killsound/RegisterWithParent() + var/obj/item/item_parent = parent + RegisterSignal(item_parent, COMSIG_ITEM_ATTACK, PROC_REF(on_attack)) + +/datum/component/item_killsound/proc/on_attack(host, target_mob, user, params) + SIGNAL_HANDLER + + if(!allowed_mobs || is_type_in_list(target_mob, allowed_mobs)) + if(is_type_in_list(target_mob, blacklisted_mobs)) + return + var/mob/living/mob = target_mob + if(replace_default_death_sound) + mob.apply_status_effect(/datum/status_effect/replace_death_sound, 1 SECONDS, killsound) + else + mob.apply_status_effect(/datum/status_effect/death_sound, 1 SECONDS, killsound, killsound_volume) diff --git a/code/datums/status_effects/death_sound.dm b/code/datums/status_effects/death_sound.dm new file mode 100644 index 00000000000..b71c070729a --- /dev/null +++ b/code/datums/status_effects/death_sound.dm @@ -0,0 +1,46 @@ +/datum/status_effect/death_sound + id = "death_sound" + tick_interval = -1 + alert_type = null + status_type = STATUS_EFFECT_REPLACE + var/death_sound + var/death_sound_volume = 100 + +/datum/status_effect/death_sound/on_creation(mob/living/new_owner, duration, death_sound, death_sound_volume = 100) + src.duration = duration + src.death_sound = death_sound + src.death_sound_volume = death_sound_volume + return ..() + +/datum/status_effect/death_sound/on_apply() + RegisterSignal(owner, COMSIG_LIVING_DEATH, PROC_REF(on_death)) + return TRUE + +/datum/status_effect/death_sound/proc/on_death() + SIGNAL_HANDLER + playsound(owner, death_sound, death_sound_volume, FALSE) + +/datum/status_effect/death_sound/on_remove() + UnregisterSignal(owner, COMSIG_LIVING_DEATH) + + +/datum/status_effect/replace_death_sound + id = "replace_death_sound" + tick_interval = -1 + alert_type = null + status_type = STATUS_EFFECT_REPLACE + var/death_sound + var/old_death_sound + +/datum/status_effect/replace_death_sound/on_creation(mob/living/new_owner, duration, death_sound) + src.duration = duration + src.death_sound = death_sound + return ..() + +/datum/status_effect/replace_death_sound/on_apply() + old_death_sound = owner.death_sound + owner.death_sound = death_sound + return TRUE + +/datum/status_effect/replace_death_sound/on_remove() + owner.death_sound = old_death_sound diff --git a/code/game/objects/items/weaponry.dm b/code/game/objects/items/weaponry.dm index fa3aadbae95..21247879dc1 100644 --- a/code/game/objects/items/weaponry.dm +++ b/code/game/objects/items/weaponry.dm @@ -432,6 +432,42 @@ for further reading, please see: https://github.com/tgstation/tgstation/pull/301 pain_mult = 0 jostle_pain_mult = 0 +/obj/item/carpenter_hammer + name = "carpenter hammer" + icon = 'icons/obj/weapons/hammer.dmi' + icon_state = "carpenter_hammer" + inhand_icon_state = "carpenter_hammer" + lefthand_file = 'icons/mob/inhands/weapons/hammers_lefthand.dmi' + righthand_file = 'icons/mob/inhands/weapons/hammers_righthand.dmi' + desc = "Uncanny looking hammer." + force = 20 + throwforce = 20 + throw_range = 4 + w_class = WEIGHT_CLASS_NORMAL + wound_bonus = 20 + demolition_mod = 1.25 + +/obj/item/carpenter_hammer/Initialize(mapload) + . = ..() + AddComponent(/datum/component/item_killsound, \ + allowed_mobs = list(/mob/living/carbon/human), \ + killsound = 'sound/items/weapons/hammer_death_scream.ogg', \ + replace_default_death_sound = TRUE, \ + ) + +/obj/item/carpenter_hammer/examine(mob/user) + . = ..() + . += "" + . += "Real World Tip:" + . += pick( + "Every building, from hospitals to homes, has a room that serves as the heart of the building \ + and carries blood and nutrients to its extremities. Try to find the heart of your home!", + "All the food you've tried is rotten. You've never eaten fresh food.", + "Viruses do not exist. Illness is simply your body punishing you for what you have done wrong.", + "Space stations must have at least 50 mammalian teeth embedded in the north walls for structural safety reasons.", + "Queen dragonfly sleeps and smiles.", + ) + /obj/item/switchblade name = "switchblade" icon = 'icons/obj/weapons/sword.dmi' diff --git a/code/modules/cargo/markets/market_items/weapons.dm b/code/modules/cargo/markets/market_items/weapons.dm index 94aa533c26e..f9fd6245c8d 100644 --- a/code/modules/cargo/markets/market_items/weapons.dm +++ b/code/modules/cargo/markets/market_items/weapons.dm @@ -64,6 +64,16 @@ stock_max = 3 availability_prob = 45 +/datum/market_item/weapon/carpenter_hammer + name = "Carpenter hammer" + desc = "When you really want to look like a psycho..." + item = /obj/item/carpenter_hammer + + price_min = CARGO_CRATE_VALUE * 1 + price_max = CARGO_CRATE_VALUE * 1.25 + stock_max = 2 + availability_prob = 65 + /datum/market_item/weapon/emp_grenade name = "EMP Grenade" desc = "Use this grenade for SHOCKING results!" diff --git a/icons/mob/inhands/weapons/hammers_lefthand.dmi b/icons/mob/inhands/weapons/hammers_lefthand.dmi index d065edd86e7..aaae035e056 100644 Binary files a/icons/mob/inhands/weapons/hammers_lefthand.dmi and b/icons/mob/inhands/weapons/hammers_lefthand.dmi differ diff --git a/icons/mob/inhands/weapons/hammers_righthand.dmi b/icons/mob/inhands/weapons/hammers_righthand.dmi index 022b281e462..6ff58389894 100644 Binary files a/icons/mob/inhands/weapons/hammers_righthand.dmi and b/icons/mob/inhands/weapons/hammers_righthand.dmi differ diff --git a/icons/obj/weapons/hammer.dmi b/icons/obj/weapons/hammer.dmi index 751e6267798..2b4e0cc8204 100644 Binary files a/icons/obj/weapons/hammer.dmi and b/icons/obj/weapons/hammer.dmi differ diff --git a/sound/attributions.txt b/sound/attributions.txt index d30d761dbb7..a6cbf21f836 100644 --- a/sound/attributions.txt +++ b/sound/attributions.txt @@ -215,3 +215,5 @@ https://freesound.org/people/C_Rogers/sounds/203368/ -- glass-shattering-hit_01. https://freesound.org/people/Czarcazas/sounds/330800/ -- Audio reversal/fading of Shattering Glass (Small) by Czarcazas -- https://freesound.org/s/330800/ -- License: Attribution 3.0 sound/effects/bonk.ogg - recorded by oranges on a coke zero bottle, edited by ninjanomnom, released to public domain + +sound\items\weapons\hammer_death_scream.ogg - Undefeatablesos' scream recorded by Niron3206, edited by Niron3206, License: Creative Commons 0 diff --git a/sound/items/weapons/hammer_death_scream.ogg b/sound/items/weapons/hammer_death_scream.ogg new file mode 100644 index 00000000000..cff35f23281 Binary files /dev/null and b/sound/items/weapons/hammer_death_scream.ogg differ diff --git a/tgstation.dme b/tgstation.dme index ef1b1ca5afc..09ca182f512 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1152,6 +1152,7 @@ #include "code\datums\components\interaction_booby_trap.dm" #include "code\datums\components\irradiated.dm" #include "code\datums\components\item_equipped_movement_rustle.dm" +#include "code\datums\components\item_killsound.dm" #include "code\datums\components\itembound.dm" #include "code\datums\components\itempicky.dm" #include "code\datums\components\jetpack.dm" @@ -1875,6 +1876,7 @@ #include "code\datums\status_effects\_status_effect_helpers.dm" #include "code\datums\status_effects\agent_pinpointer.dm" #include "code\datums\status_effects\buffs.dm" +#include "code\datums\status_effects\death_sound.dm" #include "code\datums\status_effects\drug_effects.dm" #include "code\datums\status_effects\gas.dm" #include "code\datums\status_effects\grouped_effect.dm"