Files
Bubberstation/code/modules/detectivework/evidence.dm
supersayu a993ce62db Bugfixen and minor changes. Fixes #136.
Adjusts the click code to not use client/Click().  The code is largely unchanged, except that it allows the compiler default behaviour of calling atom/Click(), and then forwards the call to mob/ClickOn().  I had some reports that melee combat mixed with movement was behaving oddly, and I believe it may be due to the use of client/Click; the byond documentation says that redefining client/Click() causes additional overhead, and it isn't strictly necessary.

Alters the way double clicks are handled, in an attempt to better handle clickspam, as often occurs during pitched combat.  This may also be responsible for the above, but I don't know.

Inserts proximity (aka flag) checks in all afterattack() procs.  The old assumption was that unless an item used the USEDELAY flag, afterattack() was only called when adjacent, but this is no longer true.  This led to beakers, soap, crayons, etc, all being usable at all ranges.

Removes the NODELAY flag, which was unused.  Removes all existing uses of the USEDELAY flag so that it can be readded to things that need extra delay.

Removes the hand_* procs, previously used by restrained actions.  Instead, the mob helper mob/RestrainedClickOn() has abosrbed basically all the functionality they were used for, which is really only monkeys with jungle fever.

Adds a special case of the Adjacency() proc for doors.  This fixes #136, airlocks being unreachable due to border fire doors.  However, this only takes us back to the unpleasant position where you have to open-hand the door, switch to a crowbar, and pry open the firedoor; it still needs a better fix.
2013-09-17 18:19:14 -04:00

90 lines
2.8 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 as mob,proximity)
if(!proximity)
return
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
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
user.client.screen -= I
U.contents.Remove(I)
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]", "You put [I] inside [src].",\
"You hear a rustle as someone puts something into a plastic bag.")
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
overlays += img
overlays += "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
/obj/item/weapon/evidencebag/attack_self(mob/user as mob)
if(contents.len)
var/obj/item/I = contents[1]
user.visible_message("[user] takes [I] out of [src]", "You take [I] out of [src].",\
"You hear someone rustle around in a plastic bag, and remove something.")
overlays.Cut() //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."
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