Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
ScriptApiNode Class Reference

#include <s_node.h>

+ Inheritance diagram for ScriptApiNode:
+ Collaboration diagram for ScriptApiNode:

Public Member Functions

 ScriptApiNode ()=default
 
virtual ~ScriptApiNode ()=default
 
bool node_on_punch (v3s16 p, MapNode node, ServerActiveObject *puncher, const PointedThing &pointed)
 
bool node_on_dig (v3s16 p, MapNode node, ServerActiveObject *digger)
 
void node_on_construct (v3s16 p, MapNode node)
 
void node_on_destruct (v3s16 p, MapNode node)
 
bool node_on_flood (v3s16 p, MapNode node, MapNode newnode)
 
void node_after_destruct (v3s16 p, MapNode node)
 
bool node_on_timer (v3s16 p, MapNode node, f32 dtime)
 
void node_on_receive_fields (v3s16 p, const std::string &formname, const StringMap &fields, ServerActiveObject *sender)
 
- Public Member Functions inherited from ScriptApiBase
 ScriptApiBase (ScriptingType type)
 
 ScriptApiBase ()
 
virtual ~ScriptApiBase ()
 
 DISABLE_CLASS_COPY (ScriptApiBase)
 
void loadMod (const std::string &script_path, const std::string &mod_name)
 
void loadScript (const std::string &script_path)
 
void runCallbacksRaw (int nargs, RunCallbacksMode mode, const char *fxn)
 
void addObjectReference (ServerActiveObject *cobj)
 
void removeObjectReference (ServerActiveObject *cobj)
 
ScriptingType getType ()
 
IGameDefgetGameDef ()
 
ServergetServer ()
 
const std::string & getOrigin ()
 
void setOriginDirect (const char *origin)
 
void setOriginFromTableRaw (int index, const char *fxn)
 
void clientOpenLibs (lua_State *L)
 
void checkSetByBuiltin ()
 
- Public Member Functions inherited from ScriptApiNodemeta
 ScriptApiNodemeta ()=default
 
virtual ~ScriptApiNodemeta ()=default
 
int nodemeta_inventory_AllowMove (const MoveAction &ma, int count, ServerActiveObject *player)
 
int nodemeta_inventory_AllowPut (const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player)
 
int nodemeta_inventory_AllowTake (const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player)
 
void nodemeta_inventory_OnMove (const MoveAction &ma, int count, ServerActiveObject *player)
 
void nodemeta_inventory_OnPut (const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player)
 
void nodemeta_inventory_OnTake (const MoveAction &ma, const ItemStack &stack, ServerActiveObject *player)
 
- Public Member Functions inherited from ScriptApiItem
bool item_OnDrop (ItemStack &item, ServerActiveObject *dropper, v3f pos)
 
bool item_OnPlace (std::optional< ItemStack > &item, ServerActiveObject *placer, const PointedThing &pointed)
 
bool item_OnUse (std::optional< ItemStack > &item, ServerActiveObject *user, const PointedThing &pointed)
 
bool item_OnSecondaryUse (std::optional< ItemStack > &item, ServerActiveObject *user, const PointedThing &pointed)
 
bool item_OnCraft (ItemStack &item, ServerActiveObject *user, const InventoryList *old_craft_grid, const InventoryLocation &craft_inv)
 
bool item_CraftPredict (ItemStack &item, ServerActiveObject *user, const InventoryList *old_craft_grid, const InventoryLocation &craft_inv)
 

Static Public Attributes

static struct EnumString es_DrawType []
 
static struct EnumString es_ContentParamType []
 
static struct EnumString es_ContentParamType2 []
 
static struct EnumString es_LiquidType []
 
static struct EnumString es_LiquidMoveType []
 
static struct EnumString es_NodeBoxType []
 
static struct EnumString es_TextureAlphaMode []
 

Additional Inherited Members

- Static Public Member Functions inherited from ScriptApiBase
static std::string getCurrentModNameInsecure (lua_State *L)
 
static std::string getCurrentModName (lua_State *L)
 
- Protected Member Functions inherited from ScriptApiBase
lua_State * getStack ()
 
void realityCheck ()
 
void scriptError (int result, const char *fxn)
 
void stackDump (std::ostream &o)
 
void setGameDef (IGameDef *gamedef)
 
EnvironmentgetEnv ()
 
void setEnv (Environment *env)
 
EmergeThreadgetEmergeThread ()
 
void setEmergeThread (EmergeThread *emerge)
 
void objectrefGetOrCreate (lua_State *L, ServerActiveObject *cobj)
 
void pushPlayerHPChangeReason (lua_State *L, const PlayerHPChangeReason &reason)
 
- Protected Member Functions inherited from LuaHelper
template<>
bool readParam (lua_State *L, int index)
 
template<>
s16 readParam (lua_State *L, int index)
 
template<>
int readParam (lua_State *L, int index)
 
template<>
float readParam (lua_State *L, int index)
 
template<>
v2s16 readParam (lua_State *L, int index)
 
template<>
v2f readParam (lua_State *L, int index)
 
template<>
v3f readParam (lua_State *L, int index)
 
template<>
std::string_view readParam (lua_State *L, int index)
 
template<>
std::string readParam (lua_State *L, int index)
 
template<>
std::string_view readParam (lua_State *L, int index)
 Read a string from Lua state L at index without copying it.
 
- Protected Member Functions inherited from ScriptApiItem
bool getItemCallback (const char *name, const char *callbackname, const v3s16 *p=nullptr)
 
void pushPointedThing (const PointedThing &pointed, bool hitpoint=false)
 
- Static Protected Member Functions inherited from LuaHelper
template<typename T >
static T readParam (lua_State *L, int index)
 Read a value using a template type T from Lua state L at index.
 
template<typename T >
static T readParam (lua_State *L, int index, const T &default_value)
 Read a value using a template type T from Lua state L at index.
 
- Protected Attributes inherited from ScriptApiBase
std::recursive_mutex m_luastackmutex
 
std::string m_last_run_mod
 
bool m_secure = false
 
int m_lock_recursion_count {}
 
std::thread::id m_owning_thread
 

Constructor & Destructor Documentation

◆ ScriptApiNode()

ScriptApiNode::ScriptApiNode ( )
default

◆ ~ScriptApiNode()

virtual ScriptApiNode::~ScriptApiNode ( )
virtualdefault

Member Function Documentation

◆ node_after_destruct()

void ScriptApiNode::node_after_destruct ( v3s16 p,
MapNode node )

References NodeDefManager::get(), ScriptApiItem::getItemCallback(), ScriptApiBase::getServer(), ContentFeatures::name, IGameDef::ndef(), p(), PCALL_RES, PUSH_ERROR_HANDLER, push_v3s16(), pushnode(), and SCRIPTAPI_PRECHECKHEADER.

Referenced by ServerEnvironment::removeNode(), and ServerEnvironment::setNode().

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

◆ node_on_construct()

void ScriptApiNode::node_on_construct ( v3s16 p,
MapNode node )

References NodeDefManager::get(), ScriptApiItem::getItemCallback(), ScriptApiBase::getServer(), ContentFeatures::name, IGameDef::ndef(), p(), PCALL_RES, PUSH_ERROR_HANDLER, push_v3s16(), and SCRIPTAPI_PRECHECKHEADER.

Referenced by ServerEnvironment::setNode().

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

◆ node_on_destruct()

void ScriptApiNode::node_on_destruct ( v3s16 p,
MapNode node )

References NodeDefManager::get(), ScriptApiItem::getItemCallback(), ScriptApiBase::getServer(), ContentFeatures::name, IGameDef::ndef(), p(), PCALL_RES, PUSH_ERROR_HANDLER, push_v3s16(), and SCRIPTAPI_PRECHECKHEADER.

Referenced by ServerEnvironment::removeNode(), and ServerEnvironment::setNode().

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

◆ node_on_dig()

bool ScriptApiNode::node_on_dig ( v3s16 p,
MapNode node,
ServerActiveObject * digger )

References NodeDefManager::get(), ScriptApiItem::getItemCallback(), ScriptApiBase::getServer(), ContentFeatures::name, IGameDef::ndef(), ScriptApiBase::objectrefGetOrCreate(), p(), PCALL_RES, PUSH_ERROR_HANDLER, push_v3s16(), pushnode(), and SCRIPTAPI_PRECHECKHEADER.

Referenced by Server::handleCommand_Interact(), and ModApiEnv::l_dig_node().

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

◆ node_on_flood()

bool ScriptApiNode::node_on_flood ( v3s16 p,
MapNode node,
MapNode newnode )

References NodeDefManager::get(), ScriptApiItem::getItemCallback(), ScriptApiBase::getServer(), ContentFeatures::name, IGameDef::ndef(), p(), PCALL_RES, PUSH_ERROR_HANDLER, push_v3s16(), pushnode(), LuaHelper::readParam(), and SCRIPTAPI_PRECHECKHEADER.

Referenced by ServerMap::transformLiquids().

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

◆ node_on_punch()

bool ScriptApiNode::node_on_punch ( v3s16 p,
MapNode node,
ServerActiveObject * puncher,
const PointedThing & pointed )

References NodeDefManager::get(), ScriptApiItem::getItemCallback(), ScriptApiBase::getServer(), ContentFeatures::name, IGameDef::ndef(), ScriptApiBase::objectrefGetOrCreate(), p(), PCALL_RES, PUSH_ERROR_HANDLER, push_v3s16(), pushnode(), ScriptApiItem::pushPointedThing(), and SCRIPTAPI_PRECHECKHEADER.

Referenced by Server::handleCommand_Interact(), and ModApiEnv::l_punch_node().

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

◆ node_on_receive_fields()

void ScriptApiNode::node_on_receive_fields ( v3s16 p,
const std::string & formname,
const StringMap & fields,
ServerActiveObject * sender )

References CONTENT_IGNORE, NodeDefManager::get(), MapNode::getContent(), ScriptApiBase::getEnv(), ScriptApiItem::getItemCallback(), Environment::getMap(), Map::getNode(), ScriptApiBase::getServer(), ContentFeatures::name, IGameDef::ndef(), ScriptApiBase::objectrefGetOrCreate(), p(), PCALL_RES, PUSH_ERROR_HANDLER, push_v3s16(), and SCRIPTAPI_PRECHECKHEADER.

Referenced by Server::handleCommand_NodeMetaFields().

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

◆ node_on_timer()

bool ScriptApiNode::node_on_timer ( v3s16 p,
MapNode node,
f32 dtime )

References NodeDefManager::get(), ScriptApiItem::getItemCallback(), ScriptApiBase::getServer(), ContentFeatures::name, IGameDef::ndef(), p(), PCALL_RES, PUSH_ERROR_HANDLER, push_v3s16(), LuaHelper::readParam(), and SCRIPTAPI_PRECHECKHEADER.

Referenced by ServerEnvironment::activateBlock(), and ServerEnvironment::step().

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

Member Data Documentation

◆ es_ContentParamType

struct EnumString ScriptApiNode::es_ContentParamType
static
Initial value:
=
{
{CPT_NONE, "none"},
{CPT_LIGHT, "light"},
{0, NULL},
}
@ CPT_LIGHT
Definition nodedef.h:37
@ CPT_NONE
Definition nodedef.h:36

Referenced by push_content_features(), and read_content_features().

◆ es_ContentParamType2

struct EnumString ScriptApiNode::es_ContentParamType2
static
Initial value:
=
{
{CPT2_NONE, "none"},
{CPT2_FULL, "full"},
{CPT2_FLOWINGLIQUID, "flowingliquid"},
{CPT2_FACEDIR, "facedir"},
{CPT2_WALLMOUNTED, "wallmounted"},
{CPT2_LEVELED, "leveled"},
{CPT2_DEGROTATE, "degrotate"},
{CPT2_MESHOPTIONS, "meshoptions"},
{CPT2_COLOR, "color"},
{CPT2_COLORED_FACEDIR, "colorfacedir"},
{CPT2_COLORED_WALLMOUNTED, "colorwallmounted"},
{CPT2_GLASSLIKE_LIQUID_LEVEL, "glasslikeliquidlevel"},
{CPT2_COLORED_DEGROTATE, "colordegrotate"},
{CPT2_4DIR, "4dir"},
{CPT2_COLORED_4DIR, "color4dir"},
{0, NULL},
}
@ CPT2_DEGROTATE
Definition nodedef.h:55
@ CPT2_COLORED_DEGROTATE
Definition nodedef.h:67
@ CPT2_FULL
Definition nodedef.h:45
@ CPT2_COLORED_4DIR
Definition nodedef.h:71
@ CPT2_WALLMOUNTED
Definition nodedef.h:51
@ CPT2_MESHOPTIONS
Definition nodedef.h:57
@ CPT2_FACEDIR
Definition nodedef.h:49
@ CPT2_4DIR
Definition nodedef.h:69
@ CPT2_COLOR
Definition nodedef.h:59
@ CPT2_COLORED_WALLMOUNTED
Definition nodedef.h:63
@ CPT2_GLASSLIKE_LIQUID_LEVEL
Definition nodedef.h:65
@ CPT2_NONE
Definition nodedef.h:43
@ CPT2_FLOWINGLIQUID
Definition nodedef.h:47
@ CPT2_COLORED_FACEDIR
Definition nodedef.h:61
@ CPT2_LEVELED
Definition nodedef.h:53

Referenced by push_content_features(), and read_content_features().

◆ es_DrawType

struct EnumString ScriptApiNode::es_DrawType
static
Initial value:
=
{
{NDT_NORMAL, "normal"},
{NDT_AIRLIKE, "airlike"},
{NDT_LIQUID, "liquid"},
{NDT_FLOWINGLIQUID, "flowingliquid"},
{NDT_GLASSLIKE, "glasslike"},
{NDT_ALLFACES, "allfaces"},
{NDT_ALLFACES_OPTIONAL, "allfaces_optional"},
{NDT_TORCHLIKE, "torchlike"},
{NDT_SIGNLIKE, "signlike"},
{NDT_PLANTLIKE, "plantlike"},
{NDT_FENCELIKE, "fencelike"},
{NDT_RAILLIKE, "raillike"},
{NDT_NODEBOX, "nodebox"},
{NDT_GLASSLIKE_FRAMED, "glasslike_framed"},
{NDT_FIRELIKE, "firelike"},
{NDT_GLASSLIKE_FRAMED_OPTIONAL, "glasslike_framed_optional"},
{NDT_MESH, "mesh"},
{NDT_PLANTLIKE_ROOTED, "plantlike_rooted"},
{0, NULL},
}
@ NDT_SIGNLIKE
Definition nodedef.h:201
@ NDT_FIRELIKE
Definition nodedef.h:219
@ NDT_FLOWINGLIQUID
Definition nodedef.h:191
@ NDT_RAILLIKE
Definition nodedef.h:210
@ NDT_NORMAL
Definition nodedef.h:185
@ NDT_TORCHLIKE
Definition nodedef.h:199
@ NDT_ALLFACES
Definition nodedef.h:195
@ NDT_NODEBOX
Definition nodedef.h:212
@ NDT_FENCELIKE
Definition nodedef.h:207
@ NDT_PLANTLIKE_ROOTED
Definition nodedef.h:225
@ NDT_GLASSLIKE
Definition nodedef.h:193
@ NDT_LIQUID
Definition nodedef.h:189
@ NDT_GLASSLIKE_FRAMED_OPTIONAL
Definition nodedef.h:221
@ NDT_AIRLIKE
Definition nodedef.h:187
@ NDT_MESH
Definition nodedef.h:223
@ NDT_GLASSLIKE_FRAMED
Definition nodedef.h:217
@ NDT_ALLFACES_OPTIONAL
Definition nodedef.h:197
@ NDT_PLANTLIKE
Definition nodedef.h:205

Referenced by push_content_features(), and read_content_features().

◆ es_LiquidMoveType

struct EnumString ScriptApiNode::es_LiquidMoveType[]
static

◆ es_LiquidType

struct EnumString ScriptApiNode::es_LiquidType
static
Initial value:
=
{
{LIQUID_NONE, "none"},
{LIQUID_FLOWING, "flowing"},
{LIQUID_SOURCE, "source"},
{0, NULL},
}
@ LIQUID_FLOWING
Definition nodedef.h:79
@ LIQUID_NONE
Definition nodedef.h:78
@ LIQUID_SOURCE
Definition nodedef.h:80

Referenced by push_content_features(), and read_content_features().

◆ es_NodeBoxType

struct EnumString ScriptApiNode::es_NodeBoxType
static
Initial value:
=
{
{NODEBOX_REGULAR, "regular"},
{NODEBOX_FIXED, "fixed"},
{NODEBOX_WALLMOUNTED, "wallmounted"},
{NODEBOX_LEVELED, "leveled"},
{NODEBOX_CONNECTED, "connected"},
{0, NULL},
}
@ NODEBOX_CONNECTED
Definition nodedef.h:90
@ NODEBOX_REGULAR
Definition nodedef.h:86
@ NODEBOX_FIXED
Definition nodedef.h:87
@ NODEBOX_WALLMOUNTED
Definition nodedef.h:88
@ NODEBOX_LEVELED
Definition nodedef.h:89

Referenced by read_nodebox().

◆ es_TextureAlphaMode

struct EnumString ScriptApiNode::es_TextureAlphaMode
static
Initial value:
=
{
{ALPHAMODE_OPAQUE, "opaque"},
{ALPHAMODE_CLIP, "clip"},
{ALPHAMODE_BLEND, "blend"},
{0, NULL},
}
@ ALPHAMODE_CLIP
Definition nodedef.h:252
@ ALPHAMODE_OPAQUE
Definition nodedef.h:253
@ ALPHAMODE_BLEND
Definition nodedef.h:251

Referenced by read_content_features().


The documentation for this class was generated from the following files: