forked from tgstation/tgstation
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## About The Pull Request Мегре апстрим
- Loading branch information
Showing
54 changed files
with
458 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Oops, something went wrong.