From bcc6b4c24a93b867783fc65651dda62f5a55457a Mon Sep 17 00:00:00 2001 From: Luc <89928798+lewcc@users.noreply.github.com> Date: Tue, 21 Feb 2023 17:16:05 -0500 Subject: [PATCH] Putting nerds to bed (#20436) * and here's the sleeper * Client-less animals sleep for longer * Fixes sleep length * never mind, animals can't be pushed :( * pronounce * Ensure they aren't already sleeping * Apply suggestions from code review Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> --------- Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> --- code/game/objects/items/candle.dm | 10 +++- .../structures/stool_bed_chair_nest/bed.dm | 57 +++++++++++++++++++ 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/candle.dm b/code/game/objects/items/candle.dm index dda80c6fef4..3dde2eb17be 100644 --- a/code/game/objects/items/candle.dm +++ b/code/game/objects/items/candle.dm @@ -106,13 +106,17 @@ var/turf/T = loc T.hotspot_expose(700, 5) +/obj/item/candle/proc/unlight() + if(lit) + lit = FALSE + update_icon(UPDATE_ICON_STATE) + set_light(0) + /obj/item/candle/attack_self(mob/user) if(lit) user.visible_message("[user] snuffs out [src].") - lit = FALSE - update_icon(UPDATE_ICON_STATE) - set_light(0) + unlight() /obj/item/candle/eternal desc = "A candle. This one seems to have an odd quality about the wax." 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 224ecf02f75..2cc714e6d0b 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -68,6 +68,63 @@ /obj/structure/bed/post_unbuckle_mob(mob/living/M) M.pixel_y = M.get_standard_pixel_y_offset() +/obj/structure/bed/shove_impact(mob/living/target, mob/living/attacker) + . = ..() + if(!ishuman(target)) + return + + var/mob/living/carbon/human/H = target + + // only if you're wearing PJs + if(!istype(H.w_uniform, /obj/item/clothing/under/misc/pj)) + return + + // and there's a sheet on the bed + if(!locate(/obj/item/bedsheet) in loc) + return + + var/sleep_ratio = 1 + + if(istype(H.shoes, /obj/item/clothing/shoes/slippers)) + sleep_ratio *= 2 + // take your shoes off first, you filthy animal + H.unEquip(H.shoes) + + var/extinguished_candle = FALSE + for(var/obj/item/candle/C in range(2, src)) + if(C.lit) + C.unlight() + extinguished_candle = TRUE + + if(extinguished_candle) + sleep_ratio *= 2 + + // nighty night + target.visible_message( + "[attacker] puts [target] to bed!", + "[attacker] shoves you under the covers, and you're out like a light!", + "You hear someone getting into bed." + ) + + if(sleep_ratio > 1) + target.visible_message( + "[target] seems especially cozy...[target.p_they()] probably won't be up for a while.", + "You feel so cozy, you could probably stay here for a while..." + ) + + target.forceMove(loc) + buckle_mob(target, TRUE) + if(!H.IsSleeping()) + H.Sleeping(15 SECONDS * sleep_ratio) + add_attack_logs(attacker, target, "put to bed for [15 * sleep_ratio] seconds.") + H.emote("snore") + + for(var/mob/living/carbon/human/viewer in viewers()) + if(prob(50)) + viewer.emote("yawn") + + return TRUE + /* * Roller beds */