Skip to content

Commit

Permalink
Reworks Curtains (#28163)
Browse files Browse the repository at this point in the history
* Reworks Curtains

* Update code/game/objects/structures/curtains.dm

Co-authored-by: CRUNCH <[email protected]>
Signed-off-by: Tojo <[email protected]>

* New Overlay Code

* THE BEGINNING OF HELL

* Interact with Atom on mountable

* Fixes return, looks mergable.

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Burzah <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Luc <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Luc <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Luc <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update code/game/objects/structures/curtains.dm

Co-authored-by: Luc <[email protected]>
Signed-off-by: Tojo <[email protected]>

* Update Overlays Refactor

---------

Signed-off-by: Tojo <[email protected]>
Co-authored-by: CRUNCH <[email protected]>
Co-authored-by: Burzah <[email protected]>
Co-authored-by: Luc <[email protected]>
  • Loading branch information
4 people authored Feb 26, 2025
1 parent 0ca8305 commit 0d968d7
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 29 deletions.
16 changes: 8 additions & 8 deletions code/game/objects/items/mountable_frames/mountables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
/turf/simulated/wall
)
var/allow_floor_mounting = FALSE
new_attack_chain = TRUE


/obj/item/mounted/afterattack__legacy__attackchain(atom/A, mob/user, proximity_flag)
if(is_type_in_list(A, buildon_types))
if(try_build(A, user, proximity_flag))
return do_build(A, user)
/obj/item/mounted/interact_with_atom(atom/target, mob/living/user, list/modifiers)
. = ..()
if(is_type_in_list(target, buildon_types))
if(try_build(target, user))
do_build(target, user)
return ITEM_INTERACT_COMPLETE
..()

/obj/item/mounted/proc/try_build(turf/on_wall, mob/user, proximity_flag) //checks
/obj/item/mounted/proc/try_build(turf/on_wall, mob/user) //checks
if(!on_wall || !user)
return FALSE
if(!proximity_flag) //if we aren't next to the turf
return FALSE

if(!allow_floor_mounting)
if(!(get_dir(on_wall, user) in GLOB.cardinal))
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/stacks/rods.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ GLOBAL_LIST_INIT(rod_recipes, list (
new /datum/stack_recipe("grille", /obj/structure/grille, 2, time = 1 SECONDS, one_per_turf = TRUE, on_floor_or_lattice = TRUE),
new /datum/stack_recipe("table frame", /obj/structure/table_frame, 2, time = 1 SECONDS, one_per_turf = TRUE, on_floor = TRUE),
new /datum/stack_recipe("catwalk tile", /obj/item/stack/tile/catwalk, 2, 4, 20),
new /datum/stack_recipe("curtain rod", /obj/item/mounted/curtain/curtain_fixture, 2, 1, 20),
null,
new /datum/stack_recipe_list("railings...", list(
new /datum/stack_recipe("railing", /obj/structure/railing, 3, time = 1 SECONDS, one_per_turf = TRUE, on_floor = TRUE),
Expand Down
149 changes: 137 additions & 12 deletions code/game/objects/structures/curtains.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,122 @@
layer = SHOWER_CLOSED_LAYER
opacity = TRUE
density = FALSE
var/image/overlay = null
new_attack_chain = TRUE
var/assembled = FALSE
var/overlay_color = "#ffffff"
var/overlay_alpha = 255


/obj/structure/curtain/Initialize(mapload)
. = ..()
if(opacity)
icon_state = "closed"
overlay = image("closed_overlay")
overlay.color = overlay_color
overlay.alpha = overlay_alpha
add_overlay(overlay)
layer = SHOWER_CLOSED_LAYER
else
icon_state = "open"
overlay = image("open_overlay")
overlay.color = overlay_color
overlay.alpha = overlay_alpha
add_overlay(overlay)
layer = SHOWER_OPEN_LAYER

/obj/structure/curtain/open
icon_state = "open"
layer = SHOWER_OPEN_LAYER
opacity = FALSE

/obj/item/mounted/curtain/curtain_fixture
icon_state = "handheld"
icon = 'icons/obj/curtain.dmi'
name = "\improper curtain rod assembly"
new_attack_chain = TRUE

/obj/item/mounted/curtain/curtain_fixture/interact_with_atom(atom/target, mob/living/user, list/modifiers)
. = ..()
if(!istype(target ,/obj/structure/window) && !istype(target, /turf/simulated/wall/))
return
var/on_wall = get_turf(target)
to_chat(user, "<span class='notice'>You begin attaching [src] to [on_wall].</span>")
playsound(get_turf(src), 'sound/machines/click.ogg', 75, TRUE)
if(!do_after(user, 3 SECONDS, target = on_wall))
return
var/obj/structure/curtain/assembly/new_curtain = new /obj/structure/curtain/assembly(on_wall)
new_curtain.fingerprints = src.fingerprints
new_curtain.fingerprintshidden = src.fingerprintshidden
new_curtain.fingerprintslast = src.fingerprintslast

user.visible_message("<span class='notice'>[user] attaches the [src] to [on_wall].</span>", \
"<span class='notice'>You attach the [src] to [on_wall].</span>")
qdel(src)

/obj/item/mounted/curtain/curtain_fixture/activate_self(mob/user)
. = ..()
to_chat(user, "<span class='notice'>You begin attaching [src] to the ceiling.</span>")
playsound(get_turf(src), 'sound/machines/click.ogg', 75, TRUE)
if(!do_after(user, 3 SECONDS, target = get_turf(user)))
return
var/obj/structure/curtain/assembly/new_curtain = new /obj/structure/curtain/assembly(get_turf(user))
new_curtain.fingerprints = src.fingerprints
new_curtain.fingerprintshidden = src.fingerprintshidden
new_curtain.fingerprintslast = src.fingerprintslast

user.visible_message("<span class='notice'>[user] attaches the [src] to the ceiling.</span>", \
"<span class='notice'>You attach the [src] to the ceiling.</span>")
qdel(src)



/obj/structure/curtain/assembly
icon_state = "assembly0"
name = "Curtain Rod"
opacity = FALSE
density = FALSE
desc = "A curtain assembly! It needs a <b>material</b>."

/obj/structure/curtain/assembly/examine(mob/user)
. = ..()
. += "<span class='notice'>Alt-Click to take it down.</span>"

/obj/structure/curtain/assembly/AltClick(mob/user)
if(HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(!Adjacent(user))
return
// TODO: turn back into assembly item
new /obj/item/mounted/curtain/curtain_fixture(get_turf(user))
playsound(loc, 'sound/effects/salute.ogg' , 75, TRUE)
qdel(src)

/obj/structure/curtain/assembly/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(istype(used, /obj/item/stack/sheet/cloth)) // Are we putting the cloth onto the assembly on the wall?
var/obj/item/stack/sheet/cloth/cloth_used = used
if(!cloth_used.use(2))
to_chat(user, "<span class='warning'> You need two sheets of cloth to hang the curtains.</span>")
return ITEM_INTERACT_COMPLETE

var/obj/structure/curtain/new_curtain = new /obj/structure/curtain/(loc, 1)
new_curtain.assembled = TRUE
playsound(loc, used.drop_sound, 75, TRUE) // Play a generic cloth sound.
qdel(src)

return ITEM_INTERACT_COMPLETE

/obj/structure/curtain/attack_hand(mob/user)
playsound(get_turf(loc), "rustle", 15, TRUE, -5)
toggle()
update_icon(UPDATE_OVERLAYS)
..()
/obj/structure/curtain/attack_robot(mob/living/user)
. = ..()
playsound(get_turf(loc), "rustle", 15, TRUE, -5)
update_icon(UPDATE_OVERLAYS)
..()


/obj/structure/curtain/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
Expand All @@ -31,13 +136,23 @@
if(BURN)
playsound(loc, 'sound/items/welder.ogg', 80, TRUE)

/obj/structure/curtain/proc/toggle()
/obj/structure/curtain/update_overlays()
. = ..()
set_opacity(!opacity)
cut_overlays()
if(opacity)
icon_state = "closed"
overlay = image("closed_overlay")
overlay.color = overlay_color
overlay.alpha = overlay_alpha
add_overlay(overlay)
layer = SHOWER_CLOSED_LAYER
else
icon_state = "open"
overlay = image("open_overlay")
overlay.color = overlay_color
overlay.alpha = overlay_alpha
add_overlay(overlay)
layer = SHOWER_OPEN_LAYER

/obj/structure/curtain/item_interaction(mob/living/user, obj/item/used, list/modifiers)
Expand Down Expand Up @@ -68,39 +183,49 @@
. = TRUE
if(!I.tool_start_check(src, user, 0))
return
if(assembled)
WIRECUTTER_ATTEMPT_DISMANTLE_MESSAGE
if(I.use_tool(src,user, 5 SECONDS, volume = I.tool_volume))
WIRECUTTER_DISMANTLE_SUCCESS_MESSAGE
var/obj/structure/curtain/assembly/new_assembly = new /obj/structure/curtain/assembly(loc, 1)
new_assembly.assembled = TRUE
var/obj/item/stack/sheet/cloth/dropped_cloth = new /obj/item/stack/sheet/cloth(loc, 2)
qdel(src)
return
return

WIRECUTTER_ATTEMPT_DISMANTLE_MESSAGE
if(I.use_tool(src, user, 50, volume = I.tool_volume))
if(I.use_tool(src, user, 5 SECONDS, volume = I.tool_volume))
WIRECUTTER_DISMANTLE_SUCCESS_MESSAGE
deconstruct()

/obj/structure/curtain/deconstruct(disassembled = TRUE)
new /obj/item/stack/sheet/cloth(loc, 2)
new /obj/item/stack/sheet/plastic(loc, 2)
new /obj/item/stack/rods(loc, 1)
qdel(src)

/obj/structure/curtain/black
name = "black curtain"
color = "#222222"
overlay_color = "#222222"

/obj/structure/curtain/medical
name = "plastic curtain"
color = "#B8F5E3"
alpha = 200
overlay_color = "#B8F5E3"
overlay_alpha = 200

/obj/structure/curtain/open/shower
name = "shower curtain"
color = "#ACD1E9"
alpha = 200
overlay_color = "#7aa6c4"
overlay_alpha = 200

/obj/structure/curtain/open/shower/engineering
color = "#FFA500"
overlay_color = "#FFA500"

/obj/structure/curtain/open/shower/security
color = "#AA0000"
overlay_color = "#AA0000"

/obj/structure/curtain/open/shower/centcom
color = "#000066"
overlay_color = "#000066"

#undef SHOWER_OPEN_LAYER
#undef SHOWER_CLOSED_LAYER
9 changes: 0 additions & 9 deletions code/modules/crafting/recipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -689,15 +689,6 @@
/obj/item/stack/sheet/mineral/gold = 1)
category = CAT_MISC

/datum/crafting_recipe/showercurtain
name = "Shower Curtains"
result = list(/obj/structure/curtain)
time = 20
reqs = list(/obj/item/stack/sheet/cloth = 2,
/obj/item/stack/sheet/plastic = 2,
/obj/item/stack/rods = 1)
category = CAT_MISC

/datum/crafting_recipe/chemical_payload
name = "Chemical Payload (C4)"
result = list(/obj/item/bombcore/chemical)
Expand Down
Binary file modified icons/obj/curtain.dmi
Binary file not shown.

0 comments on commit 0d968d7

Please sign in to comment.