openclonk/docs/sdk/script/fn/GetMaterial.xml

44 lines
1.7 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>GetMaterial</title>
<category>Landscape</category>
<subcat>Material</subcat>
<version>5.1 OC</version>
<syntax>
<rtype>int</rtype>
<params>
<param>
<type>int</type>
<name>x</name>
<desc>X coordinate at which to check the material. Offset in local calls.</desc>
</param>
<param>
<type>int</type>
<name>y</name>
<desc>Y coordinate at which to check the material. Offset in local calls.</desc>
</param>
</params>
</syntax>
<desc>Determines the material type at the specified position in the landscape. Returns a material index which can be used for comparison e.g. with <funclink>Material</funclink>. For sky areas the function returns -1.</desc>
<remark>This functions only processes static materials - moving material pixels such as rain or snow are not evaluated.</remark>
<examples>
<example>
<code><funclink>if</funclink>(GetMaterial(0, +200) == <funclink>Material</funclink>(&quot;Oil&quot;)) <funclink>Message</funclink>(&quot;I am rich!&quot;);</code>
<text>Part of a clonk script: if 200 pixels below the calling object oil is found a message is displayed.</text>
</example>
</examples>
<related>
<funclink>Material</funclink>
<funclink>GetBackMaterial</funclink>
<funclink>GBackSolid</funclink>
<funclink>GBackLiquid</funclink>
<funclink>InsertMaterial</funclink>
</related>
</func>
<author>Sven2</author><date>2002-08</date>
</funcs>