Ports TG Pickup, Equip, and Drop Sounds (#15572)

* Ports TG Pickup, Equip, and Drop Sounds

* really
This commit is contained in:
Fox McCloud
2021-02-24 12:51:59 +00:00
committed by GitHub
parent 7b7ea0a191
commit efa3aecb61
95 changed files with 271 additions and 139 deletions
+48 -14
View File
@@ -21,10 +21,20 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
can_be_hit = FALSE
suicidal_hands = TRUE
var/hitsound = null
var/usesound = null
///Sound played when you hit something with the item
var/hitsound
///Played when the item is used, for example tools
var/usesound
///Used when yate into a mob
var/mob_throw_hit_sound
///Sound used when equipping the item into a valid slot
var/equip_sound
///Sound uses when picking the item up (into your hands)
var/pickup_sound
///Sound uses when dropping the item, or when its thrown.
var/drop_sound
var/list/attack_verb //Used in attackby() to say how something was attacked "[x] has been [z.attack_verb] by [y] with [z]"
var/throwhitsound
var/w_class = WEIGHT_CLASS_NORMAL
var/slot_flags = 0 //This is used to determine on which slots an item can fit.
pass_flags = PASSTABLE
@@ -273,7 +283,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
if(throwing)
throwing.finalize(FALSE)
if(loc == user)
if(!user.unEquip(src))
if(!user.unEquip(src, silent = TRUE))
return 0
else
@@ -377,7 +387,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
/obj/item/proc/talk_into(mob/M, var/text, var/channel=null)
return
/obj/item/proc/dropped(mob/user)
/obj/item/proc/dropped(mob/user, silent = FALSE)
for(var/X in actions)
var/datum/action/A = X
A.Remove(user)
@@ -387,6 +397,8 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
flags &= ~NODROP
in_inventory = FALSE
SEND_SIGNAL(src, COMSIG_ITEM_DROPPED,user)
if(!silent)
playsound(src, drop_sound, DROP_SOUND_VOLUME, ignore_walls = FALSE)
// called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
@@ -414,14 +426,19 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
// user is mob that equipped it
// 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)
// Initial is used to indicate whether or not this is the initial equipment (job datums etc) or just a player doing it
/obj/item/proc/equipped(mob/user, slot, initial = FALSE)
SEND_SIGNAL(src, COMSIG_ITEM_EQUIPPED, user, slot)
for(var/X in actions)
var/datum/action/A = X
if(item_action_slot_check(slot, user)) //some items only give their actions buttons when in a specific slot.
A.Grant(user)
in_inventory = TRUE
if(!initial)
if(equip_sound && slot == slot_bitfield_to_slot(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)
/obj/item/proc/item_action_slot_check(slot, mob/user)
return 1
@@ -564,13 +581,30 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
else
return
/obj/item/throw_impact(atom/A)
if(A && !QDELETED(A))
SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, A)
var/itempush = 1
/obj/item/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
if(hit_atom && !QDELETED(hit_atom))
SEND_SIGNAL(src, COMSIG_MOVABLE_IMPACT, hit_atom, throwingdatum)
var/itempush = TRUE
if(w_class < WEIGHT_CLASS_BULKY)
itempush = 0 // too light to push anything
return A.hitby(src, 0, itempush)
itempush = FALSE //too light to push anything
if(isliving(hit_atom)) //Living mobs handle hit sounds differently.
if(is_hot(src))
var/mob/living/L = hit_atom
L.IgniteMob()
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', volume, TRUE, -1)
else
playsound(src, drop_sound, YEET_SOUND_VOLUME, ignore_walls = FALSE)
return hit_atom.hitby(src, 0, itempush, throwingdatum = throwingdatum)
/obj/item/throw_at(atom/target, range, speed, mob/thrower, spin=1, diagonals_first = 0, datum/callback/callback, force)
thrownby = thrower
@@ -619,7 +653,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect
return I == src
/obj/item/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
return
return SEND_SIGNAL(src, COMSIG_ATOM_HITBY, AM, skipcatch, hitpush, blocked, throwingdatum)
/obj/item/attack_hulk(mob/living/carbon/human/user)
return FALSE
+48 -25
View File
@@ -9,6 +9,8 @@
materials = list(MAT_METAL=60, MAT_GLASS=30)
force = 2
throwforce = 0
drop_sound = 'sound/items/handling/taperecorder_drop.ogg'
pickup_sound = 'sound/items/handling/taperecorder_pickup.ogg'
var/recording = 0
var/playing = 0
var/playsleepseconds = 0
@@ -16,6 +18,8 @@
var/open_panel = 0
var/canprint = 1
var/starts_with_tape = TRUE
///Sound loop that plays when recording or playing back.
var/datum/looping_sound/tape_recorder_hiss/soundloop
/obj/item/taperecorder/New()
@@ -23,9 +27,11 @@
if(starts_with_tape)
mytape = new /obj/item/tape/random(src)
update_icon()
soundloop = new(list(src))
/obj/item/taperecorder/Destroy()
QDEL_NULL(mytape)
QDEL_NULL(soundloop)
return ..()
/obj/item/taperecorder/examine(mob/user)
@@ -34,16 +40,24 @@
. += "The wire panel is [open_panel ? "opened" : "closed"]."
/obj/item/taperecorder/proc/update_sound()
if(!playing && !recording)
soundloop.stop()
else
soundloop.start()
/obj/item/taperecorder/attackby(obj/item/I, mob/user)
if(!mytape && istype(I, /obj/item/tape))
user.drop_item()
I.loc = src
mytape = I
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
update_icon()
if(user.drop_item())
I.forceMove(src)
mytape = I
to_chat(user, "<span class='notice'>You insert [I] into [src].</span>")
playsound(src, 'sound/items/taperecorder/taperecorder_close.ogg', 50, FALSE)
update_icon()
/obj/item/taperecorder/proc/eject(mob/user)
if(mytape)
playsound(src, 'sound/items/taperecorder/taperecorder_open.ogg', 50, FALSE)
to_chat(user, "<span class='notice'>You remove [mytape] from [src].</span>")
stop()
user.put_in_hands(mytape)
@@ -52,7 +66,7 @@
/obj/item/taperecorder/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume, global_overlay = TRUE)
mytape.ruin() //Fires destroy the tape
mytape?.ruin() //Fires destroy the tape
return ..()
/obj/item/taperecorder/attack_hand(mob/user)
@@ -70,7 +84,7 @@
set name = "Eject Tape"
set category = "Object"
if(usr.stat)
if(usr.incapacitated())
return
if(!mytape)
return
@@ -117,7 +131,7 @@
set name = "Start Recording"
set category = "Object"
if(usr.stat)
if(usr.incapacitated())
return
if(!mytape || mytape.ruined)
return
@@ -126,9 +140,12 @@
if(playing)
return
playsound(src, 'sound/items/taperecorder/taperecorder_play.ogg', 50, FALSE)
if(mytape.used_capacity < mytape.max_capacity)
to_chat(usr, "<span class='notice'>Recording started.</span>")
recording = 1
recording = TRUE
atom_say("Recording started.")
update_sound()
update_icon()
mytape.timestamp += mytape.used_capacity
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording started."
@@ -140,36 +157,38 @@
mytape.used_capacity++
used++
sleep(10)
recording = 0
update_icon()
stop()
else
to_chat(usr, "<span class='notice'>The tape is full.</span>")
atom_say("The tape is full!")
playsound(src, 'sound/items/taperecorder/taperecorder_stop.ogg', 50, FALSE)
/obj/item/taperecorder/verb/stop()
set name = "Stop"
set category = "Object"
if(usr.stat)
if(usr.incapacitated())
return
if(recording)
recording = 0
mytape.timestamp += mytape.used_capacity
mytape.storedinfo += "\[[time2text(mytape.used_capacity * 10,"mm:ss")]\] Recording stopped."
to_chat(usr, "<span class='notice'>Recording stopped.</span>")
return
playsound(src, 'sound/items/taperecorder/taperecorder_stop.ogg', 50, FALSE)
atom_say("Recording stopped.")
recording = FALSE
else if(playing)
playing = 0
playsound(src, 'sound/items/taperecorder/taperecorder_stop.ogg', 50, FALSE)
atom_say("Playback stopped.")
playing = FALSE
update_icon()
update_sound()
/obj/item/taperecorder/verb/play()
set name = "Play Tape"
set category = "Object"
if(usr.stat)
if(usr.incapacitated())
return
if(!mytape || mytape.ruined)
return
@@ -178,9 +197,11 @@
if(playing)
return
playing = 1
playing = TRUE
update_icon()
to_chat(usr, "<span class='notice'>Playing started.</span>")
update_sound()
atom_say("Playback started.")
playsound(src, 'sound/items/taperecorder/taperecorder_play.ogg', 50, FALSE)
var/used = mytape.used_capacity //to stop runtimes when you eject the tape
var/max = mytape.max_capacity
for(var/i = 1, used < max, sleep(10 * playsleepseconds))
@@ -189,6 +210,7 @@
if(playing == 0)
break
if(mytape.storedinfo.len < i)
atom_say("End of recording.")
break
atom_say("[mytape.storedinfo[i]]")
if(mytape.storedinfo.len < i + 1)
@@ -203,8 +225,7 @@
playsleepseconds = 1
i++
playing = 0
update_icon()
stop()
/obj/item/taperecorder/attack_self(mob/user)
@@ -220,7 +241,7 @@
set name = "Print Transcript"
set category = "Object"
if(usr.stat)
if(usr.incapacitated())
return
if(!mytape)
return
@@ -230,7 +251,7 @@
if(recording || playing)
return
to_chat(usr, "<span class='notice'>Transcript printed.</span>")
atom_say("Transcript printed.")
playsound(loc, 'sound/goonstation/machines/printer_thermal.ogg', 50, 1)
var/obj/item/paper/P = new /obj/item/paper(get_turf(src))
var/t1 = "<B>Transcript:</B><BR><BR>"
@@ -258,6 +279,8 @@
materials = list(MAT_METAL=20, MAT_GLASS=5)
force = 1
throwforce = 0
drop_sound = 'sound/items/handling/tape_drop.ogg'
pickup_sound = 'sound/items/handling/tape_pickup.ogg'
var/max_capacity = 600
var/used_capacity = 0
var/list/storedinfo = list()
@@ -218,7 +218,13 @@
color = "#378C61"
stop_bleeding = 0
heal_brute = 12
drop_sound = 'sound/misc/moist_impact.ogg'
mob_throw_hit_sound = 'sound/misc/moist_impact.ogg'
hitsound = 'sound/misc/moist_impact.ogg'
/obj/item/stack/medical/bruise_pack/comfrey/heal(mob/living/M, mob/user)
playsound(src, 'sound/misc/soggy.ogg', 30, TRUE)
return ..()
/obj/item/stack/medical/ointment/aloe
name = "\improper Aloe Vera leaf"
@@ -247,6 +247,8 @@ GLOBAL_LIST_INIT(cloth_recipes, list ( \
force = 0
throwforce = 0
merge_type = /obj/item/stack/sheet/cloth
drop_sound = 'sound/items/handling/cloth_drop.ogg'
pickup_sound = 'sound/items/handling/cloth_pickup.ogg'
/obj/item/stack/sheet/cloth/New(loc, amount=null)
recipes = GLOB.cloth_recipes
@@ -272,6 +274,8 @@ GLOBAL_LIST_INIT(durathread_recipes, list ( \
force = 0
throwforce = 0
merge_type = /obj/item/stack/sheet/durathread
drop_sound = 'sound/items/handling/cloth_drop.ogg'
pickup_sound = 'sound/items/handling/cloth_pickup.ogg'
/obj/item/stack/sheet/durathread/Initialize(mapload, new_amount, merge = TRUE)
recipes = GLOB.durathread_recipes
+2
View File
@@ -12,6 +12,8 @@
item_state = "crowbar"
w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL=50)
drop_sound = 'sound/items/handling/crowbar_drop.ogg'
pickup_sound = 'sound/items/handling/crowbar_pickup.ogg'
origin_tech = "engineering=1;combat=1"
attack_verb = list("attacked", "bashed", "battered", "bludgeoned", "whacked")
toolspeed = 1
@@ -17,6 +17,8 @@
throwforce = 0
throw_range = 7
throw_speed = 3
drop_sound = 'sound/items/handling/multitool_drop.ogg'
pickup_sound = 'sound/items/handling/multitool_pickup.ogg'
materials = list(MAT_METAL=50, MAT_GLASS=20)
origin_tech = "magnets=1;engineering=2"
toolspeed = 1
@@ -17,6 +17,8 @@
usesound = 'sound/items/screwdriver.ogg'
toolspeed = 1
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30)
drop_sound = 'sound/items/handling/screwdriver_drop.ogg'
pickup_sound = 'sound/items/handling/screwdriver_pickup.ogg'
tool_behaviour = TOOL_SCREWDRIVER
var/random_color = TRUE //if the screwdriver uses random coloring
+2
View File
@@ -22,6 +22,8 @@
toolspeed = 1
tool_enabled = FALSE
usesound = 'sound/items/welder.ogg'
drop_sound = 'sound/items/handling/weldingtool_drop.ogg'
pickup_sound = 'sound/items/handling/weldingtool_pickup.ogg'
var/maximum_fuel = 20
var/requires_fuel = TRUE //Set to FALSE if it doesn't need fuel, but serves equally well as a cost modifier
var/refills_over_time = FALSE //Do we regenerate fuel?
@@ -14,6 +14,8 @@
attack_verb = list("pinched", "nipped")
hitsound = 'sound/items/wirecutter.ogg'
usesound = 'sound/items/wirecutter.ogg'
drop_sound = 'sound/items/handling/wirecutter_drop.ogg'
pickup_sound = 'sound/items/handling/wirecutter_pickup.ogg'
sharp = 1
toolspeed = 1
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 30)
+2
View File
@@ -11,6 +11,8 @@
usesound = 'sound/items/ratchet.ogg'
w_class = WEIGHT_CLASS_SMALL
materials = list(MAT_METAL=150)
drop_sound = 'sound/items/handling/wrench_drop.ogg'
pickup_sound = 'sound/items/handling/wrench_pickup.ogg'
origin_tech = "materials=1;engineering=1"
attack_verb = list("bashed", "battered", "bludgeoned", "whacked")
toolspeed = 1
+2
View File
@@ -3,3 +3,5 @@
w_class = WEIGHT_CLASS_TINY
item_state = "card-id"
icon_state = "datadisk0"
drop_sound = 'sound/items/handling/disk_drop.ogg'
pickup_sound = 'sound/items/handling/disk_pickup.ogg'
@@ -9,6 +9,7 @@
slot_flags = SLOT_BELT
attack_verb = list("whipped", "lashed", "disciplined")
max_integrity = 300
equip_sound = 'sound/items/equip/toolbelt_equip.ogg'
var/use_item_overlays = 0 // Do we have overlays for items held inside the belt?
/obj/item/storage/belt/update_icon()
@@ -29,10 +30,10 @@
if(!M.restrained() && !M.stat && can_use())
switch(over_object.name)
if("r_hand")
M.unEquip(src)
M.unEquip(src, silent = TRUE)
M.put_in_r_hand(src)
if("l_hand")
M.unEquip(src)
M.unEquip(src, silent = TRUE)
M.put_in_l_hand(src)
src.add_fingerprint(usr)
return
@@ -47,6 +48,8 @@
icon_state = "utilitybelt"
item_state = "utility"
use_item_overlays = 1
drop_sound = 'sound/items/handling/toolbelt_drop.ogg'
pickup_sound = 'sound/items/handling/toolbelt_pickup.ogg'
can_hold = list(
/obj/item/crowbar,
/obj/item/screwdriver,
@@ -6,6 +6,8 @@
throw_range = 5
w_class = WEIGHT_CLASS_NORMAL
resistance_flags = FIRE_PROOF
drop_sound = 'sound/items/handling/book_drop.ogg'
pickup_sound = 'sound/items/handling/book_pickup.ogg'
var/mob/affecting = null
var/deity_name = "Christ"
/// Is the sprite of this bible customisable
@@ -25,6 +25,8 @@
icon_state = "box"
item_state = "syringe_kit"
resistance_flags = FLAMMABLE
drop_sound = 'sound/items/handling/cardboardbox_drop.ogg'
pickup_sound = 'sound/items/handling/cardboardbox_pickup.ogg'
foldable = /obj/item/stack/sheet/cardboard
foldable_amt = 1
@@ -828,6 +830,8 @@
w_class = WEIGHT_CLASS_TINY
max_w_class = WEIGHT_CLASS_TINY
slot_flags = SLOT_BELT
drop_sound = 'sound/items/handling/matchbox_drop.ogg'
pickup_sound = 'sound/items/handling/matchbox_pickup.ogg'
can_hold = list(/obj/item/match)
/obj/item/storage/box/matches/New()
@@ -50,10 +50,10 @@
if(!( user.restrained() ) && !( user.stat ))
switch(over_object.name)
if("r_hand")
user.unEquip(master_item)
user.unEquip(master_item, silent = TRUE)
user.put_in_r_hand(master_item)
if("l_hand")
user.unEquip(master_item)
user.unEquip(master_item, silent = TRUE)
user.put_in_l_hand(master_item)
master_item.add_fingerprint(user)
return 0
@@ -71,11 +71,11 @@
if(!(M.restrained()) && !(M.stat))
switch(over_object.name)
if("r_hand")
if(!M.unEquip(src))
if(!M.unEquip(src, silent = TRUE))
return
M.put_in_r_hand(src)
if("l_hand")
if(!M.unEquip(src))
if(!M.unEquip(src, silent = TRUE))
return
M.put_in_l_hand(src)
add_fingerprint(usr)
@@ -297,7 +297,7 @@
if(!istype(W))
return FALSE
if(usr)
if(!usr.unEquip(W))
if(!usr.unEquip(W, silent = TRUE))
return FALSE
usr.update_icons() //update our overlays
if(silent)
@@ -307,7 +307,7 @@
if(usr)
if(usr.client && usr.s_active != src)
usr.client.screen -= W
W.dropped(usr)
W.dropped(usr, TRUE)
add_fingerprint(usr)
if(!prevent_warning && !istype(W, /obj/item/gun/energy/kinetic_accelerator/crossbow))
@@ -343,7 +343,7 @@
if(new_location)
if(ismob(loc))
W.dropped(usr)
W.dropped(usr, TRUE)
if(ismob(new_location))
W.layer = ABOVE_HUD_LAYER
W.plane = ABOVE_HUD_PLANE
@@ -14,6 +14,8 @@
origin_tech = "combat=1;engineering=1"
attack_verb = list("robusted")
hitsound = 'sound/weapons/smash.ogg'
drop_sound = 'sound/items/handling/toolbox_drop.ogg'
pickup_sound = 'sound/items/handling/toolbox_pickup.ogg'
/obj/item/storage/toolbox/emergency
name = "emergency toolbox"