Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/scripting/api_server_edit.h File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Enumerations | Functions
api_server_edit.h File Reference
`#include "luascript_types.h"`

Go to the source code of this file.

## Enumerations

enum | climate_change_type { CLIMATE_CHANGE_GLOBAL_WARMING , CLIMATE_CHANGE_NUCLEAR_WINTER }

## Functions

bool | api_edit_unleash_barbarians (lua_State *L, Tile *ptile)
void | api_edit_place_partisans (lua_State *L, Tile *ptile, Player *pplayer, int count, int sq_radius)
Unit * | api_edit_create_unit (lua_State *L, Player *pplayer, Tile *ptile, Unit_Type *ptype, int veteran_level, City *homecity, int moves_left)
Unit * | api_edit_create_unit_full (lua_State *L, Player *pplayer, Tile *ptile, Unit_Type *ptype, int veteran_level, City *homecity, int moves_left, int hp_left, Unit *ptransport)
bool | api_edit_unit_teleport (lua_State *L, Unit *punit, Tile *dest, Unit *embark_to, bool allow_disembark, bool conquer_city, bool conquer_extra, bool enter_hut, bool frighten_hut)
bool | api_edit_unit_teleport_old (lua_State *L, Unit *punit, Tile *dest)
bool | api_edit_perform_action_unit_vs_city (lua_State *L, Unit *punit, Action *paction, City *tgt)
bool | api_edit_perform_action_unit_vs_city_impr (lua_State *L, Unit *punit, Action *paction, City *tgt, Building_Type *sub_tgt)
bool | api_edit_perform_action_unit_vs_city_tech (lua_State *L, Unit *punit, Action *paction, City *tgt, Tech_Type *sub_tgt)
bool | api_edit_perform_action_unit_vs_unit (lua_State *L, Unit *punit, Action *paction, Unit *tgt)
bool | api_edit_perform_action_unit_vs_tile (lua_State *L, Unit *punit, Action *paction, Tile *tgt)
bool | api_edit_perform_action_unit_vs_tile_extra (lua_State *L, Unit *punit, Action *paction, Tile *tgt, const char *sub_tgt)
bool | api_edit_perform_action_unit_vs_self (lua_State *L, Unit *punit, Action *paction)
void | api_edit_unit_turn (lua_State *L, Unit *punit, Direction dir)
bool | api_edit_unit_upgrade (lua_State *L, Unit *punit, int vet_loss)
bool | api_edit_unit_transform (lua_State *L, Unit *punit, Unit_Type *ptype, int vet_loss)
void | api_edit_unit_kill (lua_State *L, Unit *punit, const char *reason, Player *killer)
bool | api_edit_change_terrain (lua_State *L, Tile *ptile, Terrain *pterr)
bool | api_edit_create_city (lua_State *L, Player *pplayer, Tile *ptile, const char *name)
void | api_edit_remove_city (lua_State *L, City *pcity)
void | api_edit_create_building (lua_State *L, City *pcity, Building_Type *impr)
void | api_edit_remove_building (lua_State *L, City *pcity, Building_Type *impr)
Player * | api_edit_create_player (lua_State *L, const char *username, Nation_Type *pnation, const char *ai)
void | api_edit_change_gold (lua_State *L, Player *pplayer, int amount)
Tech_Type * | api_edit_give_technology (lua_State *L, Player *pplayer, Tech_Type *ptech, int cost, bool notify, const char *reason)
bool | api_edit_trait_mod_set (lua_State *L, Player *pplayer, const char *tname, const int mod)
void | api_edit_create_owned_extra (lua_State *L, Tile *ptile, const char *name, struct player *pplayer)
void | api_edit_create_extra (lua_State *L, Tile *ptile, const char *name)
void | api_edit_create_base (lua_State *L, Tile *ptile, const char *name, struct player *pplayer)
void | api_edit_create_road (lua_State *L, Tile *ptile, const char *name)
void | api_edit_remove_extra (lua_State *L, Tile *ptile, const char *name)
void | api_edit_tile_set_label (lua_State *L, Tile *ptile, const char *label)
void | api_edit_tile_show (lua_State *L, Tile *ptile, Player *pplayer)
bool | api_edit_tile_hide (lua_State *L, Tile *ptile, Player *pplayer)
void | api_edit_climate_change (lua_State *L, enum climate_change_type type, int effect)
Player * | api_edit_civil_war (lua_State *L, Player *pplayer, int probability)
void | api_edit_player_victory (lua_State *L, Player *pplayer)
bool | api_edit_unit_move (lua_State *L, Unit *punit, Tile *ptile, int movecost, Unit *embark_to, bool allow_disembark, bool conquer_city, bool conquer_extra, bool enter_hut, bool frighten_hut)
bool | api_edit_unit_move_old (lua_State *L, Unit *punit, Tile *ptile, int movecost)
void | api_edit_unit_moving_disallow (lua_State *L, Unit *punit)
void | api_edit_unit_moving_allow (lua_State *L, Unit *punit)
void | api_edit_city_add_history (lua_State *L, City *pcity, int amount)
void | api_edit_player_add_history (lua_State *L, Player *pplayer, int amount)
void | api_edit_player_give_bulbs (lua_State *L, Player *pplayer, int amount)

## Enumeration Type Documentation

## ◆ climate_change_type

enum climate_change_type

Enumerator
CLIMATE_CHANGE_GLOBAL_WARMING |
CLIMATE_CHANGE_NUCLEAR_WINTER |

Definition at line 23 of file api_server_edit.h.

## Function Documentation

## ◆ api_edit_change_gold()

void api_edit_change_gold | ( | lua_State * | L,
|  | Player * | pplayer,
|  | int | amount
| ) |  |

Change pplayer's gold by amount.

Definition at line 817 of file api_server_edit.c.

Referenced by tolua_server_edit_change_gold00().

## ◆ api_edit_change_terrain()

bool api_edit_change_terrain | ( | lua_State * | L,
|  | Tile * | ptile,
|  | Terrain * | pterr
| ) |  |

Change terrain on tile

Definition at line 651 of file api_server_edit.c.

Referenced by tolua_server_edit_change_terrain00().

## ◆ api_edit_city_add_history()

void api_edit_city_add_history | ( | lua_State * | L,
|  | City * | pcity,
|  | int | amount
| ) |  |

Add history to a city

Definition at line 1220 of file api_server_edit.c.

Referenced by tolua_server_edit_add_city_history00().

## ◆ api_edit_civil_war()

Player * api_edit_civil_war | ( | lua_State * | L,
|  | Player * | pplayer,
|  | int | probability
| ) |  |

Provoke a civil war.

Definition at line 1071 of file api_server_edit.c.

Referenced by tolua_server_edit_civil_war00().

## ◆ api_edit_climate_change()

void api_edit_climate_change | ( | lua_State * | L,
|  | enum climate_change_type | type,
|  | int | effect
| ) |  |

Global climate change.

Definition at line 1056 of file api_server_edit.c.

Referenced by tolua_server_edit_climate_change00().

## ◆ api_edit_create_base()

void api_edit_create_base | ( | lua_State * | L,
|  | Tile * | ptile,
|  | const char * | name,
|  | Player * | pplayer
| ) |  |

Create a new base.

Definition at line 955 of file api_server_edit.c.

Referenced by tolua_server_edit_create_base00().

## ◆ api_edit_create_building()

void api_edit_create_building | ( | lua_State * | L,
|  | City * | pcity,
|  | Building_Type * | impr
| ) |  |

Create a building to a city

Definition at line 712 of file api_server_edit.c.

Referenced by tolua_server_edit_create_building00().

## ◆ api_edit_create_city()

bool api_edit_create_city | ( | lua_State * | L,
|  | Player * | pplayer,
|  | Tile * | ptile,
|  | const char * | name
| ) |  |

Create a new city.

Definition at line 687 of file api_server_edit.c.

Referenced by tolua_server_edit_create_city00().

## ◆ api_edit_create_extra()

void api_edit_create_extra | ( | lua_State * | L,
|  | Tile * | ptile,
|  | const char * | name
| ) |  |

Create a new extra.

Definition at line 947 of file api_server_edit.c.

Referenced by tolua_server_edit_create_extra00().

## ◆ api_edit_create_owned_extra()

void api_edit_create_owned_extra | ( | lua_State * | L,
|  | Tile * | ptile,
|  | const char * | name,
|  | Player * | pplayer
| ) |  |

Create a new owned extra.

Definition at line 923 of file api_server_edit.c.

Referenced by api_edit_create_base(), api_edit_create_extra(), api_edit_create_road(), and tolua_server_edit_create_owned_extra00().

## ◆ api_edit_create_player()

Player * api_edit_create_player | ( | lua_State * | L,
|  | const char * | username,
|  | Nation_Type * | pnation,
|  | const char * | ai
| ) |  |

Create a new player.

Definition at line 782 of file api_server_edit.c.

Referenced by tolua_server_edit_create_player00().

## ◆ api_edit_create_road()

void api_edit_create_road | ( | lua_State * | L,
|  | Tile * | ptile,
|  | const char * | name
| ) |  |

Add a new road.

Definition at line 964 of file api_server_edit.c.

Referenced by tolua_server_edit_create_road00().

## ◆ api_edit_create_unit()

Unit * api_edit_create_unit | ( | lua_State * | L,
|  | Player * | pplayer,
|  | Tile * | ptile,
|  | Unit_Type * | ptype,
|  | int | veteran_level,
|  | City * | homecity,
|  | int | moves_left
| ) |  |

Create a new unit.

Definition at line 129 of file api_server_edit.c.

Referenced by tolua_server_edit_create_unit00().

## ◆ api_edit_create_unit_full()

Unit * api_edit_create_unit_full | ( | lua_State * | L,
|  | Player * | pplayer,
|  | Tile * | ptile,
|  | Unit_Type * | ptype,
|  | int | veteran_level,
|  | City * | homecity,
|  | int | moves_left,
|  | int | hp_left,
|  | Unit * | ptransport
| ) |  |

Create a new unit.

Definition at line 140 of file api_server_edit.c.

Referenced by api_edit_create_unit(), and tolua_server_edit_create_unit_full00().

## ◆ api_edit_give_technology()

Tech_Type * api_edit_give_technology | ( | lua_State * | L,
|  | Player * | pplayer,
|  | Tech_Type * | ptech,
|  | int | cost,
|  | bool | notify,
|  | const char * | reason
| ) |  |

Give pplayer technology ptech. Quietly returns NULL if player already has this tech; otherwise returns the tech granted. Use NULL for ptech to grant a random tech. sends script signal "tech_researched" with the given reason

Definition at line 833 of file api_server_edit.c.

Referenced by tolua_server_edit_give_tech00().

## ◆ api_edit_perform_action_unit_vs_city()

bool api_edit_perform_action_unit_vs_city | ( | lua_State * | L,
|  | Unit * | punit,
|  | Action * | paction,
|  | City * | tgt
| ) |  |

Force a unit to perform an action against a city.

Definition at line 338 of file api_server_edit.c.

Referenced by tolua_server_edit_perform_action00().

## ◆ api_edit_perform_action_unit_vs_city_impr()

bool api_edit_perform_action_unit_vs_city_impr | ( | lua_State * | L,
|  | Unit * | punit,
|  | Action * | paction,
|  | City * | tgt,
|  | Building_Type * | sub_tgt
| ) |  |

Force a unit to perform an action against a city and a building.

Definition at line 362 of file api_server_edit.c.

Referenced by tolua_server_edit_perform_action01().

## ◆ api_edit_perform_action_unit_vs_city_tech()

bool api_edit_perform_action_unit_vs_city_tech | ( | lua_State * | L,
|  | Unit * | punit,
|  | Action * | paction,
|  | City * | tgt,
|  | Tech_Type * | sub_tgt
| ) |  |

Force a unit to perform an action against a city and a tech.

Definition at line 388 of file api_server_edit.c.

Referenced by tolua_server_edit_perform_action02().

## ◆ api_edit_perform_action_unit_vs_self()

bool api_edit_perform_action_unit_vs_self | ( | lua_State * | L,
|  | Unit * | punit,
|  | Action * | paction
| ) |  |

Force a unit to perform an action against it self.

Definition at line 558 of file api_server_edit.c.

Referenced by tolua_server_edit_perform_action06().

## ◆ api_edit_perform_action_unit_vs_tile()

bool api_edit_perform_action_unit_vs_tile | ( | lua_State * | L,
|  | Unit * | punit,
|  | Action * | paction,
|  | Tile * | tgt
| ) |  |

Force a unit to perform an action against a tile.

Definition at line 440 of file api_server_edit.c.

Referenced by tolua_server_edit_perform_action04().

## ◆ api_edit_perform_action_unit_vs_tile_extra()

bool api_edit_perform_action_unit_vs_tile_extra | ( | lua_State * | L,
|  | Unit * | punit,
|  | Action * | paction,
|  | Tile * | tgt,
|  | const char * | sub_tgt
| ) |  |

Force a unit to perform an action against a tile and an extra.

Definition at line 496 of file api_server_edit.c.

Referenced by tolua_server_edit_perform_action05().

## ◆ api_edit_perform_action_unit_vs_unit()

bool api_edit_perform_action_unit_vs_unit | ( | lua_State * | L,
|  | Unit * | punit,
|  | Action * | paction,
|  | Unit * | tgt
| ) |  |

Force a unit to perform an action against a unit.

Definition at line 414 of file api_server_edit.c.

Referenced by tolua_server_edit_perform_action03().

## ◆ api_edit_place_partisans()

void api_edit_place_partisans | ( | lua_State * | L,
|  | Tile * | ptile,
|  | Player * | pplayer,
|  | int | count,
|  | int | sq_radius
| ) |  |

Place partisans for a player around a tile (normally around a city).

Definition at line 113 of file api_server_edit.c.

Referenced by tolua_server_edit_place_partisans00().

## ◆ api_edit_player_add_history()

void api_edit_player_add_history | ( | lua_State * | L,
|  | Player * | pplayer,
|  | int | amount
| ) |  |

Add history to a player

Definition at line 1231 of file api_server_edit.c.

Referenced by tolua_server_edit_add_player_history00().

## ◆ api_edit_player_give_bulbs()

void api_edit_player_give_bulbs | ( | lua_State * | L,
|  | Player * | pplayer,
|  | int | amount
| ) |  |

Give bulbs to a player

Definition at line 1242 of file api_server_edit.c.

Referenced by tolua_server_edit_give_bulbs00().

## ◆ api_edit_player_victory()

void api_edit_player_victory | ( | lua_State * | L,
|  | Player * | pplayer
| ) |  |

Make player winner of the scenario

Definition at line 1100 of file api_server_edit.c.

Referenced by tolua_server_edit_player_victory00().

## ◆ api_edit_remove_building()

void api_edit_remove_building | ( | lua_State * | L,
|  | City * | pcity,
|  | Building_Type * | impr
| ) |  |

Remove a building from a city

Definition at line 760 of file api_server_edit.c.

Referenced by tolua_server_edit_remove_building00().

## ◆ api_edit_remove_city()

void api_edit_remove_city | ( | lua_State * | L,
|  | City * | pcity
| ) |  |

Destroy a city

Definition at line 701 of file api_server_edit.c.

Referenced by tolua_server_edit_remove_city00().

## ◆ api_edit_remove_extra()

void api_edit_remove_extra | ( | lua_State * | L,
|  | Tile * | ptile,
|  | const char * | name
| ) |  |

Remove extra from tile, if present

Definition at line 972 of file api_server_edit.c.

Referenced by tolua_server_edit_remove_extra00().

## ◆ api_edit_tile_hide()

bool api_edit_tile_hide | ( | lua_State * | L,
|  | Tile * | ptile,
|  | Player * | pplayer
| ) |  |

Try to hide tile from player.

Definition at line 1022 of file api_server_edit.c.

Referenced by tolua_server_edit_tile_hide00().

## ◆ api_edit_tile_set_label()

void api_edit_tile_set_label | ( | lua_State * | L,
|  | Tile * | ptile,
|  | const char * | label
| ) |  |

Set tile label text.

Definition at line 995 of file api_server_edit.c.

Referenced by tolua_server_edit_tile_set_label00().

## ◆ api_edit_tile_show()

void api_edit_tile_show | ( | lua_State * | L,
|  | Tile * | ptile,
|  | Player * | pplayer
| ) |  |

Reveal tile as it is currently to the player.

Definition at line 1010 of file api_server_edit.c.

Referenced by tolua_server_edit_tile_show00().

## ◆ api_edit_trait_mod_set()

bool api_edit_trait_mod_set | ( | lua_State * | L,
|  | Player * | pplayer,
|  | const char * | tname,
|  | const int | mod
| ) |  |

Modify player's trait value.

Definition at line 902 of file api_server_edit.c.

Referenced by tolua_server_edit_trait_mod00().

## ◆ api_edit_unit_kill()

void api_edit_unit_kill | ( | lua_State * | L,
|  | Unit * | punit,
|  | const char * | reason,
|  | Player * | killer
| ) |  |

Kill the unit.

Definition at line 631 of file api_server_edit.c.

Referenced by tolua_server_edit_unit_kill00().

## ◆ api_edit_unit_move()

bool api_edit_unit_move | ( | lua_State * | L,
|  | Unit * | punit,
|  | Tile * | ptile,
|  | int | movecost,
|  | Unit * | embark_to,
|  | bool | disembark,
|  | bool | conquer_city,
|  | bool | conquer_extra,
|  | bool | enter_hut,
|  | bool | frighten_hut
| ) |  |

Move a unit.

Definition at line 1111 of file api_server_edit.c.

Referenced by tolua_server_edit_unit_move01().

## ◆ api_edit_unit_move_old()

bool api_edit_unit_move_old | ( | lua_State * | L,
|  | Unit * | punit,
|  | Tile * | ptile,
|  | int | movecost
| ) |  |

Move a unit.

Definition at line 1147 of file api_server_edit.c.

Referenced by tolua_server_edit_unit_move00().

## ◆ api_edit_unit_moving_allow()

void api_edit_unit_moving_allow | ( | lua_State * | L,
|  | Unit * | punit
| ) |  |

Allow unit to move

Definition at line 1207 of file api_server_edit.c.

Referenced by tolua_server_edit_movement_allow00().

## ◆ api_edit_unit_moving_disallow()

void api_edit_unit_moving_disallow | ( | lua_State * | L,
|  | Unit * | punit
| ) |  |

Prohibit unit from moving

Definition at line 1194 of file api_server_edit.c.

Referenced by tolua_server_edit_movement_disallow00().

## ◆ api_edit_unit_teleport()

bool api_edit_unit_teleport | ( | lua_State * | L,
|  | Unit * | punit,
|  | Tile * | dest,
|  | Unit * | embark_to,
|  | bool | allow_disembark,
|  | bool | conquer_city,
|  | bool | conquer_extra,
|  | bool | enter_hut,
|  | bool | frighten_hut
| ) |  |

Teleport unit to destination tile

Definition at line 222 of file api_server_edit.c.

Referenced by tolua_server_edit_unit_teleport01().

## ◆ api_edit_unit_teleport_old()

bool api_edit_unit_teleport_old | ( | lua_State * | L,
|  | Unit * | punit,
|  | Tile * | dest
| ) |  |

Teleport unit to destination tile

Definition at line 276 of file api_server_edit.c.

Referenced by tolua_server_edit_unit_teleport00().

## ◆ api_edit_unit_transform()

bool api_edit_unit_transform | ( | lua_State * | L,
|  | Unit * | punit,
|  | Unit_Type * | ptype,
|  | int | vet_loss
| ) |  |

Transform punit to ptype, decreasing vet_loss veteranship levels. Returns if the transformation was possible.

Definition at line 618 of file api_server_edit.c.

Referenced by tolua_server_Unit_transform00().

## ◆ api_edit_unit_turn()

void api_edit_unit_turn | ( | lua_State * | L,
|  | Unit * | punit,
|  | Direction | dir
| ) |  |

Change unit orientation

Definition at line 582 of file api_server_edit.c.

Referenced by tolua_server_edit_unit_turn00().

## ◆ api_edit_unit_upgrade()

bool api_edit_unit_upgrade | ( | lua_State * | L,
|  | Unit * | punit,
|  | int | vet_loss
| ) |  |

Upgrade punit for free in the default manner, lose vet_loss vet levels. Returns if the upgrade was possible.

Definition at line 600 of file api_server_edit.c.

Referenced by tolua_server_Unit_upgrade00().

## ◆ api_edit_unleash_barbarians()

bool api_edit_unleash_barbarians | ( | lua_State * | L,
|  | Tile * | ptile
| ) |  |

Unleash barbarians on a tile, for example from a hut

Definition at line 102 of file api_server_edit.c.

Referenced by tolua_server_edit_unleash_barbarians00().