Chair Fixes (#10815)

This commit is contained in:
Wowzewow (Wezzy)
2020-12-17 17:31:00 +01:00
committed by GitHub
parent 053aa03647
commit 8ea465254d
7 changed files with 129 additions and 88 deletions
@@ -24,15 +24,15 @@
var/material/padding_material
var/base_icon = "bed"
var/material_alteration = MATERIAL_ALTERATION_ALL
var/buckling_sound = 'sound/effects/buckle.ogg'
var/can_dismantle = TRUE
gfi_layer_rotation = GFI_ROTATION_DEFDIR
var/apply_material_color = TRUE
var/makes_rolling_sound = TRUE
var/buckle_sound = 'sound/effects/buckle.ogg'
slowdown = 5
/obj/structure/bed/New(newloc, var/new_material = DEFAULT_WALL_MATERIAL, var/new_padding_material)
/obj/structure/bed/New(newloc, new_material = MATERIAL_STEEL, new_padding_material)
..(newloc)
color = null
material = SSmaterials.get_material_by_name(new_material)
@@ -45,41 +45,42 @@
/obj/structure/bed/buckle_mob(mob/living/M)
. = ..()
if(. && buckle_sound)
playsound(src, buckle_sound, 20)
if(. && buckling_sound)
playsound(src, buckling_sound, 20)
// Reuse the cache/code from stools, todo maybe unify.
/obj/structure/bed/update_icon()
// Prep icon.
icon_state = ""
cut_overlays()
var/list/stool_cache = SSicon_cache.stool_cache
// Base icon.
var/list/stool_cache = SSicon_cache.stool_cache
var/cache_key = "[base_icon]-[material.name]"
if(!stool_cache[cache_key])
var/image/I = image('icons/obj/furniture.dmi', base_icon)
if(apply_material_color)
if(material_alteration & MATERIAL_ALTERATION_COLOR)
I.color = material.icon_colour
stool_cache[cache_key] = I
add_overlay(stool_cache[cache_key])
// Padding overlay.
if(padding_material)
var/padding_cache_key = "[base_icon]-padding-[padding_material.name]"
var/padding_cache_key = "[base_icon]-[padding_material.name]-padding"
if(!stool_cache[padding_cache_key])
var/image/I = image(icon, "[base_icon]_padding")
if(apply_material_color)
if(material_alteration & MATERIAL_ALTERATION_COLOR)
I.color = padding_material.icon_colour
stool_cache[padding_cache_key] = I
add_overlay(stool_cache[padding_cache_key])
// Strings.
desc = initial(desc)
if(padding_material)
name = "[padding_material.display_name] [initial(name)]" //this is not perfect but it will do for now.
desc += " It's made of [material.use_name] and covered with [padding_material.use_name]."
else
name = "[material.display_name] [initial(name)]"
desc += " It's made of [material.use_name]."
if(material_alteration & MATERIAL_ALTERATION_NAME)
name = padding_material ? "[padding_material.adjective_name] [initial(name)]" : "[material.adjective_name] [initial(name)]" //this is not perfect but it will do for now.
if(material_alteration & MATERIAL_ALTERATION_DESC)
desc = initial(desc)
desc += padding_material ? " It's made of [material.use_name] and covered with [padding_material.use_name]." : " It's made of [material.use_name]."
/obj/structure/bed/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(istype(mover) && mover.checkpass(PASSTABLE))
@@ -2,8 +2,8 @@
name = "chair"
desc = "You sit in this. Either by will or force."
icon_state = "chair_preview"
color = "#666666"
base_icon = "chair"
color = "#666666"
build_amt = 1
@@ -34,6 +34,7 @@
/obj/structure/bed/chair/post_buckle_mob()
update_icon()
return ..()
/obj/structure/bed/chair/update_icon()
..()
@@ -41,33 +42,42 @@
var/list/stool_cache = SSicon_cache.stool_cache
var/cache_key = "[base_icon]-[material.name]-over"
if(isnull(stool_cache[cache_key]))
if(!stool_cache[cache_key])
var/image/I = image('icons/obj/furniture.dmi', "[base_icon]_over")
if(apply_material_color)
if(material_alteration & MATERIAL_ALTERATION_COLOR)
I.color = material.icon_colour
I.layer = FLY_LAYER
stool_cache[cache_key] = I
add_overlay(stool_cache[cache_key])
// Padding overlay.
if(padding_material)
var/padding_cache_key = "[base_icon]-padding-[padding_material.name]-over"
if(isnull(stool_cache[padding_cache_key]))
var/padding_cache_key = "[base_icon]-[padding_material.name]-padding-over"
if(!stool_cache[padding_cache_key])
var/image/I = image(icon, "[base_icon]_padding_over")
if(apply_material_color)
if(material_alteration & MATERIAL_ALTERATION_COLOR)
I.color = padding_material.icon_colour
I.layer = FLY_LAYER
stool_cache[padding_cache_key] = I
add_overlay(stool_cache[padding_cache_key])
if(buckled_mob && padding_material)
cache_key = "[base_icon]-armrest-[padding_material.name]"
if(isnull(stool_cache[cache_key]))
if(buckled_mob)
cache_key = "[base_icon]-[material.name]-armrest"
if(!stool_cache[cache_key])
var/image/I = image(icon, "[base_icon]_armrest")
I.layer = MOB_LAYER + 0.1
if(apply_material_color)
I.color = padding_material.icon_colour
I.layer = FLY_LAYER
if(material_alteration & MATERIAL_ALTERATION_COLOR)
I.color = material.icon_colour
stool_cache[cache_key] = I
add_overlay(stool_cache[cache_key])
if(padding_material)
cache_key = "[base_icon]-[padding_material.name]-padding-armrest"
if(!stool_cache[cache_key])
var/image/I = image(icon, "[base_icon]_padding_armrest")
I.layer = FLY_LAYER
if(material_alteration & MATERIAL_ALTERATION_COLOR)
I.color = padding_material.icon_colour
stool_cache[cache_key] = I
add_overlay(stool_cache[cache_key])
/obj/structure/bed/chair/set_dir()
. = ..()
@@ -76,6 +86,7 @@
// Leaving this in for the sake of compilation.
/obj/structure/bed/chair/comfy
name = "comfy chair"
desc = "It's a chair. It looks comfy."
icon_state = "comfychair_preview"
base_icon = "comfychair"
@@ -109,13 +120,12 @@
..(newloc, MATERIAL_STEEL, MATERIAL_CLOTH_LIME)
/obj/structure/bed/chair/office
name = "office chair"
material_alteration = MATERIAL_ALTERATION_NAME || MATERIAL_ALTERATION_DESC
anchored = 0
buckle_movable = 1
build_amt = 5
/obj/structure/bed/chair/office/update_icon()
return
/obj/structure/bed/chair/office/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W,/obj/item/stack) || W.iswirecutter())
return
@@ -165,29 +175,35 @@
occupant.visible_message("<span class='danger'>[occupant] crashed into \the [A]!</span>")
/obj/structure/bed/chair/office/light
icon_state = "officechair_white"
icon_state = "officechair_white_preview"
base_icon = "officechair_white"
/obj/structure/bed/chair/office/dark
icon_state = "officechair_dark"
icon_state = "officechair_dark_preview"
base_icon = "officechair_dark"
/obj/structure/bed/chair/office/bridge
name = "command chair"
desc = "It exudes authority... and looks about as comfortable as a brick."
icon_state = "bridge"
icon_state = "bridge_preview"
base_icon = "bridge"
anchored = 1
/obj/structure/bed/chair/office/bridge/legion
name = "legion pilot seat"
desc = "A comfortable seat for a pilot."
icon_state = "bridge_legion"
icon_state = "bridge_legion_preview"
base_icon = "bridge_legion"
/obj/structure/bed/chair/office/bridge/generic
icon_state = "bridge_generic"
icon_state = "bridge_generic_preview"
base_icon = "bridge_generic"
/obj/structure/bed/chair/office/bridge/pilot
name = "pilot seat"
desc = "A comfortable seat for a pilot."
icon_state = "pilot"
icon_state = "pilot_preview"
base_icon = "pilot"
/obj/structure/bed/chair/office/hover
name = "hoverchair"
@@ -203,28 +219,20 @@
/obj/structure/bed/chair/office/hover/command
icon_state = "hover_command"
/obj/structure/bed/chair/office/Initialize()
. = ..()
var/image/I = image(icon, "[icon_state]_over")
I.layer = FLY_LAYER
add_overlay(I)
// Chair types
/obj/structure/bed/chair/plastic
color = "#CCCCCC"
/obj/structure/bed/chair/plastic/New(var/newloc)
..(newloc, MATERIAL_PLASTIC)
/obj/structure/bed/chair/wood
name = "wooden chair"
name = "classic chair"
desc = "Old is never too old to not be in fashion."
icon_state = "wooden_chair"
icon_state = "wooden_chair_preview"
base_icon = "wooden_chair"
material_alteration = MATERIAL_ALTERATION_NAME || MATERIAL_ALTERATION_DESC
build_amt = 3
/obj/structure/bed/chair/wood/update_icon()
return
/obj/structure/bed/chair/wood/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W,/obj/item/stack) || W.iswirecutter())
return
@@ -233,56 +241,38 @@
/obj/structure/bed/chair/wood/New(var/newloc)
..(newloc, MATERIAL_WOOD)
/obj/structure/bed/chair/wood/Initialize(mapload)
.=..()
var/image/I = image(icon, "[icon_state]_over")
I.layer = FLY_LAYER
add_overlay(I)
/obj/structure/bed/chair/wood/wings
icon_state = "wooden_chair_wings"
name = "winged chair"
icon_state = "wooden_chair_wings_preview"
base_icon = "wooden_chair_wings"
/obj/structure/bed/chair/unmovable
can_dismantle = 0
/obj/structure/bed/chair/shuttle
icon_state = "shuttlechair"
name = "shuttle chair"
icon_state = "shuttlechair_preview"
base_icon = "shuttlechair"
buckling_sound = 'sound/effects/metal_close.ogg'
material_alteration = MATERIAL_ALTERATION_NAME || MATERIAL_ALTERATION_DESC
can_dismantle = FALSE
apply_material_color = FALSE
anchored = TRUE
/obj/structure/bed/chair/shuttle/update_icon()
cut_overlays()
var/image/O = image(icon, "[icon_state]_over")
O.layer = FLY_LAYER
add_overlay(O)
var/list/stool_cache = SSicon_cache.stool_cache
var/cache_key = "[base_icon]_over"
if(isnull(stool_cache[cache_key]))
var/image/I = image('icons/obj/furniture.dmi', "[base_icon]_over")
if(apply_material_color)
I.color = material.icon_colour
I.layer = FLY_LAYER
stool_cache[cache_key] = I
add_overlay(stool_cache[cache_key])
/obj/structure/bed/chair/shuttle/post_buckle_mob()
if(buckled_mob)
icon_state = "[base_icon]_down"
cache_key = "[base_icon]-armrest"
if(isnull(stool_cache[cache_key]))
var/image/I = image(icon, "[base_icon]_armrest")
I.layer = MOB_LAYER + 0.1
if(apply_material_color)
I.color = padding_material.icon_colour
stool_cache[cache_key] = I
add_overlay(stool_cache[cache_key])
base_icon = "shuttlechair-b"
else
icon_state = initial(icon_state)
base_icon = "shuttlechair"
..()
/obj/structure/bed/chair/shuttle/update_icon()
..()
if(!buckled_mob)
var/image/I = image(icon, "[base_icon]_special")
I.layer = ABOVE_MOB_LAYER
if(material_alteration & MATERIAL_ALTERATION_COLOR)
I.color = material.icon_colour
overlays |= I
// pool chair, to sit with your feet in the water. only works when facing south, because water overlays weirdly otherwise
/obj/structure/bed/chair/pool