Skip to content

Commit

Permalink
update paperwork stuffs (#6913)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## About The Pull Request
use tgui on ones that have a tgui, update some stuff
<!-- Describe The Pull Request. Please be sure every change is
documented or this can delay review and even discourage maintainers from
merging your PR! -->

## Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
mark your PRs to prevent unnecessary GBP loss. You can read up on GBP
and it's effects on PRs in the tgstation guides for contributors. Please
note that maintainers freely reserve the right to remove and add tags
should they deem it appropriate. You can attempt to finagle the system
all you want, but it's best to shoot for clear communication right off
the bat. -->

:cl:
tweak: folders are more immersive
tweak: filing cabinets can now hold small objects
/:cl:

<!-- Both :cl:'s are required for the changelog to work! You can put
your name to the right of the first :cl: if you want to overwrite your
GitHub username as author ingame. -->
<!-- You can use multiple of the same prefix (they're only used for the
icon ingame) and delete the unneeded ones. Despite some of the tags,
changelogs should generally represent how a player might be affected by
the changes rather than a summary of the PR's contents. -->
  • Loading branch information
LetterN authored Dec 16, 2024
1 parent e1f0df0 commit 0b49f20
Show file tree
Hide file tree
Showing 17 changed files with 767 additions and 618 deletions.
1 change: 1 addition & 0 deletions citadel.dme
Original file line number Diff line number Diff line change
Expand Up @@ -4360,6 +4360,7 @@
#include "code\modules\paperwork\faxmachine_vr.dm"
#include "code\modules\paperwork\filingcabinet.dm"
#include "code\modules\paperwork\folders.dm"
#include "code\modules\paperwork\folders_premade.dm"
#include "code\modules\paperwork\handlabeler.dm"
#include "code\modules\paperwork\paper_bundle.dm"
#include "code\modules\paperwork\paperbin.dm"
Expand Down
175 changes: 106 additions & 69 deletions code/game/objects/structures/noticeboard.dm
Original file line number Diff line number Diff line change
@@ -1,40 +1,52 @@
#define MAX_NOTICES 8

/obj/structure/noticeboard
name = "notice board"
desc = "A board for pinning important notices upon."
icon = 'icons/obj/stationobjs.dmi'
icon_state = "nboard00"
density = 0
anchored = 1
icon_state = "noticeboard"
density = FALSE
anchored = TRUE
integrity_max = 150
/// Current number of a pinned notices
var/notices = 0

/obj/structure/noticeboard/Initialize(mapload, dir, building = FALSE)
. = ..()

if(building)
pixel_x = (dir & 3)? 0 : (dir == 4 ? -32 : 32)
pixel_y = (dir & 3)? (dir ==1 ? -27 : 27) : 0
update_icon()
if(mapload)
for(var/obj/item/I in loc)
if(notices > 4)
break
if(istype(I, /obj/item/paper))
I.forceMove(src)
notices++
icon_state = "nboard0[notices]"
. = ..()
update_appearance(UPDATE_ICON)

if(!mapload)
return

for(var/obj/item/I in loc)
if(notices > MAX_NOTICES)
break
if(istype(I, /obj/item/paper))
I.forceMove(src)
notices++
update_appearance(UPDATE_ICON)

//attaching papers!!
/obj/structure/noticeboard/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, /obj/item/paper))
if(notices < 5)
if(!user.attempt_insert_item_for_installation(O, src))
/obj/structure/noticeboard/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/paper) || istype(O, /obj/item/photo))
if(!allowed(user))
to_chat(user, SPAN_WARNING("You are not authorized to add notices!"))
return
if(notices < MAX_NOTICES)
if(!user.transfer_item_to_loc(O, src))
return
O.add_fingerprint(user)
add_fingerprint(user)
notices++
icon_state = "nboard0[notices]" //update sprite
to_chat(user, "<span class='notice'>You pin the paper to the noticeboard.</span>")
update_appearance(UPDATE_ICON)
to_chat(user, SPAN_NOTICE("You pin the [O] to the noticeboard."))
else
to_chat(user, "<span class='notice'>You reach to pin your paper to the board but hesitate. You are certain your paper will not be seen among the many others already attached.</span>")
to_chat(user, SPAN_WARNING("The notice board is full!"))
// else
// return ..()

if(O.is_wrench())
to_chat(user, "<span class='notice'>You start to unwrench the noticeboard.</span>")
playsound(src.loc, O.tool_sound, 50, 1)
Expand All @@ -43,52 +55,77 @@
new /obj/item/frame/noticeboard( src.loc )
qdel(src)

/obj/structure/noticeboard/attack_hand(mob/user, datum/event_args/actor/clickchain/e_args)
user.do_examinate(src)

// Since Topic() never seems to interact with usr on more than a superficial
// level, it should be fine to let anyone mess with the board other than ghosts.
/obj/structure/noticeboard/examine(mob/user, dist) //why the fuck is this shit on examine
if(!user)
user = usr
if(user.Adjacent(src))
var/dat = "<B>Noticeboard</B><BR>"
for(var/obj/item/paper/P in src)
dat += "<A href='?src=\ref[src];read=\ref[P]'>[P.name]</A> <A href='?src=\ref[src];write=\ref[P]'>Write</A> <A href='?src=\ref[src];remove=\ref[P]'>Remove</A><BR>"
user << browse("<HEAD><TITLE>Notices</TITLE></HEAD>[dat]","window=noticeboard")
onclose(user, "noticeboard")
/obj/structure/noticeboard/ui_state(mob/user)
return GLOB.physical_state

/obj/structure/noticeboard/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "NoticeBoard", name)
ui.open()

/obj/structure/noticeboard/ui_data(mob/user)
var/list/data = list()
data["allowed"] = allowed(user)
data["items"] = list()
for(var/obj/item/content in contents)
var/list/content_data = list(
name = content.name,
ref = REF(content)
)
data["items"] += list(content_data)
return data

/obj/structure/noticeboard/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return

var/obj/item/item = locate(params["ref"]) in contents
if(!istype(item) || item.loc != src)
return

var/mob/user = usr

switch(action)
if("examine")
// if(istype(item, /obj/item/paper))
// item.ui_interact(user) // not using tguipaper
// else
user.examinate(item)
return TRUE
if("remove")
if(!allowed(user))
return
remove_item(item, user)
return TRUE

/obj/structure/noticeboard/update_overlays()
. = ..()
if(notices)
. += "notices_[notices]"

/**
* Removes an item from the notice board
*
* Arguments:
* * item - The item that is to be removed
* * user - The mob that is trying to get the item removed, if there is one
*/
/obj/structure/noticeboard/proc/remove_item(obj/item/item, mob/user)
item.forceMove(drop_location())
if(user)
user.put_in_hands(item)
to_chat(user, SPAN_NOTICE("Removed from board."))
notices--
update_appearance(UPDATE_ICON)

/obj/structure/noticeboard/deconstructed(disassembled = TRUE)
if(!disassembled)
new /obj/item/stack/material/wood(loc)
else
..()
new /obj/item/frame/noticeboard(loc)
for(var/obj/item/content in contents)
remove_item(content)

/obj/structure/noticeboard/Topic(href, href_list)
..()
usr.set_machine(src)
if(href_list["remove"])
if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open
return
var/obj/item/P = locate(href_list["remove"])
if(P && P.loc == src)
P.loc = get_turf(src) //dump paper on the floor because you're a clumsy fuck
P.add_fingerprint(usr)
add_fingerprint(usr)
notices--
icon_state = "nboard0[notices]"
if(href_list["write"])
if((usr.stat || usr.restrained())) //For when a player is handcuffed while they have the notice window open
return
var/obj/item/P = locate(href_list["write"])
if((P && P.loc == src)) //ifthe paper's on the board
var/mob/living/M = usr
if(istype(M))
var/obj/item/pen/E = M.get_held_item_of_type(/obj/item/pen)
if(E)
add_fingerprint(M)
P.attackby(E, usr)
else
to_chat(M, "<span class='notice'>You'll need something to write with!</span>")
if(href_list["read"])
var/obj/item/paper/P = locate(href_list["read"])
if((P && P.loc == src))
usr << browse("<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY><TT>[P.info]</TT></BODY></HTML>", "window=[P.name]")
onclose(usr, "[P.name]")
return
#undef MAX_NOTICES
3 changes: 1 addition & 2 deletions code/modules/paperwork/carbonpaper.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/obj/item/paper/carbon
name = "paper"
name = "sheet of carbon"
icon_state = "paper_stack"
item_state = "paper"
var/copied = 0
var/iscopy = 0


/obj/item/paper/carbon/update_icon()
if(iscopy)
if(info)
Expand Down
Loading

0 comments on commit 0b49f20

Please sign in to comment.