OpenChest()
var/obj/chests/C
for(C in get_step(src,src.dir))
src << "You search the chest..."
flick("chestopen",C)
sleep(10)
if(src.chestsfound.Find(C.type))
src << "But there was nothing inside."
return
if(C.item == "Nothing")
src << "But there was nothing inside."
return
src << "And you have found \an [new C.item]!"
C.item += src
C += src.chestsfound
Thanks in advance
~~Dragon Lord~~
You're completely mixing up your data types here. You're trying to add to things that you can't add to.
This implies that C.item is a type path, like /obj/item/sword. Earlier you checked against "Nothing", a text string, although I think null would serve you better. Nothing's wrong with this line though; it just establishes that C.item is a path, not an object or a string or a number.
You can only add things to a string, a number, or a list, and even then you can't add an object (src) to a string or a number, so this will fail. And fail it does.
I believe what you wanted to do here was just empty the chest, which with your current code you can do with:
C.item = "Nothing"
Now, the last line:
C is an object, the chest, so you can't add to it. But I believe what you wanted to do was add this chest to the list src.chestsfound, which you can do by switching the operands around.
Lummox JR