Implements footstep sound system and adds sounds to various floor types.

* Adds system for turfs to have "footstep sounds" that play when someone walks over them.
* Adds system for floor types (the kind of turfs where you can put tiles on them) to support the footstep sounds.
* Adds sounds to plating, tiles, wood, and carpet floor types.
* Footstep sound system is configurable in game_options.txt, it can be turned off completely or the volume adjusted.
This commit is contained in:
Leshana
2017-04-18 10:21:13 -04:00
parent 7393ba0f26
commit 9a7dda1ad1
34 changed files with 80 additions and 0 deletions

View File

@@ -156,6 +156,8 @@ var/list/gamemode_cache = list()
var/slime_delay = 0
var/animal_delay = 0
var/footstep_volume = 0
var/admin_legacy_system = 0 //Defines whether the server uses the legacy admin system with admins.txt or the SQL system. Config option in config.txt
var/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt
var/use_age_restriction_for_jobs = 0 //Do jobs use account age restrictions? --requires database
@@ -768,6 +770,8 @@ var/list/gamemode_cache = list()
if("animal_delay")
config.animal_delay = value
if("footstep_volume")
config.footstep_volume = text2num(value)
if("use_loyalty_implants")
config.use_loyalty_implants = 1

View File

@@ -37,6 +37,7 @@ var/list/flooring_types
var/descriptor = "tiles"
var/flags
var/can_paint
var/list/footstep_sounds = list() // key=species name, value = list of soundss
/decl/flooring/grass
name = "grass"
@@ -90,6 +91,12 @@ var/list/flooring_types
build_type = /obj/item/stack/tile/carpet
damage_temperature = T0C+200
flags = TURF_HAS_EDGES | TURF_HAS_CORNERS | TURF_REMOVE_CROWBAR | TURF_CAN_BURN
footstep_sounds = list("human" = list(
'sound/effects/footstep/carpet1.ogg',
'sound/effects/footstep/carpet2.ogg',
'sound/effects/footstep/carpet3.ogg',
'sound/effects/footstep/carpet4.ogg',
'sound/effects/footstep/carpet5.ogg'))
/decl/flooring/carpet/blue
name = "carpet"
@@ -107,6 +114,12 @@ var/list/flooring_types
flags = TURF_REMOVE_CROWBAR | TURF_CAN_BREAK | TURF_CAN_BURN
build_type = /obj/item/stack/tile/floor
can_paint = 1
footstep_sounds = list("human" = list(
'sound/effects/footstep/floor1.ogg',
'sound/effects/footstep/floor2.ogg',
'sound/effects/footstep/floor3.ogg',
'sound/effects/footstep/floor4.ogg',
'sound/effects/footstep/floor5.ogg'))
/decl/flooring/linoleum
name = "linoleum"
@@ -193,6 +206,12 @@ var/list/flooring_types
descriptor = "planks"
build_type = /obj/item/stack/tile/wood
flags = TURF_CAN_BREAK | TURF_IS_FRAGILE | TURF_REMOVE_SCREWDRIVER
footstep_sounds = list("human" = list(
'sound/effects/footstep/wood1.ogg',
'sound/effects/footstep/wood2.ogg',
'sound/effects/footstep/wood3.ogg',
'sound/effects/footstep/wood4.ogg',
'sound/effects/footstep/wood5.ogg'))
/decl/flooring/reinforced
name = "reinforced floor"

View File

@@ -13,6 +13,12 @@
var/base_desc = "The naked hull."
var/base_icon = 'icons/turf/flooring/plating.dmi'
var/base_icon_state = "plating"
var/static/list/base_footstep_sounds = list("human" = list(
'sound/effects/footstep/plating1.ogg',
'sound/effects/footstep/plating2.ogg',
'sound/effects/footstep/plating3.ogg',
'sound/effects/footstep/plating4.ogg',
'sound/effects/footstep/plating5.ogg'))
// Flooring data.
var/flooring_override
@@ -33,10 +39,13 @@
floortype = initial_flooring
if(floortype)
set_flooring(get_flooring_data(floortype))
else
footstep_sounds = base_footstep_sounds
/turf/simulated/floor/proc/set_flooring(var/decl/flooring/newflooring)
make_plating(defer_icon_update = 1)
flooring = newflooring
footstep_sounds = newflooring.footstep_sounds
update_icon(1)
levelupdate()
@@ -53,6 +62,7 @@
desc = base_desc
icon = base_icon
icon_state = base_icon_state
footstep_sounds = base_footstep_sounds
if(flooring)
if(flooring.build_type && place_product)

View File

@@ -26,6 +26,8 @@
var/movement_cost = 0 // How much the turf slows down movement, if any.
var/list/footstep_sounds = null
/turf/New()
..()
for(var/atom/movable/AM as mob|obj in src)
@@ -145,6 +147,9 @@ var/const/enterloopsanity = 100
else if(!is_space())
M.inertia_dir = 0
M.make_floating(0)
if(isliving(M))
var/mob/living/L = M
L.handle_footstep(src)
..()
var/objects = 0
if(A && (A.flags & PROXMOVE))

View File

@@ -93,3 +93,5 @@
mob_swap_flags = ~HEAVY
var/identifying_gender // In case the human identifies as another gender than it's biological
var/step_count = 0 // Track how many footsteps have been taken to know when to play footstep sounds

View File

@@ -140,3 +140,34 @@
prob_slip = round(prob_slip)
return(prob_slip)
// Handle footstep sounds
/mob/living/carbon/human/handle_footstep(var/turf/T)
if(!config.footstep_volume || !T.footstep_sounds || !T.footstep_sounds.len)
return
// Future Upgrades - Multi species support
var/list/footstep_sounds = T.footstep_sounds["human"]
if(!footstep_sounds)
return
var/S = pick(footstep_sounds)
if(!S) return
// Only play every other step while running
if(m_intent == "run" && step_count++ % 2 == 0)
return
// Future Upgrades - Consider quieter noises if you walk or have no shoes
var/volume = config.footstep_volume
if(!has_organ(BP_L_FOOT) && !has_organ(BP_R_FOOT))
return // no feet = no footsteps
if(buckled || lying || throwing)
return // people flying, lying down or sitting do not step
if(!has_gravity(src) && prob(75))
return // Far less likely to make noise in no gravity
playsound(T, S, volume, FALSE)
return

View File

@@ -570,6 +570,9 @@ default behaviour is:
for(var/mob/living/carbon/slime/M in view(1,src))
M.UpdateFeed(src)
/mob/living/proc/handle_footstep(turf/T)
return FALSE
/mob/living/verb/resist()
set name = "Resist"
set category = "IC"

View File

@@ -57,6 +57,8 @@ ALIEN_DELAY 0
METROID_DELAY 0
ANIMAL_DELAY 0
## Volume of footstep sound effects. Range: 1-100, Set to 0 to disable footstep sounds.
FOOTSTEP_VOLUME 60
### Miscellaneous ###

View File

@@ -0,0 +1,4 @@
author: Leshana
delete-after: True
changes:
- rscadd: "Implements footstep sound system and adds sounds to various floor types including plating, tiles, wood, and carpet."

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.