Lua:Flags

From Fortress Forever Wiki
Revision as of 18:21, 22 April 2015 by R00Kie (talk | contribs)
Jump to navigationJump to search


Mapping for FF
The Basics

Setting up Hammer
Getting Started With Lua
Releasing a map

FF-specific Entities

Lua location system

Map Templates
FF Lua Documentation

Entity Typing
Entity Collections

Commands
Callbacks

Class

Returns a specific class ID

Flag Description
Player.kScout Scout Class
Player.kSniper Sniper Class
Player.kSoldier Soldier Class
Player.kDemoman Demoman Class
Player.kMedic Medic Class
Player.kHwGuy Heavy Weapons Class
Player.kPyro Pyro Class
Player.kSpy Spy Class
Player.kEngineer Engineer Class

Example

local player = CastToPlayer( touch_entity ) 
if player:GetClass() == Player.kSniper then
  ...
end

Team

Returns a specific team's ID

Flag Description
Team.kUnassigned The Unassigned team consists of players that have not picked a team)
Team.kSpectator Spectators
Team.kRed The Red team
Team.kBlue The Blue team
Team.kYellow The Yellow team
Team.kGreen The Green team

Example

local player = CastToPlayer( touch_entity ) 
if player:GetTeamId() == Team.kRed then
  ...
end

Grenade

Returns a specific grenade's ID

Flag Description
Grenade.kNormal Frag grenade (All classes except Scout and Civilian)
Grenade.kCaltrop Caltrop grenades are no longer in the game
Grenade.kNail Nail Grenade (Soldier)
Grenade.kMirv Mirv grenade (Demoman)
Grenade.kMirvlet The four mini-grenades that come out of the Mirv grenade (Demoman)
Grenade.kConc Concussion grenade (Scout and Medic)
Grenade.kNapalm Napalm grenade (Pyro)
Grenade.kGas Gas grenade (Spy)
Grenade.kEmp EMP grenade (Engineer)

Example

local grenade = CastToGrenade( explode_entity ) 
if grenade:Type() == Grenade.kNormal then
  ...
end

Damage

Returns a specific damage type's ID; predominately used to detect fall damage

Flag Description
Damage.kGeneric Generic damage
Damage.kCrush Crushing damage (as in by an elevator or door)
Damage.kBullet Bullet damage
Damage.kSlash Unknown
Damage.kBurn Burn damage (maybe by pyro, maybe by trigger_hurt)
Damage.kVehicle Vehicle damage
Damage.kFall Fall damage
Damage.kBlast Blast damage
Damage.kClub Unknown
Damage.kShock Shock damage
Damage.kSonic Unknown
Damage.kEnergyBeam Unknown
Damage.kPreventPhysForce Unknown
Damage.kNeverGib Unknown
Damage.kAlwaysGib Unknown
Damage.kDrown Drowning damage
Damage.kTimeBased Unknown
Damage.kParalyze Unknown
Damage.kNerveGas Unknown
Damage.kPoison Unknown
Damage.kRadiation Unknown
Damage.kDrownRecover Unknown
Damage.kAcid Unknown
Damage.kSlowBurn Unknown
Damage.kRemoveNoRagdoll Unknown
Damage.kPhysgun Unknown; likely not applicable
Damage.kPlasma Unknown
Damage.kAirboat Likely not applicable
Damage.kDissolve Can be dealt by a trigger_hurt
Damage.kBlastSurface Unknown
Damage.kDirect Unknown
Damage.kBuckshot Unknown
Damage.kGibCorpse Unknown
Damage.kShownHud Unknown
Damage.kNoPhysForce Unknown

Example

local damagetype = damageinfo:GetDamageType()
if damagetype == Damage.kFall then
  ...
end

Ammo

Returns a specific ammo type's ID; predominately used to add or remove ammo from a player

Flag Description
Ammo.kShells Shell ammo type
Ammo.kCells Cell ammo type
Ammo.kNails Nail ammo type
Ammo.kRockets Rocket ammo type
Ammo.kDetpack Detpack ammo type
Ammo.kManCannon Jump Pad ammo type
Ammo.kGren1 Primary grenade ammo type
Ammo.kGren2 Secondary grenade ammo type
Ammo.kInvalid Unknown

Example

local player = CastToPlayer( player_entity )

player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:AddAmmo( Ammo.kManCannon, 1 )

EF

Returns a specific status effect's ID

Flag Description
EF.kOnfire On Fire status effect
EF.kConc Concussed status effect
EF.kGas Hallucinati ons status effect
EF.kInfect Infected status effect
EF.kRadiotag Transmitting status effect
EF.kHeadshot Headshot status effect
EF.kLegshot Crippled status effect
EF.kTranq Tranquilized status effect
EF.kCaltrop Defunct
EF.kACSpinup Assault Cannon spinup status effect
EF.kSniperrifle Unknown
EF.kSpeedlua1 Custom speed effect 1
EF.kSpeedlua2 Custom speed effect 2
EF.kSpeedlua3 Custom speed effect 3
... ...
EF.kSpeedlua10 Custom speed effect 10

Example

local player = CastToPlayer( player_entity )

SPEED_MULTIPLIER = 2.0
EFFECT_DURATION = -1 -- Infinite duration
ICON_DURATION = 0

player:AddEffect( EF.kSpeedlua1, EFFECT_DURATION, ICON_DURATION, SPEED_MULTIPLIER )

AT

Returns a specific "apply to" ID; Applies various commands to players, or to the entire server. Use with ApplyToAll(ApplyToFlags), ApplyToTeam(team, ApplyToFlags), or ApplyToPlayer(player, ApplyToFlags) (not all flags are suitable for all functions).

Flag Description
AT.kKillPlayers
AT.kRespawnPlayers
AT.kDropItems
AT.kForceDropItems
AT.kThrowItems
AT.kForceThrowItems
AT.kReturnCarriedItems
AT.kReturnDroppedItems ApplyToAll only?
AT.kRemoveRagdolls ApplyToAll only?
AT.kRemovePacks ApplyToAll only?
AT.kRemoveProjectiles
AT.kRemoveBuildables
AT.kRemoveDecals ApplyToAll only?
AT.kEndMap ApplyToAll only
AT.kReloadClips
AT.kAllowRespawn
AT.kDisallowRespawn
AT.kChangeClassScout
AT.kChangeClassSniper
AT.kChangeClassSoldier
AT.kChangeClassDemoman
AT.kChangeClassMedic
AT.kChangeClassHWGuy
AT.kChangeClassPyro
AT.kChangeClassSpy
AT.kChangeClassEngineer
AT.kChangeClassCivilian
AT.kChangeClassRandom
AT.kChangeTeamBlue
AT.kChangeTeamRed
AT.kChangeTeamYellow
AT.kChangeTeamGreen
AT.kChangeTeamSpectator
AT.kStopPrimedGrens

Example

ApplyToAll({ AT.kRemovePacks, AT.kRemoveProjectiles, AT.kRespawnPlayers, AT.kRemoveBuildables, AT.kRemoveRagdolls, AT.kStopPrimedGrens, AT.kReloadClips })

ClipFlags

Used with Lua:trigger_ff_clip to determine what types of entities are allowed to pass through the trigger.

Flag Description
ClipFlags.kClipTeamBlue Use in conjunction with "ByTeam" flags.
ClipFlags.kClipTeamRed Use in conjunction with "ByTeam" flags.
ClipFlags.kClipTeamYellow Use in conjunction with "ByTeam" flags.
ClipFlags.kClipTeamGreen Use in conjunction with "ByTeam" flags.
ClipFlags.kClipAllPlayers
ClipFlags.kClipAllGrenades
ClipFlags.kClipAllProjectiles projectiles such as nails and rockets.
ClipFlags.kClipAllBullets hitscan weapons such as shotguns.
ClipFlags.kClipAllBuildables Can buildables be placed?
ClipFlags.kClipAllBuildableWeapons Can sentries fire through?
ClipFlags.kClipAllBackpacks Thrown/dropped ammo.
ClipFlags.kClipAllInfoScripts Flags, balls, etc. These currently cannot be filtered by team.
ClipFlags.kClipAllSpawnTurrets
ClipFlags.kClipAllNonPlayers
ClipFlags.kClipPlayersByTeam or ClipFlags.kClipPlayers The following pairs behave identically; the first form is preferred, but the second form is for backwards-compatibility.
ClipFlags.kClipGrenadesByTeam or ClipFlags.kClipGrenades
ClipFlags.kClipProjectilesByTeam or ClipFlags.kClipProjectiles
ClipFlags.kClipBulletsByTeam or ClipFlags.kClipBullets
ClipFlags.kClipBuildablesByTeam or ClipFlags.kClipBuildables
ClipFlags.kClipBuildableWeaponsByTeam or ClipFlags.kClipBuildableWeapons
ClipFlags.kClipBackpacksByTeam or ClipFlags.kClipBackpacks
ClipFlags.kClipSpawnTurretsByTeam or ClipFlags.kClipSpawnTurrets
ClipFlags.kClipNonPlayersByTeam or ClipFlags.kClipNonPlayers

Example

This clip brush will be solid to everything except blue players.

clip_example = trigger_ff_clip:new({ clipflags = {
ClipFlags.kClipPlayersByTeam, ClipFlags.kClipTeamRed, 
ClipFlags.kClipTeamYellow, ClipFlags.kClipTeamGreen, 
ClipFlags.kClipAllNonPlayers} })

CF

Returns a specific "collection filter" ID;. Use with Collection() functions to add certain entities to a list.

Flag Description
CF.kNone No filter
CF.kPlayers
CF.kHumanPlayers Meaning bots are excluded.
CF.kBotPlayers FF does not support bots at this time.
CF.kPlayerScout
CF.kPlayerSniper
CF.kPlayerSoldier
CF.kPlayerDemoman
CF.kPlayerMedic
CF.kPlayerHWGuy
CF.kPlayerPyro
CF.kPlayerSpy
CF.kPlayerEngineer
CF.kPlayerCivilian
CF.kTeams Not sure if the team filters work on just players or on any team-aligned object.
CF.kTeamSpec Spectators
CF.kTeamBlue
CF.kTeamRed
CF.kTeamYellow
CF.kTeamGreen
CF.kProjectiles Applies to non-hitscan projectile weapons like rockets.
CF.kGrenades
CF.kInfoScipts Applies to any info_ff_script
CF.kInfoScript_Carried Use the following on info_ff_scripts to determine their status
CF.kInfoScript_Dropped
CF.kInfoScript_Returned
CF.kInfoScript_Active
CF.kInfoScript_Inactive
CF.kInfoScript_Removed
CF.kTraceBlockWalls This flag must be used if you are using the Collection:GetInSphere function.
CF.kBuildables
CF.kDispenser
CF.kSentrygun
CF.kDetpack

Example

local col = Collection()

-- get all blue snipers
col:GetByFilter( { CF.kPlayers, CF.kPlayerSniper, CF.kTeamBlue } )

Color

Shorthand for some common colors

Flag Description
Color.kInvalid
Color.kDefault
Color.kBlue
Color.kRed
Color.kYellow
Color.kGreen
Color.kWhite
Color.kBlack
Color.kOrange
Color.kPink
Color.kPurple
Color.kGrey

Example

BroadCastMessage( "Goal!", 5, Color.kBlue )