Surgery sounds 2: Now with volume mixer! (#26884)

* fuck it

* these too

* ooops

* i did it again

* moved some vars around

* updates generics

* rematch

* oh shit i think this needs a break

* agh

* wall

* updates comment

* compile after 2 years

* this might break things

* typo fix

* restores surgery sound to default

* Misplaced thingy

* support for some new ghetto surgery changes

* organ2

* Update code/modules/surgery/bones.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Bm0n <92271472+Bm0n@users.noreply.github.com>

* Update code/modules/surgery/surgery.dm

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: Bm0n <92271472+Bm0n@users.noreply.github.com>

* review change

---------

Signed-off-by: Bm0n <92271472+Bm0n@users.noreply.github.com>
Co-authored-by: Bmon <no@email.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
This commit is contained in:
Bm0n
2024-10-06 09:40:33 +00:00
committed by GitHub
co-authored by Luc Bmon
parent 413ddc8b73
commit 1b25a5b021
24 changed files with 155 additions and 2 deletions
+33
View File
@@ -197,6 +197,12 @@
var/silicons_ignore_prob = FALSE
/// How many times this step has been automatically repeated.
var/times_repeated = 0
/// Sound played when the step is started. Lists or single value can be used for this var as well as tool defines
var/preop_sound
/// Sound played if the step succeeded. Single value only
var/success_sound
/// Sound played if the step fails. Single value only
var/failure_sound
// evil infection stuff that will make everyone hate me
@@ -331,6 +337,8 @@
surgery.step_in_progress = FALSE
return SURGERY_INITIATE_SUCCESS
play_preop_sound(user, target, target_zone, tool, surgery)
if(tool)
speed_mod = tool.toolspeed
@@ -386,8 +394,10 @@
surgery.step_in_progress = FALSE
if(advance)
play_success_sound(user, target, target_zone, tool, surgery)
return SURGERY_INITIATE_SUCCESS
else
play_failure_sound(user, target, target_zone, tool, surgery)
return SURGERY_INITIATE_FAILURE
/**
@@ -553,3 +563,26 @@
for(var/reagent in chems_needed)
if(target.reagents.has_reagent(reagent))
return TRUE
/datum/surgery_step/proc/play_preop_sound(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(!preop_sound || (islist(preop_sound) && !length(preop_sound)) || ismachineperson(target))
return
var/sound_file_use
if(islist(preop_sound))
for(var/typepath in preop_sound)
if((ispath(typepath) && istype(tool, typepath)) || ((typepath in GLOB.surgery_tool_behaviors) && istype(tool) && tool.tool_behaviour == typepath))
sound_file_use = preop_sound[typepath]
break
else
sound_file_use = preop_sound
playsound(get_turf(target), sound_file_use, 75, TRUE, falloff_exponent = 12, falloff_distance = 1, channel = CHANNEL_SURGERY_SOUNDS)
/datum/surgery_step/proc/play_success_sound(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(!success_sound || ismachineperson(target))
return
playsound(get_turf(target), success_sound, 75, TRUE, falloff_exponent = 12, falloff_distance = 1, channel = CHANNEL_SURGERY_SOUNDS)
/datum/surgery_step/proc/play_failure_sound(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
if(!failure_sound || ismachineperson(target))
return
playsound(get_turf(target), failure_sound, 75, TRUE, falloff_exponent = 12, falloff_distance = 1, channel = CHANNEL_SURGERY_SOUNDS)