Skip to content

Commit

Permalink
[MIRROR] Autotucking On Map Load (#1255)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: san7890 <[email protected]>

* Autotucking On Map Load

---------

Co-authored-by: LemonInTheDark <[email protected]>
Co-authored-by: Ghom <[email protected]>
Co-authored-by: san7890 <[email protected]>
  • Loading branch information
4 people authored and StealsThePRs committed Mar 4, 2024
1 parent 6661fbc commit 5ec28c9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
17 changes: 13 additions & 4 deletions code/datums/elements/bed_tucking.dm
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand All @@ -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)
. = ..()
Expand All @@ -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
Expand All @@ -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
*
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/plushes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/bedsheet_bin.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5ec28c9

Please sign in to comment.