Skip to content

Commit

Permalink
Merge pull request #382 from Sandstorm-Station/sounds-accept-lists
Browse files Browse the repository at this point in the history
Allows simple interactions to have varied sounds
  • Loading branch information
SandPoot authored Aug 4, 2024
2 parents 109b8c7 + ea9c4f0 commit e398b87
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modular_sand/code/datums/interactions/_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,15 @@
/datum/interaction/proc/post_interaction(mob/living/user, mob/living/target)
COOLDOWN_START(user, last_interaction_time, 0.6 SECONDS)
if(interaction_sound)
playsound(get_turf(user), interaction_sound, 50, 1, -1)
var/soundfile_to_play

// pickweight so you can make a certain sound play
// more times. This does NOT mean you are forced to
// use the system. If you do not make the list
// associative, all options will have the same chances!
if(islist(interaction_sound))
soundfile_to_play = pickweight(interaction_sound)
else
soundfile_to_play = interaction_sound
playsound(get_turf(user), soundfile_to_play, 50, 1, -1)
return

0 comments on commit e398b87

Please sign in to comment.