Merge pull request #2448 from tigercat2000/footsteps_are_good_iunno

Footstep sounds
This commit is contained in:
TheDZD
2015-12-08 20:37:49 -05:00
16 changed files with 150 additions and 4 deletions
@@ -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
@@ -95,4 +95,55 @@
if(!has_gravity(loc))
return
var/obj/item/clothing/shoes/S = shoes
S.step_action(src)
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
@@ -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
return 1
+8
View File
@@ -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
*///////////////////////
+2 -1
View File
@@ -51,4 +51,5 @@
var/list/icon/pipes_shown = list()
var/last_played_vent
var/list/datum/action/actions = list()
var/list/datum/action/actions = list()
var/step_count = 0