Revision Difference
Entity:RemoveSpawnFlags#563027
<function name="RemoveSpawnFlags" parent="Entity" type="classfunc">
<description>
Removes a SpawnFlag from the current SpawnFlags of an Entity.
SpawnFlags can easily be found on https://developer.valvesoftware.com/wiki/.
⤶
SpawnFlags can easily be found on https://developer.valvesoftware.com/wiki/.
⤶
<note>See also <page>Entity:AddSpawnFlags</page>, <page>Entity:SetSpawnFlags</page> </note>⤶
</description>
<realm>Shared</realm>
<args>
<arg name="flag" type="number" default="nil">The SpawnFlag to remove from the Entity</arg>
<arg name="flag" type="number">The SpawnFlag to remove from the Entity</arg>
</args>
</function>
<example>
<description>When a turret Entity is created, it removes the `Out of Ammo` SpawnFlag, if it has it. Therefore it now has ammo.</description>
<code>
hook.Add( "OnEntityCreated", "AddSpawnFlagsExample", function( ent )
timer.Simple( 0.1, function()
if ( !IsValid(ent) or ent:GetClass() != "npc_turret_floor" ) then return end
if ( !ent:HasSpawnFlags(256) ) then return end
ent:RemoveSpawnFlags(256) -- https://developer.valvesoftware.com/wiki/Npc_turret_floor#Flags
end )
end )
</code>
</example>