The civ library: Difference between revisions
(Put code tags in the code lines) |
m (Added to category lua resources) |
||
Line 1: | Line 1: | ||
[[Category:Lua Resources]] | |||
Back to [[TOTPP Functions]] | Back to [[TOTPP Functions]] | ||
---- | ---- | ||
Latest revision as of 20:08, 26 January 2019
Back to TOTPP Functions
Follow the link in the function name for additional information about that function, if it is available.
civ.addImprovement(city, improvement)
Adds city improvement `improvement` to city `city`.
civ.canEnter(unittype, tile) -> boolean
Returns `true` if the given unittype can enter tile `tile`, `false` otherwise.
civ.captureCity(city, tribe)
Captures city `city` for tribe `tribe`.
civ.createCity(tribe, tile) -> city
Creates a city owned by `tribe` at the location given by `tile`. Returns `nil` if a city could not be created.
civ.createUnit(unittype, tribe, tile) -> unit
Creates a unit of type `unittype`, owned by `tribe`, at the location given by `tile`.
civ.deleteCity(city)
Deletes city `city` from the game.
civ.deleteUnit(unit)
Deletes unit `unit` from the game.
civ.destroyWonder(wonder)
Destroys wonder `wonder`, removing it from the game, and marking it as 'lost'.
civ.enableTechGroup(tribe, techgroup, value)
Sets the value of tech group `techgroup` (0-7) to value `value` (0-2, 0 = can research, can own, 1 = can't research, can own, 2 = can't research, can't own) for tribe `tribe`.
civ.endGame(endscreens=false)
Ends the game. `endscreens` is a boolean that determines whether to show the powergraph and related screens.
civ.getActiveUnit() -> unit
Returns the currently active unit.
civ.getCity(id) -> city
Returns the city with id `id`, or `nil` if it doesn't exist.
civ.getCurrentTile() -> tile
Returns the currently selected tile.
civ.getCurrentTribe() -> tribe
Returns the currently active tribe.
civ.getGameYear() -> integer
Returns the current game year.
civ.getImprovement(id) -> improvement
Returns the improvement with id `id` (0-39), or `nil` if it doesn't exist.
civ.getMapDimensions() -> width, height, number_of_maps
Returns three integers, the width and height of the map and the number of maps.
civ.getPlayerTribe() -> tribe
Returns the player's tribe.
civ.getTech(id) -> tech
Returns the tech with id `id` (0-99), or `nil` if it doesn't exist.
civ.getTile(x, y, z) -> tile
Returns the tile with coordinates `x`, `y`, `z`, or `nil` if it doesn't exist.
civ.getToTDir() -> string
Returns the absolute path of the ToT installation directory.
civ.getTribe(id) -> tribe
Returns the tech with id `id` (0-7), or `nil` if it doesn't exist.
civ.getTurn() -> integer
Returns the current turn number.
civ.getUnit(id) -> integer
Returns the unit with id `id`, or `nil` if it doesn't exist.
civ.getUnitType(id) -> unittype
Returns the unit type with id `id`, or `nil` if it doesn't exist.
civ.getWonder(id) -> wonder
Returns the wonder with id `id` (0-27), or `nil` if it doesn't exist.
civ.giveTech(tribe, tech)
Gives tech `tech` to tribe `tribe`.
civ.hasImprovement(city, improvement)
Returns `true` if city `city` has improvement `improvement`, `false` otherwise.
civ.hasTech(tribe, tech) -> boolean
Returns `true` if tribe `tribe` has tech `tech`, `false` otherwise.
civ.isCity(object) -> boolean
Returns `true` if `object` is a city, `false` otherwise.
civ.isImprovement(object) -> boolean
Returns `true` if `object` is a city improvement, `false` otherwise.
civ.isLeader(object) -> boolean
Returns `true` if `object` is a leader, `false` otherwise.
civ.isTech(object) -> boolean
Returns `true` if `object` is a tech, `false` otherwise.
civ.isTile(object) -> boolean
Returns `true` if `object` is a tile, `false` otherwise.
civ.isTribe(object) -> boolean
Returns `true` if `object` is a tribe, `false` otherwise.
civ.isUnit(object) -> boolean
Returns `true` if `object` is a unit, `false` otherwise.
civ.isUnitType(object) -> boolean
Returns `true` if `object` is a unit type, `false` otherwise.
civ.isWonder(object) -> boolean
Returns `true` if `object` is a wonder, `false` otherwise.
civ.iterateCities() -> iterator
Returns an iterator yielding all cities in the game.
civ.iterateUnits() -> iterator
Returns an iterator yielding all units in the game.
civ.killTribe(tribe)
Removes tribe `tribe` from the game. All its cities and units are removed.
civ.makeAggression(who, whom)
Cancels any peace treaties between tribe `who` and tribe `whom`, and make `who` declare war on `whom`.
civ.playMusic(trackNo or filename)
Plays CD track `trackNo`, or with the DirectShow music patch enabled, play the file given by `filename`, where `filename` is relative to the 'Music' directory.
civ.playSound(filename)
Plays the sound file given by `filename`.
civ.playVideo(filename)
Plays the video file given by `filename`.
civ.removeImprovement(city, improvement)
Removes city improvement `improvement` from city `city`.
civ.sleep(milliseconds)
Sleeps for the given number of milliseconds.
civ.takeTech(tribe, tech, collapse=false)
Takes away tech `tech` from tribe `tribe`, the optional `collapse` parameter determines whether to take away all techs that have `tech` as a prerequisite somewhere up the tree.
civ.teleportUnit(unit, tile)
Teleports (i.e. moves at no cost) unit `unit` to tile `tile`. The unit is moved regardless of whether it is a valid location for the unit. To check this, see `civ.canEnter` and `civlua.isValidUnitLocation`.