Coding Class: Dagger
From LSWiki
Revision as of 22:37, 8 May 2008; Matts (Talk | contribs)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
(diff) ←Older revision | Current revision | Newer revision→ (diff)
// 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
