From 1f249fbf0fac41d2e44605611e5d62a000b36f68 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Sun, 3 Mar 2024 11:55:23 -0800 Subject: [PATCH] Autotucking On Map Load (#81782) ## About The Pull Request Doesn't really do much currently but without it wallening beds look fuckin DUMB Plus I think this better matches what is intended ## Why It's Good For The Game ![image](https://github.com/tgstation/tgstation/assets/58055496/d5e4c372-3e84-435a-88b9-b5be442049b2) --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com> Co-authored-by: san7890 --- code/datums/elements/bed_tucking.dm | 17 +++++++++++++---- code/game/objects/items/plushes.dm | 2 +- code/game/objects/structures/bedsheet_bin.dm | 2 +- .../equipment/nuclear_authentication_disk.dm | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/code/datums/elements/bed_tucking.dm b/code/datums/elements/bed_tucking.dm index 70b10d4a58c..58f5640c31c 100644 --- a/code/datums/elements/bed_tucking.dm +++ b/code/datums/elements/bed_tucking.dm @@ -1,7 +1,7 @@ /// Tucking element, for things that can be tucked into bed. /datum/element/bed_tuckable element_flags = ELEMENT_BESPOKE - argument_hash_start_idx = 2 + argument_hash_start_idx = 3 /// our pixel_x offset - how much the item moves x when in bed (+x is closer to the pillow) var/x_offset = 0 /// our pixel_y offset - how much the item move y when in bed (-y is closer to the middle) @@ -11,7 +11,7 @@ /// our starting angle for the item var/starting_angle = 0 -/datum/element/bed_tuckable/Attach(obj/target, x = 0, y = 0, rotation = 0) +/datum/element/bed_tuckable/Attach(obj/target, mapload = FALSE, x = 0, y = 0, rotation = 0) . = ..() if(!isitem(target)) return ELEMENT_INCOMPATIBLE @@ -20,6 +20,13 @@ y_offset = y starting_angle = rotation RegisterSignal(target, COMSIG_ITEM_ATTACK_ATOM, PROC_REF(tuck_into_bed)) + if(!mapload) + return + var/turf/our_home = get_turf(target) + var/obj/structure/bed/eepy = locate(/obj/structure/bed) in our_home + if(isnull(eepy)) + return + tuck(target, eepy) /datum/element/bed_tuckable/Detach(obj/target) . = ..() @@ -42,6 +49,10 @@ return to_chat(tucker, span_notice("You lay [tucked] out on [target_bed].")) + tuck(tucked, target_bed) + return COMPONENT_NO_AFTERATTACK + +/datum/element/bed_tuckable/proc/tuck(obj/item/tucked, obj/structure/bed/target_bed) tucked.dir = target_bed.dir tucked.pixel_x = target_bed.dir & EAST ? -x_offset : x_offset tucked.pixel_y = y_offset @@ -50,8 +61,6 @@ tucked.transform = turn(tucked.transform, rotation_degree) RegisterSignal(tucked, COMSIG_ITEM_PICKUP, PROC_REF(untuck)) - return COMPONENT_NO_AFTERATTACK - /** * If we rotate our object, then we need to un-rotate it when it's picked up * diff --git a/code/game/objects/items/plushes.dm b/code/game/objects/items/plushes.dm index ca669a9733e..90790a75ea2 100644 --- a/code/game/objects/items/plushes.dm +++ b/code/game/objects/items/plushes.dm @@ -44,7 +44,7 @@ /obj/item/toy/plush/Initialize(mapload) . = ..() AddComponent(/datum/component/squeak, squeak_override) - AddElement(/datum/element/bed_tuckable, 6, -5, 90) + AddElement(/datum/element/bed_tuckable, mapload, 6, -5, 90) //have we decided if Pinocchio goes in the blue or pink aisle yet? if(gender == NEUTER) diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index f80042f5679..50fcae8dec1 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -35,7 +35,7 @@ LINEN BINS /obj/item/bedsheet/Initialize(mapload) . = ..() AddComponent(/datum/component/surgery_initiator) - AddElement(/datum/element/bed_tuckable, 0, 0, 0) + AddElement(/datum/element/bed_tuckable, mapload, 0, 0, 0) if(bedsheet_type == BEDSHEET_DOUBLE) stack_amount *= 2 dying_key = DYE_REGISTRY_DOUBLE_BEDSHEET diff --git a/code/modules/antagonists/nukeop/equipment/nuclear_authentication_disk.dm b/code/modules/antagonists/nukeop/equipment/nuclear_authentication_disk.dm index 72c51f14b2b..c318679b4f6 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclear_authentication_disk.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclear_authentication_disk.dm @@ -26,7 +26,7 @@ /obj/item/disk/nuclear/Initialize(mapload) . = ..() - AddElement(/datum/element/bed_tuckable, 6, -6, 0) + AddElement(/datum/element/bed_tuckable, mapload, 6, -6, 0) AddComponent(/datum/component/stationloving, !fake) if(!fake)