Files
Bubberstation/code/modules/paperwork/folders.dm
SkyratBot ccb8a92cc9 [MIRROR] Updates paper biscuits and the paper cutter [MDB IGNORE] (#20312)
* Updates paper biscuits and the paper cutter (#74473)

## About The Pull Request

Well this started as a PR updating some of the spelling and grammar on
the biscuits... though spilled out a little into other aspects of the
relevant code.
There are a few things I've done here.

**Paper biscuits:**

- Updated spelling and grammar for paper biscuits. Confidental ->
confidential, that sort of thing.
- A little reorganisation and cleanup of the code itself.
- Preset slips are now generated on init on the parent from a var,
rather than each having its own init proc.
- Early returns, clearer vars, etc

**Paper Cutters**
Ended up doing more here, even though it wasn't the original reason I
started looking at this code.

- Added one (1) paper cutter blade to the paper cutters cargo crate.
Raised the price a little. This is just a reskinned hatchet, so I don't
think it's much of a balance concern.
- Clarifies and docs vars
- Cleans up refs on destroy
- Many `to_chat`s to `balloon_alert`s
- Removed single-letter vars
- Cancelled attack chains when trying to actually use the cutter. You
now pick it up either by having the blade secured and no paper inside,
or by dragging it into your hand.

## Changelog
🆑
spellcheck: Paper biscuits now have more proper spelling and grammar
qol: You now get one spare paper cutter blade in the paper cutter cargo
crate.
tweak: You now use right click to cut paper with a paper cutter
fix: You can now remove paper from a paper cutter if you change your
mind.
/🆑

---------

Co-authored-by: san7890 <the@ san7890.com>

* Updates paper biscuits and the paper cutter

---------

Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
Co-authored-by: san7890 <the@ san7890.com>
2023-04-04 04:45:59 +01:00

129 lines
3.5 KiB
Plaintext

/obj/item/folder//SKYRAT EDIT - ICON OVERRIDEN BY AESTHETICS - SEE MODULE
name = "folder"
desc = "A folder."
icon = 'icons/obj/bureaucracy.dmi'
icon_state = "folder"
w_class = WEIGHT_CLASS_SMALL
pressure_resistance = 2
resistance_flags = FLAMMABLE
/// The background color for tgui in hex (with a `#`)
var/bg_color = "#7f7f7f"
/// A typecache of the objects that can be inserted into a folder
var/static/list/folder_insertables = typecacheof(list(
/obj/item/paper,
/obj/item/photo,
/obj/item/documents,
/obj/item/paperwork,
))
/// Do we hide the contents on examine?
var/contents_hidden = FALSE
/obj/item/folder/suicide_act(mob/living/user)
user.visible_message(span_suicide("[user] begins filing an imaginary death warrant! It looks like [user.p_theyre()] trying to commit suicide!"))
return OXYLOSS
/obj/item/folder/Initialize(mapload)
update_icon()
. = ..()
/obj/item/folder/Destroy()
for(var/obj/important_thing in contents)
if(!(important_thing.resistance_flags & INDESTRUCTIBLE))
continue
important_thing.forceMove(drop_location()) //don't destroy round critical content such as objective documents.
return ..()
/obj/item/folder/examine()
. = ..()
if(length(contents) && !contents_hidden)
. += span_notice("<b>Right-click</b> to remove [contents[1]].")
/obj/item/folder/proc/rename(mob/user, obj/item/writing_instrument)
if(!user.can_write(writing_instrument))
return
var/inputvalue = tgui_input_text(user, "What would you like to label the folder?", "Folder Labelling", max_length = MAX_NAME_LEN)
if(!inputvalue)
return
if(user.can_perform_action(src))
name = "folder[(inputvalue ? " - '[inputvalue]'" : null)]"
/obj/item/folder/proc/remove_item(obj/item/Item, mob/user)
if(istype(Item))
Item.forceMove(user.loc)
user.put_in_hands(Item)
to_chat(user, span_notice("You remove [Item] from [src]."))
update_icon()
/obj/item/folder/attack_hand(mob/user, list/modifiers)
if(length(contents) && LAZYACCESS(modifiers, RIGHT_CLICK))
remove_item(contents[1], user)
return TRUE
. = ..()
/obj/item/folder/update_overlays()
. = ..()
if(contents.len)
. += "folder_paper"
/obj/item/folder/attackby(obj/item/weapon, mob/user, params)
if(burn_paper_product_attackby_check(weapon, user))
return
if(is_type_in_typecache(weapon, folder_insertables))
//Add paper, photo or documents into the folder
if(!user.transferItemToLoc(weapon, src))
return
to_chat(user, span_notice("You put [weapon] into [src]."))
update_appearance()
else if(istype(weapon, /obj/item/pen))
rename(user, weapon)
/obj/item/folder/attack_self(mob/user)
add_fingerprint(usr)
ui_interact(user)
return
/obj/item/folder/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Folder")
ui.open()
/obj/item/folder/ui_data(mob/user)
var/list/data = list()
if(istype(src, /obj/item/folder/syndicate))
data["theme"] = "syndicate"
data["bg_color"] = "[bg_color]"
data["folder_name"] = "[name]"
data["contents"] = list()
data["contents_ref"] = list()
for(var/Content in src)
data["contents"] += "[Content]"
data["contents_ref"] += "[REF(Content)]"
return data
/obj/item/folder/ui_act(action, params)
. = ..()
if(.)
return
if(usr.stat != CONSCIOUS || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED))
return
switch(action)
// Take item out
if("remove")
var/obj/item/Item = locate(params["ref"]) in src
remove_item(Item, usr)
. = TRUE
// Inspect the item
if("examine")
var/obj/item/Item = locate(params["ref"]) in src
if(istype(Item))
usr.examinate(Item)
. = TRUE