diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index d035c7786d2..7a39a6c19dd 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -18,6 +18,9 @@ var/item_chair = /obj/item/chair // if null it can't be picked up ///How much sitting on this chair influences fishing difficulty var/fishing_modifier = -5 + var/has_armrest = FALSE + // The mutable appearance used for the overlay over buckled mobs. + var/mutable_appearance/armrest /obj/structure/chair/Initialize(mapload) . = ..() @@ -25,9 +28,19 @@ name = "tactical [name]" fishing_modifier -= 8 MakeRotate() + if (has_armrest) + gen_armrest() if(can_buckle && fishing_modifier) AddComponent(/datum/component/adjust_fishing_difficulty, fishing_modifier) +/obj/structure/chair/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents) + if(same_z_layer || !has_armrest) + return ..() + cut_overlay(armrest) + QDEL_NULL(armrest) + gen_armrest() + return ..() + /obj/structure/chair/examine(mob/user) . = ..() . += span_notice("It's held together by a couple of bolts.") @@ -40,6 +53,7 @@ /obj/structure/chair/Destroy() SSjob.latejoin_trackers -= src //These may be here due to the arrivals shuttle + QDEL_NULL(armrest) return ..() /obj/structure/chair/atom_deconstruct(disassembled) @@ -63,6 +77,19 @@ return . = ..() +/obj/structure/chair/proc/gen_armrest() + armrest = GetArmrest() + armrest.layer = ABOVE_MOB_LAYER + update_armrest() + +/obj/structure/chair/proc/GetArmrest() + return mutable_appearance(icon, "[icon_state]_armrest") + +/obj/structure/chair/proc/update_armrest() + if(has_buckled_mobs()) + add_overlay(armrest) + else + cut_overlay(armrest) ///allows each chair to request the electrified_buckle component with overlays that dont look ridiculous /obj/structure/chair/proc/electrify_self(obj/item/assembly/shock_kit/input_shock_kit, mob/user, list/overlays_from_child_procs) @@ -111,10 +138,14 @@ /obj/structure/chair/post_buckle_mob(mob/living/M) . = ..() handle_layer() + if (has_armrest) + update_armrest() /obj/structure/chair/post_unbuckle_mob() . = ..() handle_layer() + if (has_armrest) + update_armrest() /obj/structure/chair/setDir(newdir) ..() @@ -157,46 +188,7 @@ buildstackamount = 2 item_chair = null fishing_modifier = -7 - // The mutable appearance used for the overlay over buckled mobs. - var/mutable_appearance/armrest - -/obj/structure/chair/comfy/Initialize(mapload) - gen_armrest() - return ..() - -/obj/structure/chair/comfy/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents) - if(same_z_layer) - return ..() - cut_overlay(armrest) - QDEL_NULL(armrest) - gen_armrest() - return ..() - -/obj/structure/chair/comfy/proc/gen_armrest() - armrest = GetArmrest() - armrest.layer = ABOVE_MOB_LAYER - update_armrest() - -/obj/structure/chair/comfy/proc/GetArmrest() - return mutable_appearance(icon, "[icon_state]_armrest") - -/obj/structure/chair/comfy/Destroy() - QDEL_NULL(armrest) - return ..() - -/obj/structure/chair/comfy/post_buckle_mob(mob/living/M) - . = ..() - update_armrest() - -/obj/structure/chair/comfy/proc/update_armrest() - if(has_buckled_mobs()) - add_overlay(armrest) - else - cut_overlay(armrest) - -/obj/structure/chair/comfy/post_unbuckle_mob() - . = ..() - update_armrest() + has_armrest = TRUE /obj/structure/chair/comfy/brown color = rgb(70, 47, 28) @@ -456,6 +448,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool/bar, 0) buildstackamount = 1 item_chair = null fishing_modifier = -13 //the pinnacle of Ratvarian technology. + has_armrest = TRUE /// Total rotations made var/turns = 0 @@ -474,6 +467,9 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool/bar, 0) if(turns >= 8) STOP_PROCESSING(SSfastprocess, src) +/obj/structure/chair/bronze/MakeRotate() + return + /obj/structure/chair/bronze/click_alt(mob/user) turns = 0 if(!(datum_flags & DF_ISPROCESSING)) diff --git a/code/game/objects/structures/beds_chairs/pew.dm b/code/game/objects/structures/beds_chairs/pew.dm index 6388247e8c4..e6c64d9f36f 100644 --- a/code/game/objects/structures/beds_chairs/pew.dm +++ b/code/game/objects/structures/beds_chairs/pew.dm @@ -16,83 +16,9 @@ /obj/structure/chair/pew/left name = "left wooden pew end" icon_state = "pewend_left" - var/mutable_appearance/leftpewarmrest - -/obj/structure/chair/pew/left/Initialize(mapload) - gen_armrest() - return ..() - -/obj/structure/chair/pew/left/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents) - if(same_z_layer) - return ..() - cut_overlay(leftpewarmrest) - QDEL_NULL(leftpewarmrest) - gen_armrest() - return ..() - -/obj/structure/chair/pew/left/proc/gen_armrest() - leftpewarmrest = GetLeftPewArmrest() - leftpewarmrest.layer = ABOVE_MOB_LAYER - update_leftpewarmrest() - -/obj/structure/chair/pew/left/proc/GetLeftPewArmrest() - return mutable_appearance('icons/obj/chairs_wide.dmi', "pewend_left_armrest") - -/obj/structure/chair/pew/left/Destroy() - QDEL_NULL(leftpewarmrest) - return ..() - -/obj/structure/chair/pew/left/post_buckle_mob(mob/living/M) - . = ..() - update_leftpewarmrest() - -/obj/structure/chair/pew/left/proc/update_leftpewarmrest() - if(has_buckled_mobs()) - add_overlay(leftpewarmrest) - else - cut_overlay(leftpewarmrest) - -/obj/structure/chair/pew/left/post_unbuckle_mob() - . = ..() - update_leftpewarmrest() + has_armrest = TRUE /obj/structure/chair/pew/right name = "right wooden pew end" icon_state = "pewend_right" - var/mutable_appearance/rightpewarmrest - -/obj/structure/chair/pew/right/Initialize(mapload) - gen_armrest() - return ..() - -/obj/structure/chair/pew/right/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents) - cut_overlay(rightpewarmrest) - QDEL_NULL(rightpewarmrest) - gen_armrest() - return ..() - -/obj/structure/chair/pew/right/proc/gen_armrest() - rightpewarmrest = GetRightPewArmrest() - rightpewarmrest.layer = ABOVE_MOB_LAYER - update_rightpewarmrest() - -/obj/structure/chair/pew/right/proc/GetRightPewArmrest() - return mutable_appearance('icons/obj/chairs_wide.dmi', "pewend_right_armrest") - -/obj/structure/chair/pew/right/Destroy() - QDEL_NULL(rightpewarmrest) - return ..() - -/obj/structure/chair/pew/right/post_buckle_mob(mob/living/M) - . = ..() - update_rightpewarmrest() - -/obj/structure/chair/pew/right/proc/update_rightpewarmrest() - if(has_buckled_mobs()) - add_overlay(rightpewarmrest) - else - cut_overlay(rightpewarmrest) - -/obj/structure/chair/pew/right/post_unbuckle_mob() - . = ..() - update_rightpewarmrest() + has_armrest = TRUE diff --git a/code/game/objects/structures/beds_chairs/sofa.dm b/code/game/objects/structures/beds_chairs/sofa.dm index caee13863e1..4c1278d3891 100644 --- a/code/game/objects/structures/beds_chairs/sofa.dm +++ b/code/game/objects/structures/beds_chairs/sofa.dm @@ -20,44 +20,17 @@ path/corner/color_name {\ buildstackamount = 1 item_chair = null fishing_modifier = -6 - var/mutable_appearance/armrest + has_armrest = TRUE /obj/structure/chair/sofa/Initialize(mapload) . = ..() - gen_armrest() AddElement(/datum/element/soft_landing) -/obj/structure/chair/sofa/on_changed_z_level(turf/old_turf, turf/new_turf, same_z_layer, notify_contents) - if(same_z_layer) - return ..() - cut_overlay(armrest) - QDEL_NULL(armrest) - gen_armrest() - return ..() - -/obj/structure/chair/sofa/proc/gen_armrest() - armrest = mutable_appearance(initial(icon), "[icon_state]_armrest", ABOVE_MOB_LAYER) - update_armrest() - /obj/structure/chair/sofa/electrify_self(obj/item/assembly/shock_kit/input_shock_kit, mob/user, list/overlays_from_child_procs) if(!overlays_from_child_procs) overlays_from_child_procs = list(image('icons/obj/chairs.dmi', loc, "echair_over", pixel_x = -1)) . = ..() -/obj/structure/chair/sofa/post_buckle_mob(mob/living/M) - . = ..() - update_armrest() - -/obj/structure/chair/sofa/proc/update_armrest() - if(has_buckled_mobs()) - add_overlay(armrest) - else - cut_overlay(armrest) - -/obj/structure/chair/sofa/post_unbuckle_mob() - . = ..() - update_armrest() - /obj/structure/chair/sofa/corner/handle_layer() //only the armrest/back of this chair should cover the mob. return diff --git a/icons/obj/chairs.dmi b/icons/obj/chairs.dmi index e3aaa8f3bdc..174a6a3e7bb 100644 Binary files a/icons/obj/chairs.dmi and b/icons/obj/chairs.dmi differ