mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-28 18:11:16 +00:00
* Adds an element for noisy movement (wheelchairs, office chairs, trashcarts etc. etc.) (#76378) ## About The Pull Request Converts generic, copypasted behavior into an element. ## Why It's Good For The Game I'd rather not have someone just copypaste the old thing, since there're a few more things to take into account now than just whether the item has gravity, and if that ever has to change, we will only have to modify one line than several. ## Changelog 🆑 fix: Fixed the office chair being silent. My bad. /🆑 * Adds an element for noisy movement (wheelchairs, office chairs, trashcarts etc. etc.) --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
22 lines
693 B
Plaintext
22 lines
693 B
Plaintext
/datum/element/noisy_movement
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
var/movement_sound
|
|
var/volume
|
|
|
|
/datum/element/noisy_movement/Attach(datum/target, movement_sound = 'sound/effects/roll.ogg', volume = 100)
|
|
. = ..()
|
|
if(!ismovable(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
src.movement_sound = movement_sound
|
|
src.volume = volume
|
|
|
|
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(play_sound))
|
|
|
|
/datum/element/noisy_movement/proc/play_sound(atom/movable/source, old_loc, movement_dir, forced)
|
|
SIGNAL_HANDLER
|
|
if(!forced && !CHECK_MOVE_LOOP_FLAGS(source, MOVEMENT_LOOP_OUTSIDE_CONTROL) && source.has_gravity())
|
|
playsound(source, movement_sound, volume, TRUE)
|
|
|