Skip to content

Commit

Permalink
Adds more sound effects to the game (#560)
Browse files Browse the repository at this point in the history
* Adds more sound effects to the game

* Minor tweaks

* Crumpled paper flies further and faster

* Scanner sounds

* Clothes sound moved to jumpsuits only
  • Loading branch information
EgorDinamit authored Feb 25, 2024
1 parent 10fef37 commit 4feecb6
Show file tree
Hide file tree
Showing 57 changed files with 148 additions and 50 deletions.
5 changes: 5 additions & 0 deletions code/__defines/sound.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@
#define SMALL_SOFTFLOOR ROOM
#define ASTEROID CAVE
#define SPACE UNDERWATER

#define EQUIP_SOUND_VOLUME 30
#define PICKUP_SOUND_VOLUME 15
// Multiplied by item's weight class
#define INITIAL_THROW_IMPACT_SOUND_VOLUME 15
2 changes: 1 addition & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
L.source_atom.update_light()

//called when src is thrown into hit_atom
/atom/movable/proc/throw_impact(atom/hit_atom, var/datum/thrownthing/TT)
/atom/movable/proc/throw_impact(atom/hit_atom, datum/thrownthing/TT)
if(istype(hit_atom,/mob/living))
var/mob/living/M = hit_atom
M.hitby(src,TT)
Expand Down
63 changes: 54 additions & 9 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
var/burn_point = null
var/burning = null
var/hitsound = "swing_hit"
/// Sound that is played on throw impact with a living mob
var/mob_throw_hit_sound = null
/// Sound that is played on throw impact with anything other than a living mob
var/throw_impact_sound = null
/// Sound that is played whenever the item is equipped in hands
var/pickup_sound = null
/// Sound that is played whenever the item is equipped in its defined slot
var/equip_sound = null
var/slot_flags = 0 //This is used to determine on which slots an item can fit.
var/no_attack_log = FALSE //If it's an item we don't want to log attack_logs with, set this to 1
pass_flags = PASS_FLAG_TABLE
Expand Down Expand Up @@ -325,12 +333,14 @@
// slot uses the slot_X defines found in setup.dm
// for items that can be placed in multiple slots
// note this isn't called during the initial dressing of a player
/obj/item/proc/equipped(var/mob/user, var/slot)
/obj/item/proc/equipped(mob/user, slot)
hud_layerise()
if(user.client) user.client.screen |= src
if(user.pulling == src) user.stop_pulling()
if(user.client)
user.client.screen |= src
if(user.pulling == src)
user.stop_pulling()

//Update two-handing status
// Update two-handing status
var/mob/M = loc
if(!istype(M))
return
Expand All @@ -339,6 +349,14 @@
if(M.r_hand)
M.r_hand.update_twohanding()

// Sounds
if(equip_sound && ("[slot]" in slot_flags_enumeration))
var/req_flags = slot_flags_enumeration["[slot]"]
if((req_flags & slot_flags))
playsound(src, equip_sound, EQUIP_SOUND_VOLUME, TRUE, ignore_walls = FALSE)
else if(slot == slot_l_hand || slot == slot_r_hand)
playsound(src, pickup_sound, PICKUP_SOUND_VOLUME, ignore_walls = FALSE)

//Defines which slots correspond to which slot flags
var/list/global/slot_flags_enumeration = list(
"[slot_wear_mask]" = SLOT_MASK,
Expand All @@ -362,24 +380,27 @@ var/list/global/slot_flags_enumeration = list(
//Should probably move the bulk of this into mob code some time, as most of it is related to the definition of slots and not item-specific
//set force to ignore blocking overwear and occupied slots
/obj/item/proc/mob_can_equip(M as mob, slot, disable_warning = 0, force = 0)
if(!slot) return 0
if(!M) return 0
if(!slot)
return FALSE
if(!M)
return FALSE

if(!ishuman(M)) return 0
if(!ishuman(M))
return FALSE

var/mob/living/carbon/human/H = M
var/list/mob_equip = list()
if(H.species.hud && H.species.hud.equip_slots)
mob_equip = H.species.hud.equip_slots

if(H.species && !(slot in mob_equip))
return 0
return FALSE

//First check if the item can be equipped to the desired slot.
if("[slot]" in slot_flags_enumeration)
var/req_flags = slot_flags_enumeration["[slot]"]
if(!(req_flags & slot_flags))
return 0
return FALSE

if(!force)
//Next check that the slot is free
Expand Down Expand Up @@ -892,6 +913,30 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
attack_self(user)
return TRUE

/obj/item/throw_impact(atom/hit_atom, datum/thrownthing/TT)
if(QDELETED(hit_atom))
return

. = ..()
var/volume = GetThrownSoundVolume()
var/turf/sound_turf = get_turf(src)
//Living mobs handle thrown sounds differently.
if(istype(hit_atom, /mob/living))
sound_turf = get_turf(hit_atom)
if(throwforce > 0)
if(mob_throw_hit_sound)
playsound(sound_turf, mob_throw_hit_sound, volume, FALSE, -1)
else if(hitsound)
playsound(sound_turf, hitsound, volume, FALSE, -1)
else if(throw_impact_sound)
playsound(sound_turf, throw_impact_sound, volume, FALSE, -1)

else if(throw_impact_sound)
playsound(sound_turf, throw_impact_sound, volume, FALSE, -1)

/obj/item/proc/GetThrownSoundVolume()
return min(INITIAL_THROW_IMPACT_SOUND_VOLUME * w_class, 100)

/obj/item/proc/inherit_custom_item_data(var/datum/custom_item/citem)
. = src
if(citem.item_name)
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/devices/flash.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
obj_flags = OBJ_FLAG_CONDUCTIBLE
origin_tech = list(TECH_MAGNET = 2, TECH_COMBAT = 1)

pickup_sound = 'sound/items/handling/component_pickup.ogg'
throw_impact_sound = 'sound/items/handling/component_drop.ogg'

var/times_used = 0 //Number of times it's been used.
var/broken = 0 //Is the flash burnt out?
var/last_used = 0 //last world.time it was used.
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/devices/multitool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

origin_tech = list(TECH_MAGNET = 1, TECH_ENGINEERING = 1)

pickup_sound = 'sound/items/handling/multitool_pickup.ogg'
throw_impact_sound = 'sound/items/handling/multitool_drop.ogg'

var/buffer_name
var/atom/buffer_object

Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/devices/scanners/_scanner.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
slot_flags = SLOT_BELT
item_flags = ITEM_FLAG_NO_BLUDGEON
matter = list(MATERIAL_ALUMINIUM = 30,MATERIAL_GLASS = 20)

pickup_sound = 'sound/items/handling/component_pickup.ogg'
throw_impact_sound = 'sound/items/handling/component_drop.ogg'

var/scan_title
var/scan_data
//For displaying scans
Expand Down
19 changes: 7 additions & 12 deletions code/game/objects/items/weapons/material/coins.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
thrown_force_multiplier = 0.1
w_class = 1
slot_flags = SLOT_EARS

throw_impact_sound = 'sound/effects/coin_flip2.ogg'
var/string_colour
// Sound played when used in hand to "flip" it
var/flip_sound = 'sound/effects/coin_flip1.ogg'
// Sound played on thrown impact
var/fall_sound = 'sound/effects/coin_flip2.ogg'
// How loud are the sounds produced by it
var/sound_volume = 35

Expand All @@ -38,27 +38,22 @@
var/obj/item/stack/cable_coil/CC = W
if(CC.use(1))
string_colour = CC.color
to_chat(user, "<span class='notice'>You attach a string to the coin.</span>")
to_chat(user, SPAN_NOTICE("You attach a string to the coin."))
update_icon()
return
else if(isWirecutter(W) && !isnull(string_colour))
new /obj/item/stack/cable_coil/single(get_turf(user))
string_colour = null
to_chat(user, "<span class='notice'>You detach the string from the coin.</span>")
to_chat(user, SPAN_NOTICE("You detach the string from the coin."))
update_icon()
else ..()

/obj/item/material/coin/attack_self(mob/user)
user.visible_message("<span class='notice'>\The [user] has thrown \the [src]. It lands on [rand(1, 2) == 1 ? "tails" : "heads"]!</span>")
user.visible_message(SPAN_NOTICE("\The [user] has thrown \the [src]. It lands on [rand(1, 2) == 1 ? "tails" : "heads"]!"))
playsound(user, flip_sound, sound_volume, TRUE)

/obj/item/material/coin/throw_impact(atom/hit_atom, datum/thrownthing/TT)
. = ..()
var/turf/T = get_turf(hit_atom)
if(!istype(T))
return

playsound(T, fall_sound, sound_volume, TRUE)
/obj/item/material/coin/GetThrownSoundVolume()
return sound_volume

// Subtypes.
/obj/item/material/coin/gold
Expand Down
5 changes: 4 additions & 1 deletion code/game/objects/items/weapons/storage/belt.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
slot_flags = SLOT_BELT
var/overlay_flags
attack_verb = list("whipped", "lashed", "disciplined")
equip_sound = 'sound/items/equip/toolbelt_equip.ogg'
throw_impact_sound = 'sound/items/handling/toolbelt_drop.ogg'

/obj/item/storage/belt/verb/toggle_layer()
set name = "Switch Belt Layer"
Expand Down Expand Up @@ -131,8 +133,9 @@
/obj/item/clothing/gloves,
/obj/item/tape_roll,
/obj/item/clothing/head/beret,
/obj/item/material/knife/folding/
/obj/item/material/knife/folding,
)
pickup_sound = 'sound/items/handling/toolbelt_pickup.ogg'


/obj/item/storage/belt/utility/full/New()
Expand Down
5 changes: 5 additions & 0 deletions code/game/objects/items/weapons/storage/boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
item_state = "syringe_kit"
max_storage_space = DEFAULT_BOX_STORAGE
use_sound = 'sound/effects/storage/box.ogg'
pickup_sound = 'sound/items/handling/cardboardbox_pickup.ogg'
throw_impact_sound = 'sound/items/handling/cardboardbox_drop.ogg'

var/foldable = /obj/item/stack/material/cardboard // BubbleWrap - if set, can be folded (when empty) into a sheet of cardboard

/obj/item/storage/box/large
Expand Down Expand Up @@ -190,6 +193,8 @@
icon_state = "ammo"
desc = "A sturdy metal box with several warning symbols on the front.<br>WARNING: Live ammunition. Misuse may result in serious injury or death."
use_sound = 'sound/effects/closet_open.ogg'
pickup_sound = 'sound/items/handling/ammobox_pickup.ogg'
throw_impact_sound = 'sound/items/handling/ammobox_drop.ogg'

/obj/item/storage/box/ammo/blanks
name = "box of blank shells"
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/weapons/storage/toolbox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
origin_tech = list(TECH_COMBAT = 1)
attack_verb = list("robusted")
use_sound = 'sound/effects/storage/toolbox.ogg'
throw_impact_sound = 'sound/items/handling/toolbox_drop.ogg'
pickup_sound = 'sound/items/handling/toolbox_pickup.ogg'
matter = list(MATERIAL_STEEL = 5000)

/obj/item/storage/toolbox/emergency
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/weapons/tools/crowbar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
matter = list(MATERIAL_STEEL = 140)
center_of_mass = "x=16;y=20"
attack_verb = list("attacked", "bashed", "battered", "bludgeoned", "whacked")
throw_impact_sound = 'sound/items/handling/crowbar_drop.ogg'
pickup_sound = 'sound/items/handling/crowbar_pickup.ogg'

/obj/item/crowbar/red
icon_state = "red_crowbar"
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/weapons/tools/screwdriver.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
attack_verb = list("stabbed")
lock_picking_level = 5
sharp = TRUE
throw_impact_sound = 'sound/items/handling/screwdriver_drop.ogg'
pickup_sound = 'sound/items/handling/screwdriver_pickup.ogg'

var/build_from_parts = TRUE
var/valid_colours = list(COLOR_RED, COLOR_CYAN_BLUE, COLOR_PURPLE, COLOR_CHESTNUT, COLOR_GREEN, COLOR_TEAL, COLOR_ASSEMBLY_YELLOW, COLOR_BOTTLE_GREEN, COLOR_VIOLET, COLOR_GRAY80, COLOR_GRAY20)
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/weapons/tools/weldingtool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
w_class = ITEM_SIZE_SMALL
matter = list(MATERIAL_STEEL = 70, MATERIAL_GLASS = 30)
origin_tech = list(TECH_ENGINEERING = 1)
throw_impact_sound = 'sound/items/handling/weldingtool_drop.ogg'
pickup_sound = 'sound/items/handling/weldingtool_pickup.ogg'

var/welding = 0 //Whether or not the welding tool is off(0), on(1) or currently welding(2)
var/status = 1 //Whether the welder is secured or unsecured (able to attach rods to it to make a flamethrower)
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/weapons/tools/wirecutter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
attack_verb = list("pinched", "nipped")
sharp = TRUE
edge = TRUE
throw_impact_sound = 'sound/items/handling/wirecutter_drop.ogg'
pickup_sound = 'sound/items/handling/wirecutter_pickup.ogg'

var/build_from_parts = TRUE
var/handle_icon = "cutters_handle"
Expand Down
2 changes: 2 additions & 0 deletions code/game/objects/items/weapons/tools/wrench.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
matter = list(MATERIAL_STEEL = 150)
center_of_mass = "x=17;y=16"
attack_verb = list("bashed", "battered", "bludgeoned", "whacked")
throw_impact_sound = 'sound/items/handling/wrench_drop.ogg'
pickup_sound = 'sound/items/handling/wrench_pickup.ogg'

/obj/item/wrench/Initialize()
icon_state = "wrench[pick("","_red","_black","_green","_blue")]"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/assembly/assembly.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
throw_range = 10
origin_tech = list(TECH_MAGNET = 1)

pickup_sound = 'sound/items/handling/component_pickup.ogg'
throw_impact_sound = 'sound/items/handling/component_drop.ogg'

var/secured = 1
var/list/attached_overlays = null
var/obj/item/device/assembly_holder/holder = null
Expand Down
5 changes: 5 additions & 0 deletions code/modules/clothing/clothing.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/obj/item/clothing
name = "clothing"
siemens_coefficient = 0.9

var/flash_protection = FLASH_PROTECTION_NONE // Sets the item's level of flash protection.
var/tint = TINT_NONE // Sets the item's level of visual impairment tint.
var/list/species_restricted = list(
Expand Down Expand Up @@ -801,6 +802,10 @@ BLIND // can't see anything
slot_flags = SLOT_ICLOTHING
w_class = ITEM_SIZE_NORMAL
force = 0
equip_sound = 'sound/items/equip/jumpsuit_equip.ogg'
pickup_sound = 'sound/items/handling/cloth_pickup.ogg'
throw_impact_sound = 'sound/items/handling/cloth_drop.ogg'

var/has_sensor = SUIT_HAS_SENSORS //For the crew computer 2 = unable to change mode
var/sensor_mode = SUIT_SENSOR_OFF
/*
Expand Down
3 changes: 3 additions & 0 deletions code/modules/library/lib_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
throw_range = 5
w_class = ITEM_SIZE_NORMAL //upped to three because books are, y'know, pretty big. (and you could hide them inside eachother recursively forever)
attack_verb = list("bashed", "whacked", "educated")
pickup_sound = 'sound/items/handling/book_pickup.ogg'
throw_impact_sound = 'sound/items/handling/book_drop.ogg'

var/dat // Actual page content
var/author // Who wrote the thing, can be changed by pen or PC. It is not automatically assigned
var/unique = 0 // 0 - Normal book, 1 - Should not be treated as normal book, unable to be copied, unable to be modified
Expand Down
4 changes: 4 additions & 0 deletions code/modules/paperwork/paper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
slot_flags = SLOT_HEAD
body_parts_covered = HEAD
attack_verb = list("bapped")
throw_impact_sound = 'sound/items/handling/paper_drop.ogg'
pickup_sound = 'sound/items/handling/paper_pickup.ogg'

var/info //What's actually written on the paper.
var/info_links //A different version of the paper which includes html links at fields and EOF
Expand Down Expand Up @@ -216,6 +218,8 @@
info = stars(info,85)
user.visible_message("\The [user] crumples \the [src] into a ball!")
icon_state = "scrap"
throw_range = 10
throw_speed = 3
return
user.examinate(src)

Expand Down
2 changes: 2 additions & 0 deletions code/modules/paperwork/photography.dm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ var/global/photo_count = 0
w_class = ITEM_SIZE_NORMAL //same as book
storage_slots = DEFAULT_BOX_STORAGE //yes, that's storage_slots. Photos are w_class 1 so this has as many slots equal to the number of photos you could put in a box
can_hold = list(/obj/item/photo)
pickup_sound = 'sound/items/handling/book_pickup.ogg'
throw_impact_sound = 'sound/items/handling/book_drop.ogg'

/obj/item/storage/photo_album/MouseDrop(obj/over_object as obj)

Expand Down
2 changes: 2 additions & 0 deletions code/modules/projectiles/ammunition.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@

/obj/item/ammo_magazine/box
w_class = ITEM_SIZE_NORMAL
pickup_sound = 'sound/items/handling/ammobox_pickup.ogg'
throw_impact_sound = 'sound/items/handling/ammobox_drop.ogg'

/obj/item/ammo_magazine/Initialize()
. = ..()
Expand Down
Loading

0 comments on commit 4feecb6

Please sign in to comment.