#include "scripting/lua_unit_attacks.hpp"
#include "scripting/lua_common.hpp"
#include "scripting/lua_unit.hpp"
#include "scripting/lua_unit_type.hpp"
#include "scripting/push_check.hpp"
#include "units/unit.hpp"
#include "units/types.hpp"
#include "units/attack_type.hpp"
#include "utils/const_clone.hpp"
#include <type_traits>
#include <utility>
Go to the source code of this file.
Classes | |
struct | attack_ref |
Namespaces | |
lua_units | |
Typedefs | |
template<typename T > | |
using | attack_ptr_in = std::shared_ptr< utils::const_clone_t< attack_type, std::remove_pointer_t< T > >> |
Functions | |
void | push_unit_attacks_table (lua_State *L, int idx) |
void | luaW_pushweapon (lua_State *L, const attack_ptr &weapon) |
void | luaW_pushweapon (lua_State *L, const const_attack_ptr &weapon) |
static attack_ref & | luaW_checkweapon_ref (lua_State *L, int idx) |
const_attack_ptr | luaW_toweapon (lua_State *L, int idx) |
attack_type & | luaW_checkweapon (lua_State *L, int idx) |
template<typename T > | |
auto | find_attack (T *u, const std::string &id) -> attack_ptr_in< T > |
template<typename T > | |
auto | find_attack (T *u, std::size_t i) -> attack_ptr_in< T > |
static int | impl_unit_attacks_get (lua_State *L) |
Gets the attacks of a unit or unit type (__index metamethod). More... | |
static attack_itors::iterator | get_attack_iter (unit &u, attack_ptr atk) |
static int | impl_unit_attacks_set (lua_State *L) |
static int | impl_unit_attacks_len (lua_State *L) |
Counts the attacks of a unit (__len metamethod). More... | |
static int | impl_unit_attacks_next (lua_State *L) |
static int | impl_unit_attacks_iter (lua_State *L) |
static int | impl_unit_attack_get (lua_State *L) |
Gets a property of a units attack (__index metamethod). More... | |
static int | impl_unit_attack_set (lua_State *L) |
Gets a property of a units attack (__index metamethod). More... | |
static int | impl_unit_attack_equal (lua_State *L) |
static int | impl_unit_attack_tostring (lua_State *L) |
Turns a lua proxy attack to string. More... | |
static int | impl_unit_attack_match (lua_State *L) |
static int | impl_unit_attack_collect (lua_State *L) |
int | intf_create_attack (lua_State *L) |
std::string | lua_units::register_attacks_metatables (lua_State *L) |
Variables | |
static const char | uattacksKey [] = "unit attacks table" |
static const char | uattackKey [] = "unit attack" |
using attack_ptr_in = std::shared_ptr<utils::const_clone_t<attack_type, std::remove_pointer_t<T> >> |
Definition at line 94 of file lua_unit_attacks.cpp.
auto find_attack | ( | T * | u, |
const std::string & | id | ||
) | -> attack_ptr_in<T> |
Definition at line 98 of file lua_unit_attacks.cpp.
References schema_validation::at().
Referenced by impl_unit_attacks_get(), and impl_unit_attacks_set().
auto find_attack | ( | T * | u, |
std::size_t | i | ||
) | -> attack_ptr_in<T> |
Definition at line 110 of file lua_unit_attacks.cpp.
References i.
|
static |
Definition at line 148 of file lua_unit_attacks.cpp.
References unit::attacks().
Referenced by impl_unit_attacks_set().
|
static |
Definition at line 350 of file lua_unit_attacks.cpp.
References uattackKey.
Referenced by lua_units::register_attacks_metatables().
|
static |
Definition at line 319 of file lua_unit_attacks.cpp.
References luaW_toweapon().
Referenced by lua_units::register_attacks_metatables().
|
static |
Gets a property of a units attack (__index metamethod).
Definition at line 250 of file lua_unit_attacks.cpp.
References attack_type::accuracy(), attack_type::alignment_str(), attack_ref::attack, attack_type::attack_weight(), attack_type::attacks_used(), attack_ref::cattack, attack_type::damage(), attack_type::defense_weight(), attack_type::icon(), attack_type::id(), luaW_checkweapon_ref(), luaW_getmetafield(), attack_type::max_range(), attack_type::min_range(), attack_type::movement_used(), attack_type::name(), attack_type::num_attacks(), attack_type::parry(), attack_type::range(), return_bool_attrib, return_cfgref_attrib, return_float_attrib, return_int_attrib, return_string_attrib, attack_type::specials(), attack_type::to_config(), and attack_type::type().
Referenced by lua_units::register_attacks_metatables().
|
static |
Definition at line 339 of file lua_unit_attacks.cpp.
References luaW_checkconfig(), and luaW_toweapon().
Referenced by lua_units::register_attacks_metatables().
|
static |
Gets a property of a units attack (__index metamethod).
Definition at line 288 of file lua_unit_attacks.cpp.
References luaW_checkconfig(), luaW_checkweapon(), modify_int_attrib, modify_string_attrib, modify_tstring_attrib, attack_type::set_accuracy(), attack_type::set_attack_weight(), attack_type::set_attacks_used(), attack_type::set_damage(), attack_type::set_defense_weight(), attack_type::set_icon(), attack_type::set_id(), attack_type::set_max_range(), attack_type::set_min_range(), attack_type::set_movement_used(), attack_type::set_name(), attack_type::set_num_attacks(), attack_type::set_parry(), attack_type::set_range(), attack_type::set_specials(), and attack_type::set_type().
Referenced by lua_units::register_attacks_metatables().
|
static |
Turns a lua proxy attack to string.
(__tostring metamethod)
Definition at line 330 of file lua_unit_attacks.cpp.
References attack_ref::cattack, lua_push(), and luaW_checkweapon_ref().
Referenced by lua_units::register_attacks_metatables().
|
static |
Gets the attacks of a unit or unit type (__index metamethod).
Definition at line 127 of file lua_unit_attacks.cpp.
References find_attack(), luaW_pushweapon(), luaW_tounit_ref(), luaW_tounittype(), and luaW_type_error().
Referenced by lua_units::register_attacks_metatables().
|
static |
Definition at line 236 of file lua_unit_attacks.cpp.
References impl_unit_attacks_next().
Referenced by lua_units::register_attacks_metatables().
|
static |
Counts the attacks of a unit (__len metamethod).
Definition at line 207 of file lua_unit_attacks.cpp.
References unit::attacks(), unit_type::attacks(), luaW_tounit(), luaW_tounittype(), and luaW_type_error().
Referenced by lua_units::register_attacks_metatables().
|
static |
Definition at line 222 of file lua_unit_attacks.cpp.
References n.
Referenced by impl_unit_attacks_iter().
|
static |
Definition at line 156 of file lua_unit_attacks.cpp.
References unit::add_attack(), unit::attacks(), find_attack(), get_attack_iter(), luaW_checkconfig(), luaW_checkunit(), luaW_tounittype(), luaW_toweapon(), luaW_type_error(), and unit::remove_attack().
Referenced by lua_units::register_attacks_metatables().
int intf_create_attack | ( | lua_State * | L | ) |
Definition at line 357 of file lua_unit_attacks.cpp.
References luaW_checkconfig(), and luaW_pushweapon().
Referenced by game_lua_kernel::game_lua_kernel().
attack_type& luaW_checkweapon | ( | lua_State * | L, |
int | idx | ||
) |
Definition at line 84 of file lua_unit_attacks.cpp.
References attack_ref::attack, and luaW_checkweapon_ref().
Referenced by impl_unit_attack_set().
|
static |
Definition at line 71 of file lua_unit_attacks.cpp.
References uattackKey.
Referenced by impl_unit_attack_get(), impl_unit_attack_tostring(), and luaW_checkweapon().
void luaW_pushweapon | ( | lua_State * | L, |
const attack_ptr & | weapon | ||
) |
Definition at line 51 of file lua_unit_attacks.cpp.
References uattackKey.
Referenced by impl_unit_attacks_get(), intf_create_attack(), luaW_pushfaivariant(), and luaW_pushsimweapon().
void luaW_pushweapon | ( | lua_State * | L, |
const const_attack_ptr & | weapon | ||
) |
Definition at line 61 of file lua_unit_attacks.cpp.
References uattackKey.
const_attack_ptr luaW_toweapon | ( | lua_State * | L, |
int | idx | ||
) |
Definition at line 76 of file lua_unit_attacks.cpp.
References p, and uattackKey.
Referenced by impl_add_animation(), impl_unit_attack_equal(), impl_unit_attack_match(), impl_unit_attacks_set(), lua_formula_bridge::intf_eval_formula(), and luaW_tofaivariant().
void push_unit_attacks_table | ( | lua_State * | L, |
int | idx | ||
) |
Definition at line 41 of file lua_unit_attacks.cpp.
References uattacksKey.
Referenced by UNIT_GETTER(), and UNIT_TYPE_GETTER().
|
static |
Definition at line 32 of file lua_unit_attacks.cpp.
Referenced by impl_unit_attack_collect(), luaW_checkweapon_ref(), luaW_pushweapon(), luaW_toweapon(), and lua_units::register_attacks_metatables().
|
static |
Definition at line 31 of file lua_unit_attacks.cpp.
Referenced by push_unit_attacks_table(), and lua_units::register_attacks_metatables().