mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-05-13 02:11:44 +01:00
d5849910e5
* Begin clickcode attack_self fix Begins the work to make everything call back to parent for attack_self so that signals are sacred. * Makes MORE things call the attack_self() parent Yes, I could make special_handling a var on obj/item HOWEVER i want it to be specific so it can be tracked down later and ONLY the objects that use it can be refactored instead of sitting there literally forever and it just becoming 'a thing'. * Finishes making the rest of attack_self call parent. As mentioned, things such as 'specialty_goggles' 'special_handling' and the such are only there to help with attack_self until the attack_self is recoded for those items. * begone foul demon * some more cleanup * These * GOD this was annoying * yeh * Fix this * fLARES * Thesee too * toys! * Even more! * More fixes * Even more * rest of em * these too * Update syndie.dm * hardref clear * Update code/game/gamemodes/nuclear/pinpointer.dm * Update code/game/objects/effects/mines.dm * Update code/game/objects/items/blueprints_vr.dm * Update code/game/objects/items/blueprints_vr.dm * Update code/game/objects/items/contraband_vr.dm * Update code/game/objects/items/crayons.dm * Update code/game/objects/items/crayons.dm * Update code/game/objects/items/gunbox.dm * Update code/game/objects/items/gunbox.dm * Update code/game/objects/items/gunbox_vr.dm * Update code/game/objects/items/gunbox_vr.dm * Update code/game/objects/items/weapons/gift_wrappaper.dm * Update code/game/objects/items/crayons.dm * Update code/game/objects/items/crayons.dm * Update code/game/objects/items/gunbox.dm * these too * Update maintpanel_stack.dm * angry warning * Fixes packaged snacks. Fixes improper var default. * Special handling for these * proper poly types * Fixes magclaws Makes the 'features' it had just part of base magboots that can be adjusted via varswap. * Fixes jackets Fixes https://github.com/VOREStation/VOREStation/issues/18941 * Small bugfix Makes p_Theyre properly capitialize Makes examine show proper wording * Update gift_wrappaper.dm
251 lines
8.4 KiB
Plaintext
251 lines
8.4 KiB
Plaintext
/obj/item/paper_bundle
|
|
name = "paper bundle"
|
|
gender = NEUTER
|
|
icon = 'icons/obj/bureaucracy.dmi'
|
|
icon_state = "paper"
|
|
item_state = "paper"
|
|
throwforce = 0
|
|
w_class = ITEMSIZE_SMALL
|
|
throw_range = 2
|
|
throw_speed = 1
|
|
plane = MOB_PLANE
|
|
layer = MOB_LAYER
|
|
pressure_resistance = 1
|
|
attack_verb = list("bapped")
|
|
drop_sound = 'sound/items/drop/paper.ogg'
|
|
pickup_sound = 'sound/items/pickup/paper.ogg'
|
|
var/page = 1 // current page
|
|
var/list/pages = list() // Ordered list of pages as they are to be displayed. Can be different order than src.contents.
|
|
|
|
|
|
/obj/item/paper_bundle/attackby(obj/item/W, mob/user)
|
|
..()
|
|
|
|
if (istype(W, /obj/item/paper/carbon))
|
|
var/obj/item/paper/carbon/C = W
|
|
if (!C.iscopy && !C.copied)
|
|
to_chat(user, span_notice("Take off the carbon copy first."))
|
|
add_fingerprint(user)
|
|
return
|
|
// adding sheets
|
|
if(istype(W, /obj/item/paper) || istype(W, /obj/item/photo))
|
|
insert_sheet_at(user, pages.len+1, W)
|
|
|
|
// burning
|
|
else if(istype(W, /obj/item/flame))
|
|
burnpaper(W, user)
|
|
|
|
// merging bundles
|
|
else if(istype(W, /obj/item/paper_bundle))
|
|
user.drop_from_inventory(W)
|
|
for(var/obj/O in W)
|
|
O.loc = src
|
|
O.add_fingerprint(user)
|
|
pages.Add(O)
|
|
|
|
to_chat(user, span_notice("You add \the [W.name] to [(src.name == "paper bundle") ? "the paper bundle" : src.name]."))
|
|
qdel(W)
|
|
else
|
|
if(istype(W, /obj/item/tape_roll))
|
|
return 0
|
|
if(istype(W, /obj/item/pen))
|
|
user << browse(null, "window=[name]") //Closes the dialog
|
|
var/obj/P = pages[page]
|
|
P.attackby(W, user)
|
|
|
|
update_icon()
|
|
attack_self(user) //Update the browsed page.
|
|
add_fingerprint(user)
|
|
return
|
|
|
|
/obj/item/paper_bundle/proc/insert_sheet_at(mob/user, var/index, obj/item/sheet)
|
|
if(istype(sheet, /obj/item/paper))
|
|
to_chat(user, span_notice("You add [(sheet.name == "paper") ? "the paper" : sheet.name] to [(src.name == "paper bundle") ? "the paper bundle" : src.name]."))
|
|
else if(istype(sheet, /obj/item/photo))
|
|
to_chat(user, span_notice("You add [(sheet.name == "photo") ? "the photo" : sheet.name] to [(src.name == "paper bundle") ? "the paper bundle" : src.name]."))
|
|
|
|
user.drop_from_inventory(sheet)
|
|
sheet.loc = src
|
|
|
|
pages.Insert(index, sheet)
|
|
|
|
if(index <= page)
|
|
page++
|
|
|
|
/obj/item/paper_bundle/proc/burnpaper(obj/item/flame/P, mob/user)
|
|
var/class = "warning"
|
|
|
|
if(P.lit && !user.restrained())
|
|
if(istype(P, /obj/item/flame/lighter/zippo))
|
|
class = "rose>"
|
|
user.visible_message("<span class='[class]'>[user] holds \the [P] up to \the [src], it looks like [user.p_theyre()] trying to burn it!</span>", \
|
|
"<span class='[class]'>You hold \the [P] up to \the [src], burning it slowly.</span>")
|
|
|
|
spawn(20)
|
|
if(get_dist(src, user) < 2 && user.get_active_hand() == P && P.lit)
|
|
user.visible_message("<span class='[class]'>[user] burns right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.</span>", \
|
|
"<span class='[class]'>You burn right through \the [src], turning it to ash. It flutters through the air before settling on the floor in a heap.</span>")
|
|
|
|
if(user.get_inactive_hand() == src)
|
|
user.drop_from_inventory(src)
|
|
|
|
new /obj/effect/decal/cleanable/ash(src.loc)
|
|
qdel(src)
|
|
|
|
else
|
|
to_chat(user, span_red("You must hold \the [P] steady to burn \the [src]."))
|
|
|
|
/obj/item/paper_bundle/examine(mob/user)
|
|
. = ..()
|
|
if(Adjacent(user))
|
|
show_content(user)
|
|
else
|
|
. += span_notice("It is too far away.")
|
|
|
|
/obj/item/paper_bundle/proc/show_content(mob/user)
|
|
var/dat
|
|
var/obj/item/W = pages[page]
|
|
|
|
// first
|
|
if(page == 1)
|
|
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='byond://?src=\ref[src];prev_page=1'>Front</A></DIV>"
|
|
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='byond://?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/paper)) ? "paper" : "photo"]</A></DIV>"
|
|
dat+= "<DIV STYLE='float:left; text-align:right; width:33.33333%'><A href='byond://?src=\ref[src];next_page=1'>Next Page</A></DIV><BR><HR>"
|
|
// last
|
|
else if(page == pages.len)
|
|
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='byond://?src=\ref[src];prev_page=1'>Previous Page</A></DIV>"
|
|
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='byond://?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/paper)) ? "paper" : "photo"]</A></DIV>"
|
|
dat+= "<DIV STYLE='float;left; text-align:right; with:33.33333%'><A href='byond://?src=\ref[src];next_page=1'>Back</A></DIV><BR><HR>"
|
|
// middle pages
|
|
else
|
|
dat+= "<DIV STYLE='float:left; text-align:left; width:33.33333%'><A href='byond://?src=\ref[src];prev_page=1'>Previous Page</A></DIV>"
|
|
dat+= "<DIV STYLE='float:left; text-align:center; width:33.33333%'><A href='byond://?src=\ref[src];remove=1'>Remove [(istype(W, /obj/item/paper)) ? "paper" : "photo"]</A></DIV>"
|
|
dat+= "<DIV STYLE='float:left; text-align:right; width:33.33333%'><A href='byond://?src=\ref[src];next_page=1'>Next Page</A></DIV><BR><HR>"
|
|
|
|
if(istype(pages[page], /obj/item/paper))
|
|
var/obj/item/paper/P = W
|
|
if(!(ishuman(user) || isobserver(user) || issilicon(user)))
|
|
dat+= "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[stars(P.info)][P.stamps]</BODY></HTML>"
|
|
else
|
|
dat+= "<HTML><HEAD><TITLE>[P.name]</TITLE></HEAD><BODY>[P.info][P.stamps]</BODY></HTML>"
|
|
user << browse(dat, "window=[name]")
|
|
else if(istype(pages[page], /obj/item/photo))
|
|
var/obj/item/photo/P = W
|
|
user << browse_rsc(P.img, "tmp_photo.png")
|
|
user << browse("<html>" + dat + "<head><title>[P.name]</title></head>" \
|
|
+ "<body style='overflow:hidden'>" \
|
|
+ "<div> <img src='tmp_photo.png' width = '180'" \
|
|
+ "[P.scribble ? "<div> Written on the back:<br><i>[P.scribble]</i>" : null]"\
|
|
+ "</body></html>", "window=[name]")
|
|
|
|
/obj/item/paper_bundle/attack_self(mob/user)
|
|
. = ..(user)
|
|
if(.)
|
|
return TRUE
|
|
src.show_content(user)
|
|
add_fingerprint(user)
|
|
update_icon()
|
|
return
|
|
|
|
/obj/item/paper_bundle/Topic(href, href_list)
|
|
..()
|
|
if((src in usr.contents) || (istype(src.loc, /obj/item/folder) && (src.loc in usr.contents)))
|
|
usr.set_machine(src)
|
|
var/obj/item/in_hand = usr.get_active_hand()
|
|
if(href_list["next_page"])
|
|
if(in_hand && (istype(in_hand, /obj/item/paper) || istype(in_hand, /obj/item/photo)))
|
|
insert_sheet_at(usr, page+1, in_hand)
|
|
else if(page != pages.len)
|
|
page++
|
|
playsound(src, "pageturn", 50, 1)
|
|
if(href_list["prev_page"])
|
|
if(in_hand && (istype(in_hand, /obj/item/paper) || istype(in_hand, /obj/item/photo)))
|
|
insert_sheet_at(usr, page, in_hand)
|
|
else if(page > 1)
|
|
page--
|
|
playsound(src, "pageturn", 50, 1)
|
|
if(href_list["remove"])
|
|
if(!pages.len)
|
|
return
|
|
var/obj/item/W = pages[page]
|
|
usr.put_in_hands(W)
|
|
pages.Remove(pages[page])
|
|
|
|
to_chat(usr, span_notice("You remove the [W.name] from the bundle."))
|
|
|
|
if(pages.len <= 1)
|
|
var/obj/item/paper/P = pages[1]
|
|
usr.drop_from_inventory(src)
|
|
usr.put_in_hands(P)
|
|
qdel(src)
|
|
|
|
return
|
|
|
|
if(page > pages.len)
|
|
page = pages.len
|
|
|
|
update_icon()
|
|
|
|
src.attack_self(usr)
|
|
updateUsrDialog(usr)
|
|
else
|
|
to_chat(usr, span_notice("You need to hold it in hands!"))
|
|
|
|
/obj/item/paper_bundle/verb/rename()
|
|
set name = "Rename bundle"
|
|
set category = "Object"
|
|
set src in usr
|
|
|
|
var/n_name = sanitizeSafe(tgui_input_text(usr, "What would you like to label the bundle?", "Bundle Labelling", null, MAX_NAME_LEN, encode = FALSE), MAX_NAME_LEN)
|
|
if((loc == usr || loc.loc && loc.loc == usr) && usr.stat == 0)
|
|
name = "[(n_name ? text("[n_name]") : "paper")]"
|
|
add_fingerprint(usr)
|
|
return
|
|
|
|
|
|
/obj/item/paper_bundle/verb/remove_all()
|
|
set name = "Loose bundle"
|
|
set category = "Object"
|
|
set src in usr
|
|
|
|
to_chat(usr, span_notice("You loosen the bundle."))
|
|
for(var/obj/O in src)
|
|
O.loc = usr.loc
|
|
O.layer = initial(O.layer)
|
|
O.add_fingerprint(usr)
|
|
usr.drop_from_inventory(src)
|
|
qdel(src)
|
|
return
|
|
|
|
|
|
/obj/item/paper_bundle/update_icon()
|
|
var/obj/item/paper/P = pages[1]
|
|
icon_state = P.icon_state
|
|
copy_overlays(P, TRUE)
|
|
underlays = 0
|
|
var/i = 0
|
|
var/photo
|
|
for(var/obj/O in src)
|
|
var/image/img = image('icons/obj/bureaucracy.dmi')
|
|
if(istype(O, /obj/item/paper))
|
|
img.icon_state = O.icon_state
|
|
img.pixel_x -= min(1*i, 2)
|
|
img.pixel_y -= min(1*i, 2)
|
|
pixel_x = min(0.5*i, 1)
|
|
pixel_y = min( 1*i, 2)
|
|
underlays += img
|
|
i++
|
|
else if(istype(O, /obj/item/photo))
|
|
var/obj/item/photo/Ph = O
|
|
img = Ph.tiny
|
|
photo = 1
|
|
add_overlay(img)
|
|
if(i>1)
|
|
desc = "[i] papers clipped to each other."
|
|
else
|
|
desc = "A single sheet of paper."
|
|
if(photo)
|
|
desc += "\nThere is a photo attached to it."
|
|
add_overlay(image('icons/obj/bureaucracy.dmi', "clip"))
|
|
return
|