diff --git a/code/game/gamemodes/shadowling/shadowling.dm b/code/game/gamemodes/shadowling/shadowling.dm index 4cdeec3edf0..98d1d31ccf8 100644 --- a/code/game/gamemodes/shadowling/shadowling.dm +++ b/code/game/gamemodes/shadowling/shadowling.dm @@ -301,6 +301,8 @@ Made by Xhuis flags = NO_BLOOD | NO_BREATHE | NO_SCAN | NO_INTORGANS burn_mod = 1.5 //1.5x burn damage, 2x is excessive + silent_steps = 1 + /datum/game_mode/proc/update_shadow_icons_added(datum/mind/shadow_mind) spawn(0) for(var/datum/mind/shadowling in shadows) diff --git a/code/game/turfs/simulated/floor.dm b/code/game/turfs/simulated/floor.dm index c24482a0da4..9cddb5a9fa4 100644 --- a/code/game/turfs/simulated/floor.dm +++ b/code/game/turfs/simulated/floor.dm @@ -115,6 +115,12 @@ var/list/wood_icons = list("wood","wood-broken") else if(is_plating()) if(!broken && !burnt) icon_state = icon_plating //Because asteroids are 'platings' too. + + footstep_sounds = list( + "human" = list('sound/effects/footstep/plating_human.ogg'), + "xeno" = list('sound/effects/footstep/plating_xeno.ogg') + ) + else if(is_light_floor()) var/obj/item/stack/tile/light/T = floor_tile if(T.on) @@ -193,11 +199,20 @@ var/list/wood_icons = list("wood","wood-broken") icon_state = "carpet[connectdir]-[diagonalconnect]" + footstep_sounds = list( + "human" = list('sound/effects/footstep/carpet_human.ogg'), + "xeno" = list('sound/effects/footstep/carpet_xeno.ogg') + ) + else if(is_wood_floor()) if(!broken && !burnt) if( !(icon_state in wood_icons) ) icon_state = "wood" - //world << "[icon_state]y's got [icon_state]" + + footstep_sounds = list( + "human" = list('sound/effects/footstep/wood_all.ogg'), //@RonaldVanWonderen of Freesound.org + "xeno" = list('sound/effects/footstep/wood_all.ogg') //@RonaldVanWonderen of Freesound.org + ) /turf/simulated/floor/return_siding_icon_state() diff --git a/code/game/turfs/simulated/floor_types.dm b/code/game/turfs/simulated/floor_types.dm index b9279f779cb..cb77106508e 100644 --- a/code/game/turfs/simulated/floor_types.dm +++ b/code/game/turfs/simulated/floor_types.dm @@ -31,6 +31,11 @@ icon_state = "wood" floor_tile = new/obj/item/stack/tile/wood + footstep_sounds = list( + "human" = list('sound/effects/footstep/wood_all.ogg'), //@RonaldVanWonderen of Freesound.org + "xeno" = list('sound/effects/footstep/wood_all.ogg') //@RonaldVanWonderen of Freesound.org + ) + /turf/simulated/floor/vault icon_state = "rockvault" @@ -131,6 +136,11 @@ floor_tile = null intact = 0 + footstep_sounds = list( + "human" = list('sound/effects/footstep/plating_human.ogg'), + "xeno" = list('sound/effects/footstep/plating_xeno.ogg') + ) + /turf/simulated/floor/plating/airless icon_state = "plating" name = "airless plating" @@ -246,6 +256,11 @@ icon_state = "carpet" floor_tile = new/obj/item/stack/tile/carpet + footstep_sounds = list( + "human" = list('sound/effects/footstep/carpet_human.ogg'), + "xeno" = list('sound/effects/footstep/carpet_xeno.ogg') + ) + New() floor_tile.New() //I guess New() isn't ran on objects spawned without the definition of a turf to house them, ah well. if(!icon_state) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 8cd2500b0e0..3dce001a535 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -29,6 +29,8 @@ var/image/obscured //camerachunks + var/list/footstep_sounds = list() + /turf/New() ..() for(var/atom/movable/AM in src) diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 0361ad7c5f5..2e196811932 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -310,6 +310,7 @@ BLIND // can't see anything body_parts_covered = FEET slot_flags = SLOT_FEET + var/silence_steps = 0 permeability_coefficient = 0.50 slowdown = SHOES_SLOWDOWN diff --git a/code/modules/clothing/shoes/miscellaneous.dm b/code/modules/clothing/shoes/miscellaneous.dm index f9f39bc063d..418db118b82 100644 --- a/code/modules/clothing/shoes/miscellaneous.dm +++ b/code/modules/clothing/shoes/miscellaneous.dm @@ -11,6 +11,7 @@ var/list/clothing_choices = list() siemens_coefficient = 0.8 species_restricted = null + silence_steps = 1 /obj/item/clothing/shoes/mime name = "mime shoes" @@ -175,3 +176,25 @@ icon_state = "noble_boot" item_color = "noble_boot" item_state = "noble_boot" + + +/obj/item/clothing/shoes/attackby(obj/item/I, mob/user, params) + if(istype(I, /obj/item/shoe_silencer)) + silence_steps = 1 + user.unEquip(I) + qdel(I) + else . = ..() + +/obj/item/shoe_silencer + name = "shoe rags" + desc = "Looks sneaky." + icon_state = "sheet-cloth" + +/datum/table_recipe/shoe_rags + name = "Shoe Rags" + + result = /obj/item/shoe_silencer + reqs = list(/obj/item/stack/tape_roll = 10) + tools = list(/obj/item/weapon/wirecutters) + + time = 40 diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 16a8602e527..cdd23e4d9b3 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -291,3 +291,30 @@ Des: Removes all infected images from the alien. #undef HEAT_DAMAGE_LEVEL_1 #undef HEAT_DAMAGE_LEVEL_2 #undef HEAT_DAMAGE_LEVEL_3 + +/mob/living/carbon/alien/handle_footstep(turf/T) + if(..()) + if(T.footstep_sounds["xeno"]) + var/S = pick(T.footstep_sounds["xeno"]) + if(S) + if(m_intent == "run") + if(!(step_count % 2)) //every other turf makes a sound + return 0 + + var/range = -(world.view - 2) + range -= 0.666 //-(7 - 2) = (-5) = -5 | -5 - (0.666) = -5.666 | (7 + -5.666) = 1.334 | 1.334 * 3 = 4.002 | range(4.002) = range(4) + var/volume = 5 + + if(m_intent == "walk") + return 0 //silent when walking + + if(buckled || lying || throwing) + return 0 //people flying, lying down or sitting do not step + + if(!has_gravity(src)) + if(step_count % 3) //this basically says, every three moves make a noise + return 0 //1st - none, 1%3==1, 2nd - none, 2%3==2, 3rd - noise, 3%3==0 + + playsound(T, S, volume, 1, range) + return 1 + return 0 diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 39bdd785530..c6e6279b3ad 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -95,4 +95,55 @@ if(!has_gravity(loc)) return var/obj/item/clothing/shoes/S = shoes - S.step_action(src) \ No newline at end of file + S.step_action(src) + +/mob/living/carbon/human/handle_footstep(turf/T) + if(..()) + if(T.footstep_sounds["human"]) + var/S = pick(T.footstep_sounds["human"]) + if(S) + if(m_intent == "run") + if(!(step_count % 2)) //every other turf makes a sound + return 0 + + var/range = -(world.view - 2) + if(m_intent == "walk") + range -= 0.333 + if(!shoes) + range -= 0.333 + + //shoes + running + //-(7 - 2) = -(5) = -5 | -5 - 0 = -5 | (7 + -5) = 2 | 2 * 3 = 6 | range(6) = range(6) + //running OR shoes + //-(7 - 2) = (-5) = -5 | -5 - 0.333 = -5.333 | (7 + -5.333) = 1.667 | 1.667 * 3 = 5.001 | range(5.001) = range(5) + //walking AND no shoes + //-(7 - 2) = (-5) = -5 | -5 - (0.333 * 2) = -5.666 | (7 + -5.666) = 1.334 | 1.334 * 3 = 4.002 | range(4.002) = range(4) + + var/volume = 13 + if(m_intent == "walk") + volume -= 4 + if(!shoes) + volume -= 4 + + if(istype(shoes, /obj/item/clothing/shoes)) + var/obj/item/clothing/shoes/shooess = shoes + if(shooess.silence_steps) + return 0 //silent + + if(!has_organ("l_foot") && !has_organ("r_foot")) + return 0 //no feet no footsteps + + if(buckled || lying || throwing) + return 0 //people flying, lying down or sitting do not step + + if(!has_gravity(src)) + if(step_count % 3) //this basically says, every three moves make a noise + return 0 //1st - none, 1%3==1, 2nd - none, 2%3==2, 3rd - noise, 3%3==0 + + if(species.silent_steps) + return 0 //species is silent + + playsound(T, S, volume, 1, range) + return 1 + + return 0 \ No newline at end of file diff --git a/code/modules/mob/living/carbon/human/species/species.dm b/code/modules/mob/living/carbon/human/species/species.dm index 6c12bc9b5a7..4a83a771149 100644 --- a/code/modules/mob/living/carbon/human/species/species.dm +++ b/code/modules/mob/living/carbon/human/species/species.dm @@ -23,6 +23,7 @@ var/unarmed //For empty hand harm-intent attack var/unarmed_type = /datum/unarmed_attack var/slowdown = 0 // Passive movement speed malus (or boost, if negative) + var/silent_steps = 0 // Stops step noises var/breath_type = "oxygen" // Non-oxygen gas breathed, if any. var/poison_type = "plasma" // Poisonous air. @@ -591,4 +592,4 @@ else H.bodytemp.icon_state = "temp0" - return 1 \ No newline at end of file + return 1 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 1826658faba..a248d5ae581 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -481,10 +481,18 @@ if (s_active && !( s_active in contents ) && get_turf(s_active) != get_turf(src)) //check !( s_active in contents ) first so we hopefully don't have to call get_turf() so much. s_active.close(src) + handle_footstep(loc) + step_count++ + if(update_slimes) for(var/mob/living/carbon/slime/M in view(1,src)) M.UpdateFeed(src) +/mob/living/proc/handle_footstep(turf/T) + if(istype(T)) + return 1 + return 0 + /*////////////////////// START RESIST PROCS */////////////////////// diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 08a99c0dba2..f21d2a2d954 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -51,4 +51,5 @@ var/list/icon/pipes_shown = list() var/last_played_vent - var/list/datum/action/actions = list() \ No newline at end of file + var/list/datum/action/actions = list() + var/step_count = 0 \ No newline at end of file diff --git a/sound/effects/footstep/carpet_human.ogg b/sound/effects/footstep/carpet_human.ogg new file mode 100644 index 00000000000..8e7d16e6810 Binary files /dev/null and b/sound/effects/footstep/carpet_human.ogg differ diff --git a/sound/effects/footstep/carpet_xeno.ogg b/sound/effects/footstep/carpet_xeno.ogg new file mode 100644 index 00000000000..86569b3f28b Binary files /dev/null and b/sound/effects/footstep/carpet_xeno.ogg differ diff --git a/sound/effects/footstep/plating_human.ogg b/sound/effects/footstep/plating_human.ogg new file mode 100644 index 00000000000..72c04e7fe41 Binary files /dev/null and b/sound/effects/footstep/plating_human.ogg differ diff --git a/sound/effects/footstep/plating_xeno.ogg b/sound/effects/footstep/plating_xeno.ogg new file mode 100644 index 00000000000..f38a1eb5c3f Binary files /dev/null and b/sound/effects/footstep/plating_xeno.ogg differ diff --git a/sound/effects/footstep/wood_all.ogg b/sound/effects/footstep/wood_all.ogg new file mode 100644 index 00000000000..72628a8eaea Binary files /dev/null and b/sound/effects/footstep/wood_all.ogg differ