Coding Class: Dagger
From LSWiki
(Difference between revisions)
Revision as of 21:36, 8 May 2008 (edit) Matts (Talk | contribs) (→Important Header Files) ← Previous diff |
Revision as of 21:36, 8 May 2008 (edit) Matts (Talk | contribs) (→Important Source Files) Next diff → |
||
Line 29: | Line 29: | ||
==== Important Source Files ==== | ==== Important Source Files ==== | ||
- | /obj/extensions/weapon.c | + | * /obj/extensions/weapon.c |
- | /std/item.c | + | * /std/item.c |
==== Code Discussion ==== | ==== Code Discussion ==== |
Revision as of 21:36, 8 May 2008
// Include our base header file
#include <item.h> // Inherit our base object for what we're creating inherit "/std/item"; // configure() is where we define what the object -is-, and indirectly what it does. void configure() { // Call the configure() function from the file we inherited above. This really only calls one other function but it's necessary so that everything we're about to do works. ::configure(); // Call set_weapon_type() in the weapon extension and set it to Weapon_Type_Dagger (since we're making a dagger!) weapon()->set_weapon_type(Weapon_Type_Dagger); // Set the craft of the item. set_craft(Craft_Good); // Setup a general default description. add_description(Description_Type_Generic); // Setup the materials and forms and parts that we want our dagger to be made of. add_proportion(([ Element_Type : Material_Iron, Element_Proportion : 1.0, ])); }
Important Header Files
- /lib/craft.h - Craft_Good
- /lib/item.h
- /lib/materials.h - Material_Iron
- /lib/weapons.h - Weapon_Type_Dagger
- /lib/descriptors/description.h - Description_Type_Generic
- /lib/descriptors/element.h - Element_Type, Element_Proportion
Important Source Files
- /obj/extensions/weapon.c
- /std/item.c