<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE doc
  SYSTEM '../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../clonk.xsl"?>
<doc>
  <title>Object character flags</title>
  <h id="ocf">Object Character Flags</h>
  <text>Object Character Flags are attributes of an object, which are computed from some <emlink href="definition/defcore.html">DefCore</emlink> entries and the current state of the object in the landscape. They are automatically updated by the engine.</text>
  <text>All OCF are stored in a 32 bit wide bitmask. They can be tested with a simple bitwise "and". For example:</text>
  <code>if (object-&gt;<funclink>GetOCF</funclink>() &amp; <funclink>OCF_Living</funclink>)
  <funclink>Log</funclink>(&quot;The object is a living being.&quot;);</code>  <text>The most common application for OCF are FindObjects loops:</text>
  <code>for (var obj in <funclink>FindObjects</funclink>(<funclink>Find_InRect</funclink>(-100,-100,200,200), <funclink>Find_OCF</funclink>(<funclink>OCF_Rotate</funclink>),<funclink>Find_NoContainer</funclink>())
	 obj-&gt;<funclink>SetR</funclink>(180);</code>
  <text>This script turns all rotatable objects upside down.</text>
  <h id="ocf_fns">OCF Constants</h>
  <text>The following OCFs are defined in C4Script:</text>
  <text><funclink>OCF_Alive</funclink>, <funclink>OCF_Available</funclink>, <funclink>OCF_Chop</funclink>, <funclink>OCF_Collectible</funclink>, <funclink>OCF_Collection</funclink>, <funclink>OCF_Construct</funclink>, <funclink>OCF_Container</funclink>, <funclink>OCF_CrewMember</funclink>, <funclink>OCF_Entrance</funclink>, <funclink>OCF_Exclusive</funclink>, <funclink>OCF_Fullcon</funclink>, <funclink>OCF_Grab</funclink>, <funclink>OCF_HitSpeed1</funclink>, <funclink>OCF_HitSpeed2</funclink>, <funclink>OCF_HitSpeed3</funclink>, <funclink>OCF_HitSpeed4</funclink>, <funclink>OCF_Inflammable</funclink>, <funclink>OCF_InFree</funclink>, <funclink>OCF_InLiquid</funclink>, <funclink>OCF_InSolid</funclink>, <funclink>OCF_Living</funclink>, <funclink>OCF_NotContained</funclink>, <funclink>OCF_OnFire</funclink>, <funclink>OCF_Rotate</funclink></text>
  <author>Sven2</author><date>2002-05</date>
</doc>
