Files
Bubberstation/code/modules/detectivework/evidence.dm
T
Cruix ac0bad5d61 Added priority overlay system. (#18225)
Added priority overlays to atoms, which will not be removed when overlays are cut and will always remain on top when new overlays are added. This requires everyone to use add_overlay() and cut_overlays() instead of overlays += and overlays.Cut(). These procs are found in __HELPERS/icons.dm, and the priority overlay list is found in game/atoms.dm. Everything else is replacing deprecated overlay manipulation.
2016-06-17 10:11:53 +12:00

95 lines
3.2 KiB
Plaintext

//CONTAINS: Evidence bags
/obj/item/weapon/evidencebag
name = "evidence bag"
desc = "An empty evidence bag."
icon = 'icons/obj/storage.dmi'
icon_state = "evidenceobj"
item_state = ""
w_class = 1
/obj/item/weapon/evidencebag/afterattack(obj/item/I, mob/user,proximity)
if(!proximity || loc == I)
return
evidencebagEquip(I, user)
/obj/item/weapon/evidencebag/attackby(obj/item/I, mob/user, params)
if(evidencebagEquip(I, user))
return 1
/obj/item/weapon/evidencebag/proc/evidencebagEquip(obj/item/I, mob/user)
if(!istype(I) || I.anchored == 1)
return
if(istype(I, /obj/item/weapon/evidencebag))
user << "<span class='notice'>You find putting an evidence bag in another evidence bag to be slightly absurd.</span>"
return 1 //now this is podracing
if(I.w_class > 3)
user << "<span class='notice'>[I] won't fit in [src].</span>"
return
if(contents.len)
user << "<span class='notice'>[src] already has something inside it.</span>"
return
if(!isturf(I.loc)) //If it isn't on the floor. Do some checks to see if it's in our hands or a box. Otherwise give up.
if(istype(I.loc,/obj/item/weapon/storage)) //in a container.
var/obj/item/weapon/storage/U = I.loc
U.remove_from_storage(I, src)
else if(user.l_hand == I) //in a hand
user.drop_l_hand()
else if(user.r_hand == I) //in a hand
user.drop_r_hand()
else
return
user.visible_message("[user] puts [I] into [src].", "<span class='notice'>You put [I] inside [src].</span>",\
"<span class='italics'>You hear a rustle as someone puts something into a plastic bag.</span>")
icon_state = "evidence"
var/xx = I.pixel_x //save the offset of the item
var/yy = I.pixel_y
I.pixel_x = 0 //then remove it so it'll stay within the evidence bag
I.pixel_y = 0
var/image/img = image("icon"=I, "layer"=FLOAT_LAYER) //take a snapshot. (necessary to stop the underlays appearing under our inventory-HUD slots ~Carn
I.pixel_x = xx //and then return it
I.pixel_y = yy
add_overlay(img)
add_overlay("evidence") //should look nicer for transparent stuff. not really that important, but hey.
desc = "An evidence bag containing [I]. [I.desc]"
I.loc = src
w_class = I.w_class
return 1
/obj/item/weapon/evidencebag/attack_self(mob/user)
if(contents.len)
var/obj/item/I = contents[1]
user.visible_message("[user] takes [I] out of [src].", "<span class='notice'>You take [I] out of [src].</span>",\
"<span class='italics'>You hear someone rustle around in a plastic bag, and remove something.</span>")
cut_overlays() //remove the overlays
user.put_in_hands(I)
w_class = 1
icon_state = "evidenceobj"
desc = "An empty evidence bag."
else
user << "[src] is empty."
icon_state = "evidenceobj"
return
/obj/item/weapon/storage/box/evidence
name = "evidence bag box"
desc = "A box claiming to contain evidence bags."
/obj/item/weapon/storage/box/evidence/New()
new /obj/item/weapon/evidencebag(src)
new /obj/item/weapon/evidencebag(src)
new /obj/item/weapon/evidencebag(src)
new /obj/item/weapon/evidencebag(src)
new /obj/item/weapon/evidencebag(src)
new /obj/item/weapon/evidencebag(src)
..()
return