Refactors sound groups to use decls instead of a massive switch with dozens of global lists. (#9702)

This commit is contained in:
Matt Atlas
2020-08-28 20:47:00 +02:00
committed by GitHub
parent db1b0cece0
commit 0dd08df5b2
125 changed files with 629 additions and 557 deletions
+1 -1
View File
@@ -307,7 +307,7 @@
var/mob/living/simple_animal/S = M
S.adjustBruteLoss(15)
do_attack_animation(M)
playsound(loc, "swing_hit", 50, 1, -1)
playsound(loc, /decl/sound_category/swing_hit_sound, 50, 1, -1)
is_attacking = 1
update_icon()
addtimer(CALLBACK(src, .proc/stop_attacking_cb), 2)
@@ -40,7 +40,7 @@
step_away(src,M,15)
sleep(3)
step_away(src,M,15)
playsound(loc, "punch", 25, 1, -1)
playsound(loc, /decl/sound_category/punch_sound, 25, 1, -1)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("<span class='danger'>[] has punched []!</span>", M, src), 1)
@@ -52,7 +52,7 @@
adjustBruteLoss(damage)
updatehealth()
else
playsound(loc, "punchmiss", 25, 1, -1)
playsound(loc, /decl/sound_category/punchmiss_sound, 25, 1, -1)
for(var/mob/O in viewers(src, null))
if ((O.client && !( O.blinded )))
O.show_message(text("<span class='danger'>[] has attempted to punch []!</span>", M, src), 1)
+1 -1
View File
@@ -143,7 +143,7 @@
return 0
src.apply_damage(shock_damage, BURN, def_zone, used_weapon="Electrocution")
playsound(loc, "sparks", 50, 1, -1)
playsound(loc, /decl/sound_category/spark_sound, 50, 1, -1)
if(shock_damage > 15 || tesla_shock)
src.visible_message(
SPAN_WARNING("[src] was shocked by the [source]!"), \
@@ -559,7 +559,7 @@
apply_damage(shock_damage, BURN, area, used_weapon="Electrocution")
shock_damage *= 0.4
playsound(loc, "sparks", 50, 1, -1)
playsound(loc, /decl/sound_category/spark_sound, 50, 1, -1)
if (shock_damage > 15)
visible_message(
@@ -1715,11 +1715,11 @@
if(self)
U.visible_message(SPAN_DANGER("[U] pops their [current_limb.joint] back in!"), \
SPAN_DANGER("You pop your [current_limb.joint] back in!"))
playsound(src.loc, "fracture", 50, 1, -2)
playsound(src.loc, /decl/sound_category/fracture_sound, 50, 1, -2)
else
U.visible_message(SPAN_DANGER("[U] pops [S]'s [current_limb.joint] back in!"), \
SPAN_DANGER("You pop [S]'s [current_limb.joint] back in!"))
playsound(src.loc, "fracture", 50, 1, -2)
playsound(src.loc, /decl/sound_category/fracture_sound, 50, 1, -2)
current_limb.undislocate()
/mob/living/carbon/human/drop_from_inventory(var/obj/item/W, var/atom/target = null)
@@ -80,7 +80,7 @@
H.do_attack_animation(src)
var/damage = rand(0, 9)
if(!damage)
playsound(loc, "punchmiss", 25, 1, -1)
playsound(loc, /decl/sound_category/punchmiss_sound, 25, 1, -1)
visible_message("<span class='danger'>[H] has attempted to punch [src]!</span>")
return 0
var/obj/item/organ/external/affecting = get_organ(ran_zone(H.zone_sel.selecting))
@@ -89,7 +89,7 @@
if(HULK in H.mutations)
damage += 5
playsound(loc, "punch", 25, 1, -1)
playsound(loc, /decl/sound_category/punch_sound, 25, 1, -1)
visible_message("<span class='danger'>[H] has punched [src]!</span>")
@@ -455,7 +455,7 @@
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
return
playsound(loc, "punchmiss", 25, 1, -1)
playsound(loc, /decl/sound_category/punchmiss_sound, 25, 1, -1)
visible_message("<span class='danger'>[M] attempted to disarm [src]!</span>")
return
@@ -19,7 +19,7 @@ emp_act
if(martial_art && martial_art.deflection_chance)
if(prob(martial_art.deflection_chance))
src.visible_message("<span class='danger'>\The [src] deflects \the [P]!</span>")
playsound(src, "bulletflyby_sound", 75, 1)
playsound(src, /decl/sound_category/bulletflyby_sound, 75, 1)
return 0
def_zone = check_zone(def_zone)
@@ -102,7 +102,7 @@
var/list/equipment_overlays = list() // Extra overlays from equipped items
var/is_noisy = FALSE // if TRUE, movement should make sound.
var/bodyfall_sound = "bodyfall"
var/bodyfall_sound = /decl/sound_category/bodyfall_sound
var/last_x = 0
var/last_y = 0
@@ -241,7 +241,7 @@
var/default_accent = ACCENT_CETI
var/zombie_type //What zombie species they become
var/list/character_color_presets
var/bodyfall_sound = "bodyfall" //default, can be used for species specific falling sounds
var/bodyfall_sound = /decl/sound_category/bodyfall_sound //default, can be used for species specific falling sounds
/datum/species/proc/get_eyes(var/mob/living/carbon/human/H)
return
@@ -378,7 +378,7 @@ var/global/list/golem_types = list(SPECIES_GOLEM_COAL,
death_message = "shatters into many shards!"
death_message_range = 7
death_sound = "glass_break"
death_sound = /decl/sound_category/glass_break_sound
heat_level_1 = T0C+350
heat_level_2 = T0C+550
@@ -114,7 +114,7 @@
allowed_citizenships = list(CITIZENSHIP_NONE, CITIZENSHIP_BIESEL, CITIZENSHIP_COALITION, CITIZENSHIP_ERIDANI, CITIZENSHIP_ELYRA, CITIZENSHIP_GOLDEN)
default_citizenship = CITIZENSHIP_NONE
bodyfall_sound = "bodyfall_machine"
bodyfall_sound = /decl/sound_category/bodyfall_machine_sound
allowed_accents = list(ACCENT_CETI, ACCENT_GIBSON, ACCENT_SOL, ACCENT_COC, ACCENT_ERIDANI, ACCENT_ERIDANIDREG, ACCENT_ELYRA, ACCENT_KONYAN, ACCENT_JUPITER, ACCENT_MARTIAN, ACCENT_LUNA,
ACCENT_HIMEO, ACCENT_VENUS, ACCENT_VENUSJIN, ACCENT_PHONG, ACCENT_TTS)
@@ -71,7 +71,7 @@
/mob/living/carbon/human/proc/check_tag,
/mob/living/carbon/human/proc/tie_hair)
bodyfall_sound = "bodyfall"
bodyfall_sound = /decl/sound_category/bodyfall_sound
allowed_accents = list(ACCENT_CETI, ACCENT_GIBSON, ACCENT_SOL, ACCENT_COC, ACCENT_ERIDANI, ACCENT_ERIDANIDREG, ACCENT_ELYRA, ACCENT_KONYAN, ACCENT_JUPITER, ACCENT_MARTIAN, ACCENT_LUNA,
ACCENT_HIMEO, ACCENT_VENUS, ACCENT_VENUSJIN, ACCENT_PHONG, ACCENT_SILVERSUN, ACCENT_TTS)
@@ -5,8 +5,8 @@ var/global/list/sparring_attack_cache = list()
var/attack_verb = list("attack") // Empty hand hurt intent verb.
var/attack_noun = list("fist")
var/damage = 0 // Extra empty hand attack damage.
var/attack_sound = "punch"
var/miss_sound = "punchmiss"
var/attack_sound = /decl/sound_category/punch_sound
var/miss_sound = /decl/sound_category/punchmiss_sound
var/shredding = 0 // Calls the old attack_alien() behavior on objects/mobs when on harm intent.
var/sharp = 0
var/edge = 0
@@ -197,7 +197,7 @@ var/global/list/sparring_attack_cache = list()
/datum/unarmed_attack/kick
attack_verb = list("kicked", "kicked", "kicked", "kneed")
attack_noun = list("kick", "kick", "kick", "knee strike")
attack_sound = "swing_hit"
attack_sound = /decl/sound_category/swing_hit_sound
damage = 0
attack_name = "kick"
@@ -242,7 +242,7 @@ var/global/list/sparring_attack_cache = list()
/datum/unarmed_attack/stomp
attack_verb = null
attack_noun = list("stomp")
attack_sound = "swing_hit"
attack_sound = /decl/sound_category/swing_hit_sound
damage = 0
attack_name = "stomp"
@@ -284,7 +284,7 @@
if(victim == M)
if(prob(60))
visible_message(SPAN_WARNING("[M] attempts to wrestle \the [name] off!"))
playsound(loc, "punchmiss", 25, 1, -1)
playsound(loc, /decl/sound_category/punchmiss_sound, 25, 1, -1)
else
visible_message(SPAN_WARNING("[M] manages to wrestle \the [name] off!"))
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
@@ -305,7 +305,7 @@
else
if(prob(30))
visible_message(SPAN_WARNING("[M] attempts to wrestle \the [name] off of [victim]!"))
playsound(loc, "punchmiss", 25, 1, -1)
playsound(loc, /decl/sound_category/punchmiss_sound, 25, 1, -1)
else
visible_message(SPAN_WARNING("[M] manages to wrestle \the [name] off of [victim]!"))
playsound(loc, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
@@ -364,14 +364,14 @@
sleep(3)
step_away(src,M,15)
playsound(loc, "punch", 25, 1, -1)
playsound(loc, /decl/sound_category/punch_sound, 25, 1, -1)
visible_message(SPAN_DANGER("[M] has punched [src]!"), \
SPAN_DANGER("[M] has punched [src]!"))
adjustBruteLoss(damage)
updatehealth()
else
playsound(loc, "punchmiss", 25, 1, -1)
playsound(loc, /decl/sound_category/punchmiss_sound, 25, 1, -1)
visible_message(SPAN_DANGER("[M] has attempted to punch [src]!"))
return
@@ -695,7 +695,7 @@
update_icon()
if(do_after(src, 32))
src.visible_message(SPAN_WARNING("[src] rips up \the [T]."))
playsound(src.loc, "crowbar", 100, 1)
playsound(src.loc, /decl/sound_category/crowbar_sound, 100, 1)
T.make_plating(1)
busy = 0
update_icon()
@@ -246,7 +246,7 @@ mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = TH
if(casingtype)
new casingtype(get_turf(src))
playsound(src, "casing_drop", 50, 1)
playsound(src, /decl/sound_category/casing_drop_sound, 50, 1)
stance = HOSTILE_STANCE_IDLE
target_mob = null
@@ -82,7 +82,7 @@
melee_damage_lower = 0
melee_damage_upper = 0
attacktext = "barrels into"
attack_sound = "punch"
attack_sound = /decl/sound_category/punch_sound
a_intent = I_HURT
speak_emote = list("chirps","buzzes","whirrs")
emote_hear = list("chirps cheerfully","buzzes","whirrs","hums placidly","chirps","hums")
@@ -694,7 +694,7 @@ mob/living/simple_animal/bullet_act(var/obj/item/projectile/Proj)
//Todo: add snowflakey shit to it.
/mob/living/simple_animal/electrocute_act(var/shock_damage, var/obj/source, var/base_siemens_coeff = 1.0, var/def_zone = null, var/tesla_shock = 0, var/ground_zero)
apply_damage(shock_damage, BURN)
playsound(loc, "sparks", 50, 1, -1)
playsound(loc, /decl/sound_category/spark_sound, 50, 1, -1)
spark(loc, 5, alldirs)
visible_message(SPAN_WARNING("\The [src] was shocked by \the [source]!"), SPAN_WARNING("You are shocked by \the [source]!"), SPAN_WARNING("You hear an electrical crack!"))
+1 -1
View File
@@ -108,7 +108,7 @@
target.apply_effect(20, PARALYZE)
target.visible_message("<span class='danger'>[target] [target.species.knockout_message]</span>")
playsound(attacker.loc, "swing_hit", 25, 1, -1)
playsound(attacker.loc, /decl/sound_category/swing_hit_sound, 25, 1, -1)
attacker.attack_log += text("\[[time_stamp()]\] <font color='red'>Headbutted [target.name] ([target.ckey])</font>")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Headbutted by [attacker.name] ([attacker.ckey])</font>")
msg_admin_attack("[key_name(attacker)] has headbutted [key_name(target)]",ckey=key_name(attacker),ckey_target=key_name(target))