Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
c_content.cpp File Reference
#include "common/c_content.h"
#include "common/c_converter.h"
#include "common/c_types.h"
#include "nodedef.h"
#include "object_properties.h"
#include "collision.h"
#include "cpp_api/s_node.h"
#include "lua_api/l_object.h"
#include "lua_api/l_item.h"
#include "common/c_internal.h"
#include "server.h"
#include "log.h"
#include "tool.h"
#include "porting.h"
#include "mapgen/mg_schematic.h"
#include "noise.h"
#include "server/player_sao.h"
#include "util/pointedthing.h"
#include "debug.h"
#include <SColor.h>
#include <json/json.h>
#include "mapgen/treegen.h"
+ Include dependency graph for c_content.cpp:

Macros

#define NODEBOXREAD(n, s)
 
#define NODEBOXREADVEC(n, s)
 

Functions

void read_item_definition (lua_State *L, int index, const ItemDefinition &default_def, ItemDefinition &def)
 
void push_item_definition (lua_State *L, const ItemDefinition &i)
 
void push_item_definition_full (lua_State *L, const ItemDefinition &i)
 
void read_object_properties (lua_State *L, int index, ServerActiveObject *sao, ObjectProperties *prop, IItemDefManager *idef)
 
void push_object_properties (lua_State *L, const ObjectProperties *prop)
 
TileDef read_tiledef (lua_State *L, int index, u8 drawtype, bool special)
 
void read_content_features (lua_State *L, ContentFeatures &f, int index)
 
void push_content_features (lua_State *L, const ContentFeatures &c)
 
void push_nodebox (lua_State *L, const NodeBox &box)
 
void push_palette (lua_State *L, const std::vector< video::SColor > *palette)
 
void read_server_sound_params (lua_State *L, int index, ServerPlayingSound &params)
 
void read_simplesoundspec (lua_State *L, int index, SoundSpec &spec)
 
void push_simplesoundspec (lua_State *L, const SoundSpec &spec)
 
NodeBox read_nodebox (lua_State *L, int index)
 
MapNode readnode (lua_State *L, int index)
 
void pushnode (lua_State *L, const MapNode &n)
 
void warn_if_field_exists (lua_State *L, int table, const char *fieldname, std::string_view name, std::string_view message)
 
int getenumfield (lua_State *L, int table, const char *fieldname, const EnumString *spec, int default_)
 
bool string_to_enum (const EnumString *spec, int &result, const std::string &str)
 
ItemStack read_item (lua_State *L, int index, IItemDefManager *idef)
 
void push_tool_capabilities (lua_State *L, const ToolCapabilities &toolcap)
 
void push_wear_bar_params (lua_State *L, const WearBarParams &params)
 
void push_inventory_list (lua_State *L, const InventoryList &invlist)
 
void push_inventory_lists (lua_State *L, const Inventory &inv)
 
void read_inventory_list (lua_State *L, int tableindex, Inventory *inv, const char *name, IGameDef *gdef, int forcesize)
 
struct TileAnimationParams read_animation_definition (lua_State *L, int index)
 
ToolCapabilities read_tool_capabilities (lua_State *L, int table)
 
PointabilityType read_pointability_type (lua_State *L, int index)
 
Pointabilities read_pointabilities (lua_State *L, int index)
 
void push_pointability_type (lua_State *L, PointabilityType pointable)
 
void push_pointabilities (lua_State *L, const Pointabilities &pointabilities)
 
WearBarParams read_wear_bar_params (lua_State *L, int stack_idx)
 
void push_dig_params (lua_State *L, const DigParams &params)
 
void push_hit_params (lua_State *L, const HitParams &params)
 
bool getflagsfield (lua_State *L, int table, const char *fieldname, FlagDesc *flagdesc, u32 *flags, u32 *flagmask)
 
bool read_flags (lua_State *L, int index, FlagDesc *flagdesc, u32 *flags, u32 *flagmask)
 
u32 read_flags_table (lua_State *L, int table, FlagDesc *flagdesc, u32 *flagmask)
 
void push_flags_string (lua_State *L, FlagDesc *flagdesc, u32 flags, u32 flagmask)
 
void read_groups (lua_State *L, int index, ItemGroupList &result)
 
void push_groups (lua_State *L, const ItemGroupList &groups)
 
void push_items (lua_State *L, const std::vector< ItemStack > &items)
 
std::vector< ItemStackread_items (lua_State *L, int index, IGameDef *gdef)
 
void luaentity_get (lua_State *L, u16 id)
 
bool read_noiseparams (lua_State *L, int index, NoiseParams *np)
 
void push_noiseparams (lua_State *L, NoiseParams *np)
 
bool read_tree_def (lua_State *L, int idx, const NodeDefManager *ndef, treegen::TreeDef &tree_def)
 
static int push_json_value_getdepth (const Json::Value &value)
 
static bool push_json_value_helper (lua_State *L, const Json::Value &value, int nullindex)
 
bool push_json_value (lua_State *L, const Json::Value &value, int nullindex)
 
void read_json_value (lua_State *L, Json::Value &root, int index, u16 max_depth)
 
void push_pointed_thing (lua_State *L, const PointedThing &pointed, bool csm, bool hitpoint)
 
void push_objectRef (lua_State *L, const u16 id)
 
void read_hud_element (lua_State *L, HudElement *elem)
 
void push_hud_element (lua_State *L, HudElement *elem)
 
bool read_hud_change (lua_State *L, HudElementStat &stat, HudElement *elem, void **value)
 
void push_collision_move_result (lua_State *L, const collisionMoveResult &res)
 
void push_mod_spec (lua_State *L, const ModSpec &spec, bool include_unsatisfied)
 

Variables

struct EnumString es_TileAnimationType []
 
const std::array< const char *, 33 > object_property_keys
 
static const char * collision_type_str []
 
static const char * collision_axis_str []
 

Macro Definition Documentation

◆ NODEBOXREAD

#define NODEBOXREAD ( n,
s )
Value:
{ \
lua_getfield(L, index, (s)); \
if (lua_istable(L, -1)) \
(n) = read_aabb3f(L, -1, BS); \
lua_pop(L, 1); \
}
aabb3f read_aabb3f(lua_State *L, int index, f32 scale)
Definition c_converter.cpp:327
#define BS
Definition constants.h:61

Referenced by read_nodebox().

◆ NODEBOXREADVEC

#define NODEBOXREADVEC ( n,
s )
Value:
lua_getfield(L, index, (s)); \
if (lua_istable(L, -1)) \
(n) = read_aabb3f_vector(L, -1, BS); \
lua_pop(L, 1);
std::vector< aabb3f > read_aabb3f_vector(lua_State *L, int index, f32 scale)
Definition c_converter.cpp:371

Referenced by read_nodebox().

Function Documentation

◆ getenumfield()

int getenumfield ( lua_State * L,
int table,
const char * fieldname,
const EnumString * spec,
int default_ )

References getstringfield_default(), string_to_enum(), and table.

Referenced by ModApiEnv::l_clear_objects(), ModApiCraft::l_get_craft_result(), ModApiMapgen::l_register_decoration(), ModApiMapgen::l_register_ore(), read_animation_definition(), read_biome_def(), read_content_features(), read_deco_schematic(), read_item_definition(), and read_nodebox().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getflagsfield()

bool getflagsfield ( lua_State * L,
int table,
const char * fieldname,
FlagDesc * flagdesc,
u32 * flags,
u32 * flagmask )

References read_flags(), and table.

Referenced by ModApiMapgen::l_register_decoration(), ModApiMapgen::l_register_ore(), and read_noiseparams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ luaentity_get()

void luaentity_get ( lua_State * L,
u16 id )

◆ push_collision_move_result()

void push_collision_move_result ( lua_State * L,
const collisionMoveResult & res )

References BS, collisionMoveResult::collides, COLLISION_AXIS_NONE, collision_axis_str, COLLISION_NODE, COLLISION_OBJECT, collision_type_str, collisionMoveResult::collisions, CUSTOM_RIDX_PUSH_MOVERESULT1, push_objectRef(), push_v3f(), push_v3s16(), setboolfield(), collisionMoveResult::standing_on_object, and collisionMoveResult::touching_ground.

Referenced by ScriptApiEntity::luaentity_Step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_content_features()

void push_content_features ( lua_State * L,
const ContentFeatures & c )

References ContentFeatures::alpha, ContentFeatures::buildable_to, ContentFeatures::climbable, ContentFeatures::collision_box, ContentFeatures::color, ContentFeatures::connect_sides, ContentFeatures::connects_to, ContentFeatures::damage_per_second, ContentFeatures::diggable, ContentFeatures::drawtype, ContentFeatures::drowning, ScriptApiNode::es_ContentParamType, ScriptApiNode::es_ContentParamType2, ScriptApiNode::es_DrawType, ScriptApiNode::es_LiquidType, ContentFeatures::floodable, ContentFeatures::groups, ContentFeatures::has_after_destruct, ContentFeatures::has_on_construct, ContentFeatures::has_on_destruct, ContentFeatures::is_ground_content, ContentFeatures::isLiquid(), ContentFeatures::legacy_facedir_simple, ContentFeatures::legacy_wallmounted, ContentFeatures::leveled, ContentFeatures::leveled_max, ContentFeatures::light_source, ContentFeatures::liquid_alternative_flowing, ContentFeatures::liquid_alternative_source, ContentFeatures::liquid_move_physics, ContentFeatures::liquid_range, ContentFeatures::liquid_renewable, ContentFeatures::liquid_type, ContentFeatures::liquid_viscosity, ContentFeatures::mesh, ContentFeatures::move_resistance, ContentFeatures::name, ContentFeatures::node_box, ContentFeatures::node_dig_prediction, ContentFeatures::palette, ContentFeatures::palette_name, ContentFeatures::param_type, ContentFeatures::param_type_2, ContentFeatures::pointable, ContentFeatures::post_effect_color, ContentFeatures::post_effect_color_shaded, push_ARGB8(), push_groups(), push_nodebox(), push_palette(), push_pointability_type(), push_simplesoundspec(), ContentFeatures::rightclickable, ContentFeatures::selection_box, ContentFeatures::sound_dig, ContentFeatures::sound_dug, ContentFeatures::sound_footstep, EnumString::str, ContentFeatures::sunlight_propagates, ContentFeatures::visual_scale, ContentFeatures::walkable, and ContentFeatures::waving.

Referenced by ModApiClient::l_get_node_def().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_dig_params()

void push_dig_params ( lua_State * L,
const DigParams & params )

References DigParams::diggable, setboolfield(), setfloatfield(), setintfield(), DigParams::time, and DigParams::wear.

Referenced by ModApiUtil::l_get_dig_params().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_flags_string()

void push_flags_string ( lua_State * L,
FlagDesc * flagdesc,
u32 flags,
u32 flagmask )

References writeFlagString().

Referenced by ModApiMapgen::l_get_gen_notify(), and push_noiseparams().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_groups()

void push_groups ( lua_State * L,
const ItemGroupList & groups )

Referenced by LuaLocalPlayer::l_get_armor_groups(), ObjectRef::l_get_armor_groups(), push_content_features(), and push_item_definition_full().

+ Here is the caller graph for this function:

◆ push_hit_params()

void push_hit_params ( lua_State * L,
const HitParams & params )

References HitParams::hp, setintfield(), and HitParams::wear.

Referenced by ModApiUtil::l_get_hit_params().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_hud_element()

void push_hud_element ( lua_State * L,
HudElement * elem )

References HudElement::align, HudElement::dir, es_HudElementType, HUD_ELEM_WAYPOINT, HudElement::item, HudElement::name, HudElement::number, HudElement::offset, HudElement::pos, push_v2f(), push_v2s32(), push_v3f(), HudElement::scale, HudElement::size, EnumString::str, HudElement::style, HudElement::text, HudElement::text2, HudElement::type, HudElement::world_pos, and HudElement::z_index.

Referenced by LuaLocalPlayer::l_hud_get(), ObjectRef::l_hud_get(), LuaLocalPlayer::l_hud_get_all(), and ObjectRef::l_hud_get_all().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_inventory_list()

void push_inventory_list ( lua_State * L,
const InventoryList & invlist )

References InventoryList::getItems(), and push_items().

Referenced by InvRef::l_get_list(), and push_inventory_lists().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_inventory_lists()

void push_inventory_lists ( lua_State * L,
const Inventory & inv )

References Inventory::getLists(), and push_inventory_list().

Referenced by NodeMetaRef::handleToTable(), InvRef::l_get_lists(), and ScriptApiClient::on_inventory_open().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_item_definition()

void push_item_definition ( lua_State * L,
const ItemDefinition & i )

References ItemDefinition::description, and ItemDefinition::name.

Referenced by ScriptApiClient::on_placenode().

+ Here is the caller graph for this function:

◆ push_item_definition_full()

◆ push_items()

void push_items ( lua_State * L,
const std::vector< ItemStack > & items )

References LuaItemStack::create().

Referenced by ScriptApiItem::item_CraftPredict(), ScriptApiItem::item_OnCraft(), ModApiCraft::l_get_craft_result(), and push_inventory_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_json_value()

bool push_json_value ( lua_State * L,
const Json::Value & value,
int nullindex )

References push_json_value_getdepth(), and push_json_value_helper().

Referenced by ModApiUtil::l_parse_json().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_json_value_getdepth()

static int push_json_value_getdepth ( const Json::Value & value)
static

References push_json_value_getdepth().

Referenced by push_json_value(), and push_json_value_getdepth().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_json_value_helper()

static bool push_json_value_helper ( lua_State * L,
const Json::Value & value,
int nullindex )
static

References push_json_value_helper().

Referenced by push_json_value(), and push_json_value_helper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_mod_spec()

void push_mod_spec ( lua_State * L,
const ModSpec & spec,
bool include_unsatisfied )

References ModSpec::author, ModSpec::desc, ModSpec::name, ModSpec::path, ModSpec::release, ModSpec::unsatisfied_depends, and ModSpec::virtual_path.

Referenced by ModApiMainMenu::l_check_mod_configuration().

+ Here is the caller graph for this function:

◆ push_nodebox()

void push_nodebox ( lua_State * L,
const NodeBox & box )

References FATAL_ERROR, NodeBox::fixed, NodeBox::getConnected(), NODEBOX_CONNECTED, NODEBOX_FIXED, NODEBOX_LEVELED, NODEBOX_REGULAR, NODEBOX_WALLMOUNTED, push_aabb3f(), push_aabb3f_vector(), NodeBox::type, NodeBox::wall_bottom, NodeBox::wall_side, and NodeBox::wall_top.

Referenced by push_content_features().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_noiseparams()

void push_noiseparams ( lua_State * L,
NoiseParams * np )

References flagdesc_noiseparams, NoiseParams::flags, NoiseParams::lacunarity, NoiseParams::octaves, NoiseParams::offset, NoiseParams::persist, push_flags_string(), push_v3f(), NoiseParams::scale, NoiseParams::seed, setfloatfield(), setintfield(), and NoiseParams::spread.

Referenced by ModApiMapgen::l_get_mapgen_setting_noiseparams(), ModApiMapgen::l_get_noiseparams(), and LuaSettings::l_get_np_group().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_object_properties()

void push_object_properties ( lua_State * L,
const ObjectProperties * prop )

References ObjectProperties::automatic_face_movement_dir, ObjectProperties::automatic_face_movement_dir_offset, ObjectProperties::automatic_face_movement_max_rotation_per_sec, ObjectProperties::automatic_rotate, ObjectProperties::backface_culling, ObjectProperties::breath_max, BS, ObjectProperties::collideWithObjects, ObjectProperties::collisionbox, ObjectProperties::colors, ObjectProperties::damage_texture_modifier, ObjectProperties::eye_height, ObjectProperties::glow, ObjectProperties::hp_max, ObjectProperties::infotext, ObjectProperties::initial_sprite_basepos, ObjectProperties::is_visible, ObjectProperties::makes_footstep_sound, ObjectProperties::mesh, ObjectProperties::nametag, ObjectProperties::nametag_bgcolor, ObjectProperties::nametag_color, ObjectProperties::physical, ObjectProperties::pointable, push_aabb3f(), push_ARGB8(), push_pointability_type(), push_v2s16(), push_v3f(), ObjectProperties::rotate_selectionbox, ObjectProperties::selectionbox, ObjectProperties::shaded, ObjectProperties::show_on_minimap, ObjectProperties::spritediv, ObjectProperties::static_save, ObjectProperties::stepheight, ObjectProperties::textures, ObjectProperties::use_texture_alpha, ObjectProperties::visual, ObjectProperties::visual_size, ObjectProperties::wield_item, and ObjectProperties::zoom_fov.

Referenced by ObjectRef::l_get_properties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_objectRef()

void push_objectRef ( lua_State * L,
const u16 id )

Referenced by ScriptApiEntity::luaentity_Add(), ScriptApiBase::objectrefGetOrCreate(), push_collision_move_result(), and push_pointed_thing().

+ Here is the caller graph for this function:

◆ push_palette()

void push_palette ( lua_State * L,
const std::vector< video::SColor > * palette )

References push_ARGB8().

Referenced by push_content_features().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_pointabilities()

void push_pointabilities ( lua_State * L,
const Pointabilities & pointabilities )

References Pointabilities::node_groups, Pointabilities::nodes, Pointabilities::object_groups, Pointabilities::objects, and push_pointability_type().

Referenced by push_item_definition_full().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_pointability_type()

void push_pointability_type ( lua_State * L,
PointabilityType pointable )

References POINTABLE, POINTABLE_BLOCKING, and POINTABLE_NOT.

Referenced by push_content_features(), push_object_properties(), and push_pointabilities().

+ Here is the caller graph for this function:

◆ push_pointed_thing()

void push_pointed_thing ( lua_State * L,
const PointedThing & pointed,
bool csm = false,
bool hitpoint = false )

Pushes a Lua pointed_thing to the given Lua stack.

Parameters
csmIf true, a client side pointed thing is pushed
hitpointIf true, the exact pointing location is also pushed

References PointedThing::box_id, BS, PointedThing::intersection_normal, PointedThing::intersection_point, PointedThing::node_abovesurface, PointedThing::node_undersurface, PointedThing::object_id, POINTEDTHING_NODE, POINTEDTHING_NOTHING, POINTEDTHING_OBJECT, push_objectRef(), push_v3f(), push_v3s16(), and PointedThing::type.

Referenced by LuaRaycast::l_next(), ScriptApiClient::on_item_use(), ScriptApiClient::on_placenode(), and ScriptApiItem::pushPointedThing().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_simplesoundspec()

void push_simplesoundspec ( lua_State * L,
const SoundSpec & spec )

References SoundSpec::fade, SoundSpec::gain, SoundSpec::name, and SoundSpec::pitch.

Referenced by push_content_features(), and push_item_definition_full().

+ Here is the caller graph for this function:

◆ push_tool_capabilities()

void push_tool_capabilities ( lua_State * L,
const ToolCapabilities & toolcap )

References ToolCapabilities::damageGroups, ToolCapabilities::full_punch_interval, ToolCapabilities::groupcaps, ToolCapabilities::max_drop_level, ToolGroupCap::maxlevel, ToolCapabilities::punch_attack_uses, setfloatfield(), setintfield(), ToolGroupCap::times, and ToolGroupCap::uses.

Referenced by LuaItemStack::l_get_tool_capabilities(), ScriptApiEntity::luaentity_Punch(), ScriptApiPlayer::on_punchplayer(), and push_item_definition_full().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_wear_bar_params()

void push_wear_bar_params ( lua_State * L,
const WearBarParams & params )

References WearBarParams::blend, WearBarParams::colorStops, WearBarParams::es_BlendMode, push_ARGB8(), setstringfield(), and EnumString::str.

Referenced by LuaItemStack::l_get_wear_bar_params(), and push_item_definition_full().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pushnode()

void pushnode ( lua_State * L,
const MapNode & n )

References CUSTOM_RIDX_PUSH_NODE, MapNode::getContent(), MapNode::getParam1(), and MapNode::getParam2().

Referenced by LuaVoxelManip::l_get_node_at(), ModApiClient::l_get_node_or_nil(), ModApiEnvVM::l_get_node_or_nil(), ScriptApiNode::node_after_destruct(), ScriptApiNode::node_on_dig(), ScriptApiNode::node_on_flood(), ScriptApiNode::node_on_punch(), ScriptApiClient::on_dignode(), ScriptApiEnv::on_liquid_transformed(), ScriptApiClient::on_punchnode(), and ScriptApiEnv::triggerABM().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_animation_definition()

struct TileAnimationParams read_animation_definition ( lua_State * L,
int index )

◆ read_content_features()

void read_content_features ( lua_State * L,
ContentFeatures & f,
int index )

References ContentFeatures::alpha, ALPHAMODE_BLEND, ALPHAMODE_CLIP, ContentFeatures::buildable_to, CF_SPECIAL_COUNT, check_field_or_nil(), ContentFeatures::climbable, ContentFeatures::collision_box, ContentFeatures::color, ContentFeatures::connect_sides, ContentFeatures::connects_to, CPT2_COLOR, CPT2_COLORED_4DIR, CPT2_COLORED_DEGROTATE, CPT2_COLORED_FACEDIR, CPT2_COLORED_WALLMOUNTED, CPT2_NONE, CPT_LIGHT, CPT_NONE, ContentFeatures::damage_per_second, ContentFeatures::diggable, ContentFeatures::drawtype, ContentFeatures::drowning, errorstream, ScriptApiNode::es_ContentParamType, ScriptApiNode::es_ContentParamType2, ScriptApiNode::es_DrawType, ScriptApiNode::es_LiquidType, ScriptApiNode::es_TextureAlphaMode, ContentFeatures::floodable, getboolfield(), getenumfield(), getfloatfield(), getintfield_default(), getstringfield(), ContentFeatures::groups, ContentFeatures::has_after_destruct, ContentFeatures::has_on_construct, ContentFeatures::has_on_destruct, ContentFeatures::is_ground_content, ContentFeatures::legacy_facedir_simple, ContentFeatures::legacy_wallmounted, ContentFeatures::leveled, ContentFeatures::leveled_max, LIGHT_MAX, ContentFeatures::light_propagates, ContentFeatures::light_source, ContentFeatures::liquid_alternative_flowing, ContentFeatures::liquid_alternative_source, ContentFeatures::liquid_move_physics, LIQUID_NONE, ContentFeatures::liquid_range, ContentFeatures::liquid_renewable, ContentFeatures::liquid_type, ContentFeatures::liquid_viscosity, ContentFeatures::mesh, ContentFeatures::move_resistance, ContentFeatures::name, NDT_NORMAL, ContentFeatures::node_box, ContentFeatures::node_dig_prediction, ContentFeatures::palette_name, ContentFeatures::param_type, ContentFeatures::param_type_2, ContentFeatures::pointable, ContentFeatures::post_effect_color, ContentFeatures::post_effect_color_shaded, read_color(), read_groups(), read_nodebox(), read_pointability_type(), read_simplesoundspec(), read_tiledef(), ContentFeatures::rightclickable, ContentFeatures::selection_box, ContentFeatures::setDefaultAlphaMode(), ContentFeatures::sound_dig, ContentFeatures::sound_dug, ContentFeatures::sound_footstep, string_to_enum(), ContentFeatures::sunlight_propagates, table, ContentFeatures::tiledef, ContentFeatures::tiledef_overlay, ContentFeatures::tiledef_special, ContentFeatures::visual_scale, ContentFeatures::walkable, warn_if_field_exists(), warningstream, and ContentFeatures::waving.

Referenced by ModApiItem::l_register_item_raw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_flags()

bool read_flags ( lua_State * L,
int index,
FlagDesc * flagdesc,
u32 * flags,
u32 * flagmask )

References read_flags_table(), and readFlagString().

Referenced by getflagsfield(), ModApiMapgen::l_place_schematic(), ModApiMapgen::l_place_schematic_on_vmanip(), and ModApiMapgen::l_set_gen_notify().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_flags_table()

u32 read_flags_table ( lua_State * L,
int table,
FlagDesc * flagdesc,
u32 * flagmask )

References FlagDesc::flag, getboolfield(), FlagDesc::name, strlcpy, and table.

Referenced by read_flags().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_groups()

void read_groups ( lua_State * L,
int index,
ItemGroupList & result )

Referenced by ModApiUtil::l_get_dig_params(), ModApiUtil::l_get_hit_params(), ObjectRef::l_set_armor_groups(), read_content_features(), and read_item_definition().

+ Here is the caller graph for this function:

◆ read_hud_change()

bool read_hud_change ( lua_State * L,
HudElementStat & stat,
HudElement * elem,
void ** value )

◆ read_hud_element()

void read_hud_element ( lua_State * L,
HudElement * elem )

References HudElement::align, HudElement::dir, es_HudElementType, getintfield_default(), getstringfield(), getstringfield_default(), HUD_ELEM_INVENTORY, HUD_ELEM_STATBAR, HUD_ELEM_TEXT, HUD_ELEM_WAYPOINT, HudElement::item, log_deprecated(), MYMAX, MYMIN, HudElement::name, HudElement::number, HudElement::offset, HudElement::pos, read_v2f(), read_v2s32(), read_v3f(), S16_MAX, S16_MIN, HudElement::scale, HudElement::size, string_to_enum(), HudElement::style, HudElement::text, HudElement::text2, HudElement::type, HudElement::world_pos, and HudElement::z_index.

Referenced by LuaLocalPlayer::l_hud_add(), and ObjectRef::l_hud_add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_inventory_list()

void read_inventory_list ( lua_State * L,
int tableindex,
Inventory * inv,
const char * name,
IGameDef * gdef,
int forcesize )

References Inventory::addList(), InventoryList::changeItem(), Inventory::deleteList(), and read_items().

Referenced by NodeMetaRef::handleFromTable(), InvRef::l_set_list(), and InvRef::l_set_lists().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_item()

◆ read_item_definition()

void read_item_definition ( lua_State * L,
int index,
const ItemDefinition & default_def,
ItemDefinition & def )

References WearBarParams::BLEND_MODE_CONSTANT, check_v3f(), ItemDefinition::color, ItemDefinition::description, es_ItemType, es_TouchInteractionMode, getboolfield(), getenumfield(), getfloatfield_default(), getintfield(), getintfield_default(), getstringfield(), ItemDefinition::groups, ItemDefinition::inventory_image, ItemDefinition::inventory_overlay, ITEM_NONE, ItemDefinition::liquids_pointable, ItemDefinition::name, ItemDefinition::node_placement_prediction, ItemDefinition::palette_image, ItemDefinition::place_param2, ItemDefinition::pointabilities, TouchInteraction::pointed_node, TouchInteraction::pointed_nothing, TouchInteraction::pointed_object, ItemDefinition::range, rangelim, read_color(), read_groups(), read_pointabilities(), read_simplesoundspec(), read_tool_capabilities(), read_wear_bar_params(), ItemDefinition::short_description, ItemDefinition::sound_place, ItemDefinition::sound_place_failed, ItemDefinition::sound_use, ItemDefinition::sound_use_air, ItemDefinition::stack_max, string_to_enum(), ItemDefinition::tool_capabilities, ItemDefinition::touch_interaction, ItemDefinition::type, U16_MAX, U8_MAX, ItemDefinition::usable, ItemDefinition::wallmounted_rotate_vertical, ItemDefinition::wear_bar_params, ItemDefinition::wield_image, ItemDefinition::wield_overlay, and ItemDefinition::wield_scale.

Referenced by ModApiItem::l_register_item_raw().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_items()

std::vector< ItemStack > read_items ( lua_State * L,
int index,
IGameDef * gdef )

References IGameDef::idef(), and read_item().

Referenced by ModApiCraft::l_get_craft_result(), and read_inventory_list().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_json_value()

void read_json_value ( lua_State * L,
Json::Value & root,
int index,
u16 max_depth )

References read_json_value(), and TileAnimationParams::type.

Referenced by ModApiUtil::l_write_json(), and read_json_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_nodebox()

NodeBox read_nodebox ( lua_State * L,
int index )

References ScriptApiNode::es_NodeBoxType, NodeBox::fixed, NodeBox::getConnected(), getenumfield(), NODEBOX_CONNECTED, NODEBOX_REGULAR, NODEBOXREAD, NODEBOXREADVEC, NodeBox::type, NodeBox::wall_bottom, NodeBox::wall_side, and NodeBox::wall_top.

Referenced by read_content_features().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_noiseparams()

bool read_noiseparams ( lua_State * L,
int index,
NoiseParams * np )

References flagdesc_noiseparams, NoiseParams::flags, getflagsfield(), getfloatfield(), getintfield(), NoiseParams::lacunarity, NOISE_FLAG_DEFAULTS, NoiseParams::octaves, NoiseParams::offset, NoiseParams::persist, read_v3f(), NoiseParams::scale, NoiseParams::seed, and NoiseParams::spread.

Referenced by LuaPerlinNoise::create_object(), LuaPerlinNoiseMap::create_object(), ModApiEnv::l_get_perlin(), ModApiEnv::l_get_perlin_map(), ModApiMapgen::l_register_decoration(), ModApiMapgen::l_register_ore(), ModApiMapgen::l_set_mapgen_setting_noiseparams(), ModApiMapgen::l_set_noiseparams(), and LuaSettings::l_set_np_group().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_object_properties()

void read_object_properties ( lua_State * L,
int index,
ServerActiveObject * sao,
ObjectProperties * prop,
IItemDefManager * idef )

References ACTIVEOBJECT_TYPE_PLAYER, ObjectProperties::automatic_face_movement_dir, ObjectProperties::automatic_face_movement_dir_offset, ObjectProperties::automatic_face_movement_max_rotation_per_sec, ObjectProperties::automatic_rotate, ObjectProperties::backface_culling, ObjectProperties::breath_max, BS, ObjectProperties::collideWithObjects, ObjectProperties::collisionbox, ObjectProperties::colors, ObjectProperties::damage_texture_modifier, ObjectProperties::eye_height, getboolfield(), PlayerSAO::getBreath(), getfloatfield(), ServerActiveObject::getHP(), getintfield(), ItemStack::getItemString(), getstringfield(), ActiveObject::getType(), ObjectProperties::glow, ObjectProperties::hp_max, ObjectProperties::infotext, ObjectProperties::initial_sprite_basepos, ObjectProperties::is_visible, ObjectProperties::makes_footstep_sound, ObjectProperties::mesh, ObjectProperties::nametag, ObjectProperties::nametag_bgcolor, ObjectProperties::nametag_color, ObjectProperties::physical, ObjectProperties::pointable, rangelim, read_aabb3f(), read_color(), read_item(), read_pointability_type(), read_v2f(), read_v2s16(), ObjectProperties::rotate_selectionbox, ObjectProperties::selectionbox, PlayerHPChangeReason::SET_HP_MAX, PlayerSAO::setBreath(), ServerActiveObject::setHP(), ObjectProperties::shaded, ObjectProperties::show_on_minimap, ObjectProperties::spritediv, ObjectProperties::static_save, ObjectProperties::stepheight, table, ObjectProperties::textures, U16_MAX, ObjectProperties::use_texture_alpha, ObjectProperties::visual, ObjectProperties::visual_size, ObjectProperties::wield_item, and ObjectProperties::zoom_fov.

Referenced by ObjectRef::l_set_properties(), and ScriptApiEntity::luaentity_GetProperties().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_pointabilities()

Pointabilities read_pointabilities ( lua_State * L,
int index )

References Pointabilities::node_groups, Pointabilities::nodes, Pointabilities::object_groups, Pointabilities::objects, read_pointability_type(), and str_starts_with().

Referenced by LuaRaycast::create_object(), and read_item_definition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_pointability_type()

PointabilityType read_pointability_type ( lua_State * L,
int index )

References POINTABLE, POINTABLE_BLOCKING, and POINTABLE_NOT.

Referenced by read_content_features(), read_object_properties(), and read_pointabilities().

+ Here is the caller graph for this function:

◆ read_server_sound_params()

void read_server_sound_params ( lua_State * L,
int index,
ServerPlayingSound & params )

References BS, ModApiBase::checkObject(), ServerPlayingSound::exclude_player, SoundSpec::fade, ServerPlayingSound::gain, getboolfield(), getfloatfield(), getfloatfield_default(), ActiveObject::getId(), ObjectRef::getobject(), getstringfield(), SoundSpec::loop, ServerPlayingSound::max_hear_distance, Object, ServerPlayingSound::object, p(), SoundSpec::pitch, ServerPlayingSound::pos, Position, read_v3f(), ServerPlayingSound::spec, SoundSpec::start_time, ServerPlayingSound::to_player, and ServerPlayingSound::type.

Referenced by ModApiServer::l_sound_play().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_simplesoundspec()

void read_simplesoundspec ( lua_State * L,
int index,
SoundSpec & spec )

References SoundSpec::fade, SoundSpec::gain, getfloatfield(), getstringfield(), SoundSpec::name, and SoundSpec::pitch.

Referenced by ModApiClientSound::l_sound_play(), ModApiMainMenuSound::l_sound_play(), ModApiServer::l_sound_play(), read_content_features(), and read_item_definition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_tiledef()

TileDef read_tiledef ( lua_State * L,
int index,
u8 drawtype,
bool special )

References TileDef::align_style, ALIGN_STYLE_NODE, ALIGN_STYLE_USER_DEFINED, ALIGN_STYLE_WORLD, TileDef::animation, TileDef::backface_culling, TileDef::color, getboolfield_default(), getintfield_default(), getstringfield(), TileDef::has_color, TileDef::name, NDT_FIRELIKE, NDT_LIQUID, NDT_MESH, NDT_PLANTLIKE, NDT_PLANTLIKE_ROOTED, read_animation_definition(), read_color(), TileDef::scale, TileDef::tileable_horizontal, and TileDef::tileable_vertical.

Referenced by read_content_features().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_tool_capabilities()

ToolCapabilities read_tool_capabilities ( lua_State * L,
int table )

References ToolCapabilities::damageGroups, ToolCapabilities::full_punch_interval, getfloatfield(), getintfield(), ToolCapabilities::groupcaps, infostream, ToolCapabilities::max_drop_level, ToolGroupCap::maxlevel, ToolCapabilities::punch_attack_uses, script_get_backtrace(), table, ToolGroupCap::times, ToolGroupCap::uses, and warningstream.

Referenced by ModApiUtil::l_get_dig_params(), ModApiUtil::l_get_hit_params(), ObjectRef::l_punch(), ItemStackMetaRef::l_set_tool_capabilities(), and read_item_definition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read_tree_def()

bool read_tree_def ( lua_State * L,
int idx,
const NodeDefManager * ndef,
treegen::TreeDef & tree_def )

◆ read_wear_bar_params()

WearBarParams read_wear_bar_params ( lua_State * L,
int stack_idx )

References blend, WearBarParams::BLEND_MODE_CONSTANT, check_field_or_nil(), WearBarParams::es_BlendMode, read_color(), and string_to_enum().

Referenced by ItemStackMetaRef::l_set_wear_bar_params(), and read_item_definition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readnode()

◆ string_to_enum()

◆ warn_if_field_exists()

void warn_if_field_exists ( lua_State * L,
int table,
const char * fieldname,
std::string_view name,
std::string_view message )

References infostream, script_get_backtrace(), table, and warningstream.

Referenced by ModApiMapgen::l_register_ore(), and read_content_features().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ collision_axis_str

const char* collision_axis_str[]
static
Initial value:
= {
"x",
"y",
"z",
}

Referenced by push_collision_move_result().

◆ collision_type_str

const char* collision_type_str[]
static
Initial value:
= {
"node",
"object",
}

Referenced by push_collision_move_result().

◆ es_TileAnimationType

struct EnumString es_TileAnimationType[]
Initial value:
=
{
{TAT_NONE, "none"},
{TAT_VERTICAL_FRAMES, "vertical_frames"},
{TAT_SHEET_2D, "sheet_2d"},
{0, nullptr},
}
@ TAT_NONE
Definition tileanimation.h:12
@ TAT_SHEET_2D
Definition tileanimation.h:14
@ TAT_VERTICAL_FRAMES
Definition tileanimation.h:13

Referenced by read_animation_definition().

◆ object_property_keys

const std::array<const char *, 33> object_property_keys