<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.lostsouls.org/w/skins/common/feed.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Man materials - Revision history</title>
		<link>http://wiki.lostsouls.org/w/index.php?title=Man_materials&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.8.2</generator>
		<lastBuildDate>Sun, 03 May 2026 11:40:03 GMT</lastBuildDate>
		<item>
			<title>Laine: /* Description */</title>
			<link>http://wiki.lostsouls.org/w/index.php?title=Man_materials&amp;diff=4015&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;

			&lt;table border='0' width='98%' cellpadding='0' cellspacing='4' style=&quot;background-color: white;&quot;&gt;
			&lt;tr&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;←Older revision&lt;/td&gt;
				&lt;td colspan='2' width='50%' align='center' style=&quot;background-color: white;&quot;&gt;Revision as of 23:09, 11 June 2007&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 18:&lt;/strong&gt;&lt;/td&gt;
&lt;td colspan=&quot;2&quot; align=&quot;left&quot;&gt;&lt;strong&gt;Line 18:&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;	#include &amp;lt;materials.h&amp;gt;&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;	#include &amp;lt;materials.h&amp;gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;	void create() {&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;	void create() {&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;		::create();&lt;/td&gt;&lt;td&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; font-size: smaller;&quot;&gt;		::create();&lt;/td&gt;&lt;/tr&gt;

			&lt;/table&gt;
		</description>
			<pubDate>Mon, 11 Jun 2007 23:09:00 GMT</pubDate>			<dc:creator>Laine</dc:creator>			<comments>http://wiki.lostsouls.org/Talk:Man_materials</comments>		</item>
		<item>
			<title>Laine at 23:08, 11 June 2007</title>
			<link>http://wiki.lostsouls.org/w/index.php?title=Man_materials&amp;diff=4014&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Files==&lt;br /&gt;
&lt;br /&gt;
  /lib/materials.h&lt;br /&gt;
  /daemon/materials.c&lt;br /&gt;
  /def/material/*&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
The list of materials that things can be composed of is extensive, and is&lt;br /&gt;
not described here because the primary reference for it is the directory of&lt;br /&gt;
material definitions, /def/material.  This document is to give you a quick&lt;br /&gt;
idea of how to work with materials, what they do, and how to get information&lt;br /&gt;
on ones you might want to use.&lt;br /&gt;
&lt;br /&gt;
/lib/materials.h contains the list of macros you should use to refer to&lt;br /&gt;
materials.  A quick example of how you would specify that an item is made&lt;br /&gt;
of a material is:&lt;br /&gt;
&lt;br /&gt;
	#include &amp;lt;materials.h&amp;gt;&lt;br /&gt;
	void create() {&lt;br /&gt;
		::create();&lt;br /&gt;
		set_names(({ &amp;quot;iron ball&amp;quot;, &amp;quot;ball&amp;quot; }));&lt;br /&gt;
		add_material(Material_Iron);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
This marks your item as made of iron.  This automatically causes it to have&lt;br /&gt;
the properties associated with iron, such as Prop_Metal and Prop_Ferrous --&lt;br /&gt;
the full description of iron is /def/material/iron.c.&lt;br /&gt;
&lt;br /&gt;
At times you may want, rather than to wade through the entire material list,&lt;br /&gt;
to get a list of materials that have a given property, such as Prop_Stone&lt;br /&gt;
or Prop_Metal.  A quick way to do this is by querying the materials daemon&lt;br /&gt;
as follows:&lt;br /&gt;
&lt;br /&gt;
 eval -i materials.h Material_Daemon-&amp;gt;query_materials_by_property(Prop_Stone)&lt;br /&gt;
&lt;br /&gt;
To easily and reliably retrieve the material definition object for a material&lt;br /&gt;
so you can work with it, use the following mechanism:&lt;br /&gt;
&lt;br /&gt;
	#include &amp;lt;materials.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	void find_iron_definition() {&lt;br /&gt;
		object def;&lt;br /&gt;
		def = Material(Material_Iron);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
Any time you store a reference to a material for use outside your current&lt;br /&gt;
execution context (e.g. in a global variable, or in arguments to call_out()),&lt;br /&gt;
you should use the material macro rather than storing the object definition.&lt;br /&gt;
The reason for this is that the definition could be destructed and reloaded&lt;br /&gt;
at any time, but if you store the code, you will always be able to retrieve&lt;br /&gt;
the current definition.  See the example below:&lt;br /&gt;
&lt;br /&gt;
	#include &amp;lt;materials.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	internal int material;&lt;br /&gt;
&lt;br /&gt;
	void create() {&lt;br /&gt;
		::create();&lt;br /&gt;
		material = Material_Iron;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	void find_material_definition() {&lt;br /&gt;
		object def;&lt;br /&gt;
		def = Material(material);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
The information in materials regarding &amp;quot;hardness&amp;quot; and &amp;quot;strength&amp;quot; should&lt;br /&gt;
not be used, as these are currently ill-defined measures and will probably&lt;br /&gt;
be replaced by something better-conceptualized.&lt;br /&gt;
&lt;br /&gt;
A flexible mechanism for randomly selecting materials from a defined pool&lt;br /&gt;
is available.  See [[man selection|man selection]] for details.&lt;/div&gt;</description>
			<pubDate>Mon, 11 Jun 2007 23:08:03 GMT</pubDate>			<dc:creator>Laine</dc:creator>			<comments>http://wiki.lostsouls.org/Talk:Man_materials</comments>		</item>
	</channel>
</rss>