Rebase onto Master for Volume Control Panel, Squash Commits

This commit is contained in:
Rykka
2020-08-27 19:47:38 -04:00
parent 61f7ef53c2
commit d2fb9a7691
375 changed files with 743 additions and 73 deletions
+38 -4
View File
@@ -91,8 +91,16 @@
var/icon/default_worn_icon //Default on-mob icon
var/worn_layer //Default on-mob layer
var/drop_sound = 'sound/items/drop/device.ogg' // drop sound - this is the default
// Pickup/Drop/Equip/Throw Sounds
///Used when thrown into a mob
var/mob_throw_hit_sound
// Sound used when equipping the items into a valid slot.
var/equip_sound
// pickup sound - this is the default
var/pickup_sound = 'sound/items/pickup/device.ogg'
// drop sound - this is the default
var/drop_sound = 'sound/items/drop/device.ogg'
var/tip_timer // reference to timer id for a tooltip we might open soon
@@ -278,10 +286,29 @@
/obj/item/proc/moved(mob/user as mob, old_loc as turf)
return
/obj/item/proc/get_volume_by_throwforce_and_or_w_class() // This is used for figuring out how loud our sounds are for throwing.
if(throwforce && w_class)
return CLAMP((throwforce + w_class) * 5, 30, 100)// Add the item's throwforce to its weight class and multiply by 5, then clamp the value between 30 and 100
else if(w_class)
return CLAMP(w_class * 8, 20, 100) // Multiply the item's weight class by 8, then clamp the value between 20 and 100
else
return 0
/obj/item/throw_impact(atom/hit_atom)
..()
if(drop_sound)
playsound(src, drop_sound, 50, 0, preference = /datum/client_preference/drop_sounds)
if(isliving(hit_atom)) //Living mobs handle hit sounds differently.
var/volume = get_volume_by_throwforce_and_or_w_class()
if (throwforce > 0)
if (mob_throw_hit_sound)
playsound(hit_atom, mob_throw_hit_sound, volume, TRUE, -1)
else if(hitsound)
playsound(hit_atom, hitsound, volume, TRUE, -1)
else
playsound(hit_atom, 'sound/weapons/genhit.ogg', volume, TRUE, -1)
else
playsound(hit_atom, 'sound/weapons/throwtap.ogg', 1, volume, -1)
else
playsound(src, drop_sound, 30, preference = /datum/client_preference/drop_sounds)
// apparently called whenever an item is removed from a slot, container, or anything else.
/obj/item/proc/dropped(mob/user as mob)
@@ -318,6 +345,13 @@
user.position_hud_item(src,slot)
if(user.client) user.client.screen |= src
if(user.pulling == src) user.stop_pulling()
if((slot_flags & slot))
if(equip_sound)
playsound(src, equip_sound, 30)
else
playsound(src, drop_sound, 30)
else if(slot == slot_l_hand || slot == slot_r_hand)
playsound(src, pickup_sound, 20, preference = /datum/client_preference/pickup_sounds)
return
//Defines which slots correspond to which slot flags