Stickynotes bugfix (#21887)

A handful of bugfixes covering stuff I missed in the original
stickynotes PR.
- Stickynotes can now interact with machinery, such as disposals or the
papershredder.
- - Turns out that after attack still has priority over interacting with
machines. You learn something every PR.
- Crumpled stickynotes can no longer be attached like a normal
stickynote. They can also no longer be written on.
- - As part of this, paper now uses a variable to track if it's
crumpled. Before, it would just check the icon_state.
- Crumpled stickynotes now use the crumpled sprite when being shredded.
Before it was just a normal paper sprite.
This commit is contained in:
CatsinHD
2026-02-18 22:37:04 -05:00
committed by GitHub
parent 09955a8c5e
commit 9be4bde7db
4 changed files with 100 additions and 11 deletions
+37 -10
View File
@@ -51,6 +51,8 @@
var/can_fold = TRUE
/// Is it made of paper and/or burnable material?
var/paper_like = TRUE
// Is the paper crumpled up?
var/crumpled = FALSE
var/const/deffont = "Verdana"
var/const/signfont = "Times New Roman"
@@ -119,7 +121,10 @@
/obj/item/paper/update_icon()
if(!can_change_icon_state)
return
else if (info && length(trim(info)))
if (crumpled)
icon_state = "scrap"
return
if (info && length(trim(info)))
icon_state = "[base_state]_words"
else
icon_state = "[base_state]"
@@ -179,7 +184,7 @@
/obj/item/paper/attack_self(mob/living/user as mob)
if(user.a_intent == I_HURT && paper_like)
if(icon_state == "scrap")
if(crumpled)
user.show_message(SPAN_WARNING("\The [src] is already crumpled."))
return
//crumple dat paper
@@ -191,9 +196,10 @@
else
icon_state = "scrap"
throw_range = 4 //you can now make epic paper ball hoops into the disposals (kinda dumb that you could only throw crumpled paper 1 tile) -wezzy
crumpled = TRUE
return
if (user.a_intent == I_GRAB && icon_state != "scrap" && can_fold)
if (user.a_intent == I_GRAB && !crumpled && can_fold)
if (icon_state == "paper_plane")
user.show_message(SPAN_ALERT("The paper is already folded into a plane."))
return
@@ -207,7 +213,7 @@
ClearOverlays() //Removes stamp icons
return
if (user.a_intent == I_DISARM && icon_state != "scrap" && can_fold)
if (user.a_intent == I_DISARM && !crumpled && can_fold)
if (icon_state == "paper_swan")
user.show_message(SPAN_ALERT("The paper is already folded into a swan."))
return
@@ -674,7 +680,7 @@
B.update_icon()
else if(attacking_item.tool_behaviour == TOOL_PEN)
if(icon_state == "scrap")
if(crumpled)
to_chat(user, SPAN_WARNING("The [src] is too crumpled to write on."))
return
@@ -738,6 +744,7 @@
/obj/item/paper/crumpled
name = "paper scrap"
icon_state = "scrap"
crumpled = TRUE
/obj/item/paper/crumpled/update_icon()
return
@@ -843,10 +850,14 @@
color = COLOR_PALE_YELLOW
free_space = MAX_MESSAGE_LEN //Smaller piece of paper means less space to write.
slot_flags = 0
item_flags = ITEM_FLAG_NO_BLUDGEON
/obj/item/paper/stickynotes/update_icon()
if(icon_state == "stickynote_scrap")
return
if(crumpled)
icon_state = "stickynote_scrap"
return
icon_state = info ? "stickynote_words" : "stickynote"
@@ -872,19 +883,35 @@
..()
/obj/item/paper/stickynotes/afterattack(var/A, mob/user, var/prox, var/params)
if(!in_range(user, A) || istype(A, /obj/machinery/door) || istype(A, /obj/item/paper))
if(!in_range(user, A) || istype(A, /obj/machinery) || istype(A, /obj/item/paper) || crumpled)
return
var/turf/target_turf = get_turf(A)
var/turf/source_turf = get_turf(user)
var/dir_offset = 0
if(target_turf != source_turf)
dir_offset = get_dir(source_turf, target_turf)
if(!params || !prox)
return
SSpersistence.register_track(src, ckey(user.key))
user.drop_from_inventory(src,target_turf)
var/list/mouse_control = mouse_safe_xy(params)
pixel_x = mouse_control["icon-x"] - 16
pixel_y = mouse_control["icon-y"] - 16
user.drop_from_inventory(src,source_turf)
if(params) //Parallels taped paper placement method, and avoids seeing stickynotes through walls
var/list/mouse_control = mouse_safe_xy(params)
if(mouse_control["icon-x"])
pixel_x = mouse_control["icon-x"] - 16
if(dir_offset & EAST)
pixel_x += 32
else if(dir_offset & WEST)
pixel_x -= 32
if(mouse_control["icon-y"])
pixel_y = mouse_control["icon-y"] - 16
if(dir_offset & NORTH)
pixel_y += 32
else if(dir_offset & SOUTH)
pixel_y -= 32
/obj/item/paper/stickynotes/pad
name = "sticky note pad"
+2
View File
@@ -36,6 +36,8 @@
/obj/item/paper_bundle/attackby(obj/item/attacking_item, mob/user)
..()
if (istype(attacking_item, /obj/item/paper/stickynotes/pad))
return
if (istype(attacking_item, /obj/item/paper/carbon))
var/obj/item/paper/carbon/C = attacking_item
+1 -1
View File
@@ -45,7 +45,7 @@
return
if (paper_result > 0)
paperamount += paper_result
if(attacking_item.icon_state == "scrap")
if(astype(attacking_item, /obj/item/paper)?.crumpled)
flick("papershredder_s_on", src)
else if(attacking_item.icon_state == "paper_words")
flick("papershredder_w_on", src)