Merge pull request #13965 from Xantholne/GoodNightDisky
Good Night Disky
This commit is contained in:
60
code/datums/elements/bed_tucking.dm
Normal file
60
code/datums/elements/bed_tucking.dm
Normal file
@@ -0,0 +1,60 @@
|
||||
/// Tucking element, for things that can be tucked into bed.
|
||||
/datum/element/bed_tuckable
|
||||
element_flags = ELEMENT_BESPOKE|ELEMENT_DETACH
|
||||
id_arg_index = 2
|
||||
/// 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)
|
||||
var/y_offset = 0
|
||||
/// our rotation degree - how much the item turns when in bed (+degrees turns it more parallel)
|
||||
var/rotation_degree = 0
|
||||
|
||||
/datum/element/bed_tuckable/Attach(obj/target, x = 0, y = 0, rotation = 0)
|
||||
. = ..()
|
||||
if(!isitem(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
|
||||
x_offset = x
|
||||
y_offset = y
|
||||
rotation_degree = rotation
|
||||
RegisterSignal(target, COMSIG_ITEM_ATTACK_OBJ, .proc/tuck_into_bed)
|
||||
|
||||
/datum/element/bed_tuckable/Detach(obj/target)
|
||||
. = ..()
|
||||
UnregisterSignal(target, list(COMSIG_ITEM_ATTACK_OBJ, COMSIG_ITEM_PICKUP))
|
||||
|
||||
/**
|
||||
* Tuck our object into bed.
|
||||
*
|
||||
* tucked - the object being tucked
|
||||
* target_bed - the bed we're tucking them into
|
||||
* tucker - the guy doing the tucking
|
||||
*/
|
||||
/datum/element/bed_tuckable/proc/tuck_into_bed(obj/item/tucked, obj/structure/bed/target_bed, mob/living/tucker)
|
||||
|
||||
|
||||
if(!istype(target_bed))
|
||||
return
|
||||
|
||||
if(!tucker.transferItemToLoc(tucked, target_bed.drop_location()))
|
||||
return
|
||||
|
||||
to_chat(tucker, "<span class='notice'>You lay [tucked] out on [target_bed].</span>")
|
||||
tucked.pixel_x = x_offset
|
||||
tucked.pixel_y = y_offset
|
||||
if(rotation_degree)
|
||||
tucked.transform = turn(tucked.transform, rotation_degree)
|
||||
RegisterSignal(tucked, COMSIG_ITEM_PICKUP, .proc/untuck)
|
||||
|
||||
return COMPONENT_NO_AFTERATTACK
|
||||
|
||||
/**
|
||||
* If we rotate our object, then we need to un-rotate it when it's picked up
|
||||
*
|
||||
* tucked - the object that is tucked
|
||||
*/
|
||||
/datum/element/bed_tuckable/proc/untuck(obj/item/tucked)
|
||||
|
||||
|
||||
tucked.transform = turn(tucked.transform, -rotation_degree)
|
||||
UnregisterSignal(tucked, COMSIG_ITEM_PICKUP)
|
||||
@@ -18,6 +18,7 @@
|
||||
/obj/item/paicard/Initialize()
|
||||
SSpai.pai_card_list += src
|
||||
add_overlay("pai-off")
|
||||
AddElement(/datum/element/bed_tuckable, 6, -5, 90)
|
||||
return ..()
|
||||
|
||||
/obj/item/paicard/Destroy()
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
/obj/item/toy/plush/Initialize(mapload, set_snowflake_id)
|
||||
. = ..()
|
||||
AddComponent(/datum/component/squeak, squeak_override)
|
||||
AddElement(/datum/element/bed_tuckable, 6, -5, 90)
|
||||
|
||||
//have we decided if Pinocchio goes in the blue or pink aisle yet?
|
||||
if(gender == NEUTER)
|
||||
|
||||
@@ -40,6 +40,16 @@
|
||||
if(istype(W, /obj/item/wrench) && !(flags_1&NODECONSTRUCT_1))
|
||||
W.play_tool_sound(src)
|
||||
deconstruct(TRUE)
|
||||
else if(istype(W, /obj/item/bedsheet))
|
||||
if(user.transferItemToLoc(W, drop_location()))
|
||||
to_chat(user, "<span class='notice'>You make \the [src] with [W].</span>")
|
||||
W.pixel_x = 0
|
||||
W.pixel_y = 0
|
||||
else if(istype(W, /obj/item/disk/nuclear))
|
||||
if(user.transferItemToLoc(W, drop_location()))
|
||||
to_chat(user, "<span class='notice'>You tuck little disky into bed. Good night disky.</span>")
|
||||
W.pixel_x = 6 //make sure they reach the pillow
|
||||
W.pixel_y = -6
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ LINEN BINS
|
||||
dog_fashion = /datum/dog_fashion/head/ghost
|
||||
var/list/dream_messages = list("white")
|
||||
|
||||
/obj/item/bedsheet/Initialize(mapload)
|
||||
. = ..()
|
||||
AddElement(/datum/element/bed_tuckable, 0, 0, 0)
|
||||
|
||||
/obj/item/bedsheet/attack(mob/living/M, mob/user)
|
||||
if(!attempt_initiate_surgery(src, M, user))
|
||||
..()
|
||||
|
||||
@@ -620,6 +620,8 @@ This is here to make the tiles around the station mininuke change when it's arme
|
||||
|
||||
/obj/item/disk/nuclear/Initialize()
|
||||
. = ..()
|
||||
AddElement(/datum/element/bed_tuckable, 6, -6, 0)
|
||||
|
||||
if(!fake)
|
||||
GLOB.poi_list |= src
|
||||
last_disk_move = world.time
|
||||
@@ -634,7 +636,19 @@ This is here to make the tiles around the station mininuke change when it's arme
|
||||
STOP_PROCESSING(SSobj, src)
|
||||
CRASH("A fake nuke disk tried to call process(). Who the fuck and how the fuck")
|
||||
var/turf/newturf = get_turf(src)
|
||||
|
||||
if(newturf && lastlocation == newturf)
|
||||
|
||||
// How comfy is disky?
|
||||
var/disk_comfort_level = 0
|
||||
|
||||
// Checking for items that make disky comfy
|
||||
for(var/obj/comfort_item in loc)
|
||||
if(istype(comfort_item, /obj/item/bedsheet) || istype(comfort_item, /obj/structure/bed))
|
||||
disk_comfort_level++
|
||||
|
||||
if(disk_comfort_level >= 2) //Sleep tight, disky.
|
||||
visible_message("<span class='notice'>[src] sleeps soundly. Sleep tight, disky.</span>")
|
||||
if(last_disk_move < world.time - 5000 && prob((world.time - 5000 - last_disk_move)*0.0001))
|
||||
var/datum/round_event_control/operative/loneop = locate(/datum/round_event_control/operative) in SSevents.control
|
||||
if(istype(loneop) && loneop.occurrences < loneop.max_occurrences)
|
||||
|
||||
Reference in New Issue
Block a user