obj/Food
//proc that is usable by all obj's at the lowest level in this tree
Fruit
icon = 'Food.dmi'
icon_state = "Fruitbowl"
Apple
name="Golden Apple"
desc="This apple grants you the power to turn anything into gold!"
Click()
if(src in usr.contents)
for(var/mob/M in hearers(10))
hearers(10) << "[usr] reveals his [name]: [desc]"
Orange
name="Juicy Orange"
desc="The user of this orange is able to call upon an endless river of orange juice!"
Meat
icon = 'Food.dmi'
icon_state="Foodplatter"
Burger
name="Hamburger"
desc="The user who eats this will gain large love handles that can function as a flotation device!"
German_Meat
name="Brautwurst"
desc="The user who eats this will never be hungry again!"
Vegetable
icon = 'Food.dmi'
icon_state="Veggies"
Spinach
name="Can of Spinach"
desc="Toot toot! Whosoever eats this spinach, if he be worthy, shall possess the power of Popeye the Sailor Man!"
Brussel_Sprouts
name"Brussel Sprouts"
desc="BLECH! If anyone eats this they lose all their food-gained powers."
Problem description:Hi. I present to you my highly complex and advanced tree of objects relating to food. It's representative of what's currently in my source code but I changed/simplified it so it's more attractive to receive a response, and so that I could understand just in case someone decides to bust out a mosaic response filled DM/coding jargon that I'm not yet familiar with. Anyway there's the object Food, with its three "sub objects", Fruit, Meat, and Vegetable. Each of those use the same icon file but different icon_state as it's icon. Within them there's 2 specific fruits, meats, and vegetables, respectively with their own [name] and [desc].
What I could do is add a Click() proc for each specific food at the lowest level to display its [name] and [desc] but as far as I know that probably isn't the most efficient route to take. What I'd like to know how to do is add a single Click() (or any proc, really) under
obj/Food
Any help?
You want a basic Click() command that will do this:
but then do extra food-specific things for each individual food like for example: Apple will show "[usr] reveals his [name]: [desc]" AND give +15 health to usr?
If that's the case, just have the basic
under Food and then in each individual food object have a modified use_food().
For example: