Skip to content

Commit

Permalink
Adding a burn/broken check for floors.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Nov 12, 2024
1 parent 8fb0654 commit dc33136
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
12 changes: 11 additions & 1 deletion code/game/turfs/flooring/flooring_carpet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@
footstep_type = /decl/footsteps/carpet
force_material = /decl/material/solid/organic/cloth
constructed = TRUE

burned_states = list(
"burned0",
"burned1"
)
broken_states = list(
"broken0",
"broken1",
"broken2",
"broken3",
"broken4"
)
/decl/flooring/carpet/blue
name = "blue carpet"
icon_base = "blue1"
Expand Down
3 changes: 3 additions & 0 deletions code/game/turfs/unsimulated/floor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
icon = 'icons/turf/flooring/wood.dmi'
icon_state = "wood0"

/turf/unsimulated/floor/wood/broken
icon_state = "wood_broken0"

/turf/unsimulated/floor/wood/broken1
icon_state = "wood_broken1"

Expand Down
27 changes: 27 additions & 0 deletions code/unit_tests/turf_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,30 @@
. += "null or invalid _base_flooring ([_base_flooring || "NULL"])"
if(_flooring && !istype(_flooring))
. += "invalid post-init type for _flooring ([_flooring || "NULL"])"

var/decl/flooring/check_flooring = get_topmost_flooring()

var/initial_floor_broken = initial(_floor_broken)
if(initial_floor_broken)
if(!istype(check_flooring))
. += "non-null initial _floor_broken, but no valid flooring found"
else if(!length(check_flooring.broken_states))
. += "non-null initial _floor_broken, but no flooring broken states found"
else if(istext(initial_floor_broken))
if(!(initial_floor_broken in check_flooring.broken_states))
. += "non-null initial _floor_broken not found in [check_flooring] broken states"
else if(initial_floor_broken != TRUE)
. += "non-TRUE, non-null, non-text initial _floor_broken value."

var/initial_floor_burned = initial(_floor_burned)
if(initial_floor_burned)
if(!istype(check_flooring))
. += "non-null initial _floor_burned, but no valid flooring found"
else if(!length(check_flooring.burned_states))
. += "non-null initial _floor_burned, but no flooring burned states found"
else if(istext(initial_floor_burned))
if(!(initial_floor_burned in check_flooring.burned_states))
. += "non-null initial _floor_burned not found in [check_flooring] burned states"
else if(initial_floor_burned != TRUE)
. += "non-TRUE, non-null, non-text initial _floor_burned value."

0 comments on commit dc33136

Please sign in to comment.