Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ports even more Vanderlin stuff #1228

Merged
merged 8 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/components.dm
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
#define COMSIG_MOB_DEADSAY "mob_deadsay" // from /mob/say_dead(): (mob/speaker, message)
#define MOB_DEADSAY_SIGNAL_INTERCEPT 1
// /mob/living signals
#define COMSIG_LIVING_SET_RESTING "comsig_set_resting"
#define COMSIG_LIVING_RESIST "living_resist" //from base of mob/living/resist() (/mob/living)
#define COMSIG_LIVING_IGNITED "living_ignite" //from base of mob/living/IgniteMob() (/mob/living)
#define COMSIG_LIVING_EXTINGUISHED "living_extinguished" //from base of mob/living/ExtinguishMob() (/mob/living)
Expand Down
66 changes: 66 additions & 0 deletions code/datums/elements/bed_tuckable.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/// Tucking element, for things that can be tucked into bed.
/datum/element/bed_tuckable
/// 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 many degrees we need to turn the item to get to the left/right side
var/rotation_degree = 0
/// our starting angle for the item
var/starting_angle = 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
starting_angle = rotation
RegisterSignal(target, COMSIG_ITEM_ATTACK_OBJ, PROC_REF(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)
SIGNAL_HANDLER

if(!istype(target_bed))
return

if(!tucker.transferItemToLoc(tucked, target_bed.drop_location()))
return

to_chat(tucker, span_notice("You lay [tucked] out on [target_bed]."))
tucked.dir = target_bed.dir
tucked.pixel_x = target_bed.dir & EAST ? -x_offset : x_offset
tucked.pixel_y = y_offset
tucked.layer = ABOVE_MOB_LAYER
tucked.plane = -2
if(starting_angle)
rotation_degree = target_bed.dir & EAST ? starting_angle + 180 : starting_angle
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
*
* tucked - the object that is tucked
*/
/datum/element/bed_tuckable/proc/untuck(obj/item/tucked)
SIGNAL_HANDLER

tucked.transform = turn(tucked.transform, -rotation_degree)
tucked.layer = initial(tucked.layer)
tucked.plane = initial(tucked.plane)
UnregisterSignal(tucked, COMSIG_ITEM_PICKUP)
2 changes: 1 addition & 1 deletion code/datums/particle_weathers/_base.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//Obnoxiously 3D -- INCREASE Z level to make them further away
transform = list( 1, 0, 0, 0 ,
0, 1, 0, 0 ,
0, 0, 1, 1/2, //Get twice as Small every 2 Z
0, 0, 1, 1/4, //Get twice as Small every 4 Z
0, 0, 0, 1 )

//Animate particle effect to a severity
Expand Down
118 changes: 118 additions & 0 deletions code/game/objects/items/bedsheets.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
CONTAINS:
BEDSHEETS
*/

/obj/item/bedsheet
name = "bedsheet"
desc = ""
icon = 'icons/obj/bedsheets.dmi'
lefthand_file = 'icons/mob/inhands/misc/bedsheet_lefthand.dmi'
righthand_file = 'icons/mob/inhands/misc/bedsheet_righthand.dmi'
icon_state = "sheetwhite"
item_state = "sheetwhite"
layer = OBJ_LAYER
plane = GAME_PLANE_UPPER
throwforce = 0
throw_speed = 1
throw_range = 2
w_class = WEIGHT_CLASS_TINY
resistance_flags = FLAMMABLE
dying_key = DYE_REGISTRY_BEDSHEET

dog_fashion = /datum/dog_fashion/head/ghost
var/list/dream_messages = list("white")
var/datum/weakref/signal_sleeper //this is our goldylocks

/obj/item/bedsheet/Initialize()
. = ..()
AddElement(/datum/element/bed_tuckable, 0, 0, 0)

/obj/item/bedsheet/attack_self(mob/user)
if(!user.CanReach(src)) //No telekenetic grabbing.
return
if(!user.dropItemToGround(src))
return
coverup(user)
add_fingerprint(user)

/obj/item/bedsheet/proc/coverup(mob/living/sleeper)
layer = ABOVE_MOB_LAYER
plane = -2
pixel_x = 0
pixel_y = 0
to_chat(sleeper, span_notice("I cover myself with [src]."))
var/angle = sleeper.lying_prev
dir = angle2dir(angle + 180) // 180 flips it to be the same direction as the mob
signal_sleeper = WEAKREF(sleeper)
RegisterSignal(src, COMSIG_ITEM_PICKUP, PROC_REF(on_pickup))
RegisterSignal(sleeper, COMSIG_MOVABLE_MOVED, PROC_REF(smooth_sheets))
RegisterSignal(sleeper, COMSIG_LIVING_SET_RESTING, PROC_REF(smooth_sheets))
RegisterSignal(sleeper, COMSIG_PARENT_QDELETING, PROC_REF(smooth_sheets))

/obj/item/bedsheet/proc/smooth_sheets(mob/living/sleeper)
SIGNAL_HANDLER
UnregisterSignal(src, COMSIG_ITEM_PICKUP)
UnregisterSignal(sleeper, COMSIG_MOVABLE_MOVED)
UnregisterSignal(sleeper, COMSIG_LIVING_SET_RESTING)
UnregisterSignal(sleeper, COMSIG_PARENT_QDELETING)
to_chat(sleeper, span_notice("I smooth [src] out beneath you."))
layer = initial(layer)
plane = initial(plane)
signal_sleeper = null

// We need to do this in case someone picks up a bedsheet while a mob is covered up
// otherwise the bedsheet will disappear while in our hands if the sleeper signals get activated by moving
/obj/item/bedsheet/proc/on_pickup(datum/source, mob/grabber)
SIGNAL_HANDLER
var/mob/living/sleeper = signal_sleeper?.resolve()
UnregisterSignal(src, COMSIG_ITEM_PICKUP)
UnregisterSignal(sleeper, COMSIG_MOVABLE_MOVED)
UnregisterSignal(sleeper, COMSIG_LIVING_SET_RESTING)
UnregisterSignal(sleeper, COMSIG_PARENT_QDELETING)
signal_sleeper = null

/obj/item/bedsheet/rogue/cloth
desc = ""
icon = 'icons/roguetown/misc/structure.dmi'
icon_state = "cloth_bedsheet"
item_state = "cloth_bedsheet"
pixel_y = 5

/obj/item/bedsheet/rogue/pelt
desc = ""
icon = 'icons/roguetown/misc/structure.dmi'
icon_state = "pelt_bedsheet"
item_state = "pelt_bedsheet"
pixel_y = 5

/obj/item/bedsheet/rogue/wool
desc = ""
icon = 'icons/roguetown/misc/structure.dmi'
icon_state = "wool_bedsheet"
item_state = "wool_bedsheet"
pixel_y = 5

/obj/item/bedsheet/rogue/double_pelt
desc = ""
icon = 'icons/roguetown/misc/structure.dmi'
icon_state = "double_pelt_bedsheet"
item_state = "double_pelt_bedsheet"

/obj/item/bedsheet/rogue/fabric
desc = ""
icon = 'icons/roguetown/misc/structure.dmi'
icon_state = "fabric_bedsheet"
item_state = "fabric_bedsheet"
pixel_y = 5

/obj/item/bedsheet/rogue/fabric_double
desc = ""
icon = 'icons/roguetown/misc/structure.dmi'
icon_state = "double_fabric_bedsheet"
item_state = "double_fabric_bedsheet"

/obj/item/bedsheet/random
icon_state = "random_bedsheet"
name = "random bedsheet"
desc = ""
15 changes: 15 additions & 0 deletions code/game/objects/items/rogueitems/natural/clothfibersthorn.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
to_chat(user, "<span class='warning'>I start to collect [src]...</span>")
if(move_after(user, 5 SECONDS, target = src))
var/fibercount = 0
var/obj/item/natural/fibers/W = user.get_active_held_item()
if(istype(W))
fibercount++
for(var/obj/item/natural/fibers/F in get_turf(src))
fibercount++
while(fibercount > 0)
Expand All @@ -33,6 +36,8 @@
fibercount -= clamp(fibercount, 2, 6)
for(var/obj/item/natural/fibers/F in get_turf(src))
qdel(F)
if(istype(W))
qdel(W)

/obj/item/natural/silk
name = "silk"
Expand All @@ -56,6 +61,9 @@
to_chat(user, "<span class='warning'>I start to collect [src]...</span>")
if(move_after(user, 5 SECONDS, target = src))
var/silkcount = 0
var/obj/item/natural/silk/W = user.get_active_held_item()
if(istype(W))
silkcount++
for(var/obj/item/natural/silk/F in get_turf(src))
silkcount++
while(silkcount > 0)
Expand All @@ -69,6 +77,8 @@
silkcount -= clamp(silkcount, 2, 6)
for(var/obj/item/natural/silk/F in get_turf(src))
qdel(F)
if(istype(W))
qdel(W)

#ifdef TESTSERVER

Expand Down Expand Up @@ -358,6 +368,9 @@
to_chat(user, "<span class='warning'>I start to collect [src]...</span>")
if(move_after(user, 5 SECONDS, target = src))
var/wormcount = 0
var/obj/item/natural/worms/W = user.get_active_held_item()
if(istype(W))
wormcount++
for(var/obj/item/natural/worms/F in get_turf(src))
wormcount++
while(wormcount > 0)
Expand All @@ -371,3 +384,5 @@
wormcount -= clamp(wormcount, 2, 12)
for(var/obj/item/natural/worms/F in get_turf(src))
qdel(F)
if(istype(W))
qdel(W)
1 change: 0 additions & 1 deletion code/game/objects/items/stacks/rods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ GLOBAL_LIST_INIT(rod_recipes, list ( \
new/datum/stack_recipe("grille", /obj/structure/grille, 2, time = 10, one_per_turf = TRUE, on_floor = FALSE), \
new/datum/stack_recipe("table frame", /obj/structure/table_frame, 2, time = 10, one_per_turf = 1, on_floor = 1), \
new/datum/stack_recipe("scooter frame", /obj/item/scooter_frame, 10, time = 25, one_per_turf = 0), \
new/datum/stack_recipe("linen bin", /obj/structure/bedsheetbin/empty, 2, time = 5, one_per_turf = 0), \
))

/obj/item/stack/rods
Expand Down
1 change: 0 additions & 1 deletion code/game/objects/items/stacks/sheets/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ GLOBAL_LIST_INIT(wood_recipes, list ( \
new/datum/stack_recipe("wooden door", /obj/structure/mineral_door/wood, 10, time = 20, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("coffin", /obj/structure/closet/crate/coffin, 5, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("book case", /obj/structure/bookcase, 4, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("dog bed", /obj/structure/bed/dogbed, 10, time = 10, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("dresser", /obj/structure/dresser, 10, time = 15, one_per_turf = TRUE, on_floor = TRUE), \
new/datum/stack_recipe("picture frame", /obj/item/wallframe/picture, 1, time = 10),\
new/datum/stack_recipe("display case chassis", /obj/structure/displaycase_chassis, 5, one_per_turf = TRUE, on_floor = TRUE), \
Expand Down
Loading
Loading