Skip to content

Commit

Permalink
Make chairs not a subtype of bed
Browse files Browse the repository at this point in the history
  • Loading branch information
out-of-phaze committed Feb 4, 2025
1 parent cb23108 commit fee1377
Show file tree
Hide file tree
Showing 70 changed files with 1,394 additions and 1,434 deletions.
2 changes: 1 addition & 1 deletion code/controllers/subsystems/jobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ SUBSYSTEM_DEF(jobs)
spawnpoint.after_join(H)

// Moving wheelchair if they have one
if(H.buckled && istype(H.buckled, /obj/structure/bed/chair/wheelchair))
if(H.buckled && istype(H.buckled, /obj/structure/chair/wheelchair))
H.buckled.forceMove(H.loc)
H.buckled.set_dir(H.dir)

Expand Down
2 changes: 1 addition & 1 deletion code/datums/supplypacks/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@

/decl/hierarchy/supply_pack/medical/wheelchair
name = "Equipment - Wheelchair crate"
contains = list(/obj/structure/bed/chair/wheelchair)
contains = list(/obj/structure/chair/wheelchair)
containertype = /obj/structure/closet/crate/large
containername = "\improper Wheelchair crate"

Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/effects/decals/Cleanable/humans.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@
if(!isliving(AM) || amount < 1)
return
var/mob/living/walker = AM
if(istype(walker.buckled, /obj/structure/bed/chair/wheelchair))
var/obj/structure/bed/chair/wheelchair/wheelchair = walker.buckled
if(istype(walker.buckled, /obj/structure/chair/wheelchair))
var/obj/structure/chair/wheelchair/wheelchair = walker.buckled
wheelchair.bloodiness = 4
else
walker.add_walking_contaminant(chemical, amount, (blood_data ? blood_data[pick(blood_data)] : null))
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/effects/footprints.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
return null
if(buckled || current_posture?.prone)
return 'icons/mob/footprints/footprints_trail.dmi'
if(istype(buckled, /obj/structure/bed/chair))
if(istype(buckled, /obj/structure/chair))
return 'icons/mob/footprints/footprints_wheelchair.dmi'
var/obj/item/clothing/shoes/shoes = get_equipped_item(slot_shoes_str)
if(istype(shoes) && shoes.footprint_icon)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/extinguisher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
if(O.anchored || !(O.movable_flags & MOVABLE_FLAG_WHEELED))
return

var/obj/structure/bed/chair/C = istype(O, /obj/structure/bed/chair)? O : null
var/obj/structure/chair/C = istype(O, /obj/structure/chair)? O : null
//#TODO: That could definitely be improved. Would suggest to use process_momentum but its only for thrownthing
var/list/move_speed = list(1, 1, 1, 2, 2, 3)
for(var/i in 1 to 6)
Expand Down
27 changes: 8 additions & 19 deletions code/game/objects/structures/beds/bed.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// Beds... get your mind out of the gutter, they're for sleeping!
// TODO by end of Q2 2025: Repath /obj/structure/bed/chair to just /obj/structure/chair.
// Remaining steps:
// - Move padding interactions and padding_color var onto an extension
/obj/structure/bed
name = "bed"
desc = "A raised, padded platform for sleeping on. This one has straps for ensuring restful snoozing in microgravity."
Expand All @@ -19,6 +16,7 @@
parts_type = /obj/item/stack/material/rods
user_comfort = 1
obj_flags = OBJ_FLAG_SUPPORT_MOB
monetary_worth_multiplier = 2.5 // Utility structures should be worth more than their matter (wheelchairs, rollers, etc).
/// The padding extension type for this bed. If null, no extension is created and this bed cannot be padded.
var/padding_extension_type = /datum/extension/padding
var/decl/material/initial_padding_material
Expand All @@ -34,9 +32,6 @@
return user.Adjacent(src) && !user.incapacitated(INCAPACITATION_STUNNED|INCAPACITATION_KNOCKOUT)
return ..()

/obj/structure/bed/get_base_value()
. = round(..() * 2.5) // Utility structures should be worth more than their matter (wheelchairs, rollers, etc).

/obj/structure/bed/get_surgery_surface_quality(mob/living/victim, mob/living/user)
return OPERATE_PASSABLE

Expand All @@ -56,35 +51,29 @@
new_name = "[name_prefix] [new_name]"
SetName(new_name)

/obj/structure/bed/update_material_desc()
/obj/structure/bed/update_material_desc(override_desc)
var/base_desc = override_desc || initial(desc)
var/datum/extension/padding/padding_extension = get_extension(src, __IMPLIED_TYPE__)
var/decl/material/padding_material = padding_extension?.get_padding_material()
if(padding_material)
desc = "[initial(desc)] It's made of [material.use_name] and covered with [padding_material.use_name]."
desc = "[base_desc] It's made of [material.use_name] and covered with [padding_material.use_name]."
else
desc = "[initial(desc)] It's made of [material.use_name]."

/obj/structure/bed/proc/get_base_icon()
return ICON_STATE_WORLD
desc = "[base_desc] It's made of [material.use_name]."

/obj/structure/bed/on_update_icon()
..()
icon_state = get_base_icon()
icon_state = ICON_STATE_WORLD
var/datum/extension/padding/padding_extension = get_extension(src, __IMPLIED_TYPE__)
var/decl/material/padding_material = padding_extension?.get_padding_material()
if(padding_material)
add_overlay(overlay_image(icon, "[icon_state]_padding", material_alteration & MAT_FLAG_ALTERATION_COLOR ? padding_extension.get_padding_color() : null, RESET_COLOR|RESET_ALPHA))

// Used to allow things to pass over dense beds, e.g. rollerbeds, ironing boards
/obj/structure/bed/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(istype(mover) && mover.checkpass(PASS_FLAG_TABLE))
return 1
return TRUE
return ..()

/obj/structure/bed/explosion_act(severity)
. = ..()
if(. && !QDELETED(src) && (severity == 1 || (severity == 2 && prob(50)) || (severity == 3 && prob(5))))
physically_destroyed()

/obj/structure/bed/psych
name = "psychiatrist's couch"
desc = "For prime comfort during psychiatric evaluations."
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/structures/beds/rollerbed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
var/iv_attached = 0
var/iv_stand = TRUE

// this completely circumvents normal bed icon updating, does this really even need to be a bed subtype?
/obj/structure/bed/roller/on_update_icon()
cut_overlays()
if(density)
Expand Down
34 changes: 17 additions & 17 deletions code/game/objects/structures/benches/bench.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// These are benches with backs. For backless benches that can't be buckled to, check for /obj/structure/table/bench.
/obj/structure/bed/chair/bench
/obj/structure/chair/bench
name = "bench"
desc = "A simple slatted bench."
icon = 'icons/obj/structures/furniture/bench.dmi'
Expand All @@ -12,73 +12,73 @@
/// A bitfield of connected neighbors.
var/neighbors = 0

/obj/structure/bed/chair/bench/should_have_alpha_mask()
/obj/structure/chair/bench/should_have_alpha_mask()
if(!simulated || !isturf(loc))
return FALSE
var/obj/structure/bed/chair/bench/south_neighbor = locate() in get_step(loc, SOUTH)
var/obj/structure/chair/bench/south_neighbor = locate() in get_step(loc, SOUTH)
if(can_visually_connect_to(south_neighbor)) // if we're connected to a south neighbor don't add an alpha mask
return TRUE
return TRUE

// TODO: make this use the generic structure smoothing system?
/obj/structure/bed/chair/bench/can_visually_connect_to(var/obj/structure/bed/chair/bench/other)
/obj/structure/chair/bench/can_visually_connect_to(var/obj/structure/chair/bench/other)
return istype(other) && other.dir == dir && other.icon == icon && other.material == material

/obj/structure/bed/chair/bench/Initialize(mapload)
/obj/structure/chair/bench/Initialize(mapload)
..()
return INITIALIZE_HINT_LATELOAD

/obj/structure/bed/chair/bench/LateInitialize(mapload)
/obj/structure/chair/bench/LateInitialize(mapload)
..()
if(mapload)
recalculate_connections()
else
update_neighbors()

/obj/structure/bed/chair/bench/Destroy()
/obj/structure/chair/bench/Destroy()
var/oldloc = loc
. = ..()
update_neighbors(oldloc)

/obj/structure/bed/chair/bench/set_dir()
/obj/structure/chair/bench/set_dir()
var/olddir = dir
. = ..()
if(.)
update_neighbors(update_dir = olddir, skip_icon_update = TRUE)
update_neighbors(update_dir = dir)

/obj/structure/bed/chair/bench/Move()
/obj/structure/chair/bench/Move()
var/oldloc = loc
. = ..()
if(.)
update_neighbors(oldloc, skip_icon_update = TRUE)
update_neighbors(loc)

/obj/structure/bed/chair/bench/proc/update_neighbors(update_loc = loc, update_dir = dir, skip_icon_update)
/obj/structure/chair/bench/proc/update_neighbors(update_loc = loc, update_dir = dir, skip_icon_update)
if(!skip_icon_update)
recalculate_connections()
if(!isturf(update_loc))
return
for(var/stepdir in list(turn(update_dir, -90), turn(update_dir, 90)))
for(var/obj/structure/bed/chair/bench/other in get_step(update_loc, stepdir))
for(var/obj/structure/chair/bench/other in get_step(update_loc, stepdir))
other.recalculate_connections()

// TODO: Make this use base structure smoothing eventually? Somehow?
/obj/structure/bed/chair/bench/proc/recalculate_connections()
/obj/structure/chair/bench/proc/recalculate_connections()
neighbors = 0
if(!isturf(loc))
neighbors = 0
else
for(var/checkdir in list(turn(dir, -90), turn(dir, 90)))
var/turf/check_turf = get_step(loc, checkdir)
for(var/obj/structure/bed/chair/bench/other in check_turf)
for(var/obj/structure/chair/bench/other in check_turf)
// TODO: Make this use normal structure smoothing helpers.
if(other.dir == dir && other.icon == icon && other.material == material)
neighbors |= checkdir
break
update_icon()

/obj/structure/bed/chair/bench/get_base_icon()
/obj/structure/chair/bench/get_base_icon()
. = ..()
var/left_dir = turn(dir, -90)
var/right_dir = turn(dir, 90)
Expand All @@ -92,13 +92,13 @@
else
. += "_standing"

/obj/structure/bed/chair/bench/get_material_icon()
/obj/structure/chair/bench/get_material_icon()
return material?.bench_icon || initial(icon)

/obj/structure/bed/chair/bench/mahogany
/obj/structure/chair/bench/mahogany
color = WOOD_COLOR_RICH
material = /decl/material/solid/organic/wood/mahogany

/obj/structure/bed/chair/bench/ebony
/obj/structure/chair/bench/ebony
color = WOOD_COLOR_BLACK
material = /decl/material/solid/organic/wood/ebony
6 changes: 3 additions & 3 deletions code/game/objects/structures/benches/lounge.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/obj/structure/bed/chair/bench/lounge
/obj/structure/chair/bench/lounge
name = "lounge"
desc = "An elegant lounge, perfect for reclining on."
icon = 'icons/obj/structures/furniture/lounge.dmi'

// Just use the existing icon.
/obj/structure/bed/chair/bench/lounge/get_material_icon()
/obj/structure/chair/bench/lounge/get_material_icon()
return icon || initial(icon)

/obj/structure/bed/chair/bench/lounge/mapped
/obj/structure/chair/bench/lounge/mapped
color = /decl/material/solid/organic/wood/mahogany::color
material = /decl/material/solid/organic/wood/mahogany
initial_padding_material = /decl/material/solid/organic/cloth
Expand Down
8 changes: 4 additions & 4 deletions code/game/objects/structures/benches/pew.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/obj/structure/bed/chair/bench/pew
/obj/structure/chair/bench/pew
name = "pew"
desc = "A long bench with a backboard, commonly found in places of worship, courtrooms and so on. Not known for being particularly comfortable."
icon = 'icons/obj/structures/furniture/pew.dmi'

/obj/structure/bed/chair/bench/pew/get_material_icon()
/obj/structure/chair/bench/pew/get_material_icon()
return material?.pew_icon || initial(icon)

/obj/structure/bed/chair/bench/pew/mahogany
/obj/structure/chair/bench/pew/mahogany
color = /decl/material/solid/organic/wood/mahogany::color
material = /decl/material/solid/organic/wood/mahogany

/obj/structure/bed/chair/bench/pew/ebony
/obj/structure/chair/bench/pew/ebony
color = /decl/material/solid/organic/wood/ebony::color
material = /decl/material/solid/organic/wood/ebony
Loading

0 comments on commit fee1377

Please sign in to comment.