Freeciv21
Develop your civilization from humble roots to a global empire
api_server_edit.h
Go to the documentation of this file.
1 /**************************************************************************
2  Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3  part of Freeciv21. Freeciv21 is free software: you can redistribute it
4  and/or modify it under the terms of the GNU General Public License as
5  published by the Free Software Foundation, either version 3 of the
6  License, or (at your option) any later version. You should have received
7  a copy of the GNU General Public License along with Freeciv21. If not,
8  see https://www.gnu.org/licenses/.
9 **************************************************************************/
10 
11 #pragma once
12 
13 /* common/scriptcore */
14 #include "luascript_types.h"
15 
16 struct lua_State;
17 
18 // type of clima change
22 };
23 
24 bool api_edit_unleash_barbarians(lua_State *L, Tile *ptile);
25 void api_edit_place_partisans(lua_State *L, Tile *ptile, Player *pplayer,
26  int count, int sq_radius);
27 Unit *api_edit_create_unit(lua_State *L, Player *pplayer, Tile *ptile,
28  Unit_Type *ptype, int veteran_level,
29  City *homecity, int moves_left);
30 Unit *api_edit_create_unit_full(lua_State *L, Player *pplayer, Tile *ptile,
31  Unit_Type *ptype, int veteran_level,
32  City *homecity, int moves_left, int hp_left,
33  Unit *ptransport);
34 bool api_edit_unit_teleport(lua_State *L, Unit *punit, Tile *dest);
35 
36 void api_edit_unit_turn(lua_State *L, Unit *punit, Direction dir);
37 
38 void api_edit_unit_kill(lua_State *L, Unit *punit, const char *reason,
39  Player *killer);
40 
41 bool api_edit_change_terrain(lua_State *L, Tile *ptile, Terrain *pterr);
42 
43 void api_edit_create_city(lua_State *L, Player *pplayer, Tile *ptile,
44  const char *name);
45 void api_edit_resize_city(lua_State *L, City *pcity, int size,
46  const char *reason);
47 Player *api_edit_create_player(lua_State *L, const char *username,
48  Nation_Type *pnation, const char *ai);
49 void api_edit_change_gold(lua_State *L, Player *pplayer, int amount);
50 Tech_Type *api_edit_give_technology(lua_State *L, Player *pplayer,
51  Tech_Type *ptech, int cost, bool notify,
52  const char *reason);
53 bool api_edit_trait_mod_set(lua_State *L, Player *pplayer, const char *tname,
54  const int mod);
55 
56 void api_edit_create_owned_extra(lua_State *L, Tile *ptile, const char *name,
57  struct player *pplayer);
58 void api_edit_create_extra(lua_State *L, Tile *ptile, const char *name);
59 void api_edit_create_base(lua_State *L, Tile *ptile, const char *name,
60  struct player *pplayer);
61 void api_edit_create_road(lua_State *L, Tile *ptile, const char *name);
62 void api_edit_remove_extra(lua_State *L, Tile *ptile, const char *name);
63 
64 void api_edit_tile_set_label(lua_State *L, Tile *ptile, const char *label);
65 
66 void api_edit_climate_change(lua_State *L, enum climate_change_type type,
67  int effect);
68 Player *api_edit_civil_war(lua_State *L, Player *pplayer, int probability);
69 
70 void api_edit_player_victory(lua_State *L, Player *pplayer);
71 bool api_edit_unit_move(lua_State *L, Unit *punit, Tile *ptile,
72  int movecost);
73 void api_edit_unit_moving_disallow(lua_State *L, Unit *punit);
74 void api_edit_unit_moving_allow(lua_State *L, Unit *punit);
75 
76 void api_edit_city_add_history(lua_State *L, City *pcity, int amount);
77 void api_edit_player_add_history(lua_State *L, Player *pplayer, int amount);
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.
void api_edit_climate_change(lua_State *L, enum climate_change_type type, int effect)
Global climate change.
Player * api_edit_create_player(lua_State *L, const char *username, Nation_Type *pnation, const char *ai)
Create a new player.
void api_edit_resize_city(lua_State *L, City *pcity, int size, const char *reason)
Resizes a city.
void api_edit_unit_moving_allow(lua_State *L, Unit *punit)
Allow unit to move.
bool api_edit_trait_mod_set(lua_State *L, Player *pplayer, const char *tname, const int mod)
Modify player's trait value.
bool api_edit_unleash_barbarians(lua_State *L, Tile *ptile)
Unleash barbarians on a tile, for example from a hut.
Player * api_edit_civil_war(lua_State *L, Player *pplayer, int probability)
Provoke a civil war.
void api_edit_player_victory(lua_State *L, Player *pplayer)
Make player winner of the scenario.
void api_edit_create_extra(lua_State *L, Tile *ptile, const char *name)
Create a new extra.
climate_change_type
@ CLIMATE_CHANGE_GLOBAL_WARMING
@ CLIMATE_CHANGE_NUCLEAR_WINTER
void api_edit_player_add_history(lua_State *L, Player *pplayer, int amount)
Add history to a player.
bool api_edit_unit_teleport(lua_State *L, Unit *punit, Tile *dest)
Teleport unit to destination tile.
bool api_edit_change_terrain(lua_State *L, Tile *ptile, Terrain *pterr)
Change terrain on tile.
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.
void api_edit_unit_kill(lua_State *L, Unit *punit, const char *reason, Player *killer)
Kill the unit.
void api_edit_unit_turn(lua_State *L, Unit *punit, Direction dir)
Change unit orientation.
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).
void api_edit_remove_extra(lua_State *L, Tile *ptile, const char *name)
Remove extra from tile, if present.
void api_edit_create_base(lua_State *L, Tile *ptile, const char *name, struct player *pplayer)
Create a new base.
void api_edit_tile_set_label(lua_State *L, Tile *ptile, const char *label)
Set tile label text.
void api_edit_create_road(lua_State *L, Tile *ptile, const char *name)
Add a new road.
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.
void api_edit_city_add_history(lua_State *L, City *pcity, int amount)
Add history to a city.
bool api_edit_unit_move(lua_State *L, Unit *punit, Tile *ptile, int movecost)
Move a unit.
void api_edit_unit_moving_disallow(lua_State *L, Unit *punit)
Prohibit unit from moving.
void api_edit_create_owned_extra(lua_State *L, Tile *ptile, const char *name, struct player *pplayer)
Create a new owned extra.
void api_edit_create_city(lua_State *L, Player *pplayer, Tile *ptile, const char *name)
Create a new city.
void api_edit_change_gold(lua_State *L, Player *pplayer, int amount)
Change pplayer's gold by amount.
const char * name
Definition: inputfile.cpp:118
enum direction8 Direction
size_t size
Definition: specvec.h:64
Definition: tech.h:113
Definition: city.h:291
Definition: player.h:231
Definition: tile.h:42
Definition: unit.h:134