The Impact Soundening (#11697)

* e

* e

* e

* Update species.dm

* Update sound.dm

* e

* E

* e
This commit is contained in:
Gandalf
2022-02-28 15:21:00 +00:00
committed by GitHub
parent 405510a4f5
commit 8055a6f2bd
79 changed files with 347 additions and 19 deletions
+13
View File
@@ -0,0 +1,13 @@
/**
* Sound effect defines, used in get_sfx.
*/
#define SFX_KEYBOARD "keyboard"
// Bullet impact types
#define SFX_BULLET_IMPACT_ICE "bullet_impact_ice"
#define SFX_BULLET_IMPACT_WOOD "bullet_impact_wood"
#define SFX_BULLET_IMPACT_METAL "bullet_impact_metal"
#define SFX_BULLET_IMPACT_GLASS "bullet_impact_glass"
#define SFX_BULLET_IMPACT_CONCRETE "bullet_impact_concrete"
#define SFX_BULLET_IMPACT_FLESH "bullet_impact_flesh"
+8 -3
View File
@@ -31,9 +31,14 @@
var/obj/item/bodypart/affecting = D.get_bodypart(ran_zone(A.zone_selected))
var/armor_block = D.run_armor_check(affecting, MELEE)
playsound(D.loc, species.attack_sound, 25, TRUE, -1)
// SKYRAT EDIT CHANGE
var/sound/attack_sound
if(!species.attack_sound)
attack_sound = get_sfx("punch")
else
attack_sound = species.attack_sound
playsound(D.loc, attack_sound, 25, TRUE, -1)
//SKYRAT EDIT END
D.visible_message(span_danger("[A] [atk_verb]ed [D]!"), \
span_userdanger("You're [atk_verb]ed by [A]!"), span_hear("You hear a sickening sound of flesh hitting flesh!"), COMBAT_MESSAGE_RANGE, A)
to_chat(A, span_danger("You [atk_verb]ed [D]!"))
+2 -5
View File
@@ -209,15 +209,12 @@ distance_multiplier - Can be used to multiply the distance at which the sound is
/proc/get_sfx(soundin)
if(istext(soundin))
soundin = get_sfx_skyrat(soundin) //SKYRAT EDIT ADDITION - This overrides the default sound effects too, so use it to modularly change a sound effect output.
switch(soundin)
if ("shatter")
soundin = pick('sound/effects/glassbr1.ogg','sound/effects/glassbr2.ogg','sound/effects/glassbr3.ogg')
if ("explosion")
soundin = pick(
'modular_skyrat/master_files/sound/blackmesa/explosions/explode1.ogg', 'modular_skyrat/master_files/sound/blackmesa/explosions/explode2.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode3.ogg', 'modular_skyrat/master_files/sound/blackmesa/explosions/explode4.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode5.ogg', 'modular_skyrat/master_files/sound/blackmesa/explosions/explode6.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode7.ogg')//soundin = pick('sound/effects/explosion1.ogg','sound/effects/explosion2.ogg') SKYRAT EDIT CHANGE
soundin = pick('sound/effects/explosion1.ogg','sound/effects/explosion2.ogg')
if ("explosion_creaking")
soundin = pick('sound/effects/explosioncreak1.ogg', 'sound/effects/explosioncreak2.ogg')
if ("hull_creaking")
@@ -204,7 +204,7 @@
return
if(check_block()) //everybody is kung fu fighting
return
playsound(loc, user.dna.species.attack_sound, 25, TRUE, -1)
playsound(loc, get_sfx("punch"), 25, TRUE, -1) //SKYRAT EDIT CHANGE
visible_message(span_danger("[user] [hulk_verb]ed [src]!"), \
span_userdanger("[user] [hulk_verb]ed [src]!"), span_hear("You hear a sickening sound of flesh hitting flesh!"), null, user)
to_chat(user, span_danger("You [hulk_verb] [src]!"))
@@ -161,7 +161,7 @@ GLOBAL_LIST_EMPTY(features_by_species)
var/attack_verb = "punch"
/// The visual effect of the attack.
var/attack_effect = ATTACK_EFFECT_PUNCH
var/sound/attack_sound = 'sound/weapons/punch1.ogg'
var/sound/attack_sound //SKYRAT EDIT CHANGE
var/sound/miss_sound = 'sound/weapons/punchmiss.ogg'
///What gas does this species breathe? Used by suffocation screen alerts, most of actual gas breathing is handled by mutantlungs. See [life.dm][code/modules/mob/living/carbon/human/life.dm]
@@ -1430,7 +1430,14 @@ GLOBAL_LIST_EMPTY(features_by_species)
var/armor_block = target.run_armor_check(affecting, MELEE)
playsound(target.loc, user.dna.species.attack_sound, 25, TRUE, -1)
// SKYRAT EDIT CHANGE
var/sound/attack_sound
if(!user.dna.species.attack_sound)
attack_sound = get_sfx("punch")
else
attack_sound = user.dna.species.attack_sound
playsound(target.loc, attack_sound, 25, TRUE, -1)
// SKYRAT EDTI END
target.visible_message(span_danger("[user] [atk_verb]ed [target]!"), \
span_userdanger("You're [atk_verb]ed by [user]!"), span_hear("You hear a sickening sound of flesh hitting flesh!"), COMBAT_MESSAGE_RANGE, user)
+3 -2
View File
@@ -15,7 +15,7 @@
layer = MOB_LAYER
plane = GAME_PLANE_FOV_HIDDEN
//The sound this plays on impact.
var/hitsound = 'sound/weapons/pierce.ogg'
var/hitsound // SKYRAT EDIT CHANGE
var/hitsound_wall = ""
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
@@ -214,6 +214,7 @@
* blocked - percentage of hit blocked
* pierce_hit - are we piercing through or regular hitting
*/
/* SKYRAT EDIT REMOVAL - MOVED TO MASTER_FILES PROJECTILE.DM
/obj/projectile/proc/on_hit(atom/target, blocked = FALSE, pierce_hit)
if(fired_from)
SEND_SIGNAL(fired_from, COMSIG_PROJECTILE_ON_HIT, firer, target, Angle)
@@ -302,7 +303,7 @@
L.log_message("has been shot by [firer] with [src]", LOG_ATTACK, color="orange")
return BULLET_ACT_HIT
*/
/obj/projectile/proc/vol_by_damage()
if(src.damage)
return clamp((src.damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then CLAMP the value between 30 and 100
@@ -0,0 +1,214 @@
/proc/get_sfx_skyrat(soundin)
if(istext(soundin))
switch(soundin)
if(SFX_KEYBOARD)
soundin = pick(
'modular_skyrat/modules/aesthetics/computer/sound/keypress1.ogg',
'modular_skyrat/modules/aesthetics/computer/sound/keypress2.ogg',
'modular_skyrat/modules/aesthetics/computer/sound/keypress3.ogg',
'modular_skyrat/modules/aesthetics/computer/sound/keypress4.ogg',
'modular_skyrat/modules/aesthetics/computer/sound/keystroke4.ogg',
)
if(SFX_BULLET_IMPACT_METAL) //This is the one that will be used most, it is extensive.
soundin = pick(
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_01.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_02.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_03.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_04.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_05.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_06.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_07.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_08.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_09.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_10.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_11.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_12.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_13.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_14.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_15.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_16.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_metal_17.ogg',
)
if(SFX_BULLET_IMPACT_FLESH)
soundin = pick(
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_01.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_02.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_03.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_04.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_05.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_06.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_07.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_08.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_flesh_09.ogg',
)
if(SFX_BULLET_IMPACT_ICE)
soundin = pick(
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_01.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_02.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_03.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_04.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_05.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_06.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_07.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_08.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_09.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_snow_10.ogg',
)
if(SFX_BULLET_IMPACT_WOOD)
soundin = pick(
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_01.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_02.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_03.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_04.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_05.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_06.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_07.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_08.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_09.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_wood_10.ogg',
)
if(SFX_BULLET_IMPACT_CONCRETE)
soundin = pick(
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_01.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_02.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_03.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_04.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_05.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_06.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_07.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_08.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_09.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_masonry_10.ogg',
)
if(SFX_BULLET_IMPACT_GLASS)
soundin = pick(
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_01.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_02.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_03.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_04.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_05.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_06.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_07.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_08.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_09.ogg',
'modular_skyrat/modules/gunsgalore/sound/impact/impact_glass_10.ogg',
)
if("punch")
soundin = pick('modular_skyrat/master_files/sound/weapons/punch1.ogg', 'modular_skyrat/master_files/sound/weapons/punch3.ogg')
if ("explosion")
soundin = pick(
'modular_skyrat/master_files/sound/blackmesa/explosions/explode1.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode2.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode3.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode4.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode5.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode6.ogg',
'modular_skyrat/master_files/sound/blackmesa/explosions/explode7.ogg',
)
return soundin
// This is an atom level variable to prevent extensive typechecking for impacts.
/atom
// The sound we make if hit.
var/impact_sound = SFX_BULLET_IMPACT_METAL
// TURFS
/turf/closed/wall/ice
impact_sound = SFX_BULLET_IMPACT_ICE
/turf/closed/wall/mineral/snow
impact_sound = SFX_BULLET_IMPACT_ICE
/turf/closed/wall/mineral/wood
impact_sound = SFX_BULLET_IMPACT_WOOD
/turf/closed/wall/mineral/bamboo
impact_sound = SFX_BULLET_IMPACT_WOOD
/turf/closed/wall/mineral/sandstone
impact_sound = SFX_BULLET_IMPACT_CONCRETE
/turf/closed/wall/vault/rock
impact_sound = SFX_BULLET_IMPACT_CONCRETE
/turf/closed/wall/vault/sandstone
impact_sound = SFX_BULLET_IMPACT_CONCRETE
/turf/closed/wall/rock
impact_sound = SFX_BULLET_IMPACT_CONCRETE
/turf/closed/wall/mineral/diamond
impact_sound = SFX_BULLET_IMPACT_GLASS
/turf/closed/wall/mineral/plasma
impact_sound = SFX_BULLET_IMPACT_GLASS
// MOBS
/mob/living
impact_sound = SFX_BULLET_IMPACT_FLESH
// STRUCTURES
/obj/structure/window
impact_sound = SFX_BULLET_IMPACT_GLASS
/obj/structure/table/glass
impact_sound = SFX_BULLET_IMPACT_GLASS
/obj/structure/table/reinforced/rglass
impact_sound = SFX_BULLET_IMPACT_GLASS
/obj/structure/table/reinforced/plasmarglass
impact_sound = SFX_BULLET_IMPACT_GLASS
/obj/structure/table/reinforced/plastitaniumglass
impact_sound = SFX_BULLET_IMPACT_GLASS
/obj/structure/table/reinforced/titaniumglass
impact_sound = SFX_BULLET_IMPACT_GLASS
/obj/structure/table/wood
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/structure/barricade/wooden
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/structure/chair/wood
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/structure/closet/crate/wooden
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/structure/door_assembly/door_assembly_wood
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/structure/falsewall/wood
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/structure/table_frame/wood
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/structure/deployable_barricade/wooden
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/structure/statue/snow
impact_sound = SFX_BULLET_IMPACT_ICE
/obj/structure/deployable_barricade/snow
impact_sound = SFX_BULLET_IMPACT_ICE
// MACHINERY
/obj/machinery/door/window
impact_sound = SFX_BULLET_IMPACT_GLASS
/obj/machinery/computer
impact_sound = SFX_BULLET_IMPACT_GLASS
/obj/machinery/door/airlock/wood
impact_sound = SFX_BULLET_IMPACT_WOOD
/obj/machinery/computer/security/wooden_tv
impact_sound = SFX_BULLET_IMPACT_WOOD
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -16,9 +16,3 @@
playsound(src, get_sfx_skyrat(clicksound), clickvol)
. = ..()
/proc/get_sfx_skyrat(soundin)
if(istext(soundin))
switch(soundin)
if("keyboard")
soundin = pick('modular_skyrat/modules/aesthetics/computer/sound/keypress1.ogg','modular_skyrat/modules/aesthetics/computer/sound/keypress2.ogg','modular_skyrat/modules/aesthetics/computer/sound/keypress3.ogg','modular_skyrat/modules/aesthetics/computer/sound/keypress4.ogg', 'modular_skyrat/modules/aesthetics/computer/sound/keystroke4.ogg')
return soundin
@@ -0,0 +1,94 @@
/**
* Called when the projectile hits something
*
* @params
* target - thing hit
* blocked - percentage of hit blocked
* pierce_hit - are we piercing through or regular hitting
*/
/obj/projectile/proc/on_hit(atom/target, blocked = FALSE, pierce_hit)
if(fired_from)
SEND_SIGNAL(fired_from, COMSIG_PROJECTILE_ON_HIT, firer, target, Angle)
// i know that this is probably more with wands and gun mods in mind, but it's a bit silly that the projectile on_hit signal doesn't ping the projectile itself.
// maybe we care what the projectile thinks! See about combining these via args some time when it's not 5AM
var/obj/item/bodypart/hit_limb
if(isliving(target))
var/mob/living/L = target
hit_limb = L.check_limb_hit(def_zone)
SEND_SIGNAL(src, COMSIG_PROJECTILE_SELF_ON_HIT, firer, target, Angle, hit_limb)
if(QDELETED(src)) // in case one of the above signals deleted the projectile for whatever reason
return
var/turf/target_loca = get_turf(target)
var/hitx
var/hity
if(target == original)
hitx = target.pixel_x + p_x - 16
hity = target.pixel_y + p_y - 16
else
hitx = target.pixel_x + rand(-8, 8)
hity = target.pixel_y + rand(-8, 8)
var/impact_sound
if(hitsound)
impact_sound = hitsound
else
impact_sound = target.impact_sound
get_sfx()
playsound(src, get_sfx_skyrat(impact_sound), vol_by_damage(), TRUE, -1)
if(!nodamage && (damage_type == BRUTE || damage_type == BURN) && iswallturf(target_loca) && prob(75))
var/turf/closed/wall/W = target_loca
if(impact_effect_type && !hitscan)
new impact_effect_type(target_loca, hitx, hity)
W.add_dent(WALL_DENT_SHOT, hitx, hity)
return BULLET_ACT_HIT
if(!isliving(target))
if(impact_effect_type && !hitscan)
new impact_effect_type(target_loca, hitx, hity)
return BULLET_ACT_HIT
var/mob/living/L = target
if(blocked != 100) // not completely blocked
if(damage && L.blood_volume && damage_type == BRUTE)
var/splatter_dir = dir
if(starting)
splatter_dir = get_dir(starting, target_loca)
if(isalien(L))
new /obj/effect/temp_visual/dir_setting/bloodsplatter/xenosplatter(target_loca, splatter_dir)
else
new /obj/effect/temp_visual/dir_setting/bloodsplatter(target_loca, splatter_dir)
if(prob(33))
L.add_splatter_floor(target_loca)
else if(impact_effect_type && !hitscan)
new impact_effect_type(target_loca, hitx, hity)
var/organ_hit_text = ""
var/limb_hit = hit_limb
if(limb_hit)
organ_hit_text = " in \the [parse_zone(limb_hit)]"
else if(suppressed && suppressed != SUPPRESSED_VERY)
to_chat(L, span_userdanger("You're shot by \a [src][organ_hit_text]!"))
else
L.visible_message(span_danger("[L] is hit by \a [src][organ_hit_text]!"), \
span_userdanger("You're hit by \a [src][organ_hit_text]!"), null, COMBAT_MESSAGE_RANGE)
L.on_hit(src)
var/reagent_note
if(reagents?.reagent_list)
reagent_note = " REAGENTS:"
for(var/datum/reagent/R in reagents.reagent_list)
reagent_note += "[R.name] ([num2text(R.volume)])"
if(ismob(firer))
log_combat(firer, L, "shot", src, reagent_note)
else
L.log_message("has been shot by [firer] with [src]", LOG_ATTACK, color="orange")
return BULLET_ACT_HIT
+3
View File
@@ -295,6 +295,7 @@
#include "code\__DEFINES\~skyrat_defines\say.dm"
#include "code\__DEFINES\~skyrat_defines\security_alerts.dm"
#include "code\__DEFINES\~skyrat_defines\signals.dm"
#include "code\__DEFINES\~skyrat_defines\sound.dm"
#include "code\__DEFINES\~skyrat_defines\span.dm"
#include "code\__DEFINES\~skyrat_defines\teshari_clothing_paths.dm"
#include "code\__DEFINES\~skyrat_defines\traits.dm"
@@ -4385,6 +4386,7 @@
#include "modular_skyrat\master_files\code\datums\traits\good.dm"
#include "modular_skyrat\master_files\code\datums\traits\negative.dm"
#include "modular_skyrat\master_files\code\datums\traits\neutral.dm"
#include "modular_skyrat\master_files\code\game\sound.dm"
#include "modular_skyrat\master_files\code\game\effects\spawners\structure.dm"
#include "modular_skyrat\master_files\code\game\effects\spawners\random\structure.dm"
#include "modular_skyrat\master_files\code\game\gamemodes\dynamic.dm"
@@ -4916,6 +4918,7 @@
#include "modular_skyrat\modules\gunpoint\code\gunpoint_datum.dm"
#include "modular_skyrat\modules\gunpoint\code\gunpoint_radial.dm"
#include "modular_skyrat\modules\gunsafety\code\gun_safety.dm"
#include "modular_skyrat\modules\gunsgalore\code\projectile.dm"
#include "modular_skyrat\modules\gunsgalore\code\ammo\ammo.dm"
#include "modular_skyrat\modules\gunsgalore\code\guns\akm.dm"
#include "modular_skyrat\modules\gunsgalore\code\guns\ballistic_master.dm"