obj
Ingredients
icon='Ingredients.dmi'
var/bigicon = 'Carrot.png'
Carrot
icon_state="carrot"
bigicon = 'Carrot.png'
verb
Get()
set src in view(1)
var/fullname = usr.lastname + ", " + usr.firstname
if(!usr.lastname)
fullname = usr.firstname
var/obj/Ingredients/C = new()
C = src
// del(src)
src.Move(usr.bag)
usr.ingredients += C
view()<<"[fullname] picked up [C]."
mob
var
cooking_bowl = new/list()
ingredients = new/list()
choppingboard = new/list()
bag = new/list()
Problem description:
Upon using the Get() verb, I'm given this runtime error.
runtime error: undefined proc or verb /list/Enter().
proc name: Get (/obj/Ingredients/verb/Get)
source file: Cooking.dm,47
usr: RiceINF (/mob)
src: Carrot (/obj/Ingredients/Carrot)
usr.loc: the turf (54,38,2) (/turf)
src.loc: the turf (55,39,2) (/turf)
call stack:
Carrot (/obj/Ingredients/Carrot): Get()
The Move() proc allows movable atoms to move between atoms.
Lists aren't atoms, so they're not involved in movement at all. You can add things to them like this:
This is how it should be, I think:
A few other points:
* The C variable is not necessary (you're instantiating it, and then setting it to src, ignoring what you just instantiated).
* I refactored your "full name" code into a mob proc. You're not going to want to copy/paste it everywhere you need it. You could optimize it by storing the full name as a variable and only updating it whenever firstname or lastname are modified, if they're not likely to change very often.
* List variables should have the list type. I modified your mob var declarations to have the list type.