Item rustling component, riot armor and swat suit sounds (#87008)

## About The Pull Request


https://github.com/user-attachments/assets/665053dc-8b46-49a5-bbea-7e6bb8f81cd7

- added a new component called `item_equipped_movement_rustle` for
moving in zero-g and gravity with editable variables.
- gave riot suits and swat suits a new sound using this new component.
## Why It's Good For The Game
makes riot suits more immersive and allows us to implement it for other
items in the future.
## Changelog
🆑 grungussuss
sound: riot suits and swat suits now make noise when moving around in
them.
/🆑
This commit is contained in:
grungussuss
2024-11-11 00:43:40 -08:00
committed by Majkl-J
parent 3c06dfd003
commit 056e2c52e8
6 changed files with 82 additions and 1 deletions
@@ -0,0 +1,67 @@
/datum/component/item_equipped_movement_rustle
///sound that plays, use an SFX define if there is multiple.
var/rustle_sounds = SFX_SUIT_STEP
///human that has the item equipped.
var/mob/holder
///what move are we on.
var/move_counter = 0
///how many moves to take before playing the sound.
var/move_delay = 4
///volume at which the sound plays.
var/volume = 20
///does the sound vary?
var/sound_vary = TRUE
///extra-range for this component's sound.
var/sound_extra_range = -1
///sound exponent for the rustle.
var/sound_falloff_exponent = 5
///when sounds start falling off for the rustle rustle.
var/sound_falloff_distance = SOUND_DEFAULT_FALLOFF_DISTANCE
/datum/component/item_equipped_movement_rustle/Initialize(custom_sounds, move_delay_override, volume_override, extrarange, falloff_exponent, falloff_distance)
if(!isitem(parent))
return COMPONENT_INCOMPATIBLE
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(on_equip))
RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(on_unequip))
if(custom_sounds)
rustle_sounds = custom_sounds
if(isnum(volume_override))
volume = volume_override
if(isnum(move_delay_override))
move_delay = move_delay_override
if(isnum(extrarange))
sound_extra_range = extrarange
if(isnum(falloff_exponent))
sound_falloff_exponent = falloff_exponent
if(isnum(falloff_distance))
sound_falloff_distance = falloff_distance
/datum/component/item_equipped_movement_rustle/proc/on_equip(datum/source, mob/equipper, slot)
var/obj/item/our_item = parent
if(!(slot & our_item.slot_flags))
return
SIGNAL_HANDLER
holder = equipper
RegisterSignal(holder, COMSIG_MOVABLE_MOVED, PROC_REF(try_step), override = TRUE)
/datum/component/item_equipped_movement_rustle/proc/on_unequip(datum/source, mob/equipper, slot)
SIGNAL_HANDLER
move_counter = 0
UnregisterSignal(equipper, COMSIG_MOVABLE_MOVED)
holder = null
/datum/component/item_equipped_movement_rustle/proc/try_step(obj/item/clothing/source)
SIGNAL_HANDLER
move_counter++
if(move_counter >= move_delay)
play_rustle_sound()
move_counter = 0
/datum/component/item_equipped_movement_rustle/proc/play_rustle_sound()
playsound(parent, rustle_sounds, volume, sound_vary, sound_extra_range, sound_falloff_exponent, falloff_distance = sound_falloff_distance)
+4 -1
View File
@@ -229,7 +229,10 @@
if(SFX_CLOWN_STEP)
soundin = pick('sound/effects/footstep/clownstep1.ogg','sound/effects/footstep/clownstep2.ogg')
if(SFX_SUIT_STEP)
soundin = pick('sound/effects/suitstep1.ogg','sound/effects/suitstep2.ogg')
soundin = pick(
'sound/items/handling/armor_rustle/riot_armor/suitstep1.ogg',
'sound/items/handling/armor_rustle/riot_armor/suitstep2.ogg',
)
if(SFX_SWING_HIT)
soundin = pick('sound/items/weapons/genhit1.ogg', 'sound/items/weapons/genhit2.ogg', 'sound/items/weapons/genhit3.ogg')
if(SFX_HISS)
+10
View File
@@ -321,6 +321,10 @@
/obj/item/clothing/suit/armor/riot/Initialize(mapload)
. = ..()
AddComponent(/datum/component/adjust_fishing_difficulty, 5)
init_rustle_component()
/obj/item/clothing/suit/armor/riot/proc/init_rustle_component()
AddComponent(/datum/component/item_equipped_movement_rustle)
/datum/armor/armor_riot
melee = 50
@@ -444,6 +448,10 @@
/obj/item/clothing/suit/armor/swat/Initialize(mapload)
. = ..()
AddComponent(/datum/component/adjust_fishing_difficulty, 5)
init_rustle_component()
/obj/item/clothing/suit/armor/swat/proc/init_rustle_component()
AddComponent(/datum/component/item_equipped_movement_rustle)
//All of the armor below is mostly unused
@@ -543,6 +551,8 @@
/obj/item/tank/internals/emergency_oxygen,
/obj/item/tank/internals/plasmaman,
)
/obj/item/clothing/suit/armor/riot/knight/init_rustle_component()
return
/obj/item/clothing/suit/armor/riot/knight/yellow
icon_state = "knight_yellow"
+1
View File
@@ -1265,6 +1265,7 @@
#include "code\datums\components\infective.dm"
#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\itembound.dm"
#include "code\datums\components\itempicky.dm"
#include "code\datums\components\jetpack.dm"