FeatureType (Civ5 Type)

From Civilization Modding Wiki
Jump to: navigation, search

This page is a part of the Lua and UI Reference (Civ5).


ID.png The FeatureType pseudo-type is actually a regular integer. Pseudo-types do not exist in Lua, they only serve a documentation purpose on the wiki!
  • DB.png Integers labeled as FeatureType corresponds to the ID column of the Features XML table.
  • Lua.png The standard (unmodded) values in the ID and Type columns are also stored in the FeatureTypes Lua enumeration.


Lua: the FeatureTypes enumeration

Firaxis provides a Lua enumeration named FeatureTypes. This is just a regular global table. Its keys are the constants' names and the pairs the corresponding values.

  • This specific enumeration contains data from the Features data table.
  • They are stored as key/value pairs: the keys are the strings from the Type column and the values are the integers from the ID column.

Radioactive.png Be careful: this enumeration do not reflect the changes, additions and deletions made by mods. As a result it is advised to rely on GameInfo instead.


Below are the values found in this enumeration.

Key Value
"NO_FEATURE" -1
"FEATURE_ICE" 0
"FEATURE_JUNGLE" 1
"FEATURE_MARSH" 2
"FEATURE_OASIS" 3
"FEATURE_FLOOD_PLAINS" 4
"FEATURE_FOREST" 5
"FEATURE_FALLOUT" 6
"NUM_FEATURE_TYPES" 8


XML: the Features table

Here are the ID and Type columns found in this table.

ID Type
0 FEATURE_ICE
1 FEATURE_JUNGLE
2 FEATURE_MARSH
3 FEATURE_OASIS
4 FEATURE_FLOOD_PLAINS
5 FEATURE_FOREST
6 FEATURE_FALLOUT
7 FEATURE_CRATER
8 FEATURE_FUJI
9 FEATURE_MESA
10 FEATURE_REEF
11 FEATURE_VOLCANO
12 FEATURE_GIBRALTAR
13 FEATURE_GEYSER
14 FEATURE_FOUNTAIN_YOUTH
15 FEATURE_POTOSI
16 FEATURE_EL_DORADO
17 FEATURE_ATOLL
18 FEATURE_SRI_PADA
19 FEATURE_MT_SINAI
20 FEATURE_MT_KAILASH
21 FEATURE_ULURU


Examples

Here is how to use the LUA enumeration to retrieve the ID from the type. Those examples will return and assign the integer value 0.

local id = FeatureTypes.FEATURE_ICE
local id = FeatureTypes["FEATURE_ICE"]


Used by

bool IsFeatureSpecial(FeatureType feature)
Events.GenericWorldAnchor(GenericWorldAnchorType type, bool show, int plotX, int plotY, FeatureType data1 = nil)
int Player:CountCityFeatures(FeatureType feature)
bool Player:IsBuildBlockedByFeature(BuildActionType build, FeatureType feature)
int Plot:CanHaveFeature(FeatureType featureForest)
FeatureType Plot:GetFeatureType()
int Unit:FeatureAttackModifier(FeatureType feature)
int Unit:FeatureDefenseModifier(FeatureType feature)
int Unit:GetExtraFeatureAttackPercent(FeatureType index)
int Unit:GetExtraFeatureDefensePercent(FeatureType index)
bool Unit:IsFeatureDoubleMove(FeatureType index)



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.