mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-03 22:22:31 +00:00
* Globals work
* Double access works
* All other things
* Revert "All other things"
This reverts commit 6574442eb6.
* More changes that compile and work
* IT WORKS AAAAAA
* Changes even more .len to length()
* Apply suggestions from code review
* Update code/datums/mind.dm
* Update code/__HELPERS/sorts/InsertSort.dm
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
* Update code/__HELPERS/sanitize_values.dm
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
---------
Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com>
Co-authored-by: Deniz <66401072+Oyu07@users.noreply.github.com>
83 lines
2.8 KiB
Plaintext
83 lines
2.8 KiB
Plaintext
//CONTAINS: Evidence bags
|
|
|
|
/obj/item/evidencebag
|
|
name = "evidence bag"
|
|
desc = "An empty evidence bag."
|
|
icon = 'icons/obj/storage.dmi'
|
|
icon_state = "evidenceobj"
|
|
item_state = ""
|
|
w_class = WEIGHT_CLASS_TINY
|
|
|
|
/obj/item/evidencebag/afterattack(obj/item/I, mob/user,proximity)
|
|
if(!proximity || loc == I)
|
|
return
|
|
evidencebagEquip(I, user)
|
|
|
|
/obj/item/evidencebag/attackby(obj/item/I, mob/user, params)
|
|
if(evidencebagEquip(I, user))
|
|
return 1
|
|
|
|
/obj/item/evidencebag/proc/evidencebagEquip(obj/item/I, mob/user)
|
|
if(!istype(I) || I.anchored)
|
|
return
|
|
|
|
if(istype(I, /obj/item/storage/box))
|
|
to_chat(user, "<span class='notice'>This box is too big to fit in the evidence bag.</span>")
|
|
return
|
|
|
|
if(istype(I, /obj/item/evidencebag))
|
|
to_chat(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 > WEIGHT_CLASS_NORMAL)
|
|
to_chat(user, "<span class='notice'>[I] won't fit in [src].</span>")
|
|
return
|
|
|
|
if(length(contents))
|
|
to_chat(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(isstorage(I.loc)) //in a container.
|
|
var/obj/item/storage/U = I.loc
|
|
U.remove_from_storage(I, src)
|
|
else if(!user.is_holding(I) || !user.unEquip(I)) //in a hand
|
|
return
|
|
|
|
user.visible_message("<span class='notice'>[user] puts [I] into [src].</span>", "<span class='notice'>You put [I] inside [src].</span>",\
|
|
"<span class='notice'>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
|
|
img.plane = FLOAT_PLANE
|
|
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 1
|
|
|
|
/obj/item/evidencebag/attack_self(mob/user)
|
|
if(length(contents))
|
|
var/obj/item/I = contents[1]
|
|
user.visible_message("<span class='notice'>[user] takes [I] out of [src].</span>", "<span class='notice'>You take [I] out of [src].</span>",\
|
|
"<span class='notice'>You hear someone rustle around in a plastic bag, and remove something.</span>")
|
|
overlays.Cut() //remove the overlays
|
|
user.put_in_hands(I)
|
|
I.pickup(user)
|
|
w_class = WEIGHT_CLASS_TINY
|
|
icon_state = "evidenceobj"
|
|
desc = "An empty evidence bag."
|
|
|
|
else
|
|
to_chat(user, "[src] is empty.")
|
|
icon_state = "evidenceobj"
|