Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
s_env.h
Go to the documentation of this file.
1// Luanti
2// SPDX-License-Identifier: LGPL-2.1-or-later
3// Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5#pragma once
6
7#include "cpp_api/s_base.h"
8#include "irr_v3d.h"
9#include "mapnode.h"
10#include <unordered_set>
11#include <vector>
12
14class MapBlock;
16
17class ScriptApiEnv : virtual public ScriptApiBase
18{
19public:
20 // Called on environment step
21 void environment_Step(float dtime);
22
23 // Called after generating a piece of map
24 void environment_OnGenerated(v3s16 minp, v3s16 maxp, u32 blockseed);
25
26 // Called on player event
27 void player_event(ServerActiveObject *player, const std::string &type);
28
29 // Called after emerge of a block queued from core.emerge_area()
30 void on_emerge_area_completion(v3s16 blockpos, int action,
31 ScriptCallbackState *state);
32
34
35 // Called after liquid transform changes
36 void on_liquid_transformed(const std::vector<std::pair<v3s16, MapNode>> &list);
37
38 // Called after mapblock changes
39 void on_mapblocks_changed(const std::unordered_set<v3s16> &set);
40
41 // Determines whether there are any on_mapblocks_changed callbacks
43
44 // Initializes environment and loads some definitions from Lua
46
47 void triggerABM(int id, v3s16 p, MapNode n,
48 u32 active_object_count, u32 active_object_count_wider);
49
50 void triggerLBM(int id, MapBlock *block,
51 const std::unordered_set<v3s16> &positions, float dtime_s);
52
53private:
54 void readABMs();
55
56 void readLBMs();
57
58 // Reads a single or a list of node names into a vector
59 static bool read_nodenames(lua_State *L, int idx, std::vector<std::string> &to);
60};
Definition mapblock.h:58
Definition s_base.h:64
Definition s_env.h:18
void triggerABM(int id, v3s16 p, MapNode n, u32 active_object_count, u32 active_object_count_wider)
Definition s_env.cpp:422
void player_event(ServerActiveObject *player, const std::string &type)
Definition s_env.cpp:145
void triggerLBM(int id, MapBlock *block, const std::unordered_set< v3s16 > &positions, float dtime_s)
Definition s_env.cpp:460
void on_emerge_area_completion(v3s16 blockpos, int action, ScriptCallbackState *state)
Definition s_env.cpp:304
void initializeEnvironment(ServerEnvironment *env)
Definition s_env.cpp:162
void on_mapblocks_changed(const std::unordered_set< v3s16 > &set)
Definition s_env.cpp:389
void check_for_falling(v3s16 p)
Definition s_env.cpp:346
static bool read_nodenames(lua_State *L, int idx, std::vector< std::string > &to)
Definition s_env.cpp:175
void environment_Step(float dtime)
Definition s_env.cpp:133
void on_liquid_transformed(const std::vector< std::pair< v3s16, MapNode > > &list)
Definition s_env.cpp:358
bool has_on_mapblocks_changed()
Definition s_env.cpp:411
void environment_OnGenerated(v3s16 minp, v3s16 maxp, u32 blockseed)
Definition s_env.cpp:118
void readLBMs()
Definition s_env.cpp:261
void readABMs()
Definition s_env.cpp:195
Definition serveractiveobject.h:41
Definition serverenvironment.h:219
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
#define idx(x, y)
Definition noise.cpp:490
Definition mapnode.h:124
Definition l_env.h:311
static std::string p(std::string path)
Definition test_filesys.cpp:53