diff --git a/code/__defines/materials.dm b/code/__defines/materials.dm index 11cf6d4a390..23572899ae4 100644 --- a/code/__defines/materials.dm +++ b/code/__defines/materials.dm @@ -64,3 +64,8 @@ #define MATERIAL_CLOTH_BEIGE "beige" #define MATERIAL_CLOTH_LIME "lime" +#define MATERIAL_ALTERATION_NONE 0 +#define MATERIAL_ALTERATION_NAME 1 +#define MATERIAL_ALTERATION_DESC 2 +#define MATERIAL_ALTERATION_COLOR 4 +#define MATERIAL_ALTERATION_ALL (~MATERIAL_ALTERATION_NONE) diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index d25e82906b2..714c5de00bb 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -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)) diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index 7840493fb41..ee098df1d86 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -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("[occupant] crashed into \the [A]!") /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 diff --git a/code/modules/materials/materials.dm b/code/modules/materials/materials.dm index 1df42efb08e..ee0b122b280 100644 --- a/code/modules/materials/materials.dm +++ b/code/modules/materials/materials.dm @@ -38,6 +38,7 @@ /material var/name // Unique name for use in indexing the list. var/display_name // Prettier name for display. + var/adjective_name // To override the name for subtypes and stuff. var/use_name var/flags = 0 // Various status modifiers. var/sheet_singular_name = "sheet" @@ -144,6 +145,8 @@ display_name = name if(!use_name) use_name = display_name + if(!adjective_name) + adjective_name = display_name if(!shard_icon) shard_icon = shard_type diff --git a/html/changelogs/wezzy-chairfixes2.yml b/html/changelogs/wezzy-chairfixes2.yml new file mode 100644 index 00000000000..482512a4a93 --- /dev/null +++ b/html/changelogs/wezzy-chairfixes2.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: Wowzewow (Wezzy) + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixes chair overlays and coloring once and for all. Also, added more accurate previews which help in mapping and examining." + - rscadd: "Added a new buckling sound for shuttle chairs." diff --git a/icons/obj/furniture.dmi b/icons/obj/furniture.dmi index ccf651a5723..13bda64f936 100644 Binary files a/icons/obj/furniture.dmi and b/icons/obj/furniture.dmi differ diff --git a/sound/effects/metal_close.ogg b/sound/effects/metal_close.ogg new file mode 100644 index 00000000000..5a45d743270 Binary files /dev/null and b/sound/effects/metal_close.ogg differ