Object flags

From SRB2 Wiki
(Redirected from Primary Object flags)
Jump to navigation Jump to search

Object flags are a series of toggles that determine the properties of an Object. They are used for a variety of different purposes, such as the Object's interaction with the level environment and other Objects as well as the type of thinker it uses. Some of them have very specific uses while others set more general options.

There are three sets of flags: The primary flags are the basic properties that must be set for every Object and that are checked on level load. In most cases, these properties will not change during runtime, although the action A_SetObjectFlags can be used if this is necessary. In contrast to these, the secondary flags are used for temporary properties that are added and removed by certain actions for short periods of time. While the primary flags must be set for every custom Object in its SOC block, the secondary flags can only be set during runtime. The action A_SetObjectFlags2 can be used to modify them. Finally, a set of extra flags also exists for primarily physics-related effects such as marking when an Object is underwater or should have flipped sprites/physics. These can only be modified directly via Lua.

The primary, secondary, and extra Object flags for an Object are each stored in 32-bit integers where every bit represents a flag, i.e. 0 means "disabled" and 1 means "enabled". To set several flags at once, the bitwise OR operator (|) has to be performed on them. For example, to give all Objects of a particular type the primary flags MF_SPECIAL, MF_ENEMY, and MF_RUNSPAWNFUNC, one would write Flags = MF_SPECIAL|MF_ENEMY|MF_RUNSPAWNFUNC in the corresponding Object SOC block.

Primary flags

Decimal Hexadecimal Flag name Description
1 0x00000001 MF_SPECIAL When an Object with this flag is touched by the player, the function P_TouchSpecialThing is called to determine what should happen with the Object and/or the player. Objects that interact with the player in some way upon being touched, such as enemies, hazards or collectible items, should have this flag. Objects with MF_ENEMY, MF_BOSS and/or MF_FIRE in particular require this flag to be able to damage the player on touch or be damaged by the player on touch. If there is no existing behavior set, touching the Object will by default kill the Object (sending it to its DeathState) and play its DeathSound. Lua is capable of modifying the effect of this flag for particular Object types, using the TouchSpecial Lua hook.
2 0x00000002 MF_SOLID This makes the Object solid, and it will act as such to the player.
4 0x00000004 MF_SHOOTABLE The Object can be damaged. Combined with MF_SOLID, this makes it vulnerable to missiles, but not normal attacks.
8 0x00000008 MF_NOSECTOR Removes the Object from the sector links, making it invisible. Don't change this flag during runtime. To make something invisible during the game, use MF2_DONTDRAW or set the sprite to SPR_NULL.
16 0x00000010 MF_NOBLOCKMAP Removes the Object from the blockmap, making it intangible. Just like MF_NOSECTOR though, don't change this flag during runtime – use MF_NOCLIP instead.
32 0x00000020 MF_PAPERCOLLISION The Object's hitbox will be treated as a line instead of a box, lining up with the appearance of states with the FF_PAPERSPRITE flag.
64 0x00000040 MF_PUSHABLE The Object is a pushable, and as such can be pushed by players and other pushables. See the Pushable article for further details.
128 0x00000080 MF_BOSS The Object is a boss and will use a boss thinker. See the Boss article for further details.
256 0x00000100 MF_SPAWNCEILING The Object spawns on the ceiling rather than the floor, unless the Flip flag is checked on the Object's map Thing.
512 0x00000200 MF_NOGRAVITY The Object is unaffected by gravity and will keep its height unless moved by something else.
1024 0x00000400 MF_AMBIENT The Object is an ambient sound effect. The Object's SeeSound is constantly played. SpawnHealth sets the interval between each time SeeSound is played. See the Ambient sound effect article for further details.
2048 0x00000800 MF_SLIDEME The Object will slide along walls when colliding with them.
4096 0x00001000 MF_NOCLIP The Object is intangible and will go through walls and other Objects. When noclip is turned on, the player will be given this flag.
8192 0x00002000 MF_FLOAT The Object will automatically floats up or down to the height of its target, unless MF2_INFLOAT or MF2_SKULLFLY are set. This is most commonly used by flying or underwater enemies and bosses that need to chase the player vertically. MF_NOGRAVITY has to be checked for this to work as intended. The Object will move up/down at a fixed speed of 4 fracunits/tic. Note that the Egg Mobile's floating behavior and speed works differently to that of other Objects that use this flag.
16384 0x00004000 MF_BOXICON The Object is a monitor icon and will float upwards upon being spawned. Damage sets how high the Object will rise before disappearing, and Speed sets how fast it will rise.
32768 0x00008000 MF_MISSILE The Object is a projectile of some sort. See the Projectile article for further details.
65536 0x00010000 MF_SPRING The Object is a spring and will be treated as such when touched. See the Spring article for further details.
131072 0x00020000 MF_BOUNCE The Object will bounce off walls and other Objects, playing its ActiveSound whenever this happens.
262144 0x00040000 MF_MONITOR The Object is a monitor; it will be popped when hit by a normal attack from the player and award a power. If the Object falls on a player, the player will be crushed and die – in multiplayer, a player is awarded points if they manage to pop the monitor Object before it falls on another player. See the Monitor article for further details.
524288 0x00080000 MF_NOTHINK The Object has no AI. Use this to save CPU power for static scenery Objects. Objects with this flag will not animate and cannot use any actions.
1048576 0x00100000 MF_FIRE The Object is flaming; it will hurt players without an Elemental Shield (provided MF_SPECIAL or MF_PAIN is also checked) and vanish when it touches water.
2097152 0x00200000 MF_NOCLIPHEIGHT The Object is not restricted to the top and bottom heights of the sector it is in, and can go into the floor or ceiling.
4194304 0x00400000 MF_ENEMY The Object is an enemy; provided it has MF_SPECIAL also checked it can hurt the player on touch, can be killed by various means, and gives the player who killed it 100 points. See the Enemy article for further details.
8388608 0x00800000 MF_SCENERY The Object is a scenery item and will use a reduced thinker, taking up less CPU power than a regular Object would.
16777216 0x01000000 MF_PAIN The Object hurts players on contact. This effect will override any extra effects on touch from flags such as MF_SPECIAL.
33554432 0x02000000 MF_STICKY The Object will stick to any surface or solid Object it touches.
67108864 0x04000000 MF_NIGHTSITEM Used by NiGHTS power-up items. When the Object is paralooped, it goes into its SeeState and adds the MF_SPECIAL flag, allowing the player to collect it. See the NiGHTS power-up article for further details.
134217728 0x08000000 MF_NOCLIPTHING The Object is partially intangible, it will pass through other Objects, but not walls. This is used for the flickies that are released from destroyed enemies, for example. Objects with the MF_MISSILE flag use this for an extra purpose: When a missile explodes, this flag is set to indicate that is has exploded and prevent it from exploding again.
268435456 0x10000000 MF_GRENADEBOUNCE Used by grenade-like projectiles, such as the Grenade Ring, to be used with MF_MISSILE. Instead of exploding on collision with the floor, it will bounce off it instead. ActiveSound is played for every collision.
536870912 0x20000000 MF_RUNSPAWNFUNC When an Object is spawned and its SpawnState has an action, the action will normally not be performed. If this flag is set, the action will be performed. Note that some actions rely on information that is not yet available when the Object is still being spawned, such as the Object's target or tracer. These actions may crash the game when performed on spawn, so use caution with this flag.

Secondary flags

Decimal Hexadecimal Flag name Description
1 0x00000001 MF2_AXIS This flag is automatically set for the NiGHTS Axis, Axis Transfer and Axis Transfer Line. It is used internally to make it more convenient to check if an Object is one of those three.
2 0x00000002 MF2_TWOD This flag is given to Objects if they are in 2D mode or are supposed to behave as such. In general this prevents movement along the y-axis, with exceptions such as being propelled by springs. Can be given to/removed from players through linedef type 432.
4 0x00000004 MF2_DONTRESPAWN The Object does not respawn. Given to any rings, ammo and panels dropped by players who have been hit. This does not do anything for most Objects otherwise.
8 0x00000008 MF2_DONTDRAW The Object does not generate a visible sprite. Frequently used for sprite flickering effects, such as when a player is recovering from being hit, usually by turning on and off this flag every other tic.
16 0x00000010 MF2_AUTOMATIC This flag is given to thrown Automatic Rings to identify them as such.
32 0x00000020 MF2_RAILRING This flag is given to thrown Rail Rings to identify them as such. This does not in fact allow Objects to instantanously fly across the map as with Rail Rings themselves, unless when fired by a player specifically. For players that have just been hit by an Object with this flag, they will have a greatly increased knockback speed (45 FU/tic); combined with MF2_EXPLOSION however, this is slightly decreased to 38 FU/tic. Overridden by the knockback effect of MF2_SCATTER.
64 0x00000040 MF2_BOUNCERING This flag is given to thrown Bounce Rings to identify them as such.
128 0x00000080 MF2_EXPLOSION This flag is given to thrown Explosion Rings and Grenade Rings to identify them as such. For players that have just been hit by an Object with this flag, they will have a greatly increased knockback speed (30 FU/tic); combined with MF2_RAILRING this is further increased to 38 FU/tic. Overridden by the knockback effect of MF2_SCATTER.
256 0x00000100 MF2_SCATTER This flag is given to thrown Scatter Rings to identify them as such. For players that have just been hit by an Object with this flag, their knockback speed will depend on how far away the Object has moved from the Object that fired it if one exists; players very close to the firer will receive a massive knockback speed up to 128 FU/tic maximum, players far away meanwhile will receive a much smaller knockback (minimum is 4 FU/tic, the normal knockback speed).
512 0x00000200 MF2_BEYONDTHEGRAVE This flag is given to projectiles when the player who threw them has since died and respawned.
1024 0x00000400 MF2_SLIDEPUSH The Object slides after being pushed. MF_SOLID and MF_PUSHABLE have to be checked for this to work. The maximum speed at which an Object with this flag can slide is set by its Speed value. Also used by flung emeralds in Match/CTF to prevent them from being collected if they are moving upwards.
2048 0x00000800 MF2_CLASSICPUSH If the Object is falling, it will stop all horizontal movement and drop straight down. This flag is given to pushables whose map Things have both the Special and Ambush flag checked.
4096 0x00001000 MF2_INVERTAIMABLE Inverts the conditions for this Object to be able to be targeted by A_LookForEnemies, for mechanics such as Fang's pop gun. Objects with the MF_SHOOTABLE flag and at least one of MF_ENEMY, MF_BOSS, and/or MF_MONITOR normally are the only targets, but this flag will disallow those objects & allow others.
8192 0x00002000 MF2_INFLOAT If an Object has the MF_FLOAT flag set, it automatically floats to the height of its target. If it shouldn't do that, this flag is used. This flag is automatically given and removed during use of A_Chase-style actions, when the actor Object's movement is blocked and the actor has to concentrate on adjusting its height to get past a blocking wall.
16384 0x00004000 MF2_DEBRIS Exploded Explosion Rings and Grenade Rings are given this flag to signify that they have already exploded. Missile Objects with this flag will not play DeathSound when exploding.
32768 0x00008000 MF2_NIGHTSPULL This flag is used for the item attraction in NiGHTS. Spheres, rings and coins that are inside the player's attraction radius are given this flag.
65536 0x00010000 MF2_JUSTATTACKED The Object has just attacked, and cannot attack again immediately. Objects using actions such as A_Chase, A_FaceStabChase, A_SkimChase, A_Boss1Chase or A_BrakChase add this flag when they first attack – when they try to attack again, this flag is removed instead of attacking, and then the process repeats again once they are ready to attack again. CTF flags have this flag set when they are outside their respective bases.
131072 0x00020000 MF2_FIRING This flag is used signify that an Object is currently firing some type of projectile. Used by the Turret and the Flame Jets. A_TurretFire and A_SuperTurretFire add this flag to the Object, A_TurretStop removes it, while A_ToggleFlameJet can do either depending on whether the flag is already set or not.
262144 0x00040000 MF2_SUPERFIRE Missile Objects with this flag will be able to make even Super players be flung back when collided with; however, it will not make them lose rings as with normal players. Objects with MF2_FIRING and this flag will pass on this flag to the missiles they fire.
524288 0x00080000 MF2_SHADOW The Object's sprite is automatically drawn with tr_trans80 translucency and full brightness, overriding the current state's settings. Set by the Force Shield when it has only one health point left. Also used in Single Player to make the player translucent when the camera is too close.
1048576 0x00100000 MF2_STRONGBOX This flag is given to Strong Random Monitors to identify them as such. This flag is also given to Objects with MF_NIGHTSITEM whose map Things have the Special flag checked, to mark that the item can only be activated during bonus time.
2097152 0x00200000 MF2_OBJECTFLIP This flag forces Objects to have permanently flipped gravity, regardless of the current gravity in the sector (unless the Object is a player). For players however, this can be combined with the gravity boots powerup to cancel out the flipped gravity temporarily. Can be given to/removed from players through linedef type 433, and will be given to any Object whose map Things have the Flip flag checked.
4194304 0x00400000 MF2_SKULLFLY This flag is set by the action A_SkullAttack to signify that the Object is currently flying at the player. If the Object is the Egg Mobile or a custom Object with MF_BOSS, ghost trails of the Object will be spawned while this flag is set.
8388608 0x00800000 MF2_FRET This flag is used to signify that a boss has been hit by the player. Among other things, it makes the boss's outlines flash white and makes it temporarily immune to the player. The Crawla Commander also uses this in a similar fashion.
16777216 0x01000000 MF2_BOSSNOTRAP This flag is given to bosses whose map Things have the Special flag checked. If the flag is set and A_BossDeath is called, no Egg Capsule will appear and the level will end instead. Also given to spinning maces when Special is checked to make them silent.
33554432 0x02000000 MF2_BOSSFLEE This flag is given to bosses who are fleeing to control their movement.
67108864 0x04000000 MF2_BOSSDEAD This flag is given to bosses who have died but are not necessarily fleeing. While SRB2 itself never makes use of this flag, it can be used in Lua scripts to identify bosses that have been defeated.
134217728 0x08000000 MF2_AMBUSH This flag is used for various purposes, usually to signify an alternate type of behavior for an Object. Its effect depends on the Object's other flags and the actions being used. Checking the Ambush flag on a Thing will usually activate this flag for the corresponding Object.
268435456 0x10000000 MF2_LINKDRAW This Object will be drawn immediately before or after its tracer is drawn, depending on its dispoffset and position, essentially creating multi-sprite Objects that are drawn as a single Object. This is notably used for character followitems, such as Tails' tail overlay and Metal Sonic's jet fume.
536870912 0x20000000 MF2_SHIELD This Object's thinker calls P_AddShield and P_ShieldLook. Used for Shield overlay objects. For this flag to work, the MF_SCENERY flag also needs applied.
1073741824 0x40000000 MF2_SPLAT The Object will be drawn on a horizontal plane, also called a floor sprite, or a "splat".

Extra flags

Decimal Hexadecimal Flag name Description
1 0x0001 MFE_ONGROUND This flag is given when the Object's "ground" is a solid floor, whether it is the sector's main floor or the top of an FOF/PolyObject. If the Object's ground is instead an Object with MF_SOLID, this flag will not be given.
2 0x0002 MFE_JUSTHITFLOOR This flag is given to mark when the Object has just landed on the floor from falling down (or on the ceiling when in flipped gravity); the flag will subsequently be removed on the next tic afterwards.
4 0x0004 MFE_TOUCHWATER The Object is "touching" water – i.e. the Object's bottom is below the surface of a water FOF, but the Object's top is still above.
8 0x0008 MFE_UNDERWATER The Object is "underwater" – i.e. the Object is submerged at least half its height into a water FOF. For players, this causes the underwater timer to activate, which may result in drowning unless the player escapes or is wearing an Elemental Shield. However, it allows characters with the Swim ability (CA_SWIM) to use their ability while this flag is set.
16 0x0010 MFE_JUSTSTEPPEDDOWN This flag is given to mark when a player has just "stepped" down from a floor to another floor under 24 fracunits below it (the flag is not given for non-player Objects). However, if the Non-Ramp Sector sector special is applied to the sector floor the player is standing in, the player will instead fall down and this flag will not be given.
32 0x0020 MFE_VERTICALFLIP This flag is given to mark when the Object's sprites/physics should be vertically flipped. Not to be confused with MF2_OBJECTFLIP, which forces this flag on constantly for permanent reverse gravity. See reverse gravity for more details on flipping gravity.
64 0x0040 MFE_GOOWATER The Object is at least partially submerged in THZ goop, so must have THZ goop gravity/physics applied to it.
128 0x0080 MFE_TOUCHLAVA The mobj is touching a lava block.
256 0x0100 MFE_PUSHED The Object was already pushed this tic.
512 0x0200 MFE_SPRUNG The Object was already sprung this tic.
1024 0x0400 MFE_APPLYPMOMZ Used to tell the game when to apply Z momentum from platforms.
2048 0x0800 MFE_TRACERANGLE Compute and trigger on mobj angle relative to tracer. See Linedef type 457 (Track mobj angle to point).
4096 0x1000 MFE_FORCESUPER Forces an object to use super sprites with SPR_PLAY.
8192 0x2000 MFE_FORCENOSUPER Forces an object to NOT use super sprites with SPR_PLAY.
12288 0x3000 MFE_REVERSESUPER MFE_FORCENOSUPER.