aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_env.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_env.h')
-rw-r--r--src/script/lua_api/l_env.h84
1 files changed, 45 insertions, 39 deletions
diff --git a/src/script/lua_api/l_env.h b/src/script/lua_api/l_env.h
index 43388475e..e1b89494b 100644
--- a/src/script/lua_api/l_env.h
+++ b/src/script/lua_api/l_env.h
@@ -23,8 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "serverenvironment.h"
#include "raycast.h"
-class ModApiEnvMod : public ModApiBase
-{
+class ModApiEnvMod : public ModApiBase {
private:
// set_node(pos, node)
// pos = {x=num, y=num, z=num}
@@ -127,17 +126,17 @@ private:
// find_node_near(pos, radius, nodenames, search_center) -> pos or nil
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
static int l_find_node_near(lua_State *L);
-
+
// find_nodes_near(pos, radius, nodenames, search_center) -> list of positions
// nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
static int l_find_nodes_near(lua_State *L);
-
- // find_nodes_near_under_air(pos, radius, nodenames, search_center) -> list of
- // positions nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
+
+ // find_nodes_near_under_air(pos, radius, nodenames, search_center) -> list of positions
+ // nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
static int l_find_nodes_near_under_air(lua_State *L);
-
- // find_nodes_near_under_air(pos, radius, nodenames, search_center) -> list of
- // positions nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
+
+ // find_nodes_near_under_air(pos, radius, nodenames, search_center) -> list of positions
+ // nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
static int l_find_nodes_near_under_air_except(lua_State *L);
// find_nodes_in_area(minp, maxp, nodenames) -> list of positions
@@ -201,12 +200,12 @@ private:
static int l_forceload_free_block(lua_State *L);
// Get a string translated server side
- static int l_get_translated_string(lua_State *L);
+ static int l_get_translated_string(lua_State * L);
/* Helpers */
- static void collectNodeIds(lua_State *L, int idx, const NodeDefManager *ndef,
- std::vector<content_t> &filter);
+ static void collectNodeIds(lua_State *L, int idx,
+ const NodeDefManager *ndef, std::vector<content_t> &filter);
public:
static void Initialize(lua_State *L, int top);
@@ -215,8 +214,7 @@ public:
static struct EnumString es_ClearObjectsMode[];
};
-class LuaABM : public ActiveBlockModifier
-{
+class LuaABM : public ActiveBlockModifier {
private:
int m_id;
@@ -225,18 +223,17 @@ private:
float m_trigger_interval;
u32 m_trigger_chance;
bool m_simple_catch_up;
-
public:
- LuaABM(lua_State *L, int id, const std::vector<std::string> &trigger_contents,
+ LuaABM(lua_State *L, int id,
+ const std::vector<std::string> &trigger_contents,
const std::vector<std::string> &required_neighbors,
- float trigger_interval, u32 trigger_chance,
- bool simple_catch_up) :
- m_id(id),
- m_trigger_contents(trigger_contents),
- m_required_neighbors(required_neighbors),
- m_trigger_interval(trigger_interval),
- m_trigger_chance(trigger_chance),
- m_simple_catch_up(simple_catch_up)
+ float trigger_interval, u32 trigger_chance, bool simple_catch_up):
+ m_id(id),
+ m_trigger_contents(trigger_contents),
+ m_required_neighbors(required_neighbors),
+ m_trigger_interval(trigger_interval),
+ m_trigger_chance(trigger_chance),
+ m_simple_catch_up(simple_catch_up)
{
}
virtual const std::vector<std::string> &getTriggerContents() const
@@ -247,9 +244,18 @@ public:
{
return m_required_neighbors;
}
- virtual float getTriggerInterval() { return m_trigger_interval; }
- virtual u32 getTriggerChance() { return m_trigger_chance; }
- virtual bool getSimpleCatchUp() { return m_simple_catch_up; }
+ virtual float getTriggerInterval()
+ {
+ return m_trigger_interval;
+ }
+ virtual u32 getTriggerChance()
+ {
+ return m_trigger_chance;
+ }
+ virtual bool getSimpleCatchUp()
+ {
+ return m_simple_catch_up;
+ }
virtual void trigger(ServerEnvironment *env, v3s16 p, MapNode n,
u32 active_object_count, u32 active_object_count_wider);
};
@@ -258,11 +264,12 @@ class LuaLBM : public LoadingBlockModifierDef
{
private:
int m_id;
-
public:
- LuaLBM(lua_State *L, int id, const std::set<std::string> &trigger_contents,
- const std::string &name, bool run_at_every_load) :
- m_id(id)
+ LuaLBM(lua_State *L, int id,
+ const std::set<std::string> &trigger_contents,
+ const std::string &name,
+ bool run_at_every_load):
+ m_id(id)
{
this->run_at_every_load = run_at_every_load;
this->trigger_contents = trigger_contents;
@@ -290,14 +297,14 @@ private:
* Returns the next pointed thing on the ray.
*/
static int l_next(lua_State *L);
-
public:
//! Constructor with the same arguments as RaycastState.
- LuaRaycast(const core::line3d<f32> &shootline, bool objects_pointable,
- bool liquids_pointable) :
- state(shootline, objects_pointable, liquids_pointable)
- {
- }
+ LuaRaycast(
+ const core::line3d<f32> &shootline,
+ bool objects_pointable,
+ bool liquids_pointable) :
+ state(shootline, objects_pointable, liquids_pointable)
+ {}
//! Creates a LuaRaycast and leaves it on top of the stack.
static int create_object(lua_State *L);
@@ -312,8 +319,7 @@ public:
static void Register(lua_State *L);
};
-struct ScriptCallbackState
-{
+struct ScriptCallbackState {
ServerScripting *script;
int callback_ref;
int args_ref;