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
+3 -3
View File
@@ -10,7 +10,7 @@
var/health
var/burn_point
var/burning
var/hitsound = "swing_hit" //generic hit sound.
var/hitsound = /decl/sound_category/swing_hit_sound//generic hit sound.
var/storage_cost
var/slot_flags = 0 //This is used to determine on which slots an item can fit.
var/no_attack_log = 0 //If it's an item we don't want to log attack_logs with, set this to 1
@@ -53,9 +53,9 @@
///Sound used when equipping the item into a valid slot
var/equip_sound = null
///Sound uses when picking the item up (into your hands)
var/pickup_sound = "generic_pickup"
var/pickup_sound = /decl/sound_category/generic_pickup_sound
///Sound uses when dropping the item, or when its thrown.
var/drop_sound = "generic_drop" // drop sound - this is the default
var/drop_sound = /decl/sound_category/generic_drop_sound // drop sound - this is the default
//Item_state definition moved to /obj
//var/item_state = null // Used to specify the item state for the on-mob overlays.
@@ -234,7 +234,7 @@
/obj/item/device/lightreplacer/emag_act(var/remaining_charges, var/mob/user)
emagged = !emagged
playsound(src.loc, "sparks", 100, 1)
playsound(src.loc, /decl/sound_category/spark_sound, 100, 1)
update_icon()
return 1
@@ -48,7 +48,7 @@ var/global/list/default_medbay_channels = list(
matter = list(DEFAULT_WALL_MATERIAL = 75, MATERIAL_GLASS = 25)
var/const/FREQ_LISTENING = TRUE
var/list/internal_channels
var/clicksound = "button" //played sound on usage
var/clicksound = /decl/sound_category/button_sound //played sound on usage
var/clickvol = 10 //volume
+2 -2
View File
@@ -306,8 +306,8 @@
icon_state = "katana"
item_state = "katana"
drop_sound = 'sound/items/drop/gun.ogg'
pickup_sound = "pickup_sword"
equip_sound = "equip_sword"
pickup_sound = /decl/sound_category/sword_pickup_sound
equip_sound = /decl/sound_category/sword_equip_sound
flags = CONDUCT
slot_flags = SLOT_BELT | SLOT_BACK
force = 5
@@ -6,5 +6,5 @@
/obj/item/grenade/fake/prime()
active = 0
playsound(src.loc, get_sfx("explosion"), 50, 1, 30)
playsound(src.loc, get_sfx(/decl/sound_category/explosion_sound), 50, 1, 30)
icon_state = "frag"
@@ -17,8 +17,8 @@
can_embed = 0
var/parry_chance = 40
drop_sound = 'sound/items/drop/sword.ogg'
pickup_sound = "pickup_sword"
equip_sound = "equip_sword"
pickup_sound = /decl/sound_category/sword_pickup_sound
equip_sound = /decl/sound_category/sword_equip_sound
/obj/item/material/sword/handle_shield(mob/user, var/on_back, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
var/parry_bonus = 1
@@ -21,7 +21,7 @@
var/wielded = 0
var/force_wielded = 0
var/force_unwielded
var/wield_sound = "wield_generic"
var/wield_sound = /decl/sound_category/generic_wield_sound
var/unwield_sound = null
var/base_icon
var/base_name
@@ -34,8 +34,8 @@
slot_r_hand_str = 'icons/mob/items/weapons/righthand_twohanded.dmi'
)
drop_sound = 'sound/items/drop/sword.ogg'
pickup_sound = "pickup_sword"
equip_sound = "equip_sword"
pickup_sound = /decl/sound_category/sword_pickup_sound
equip_sound = /decl/sound_category/sword_equip_sound
hitsound = 'sound/weapons/bladeslice.ogg'
/obj/item/material/twohanded/proc/wield()
@@ -88,7 +88,7 @@
/obj/item/material/twohanded/handle_shield(mob/user, var/on_back, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
if(wielded && default_parry_check(user, attacker, damage_source) && prob(parry_chance))
user.visible_message("<span class='danger'>\The [user] parries [attack_text] with \the [src]!</span>")
playsound(user.loc, "punchmiss", 50, 1)
playsound(user.loc, /decl/sound_category/punchmiss_sound, 50, 1)
return 1
return 0
@@ -324,8 +324,8 @@
active_w_class = 3
w_class = 3
drop_sound = 'sound/items/drop/sword.ogg'
pickup_sound = "pickup_sword"
equip_sound = "equip_sword"
pickup_sound = /decl/sound_category/sword_pickup_sound
equip_sound = /decl/sound_category/sword_equip_sound
/obj/item/melee/energy/sword/powersword/activate(mob/living/user)
..()
@@ -42,7 +42,7 @@
var/obj/item/melee/energy/blade/blade = W
blade.spark_system.queue()
playsound(src.loc, 'sound/weapons/blade.ogg', 50, 1)
playsound(src.loc, "sparks", 50, 1)
playsound(src.loc, /decl/sound_category/spark_sound, 50, 1)
if(!locked)
..()
else
@@ -3,7 +3,7 @@
desc = "It's a small container with dice inside."
icon = 'icons/obj/dice.dmi'
icon_state = "dicebag"
use_sound = "rustle"
use_sound = /decl/sound_category/rustle_sound
drop_sound = 'sound/items/drop/hat.ogg'
pickup_sound = 'sound/items/pickup/hat.ogg'
starts_with = list(
@@ -29,8 +29,8 @@
icon_state = "card_holder_empty"
can_hold = list(/obj/item/deck, /obj/item/battle_monsters/deck, /obj/item/hand, /obj/item/pack/, /obj/item/card) //sneaky folks can hide ID and other cards
storage_slots = 1 //can hold one deck
use_sound = "sound/items/drop/shoes.ogg"
drop_sound = "sound/items/drop/hat.ogg"
use_sound = 'sound/items/drop/shoes.ogg'
drop_sound = 'sound/items/drop/hat.ogg'
/obj/item/storage/card/update_icon()
if(contents.len)
@@ -38,7 +38,7 @@
var/obj/item/melee/energy/blade/blade = W
blade.spark_system.queue()
playsound(src.loc, 'sound/weapons/blade.ogg', 50, 1)
playsound(src.loc, "sparks", 50, 1)
playsound(src.loc, /decl/sound_category/spark_sound, 50, 1)
return
if (W.isscrewdriver())
@@ -37,7 +37,7 @@
var/allow_quick_empty //Set this variable to allow the object to have the 'empty' verb, which dumps all the contents on the floor.
var/allow_quick_gather //Set this variable to allow the object to have the 'toggle mode' verb, which quickly collects all items from a tile.
var/collection_mode = 1 //0 = pick one at a time, 1 = pick all on tile
var/use_sound = "rustle" //sound played when used. null for no sound.
var/use_sound = /decl/sound_category/rustle_sound //sound played when used. null for no sound.
var/list/starts_with // for pre-filled items
var/empty_delay = 0 SECOND // time it takes to empty bag. this is multiplies by number of objects stored
+1 -1
View File
@@ -94,7 +94,7 @@
if(bcell && bcell.charge > hitcost)
status = !status
to_chat(user, "<span class='notice'>[src] is now [status ? "on" : "off"].</span>")
playsound(loc, "sparks", 75, 1, -1)
playsound(loc, /decl/sound_category/spark_sound, 75, 1, -1)
update_icon()
else
status = 0
@@ -66,7 +66,7 @@
desc = "You can drill using this item. You dig?"
icon_state = "drill"
item_state = "drill"
hitsound = "drillhit"
hitsound = /decl/sound_category/drillhit_sound
matter = list(DEFAULT_WALL_MATERIAL = 15000, MATERIAL_GLASS = 10000)
flags = CONDUCT
force = 15.0
+1 -1
View File
@@ -602,7 +602,7 @@
w_class = ITEMSIZE_SMALL
drop_sound = 'sound/items/drop/crowbar.ogg'
pickup_sound = 'sound/items/pickup/crowbar.ogg'
usesound = "crowbar"
usesound = /decl/sound_category/crowbar_sound
origin_tech = list(TECH_ENGINEERING = 1)
matter = list(DEFAULT_WALL_MATERIAL = 50)
attack_verb = list("attacked", "bashed", "battered", "bludgeoned", "whacked")
@@ -385,7 +385,7 @@
icon = 'icons/obj/vaurca_items.dmi'
icon_state = "gaussrifle"
item_state = "gaussrifle"
fire_sound = "gauss_fire"
fire_sound = /decl/sound_category/gauss_fire_sound
fire_sound_text = "a subdued boom"
fire_delay = 12
slot_flags = SLOT_BACK
+2 -2
View File
@@ -163,8 +163,8 @@
hitsound = 'sound/weapons/bladeslice.ogg'
contained_sprite = TRUE
drop_sound = 'sound/items/drop/sword.ogg'
pickup_sound = "pickup_sword"
equip_sound = "equip_sword"
pickup_sound = /decl/sound_category/sword_pickup_sound
equip_sound = /decl/sound_category/sword_equip_sound
/obj/item/sord
name = "\improper SORD"
+2 -2
View File
@@ -117,7 +117,7 @@ LINEN BINS
if (do_after(user, 25, src))
if(user.loc != loc)
user.do_attack_animation(src)
playsound(get_turf(loc), "rustle", 15, 1, -5)
playsound(get_turf(loc), /decl/sound_category/rustle_sound, 15, 1, -5)
var/folds = fold
user.visible_message(SPAN_NOTICE("\The [user] [folds ? "unfolds" : "folds"] \the [src]."),
SPAN_NOTICE("You [fold ? "unfold" : "fold"] \the [src]."))
@@ -151,7 +151,7 @@ LINEN BINS
if (do_after(user, 6, src))
if(user.loc != loc)
user.do_attack_animation(src)
playsound(get_turf(loc), "rustle", 15, 1, -5)
playsound(get_turf(loc), /decl/sound_category/rustle_sound, 15, 1, -5)
var/rolls = roll
user.visible_message(SPAN_NOTICE("\The [user] [rolls ? "unrolls" : "rolls"] \the [src]."),
SPAN_NOTICE("You [roll ? "unroll" : "roll"] \the [src]."))
@@ -82,7 +82,7 @@
if(emag_act(INFINITY, user, "The locker has been sliced open by [user] with \an [blade]!", "You hear metal being sliced and sparks flying."))
blade.spark_system.queue()
playsound(loc, 'sound/weapons/blade.ogg', 50, 1)
playsound(loc, "sparks", 50, 1)
playsound(loc, /decl/sound_category/spark_sound, 50, 1)
else
to_chat(user, "<span class='warning'>Access Denied</span>")
return
@@ -170,7 +170,7 @@
if(emag_act(INFINITY, user, "<span class='danger'>The locker has been sliced open by [user] with \an [W]</span>!", "<span class='danger'>You hear metal being sliced and sparks flying.</span>"))
spark(src, 5)
playsound(loc, 'sound/weapons/blade.ogg', 50, 1)
playsound(loc, "sparks", 50, 1)
playsound(loc, /decl/sound_category/spark_sound, 50, 1)
else if(W.iswelder())
var/obj/item/weldingtool/WT = W
if(WT.isOn())
@@ -351,7 +351,7 @@
add_overlay(emag)
add_overlay(sparks)
CUT_OVERLAY_IN(sparks, 6)
playsound(loc, "sparks", 60, 1)
playsound(loc, /decl/sound_category/spark_sound, 60, 1)
locked = 0
broken = 1
to_chat(user, "<span class='notice'>You unlock \the [src].</span>")
+1 -1
View File
@@ -40,7 +40,7 @@
src.density = 0
src.destroyed = 1
new /obj/item/material/shard( src.loc )
playsound(src, "glass_break", 70, 1)
playsound(src, /decl/sound_category/glass_break_sound, 70, 1)
update_icon()
else
playsound(src.loc, 'sound/effects/glass_hit.ogg', 75, 1)
@@ -278,7 +278,7 @@
if (S)
if (S.get_amount() >= 1)
if(material_name == "rglass")
playsound(src.loc, "crowbar", 100, 1)
playsound(src.loc, /decl/sound_category/crowbar_sound, 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40) && !glass)
if (S.use(1))
@@ -290,7 +290,7 @@
to_chat(user, "You cannot make an airlock out of that material.")
return
if(S.get_amount() >= 2)
playsound(src.loc, "crowbar", 100, 1)
playsound(src.loc, /decl/sound_category/crowbar_sound, 100, 1)
user.visible_message("[user] adds [S.name] to the airlock assembly.", "You start to install [S.name] into the airlock assembly.")
if(do_after(user, 40) && !glass)
if (S.use(2))
@@ -23,7 +23,7 @@
shattered = 1
unlocked = 1
open = 1
playsound(user, "glass_break", 100, 1)
playsound(user, /decl/sound_category/glass_break_sound, 100, 1)
update_icon()
/obj/structure/fireaxecabinet/update_icon()
+1 -1
View File
@@ -21,7 +21,7 @@
/obj/structure/grille,
/turf/unsimulated/mineral/asteroid
)
footstep_sound = "catwalk"
footstep_sound = /decl/sound_category/catwalk_footstep
/obj/structure/lattice/Initialize()
. = ..()
+1 -1
View File
@@ -28,7 +28,7 @@
if(shattered) return
shattered = 1
icon_state = "mirror_broke"
playsound(src, "glass_break", 70, 1)
playsound(src, /decl/sound_category/glass_break_sound, 70, 1)
desc = "Oh no, seven years of bad luck!"
+4 -4
View File
@@ -60,13 +60,13 @@
playsound(loc, 'sound/effects/glass_hit.ogg', 100, 1)
if(health < maxhealth / 4 && initialhealth >= maxhealth / 4)
visible_message(SPAN_DANGER("[src] looks like it's about to shatter!"))
playsound(loc, "glasscrack", 100, 1)
playsound(loc, /decl/sound_category/glasscrack_sound, 100, 1)
else if(health < maxhealth / 2 && initialhealth >= maxhealth / 2)
visible_message(SPAN_WARNING("[src] looks seriously damaged!"))
playsound(loc, "glasscrack", 100, 1)
playsound(loc, /decl/sound_category/glasscrack_sound, 100, 1)
else if(health < maxhealth * 3/4 && initialhealth >= maxhealth * 3/4)
visible_message(SPAN_WARNING("Cracks begin to appear in [src]!"))
playsound(loc, "glasscrack", 100, 1)
playsound(loc, /decl/sound_category/glasscrack_sound, 100, 1)
return
/obj/structure/window/proc/apply_silicate(var/amount)
@@ -87,7 +87,7 @@
add_overlay(img)
/obj/structure/window/proc/shatter(var/display_message = 1)
playsound(src, "glass_break", 70, 1)
playsound(src, /decl/sound_category/glass_break_sound, 70, 1)
if(display_message)
visible_message(SPAN_WARNING("\The [src] shatters!"))
if(dir == SOUTHWEST)