Object Character Flags
Object Character Flags are attributes of an object, which are computed from some DefCore entries and the current state of the object in the landscape. They are automatically updated by the engine.
All OCF are stored in a 32 bit wide bitmask. They can be tested with a simple bitwise "and". For example:
if (object->GetOCF() & OCF_Living) Log("The object is a living being.");
The most common application for OCF are FindObjects loops:
for (var obj in FindObjects(Find_InRect(-100,-100,200,200), Find_OCF(OCF_Rotate),Find_NoContainer()) obj->SetR(180);
This script turns all rotatable objects upside down.
OCF Constants
The following OCFs are defined in C4Script:
OCF_Alive, OCF_Available, OCF_Chop, OCF_Collectible, OCF_Collection, OCF_Construct, OCF_Container, OCF_CrewMember, OCF_Entrance, OCF_Exclusive, OCF_Fullcon, OCF_Grab, OCF_HitSpeed1, OCF_HitSpeed2, OCF_HitSpeed3, OCF_HitSpeed4, OCF_Inflammable, OCF_InFree, OCF_InLiquid, OCF_InSolid, OCF_Living, OCF_NotContained, OCF_OnFire, OCF_Rotate