InterfaceMode (Civ5 Type)

From Civilization Modding Wiki
Jump to navigationJump to search

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


ID.png The InterfaceMode 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 InterfaceMode corresponds to the ID column of the InterfaceModes XML table.
  • Lua.png The standard (unmodded) values in the ID and Type columns are also stored in the InterfaceModeTypes Lua enumeration.


Lua: the InterfaceModeTypes enumeration

Firaxis provides a Lua enumeration named InterfaceModeTypes. 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 InterfaceModes 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_INTERFACEMODE" -1
"INTERFACEMODE_DEBUG" 0
"INTERFACEMODE_SELECTION" 1
"INTERFACEMODE_PING" 2
"INTERFACEMODE_MOVE_TO" 3
"INTERFACEMODE_MOVE_TO_TYPE" 4
"INTERFACEMODE_MOVE_TO_ALL" 5
"INTERFACEMODE_ROUTE_TO" 6
"INTERFACEMODE_AIRLIFT" 7
"INTERFACEMODE_NUKE" 8
"INTERFACEMODE_PARADROP" 9
"INTERFACEMODE_ATTACK" 10
"INTERFACEMODE_RANGE_ATTACK" 11
"INTERFACEMODE_AIRSTRIKE" 12
"INTERFACEMODE_AIR_SWEEP" 13
"INTERFACEMODE_REBASE" 14
"INTERFACEMODE_PLACE_UNIT" 15
"INTERFACEMODE_EMBARK" 16
"INTERFACEMODE_DISEMBARK" 17
"INTERFACEMODE_GIFT_UNIT" 18
"INTERFACEMODE_CITY_PLOT_SELECTION" 19
"INTERFACEMODE_PURCHASE_PLOT" 20
"INTERFACEMODE_CITY_RANGE_ATTACK" 21
"INTERFACEMODE_GIFT_TILE_IMPROVEMENT" 22
"NUM_INTERFACEMODE_TYPES" 23


XML: the InterfaceModes table

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

ID Type
0 INTERFACEMODE_DEBUG
0 INTERFACEMODE_GIFT_TILE_IMPROVEMENT
1 INTERFACEMODE_SELECTION
2 INTERFACEMODE_PING
3 INTERFACEMODE_MOVE_TO
4 INTERFACEMODE_MOVE_TO_TYPE
5 INTERFACEMODE_MOVE_TO_ALL
6 INTERFACEMODE_ROUTE_TO
7 INTERFACEMODE_AIRLIFT
8 INTERFACEMODE_NUKE
9 INTERFACEMODE_PARADROP
10 INTERFACEMODE_ATTACK
11 INTERFACEMODE_RANGE_ATTACK
12 INTERFACEMODE_AIRSTRIKE
13 INTERFACEMODE_AIR_SWEEP
14 INTERFACEMODE_REBASE
15 INTERFACEMODE_PLACE_UNIT
16 INTERFACEMODE_EMBARK
17 INTERFACEMODE_DISEMBARK
18 INTERFACEMODE_GIFT_UNIT
19 INTERFACEMODE_CITY_PLOT_SELECTION
20 INTERFACEMODE_PURCHASE_PLOT
21 INTERFACEMODE_CITY_RANGE_ATTACK


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 = InterfaceModeTypes.INTERFACEMODE_DEBUG
local id = InterfaceModeTypes["INTERFACEMODE_DEBUG"]

Here are different ways to query the database to retrieve the ID from the type. Those examples will return and assign the integer value 0. See also GameInfo.

local id = GameInfo.InterfaceModes.INTERFACEMODE_GIFT_TILE_IMPROVEMENT.ID
local id = GameInfo["InterfaceModes"].["INTERFACEMODE_GIFT_TILE_IMPROVEMENT"].ID
local id = GameInfo.InterfaceModes{Type="INTERFACEMODE_GIFT_TILE_IMPROVEMENT"}().ID

Alternatively you could use the ID or the type to retrieve the value of the Description column. Those examples will return and assign the value TXT_KEY_INTERFACEMODE_GIFT_TILE_IMPROVEMENT.

local description = GameInfo.InterfaceModes[0].Description
local description = GameInfo["InterfaceModes"][0]["Description"]
local description = GameInfo.InterfaceModes{ID=0}().Description


Used by

Events.InterfaceModeChanged(InterfaceMode oldInterfaceMode, InterfaceMode newInterfaceMode)
bool UI.CanDoInterfaceMode(InterfaceMode interfaceMode)
InterfaceMode UI.GetInterfaceMode()
UI.SetInterfaceMode(InterfaceMode interfaceModeSelection)



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.