["PlayerTracers"] = "enable_player_tracers",
["NodeESP"] = "enable_node_esp",
["NodeTracers"] = "enable_node_tracers",
+ ["NoWeather"] = "noweather",
},
["World"] = {
["FastDig"] = "fastdig",
core.register_list_command("xray", "Configure X-Ray", "xray_nodes")
core.register_list_command("search", "Configure NodeESP", "node_esp_nodes")
+
+core.register_on_spawn_particle(function(particle)
+ if core.settings:get_bool("noweather") and particle.texture:sub(1, 12) == "weather_pack" then
+ return true
+ end
+end)
+
+core.register_on_play_sound(function(sound)
+ if core.settings:get_bool("noweather") and sound.name == "weather_rain" then
+ return true
+ end
+end)
core.registered_on_inventory_open, core.register_on_inventory_open = make_registration()
core.registered_on_recieve_physics_override, core.register_on_recieve_physics_override = make_registration()
core.registered_on_play_sound, core.register_on_play_sound = make_registration()
+core.registered_on_spawn_particle, core.register_on_spawn_particle = make_registration()
entity_esp_color (EntityESP Color) v3f 255, 255, 255
player_esp_color (PlayerESP Color) v3f 0, 255, 0
+
+noweather (NoWeather) bool false
* Called when recieving physics_override from server
* Newest functions are called first
* If any function returns true, the physics override does not change
-* `minetest.register_on_sound_play(function(SimpleSoundSpec))`
+* `minetest.register_on_play_sound(function(SimpleSoundSpec))`
* Called when recieving a play sound command from server
* Newest functions are called first
* If any function returns true, the sound does not play
+* `minetest.register_on_spawn_partice(function(particle definition))`
+ * Called when recieving a spawn particle command from server
+ * Newest functions are called first
+ * If any function returns true, the particel does not spawn
### Setting-related
* `minetest.settings`: Settings object containing all of the settings from the
settings->setDefault("enable_node_tracers", "false");
settings->setDefault("entity_esp_color", "(255, 255, 255)");
settings->setDefault("player_esp_color", "(0, 255, 0)");
+ settings->setDefault("noweather", "false");
// Keymap
settings->setDefault("remote_port", "30000");
event->type = CE_SPAWN_PARTICLE;
event->spawn_particle = new ParticleParameters(p);
- if (g_settings->getBool("log_particles")) {
- std::cout << p.pos.X << " " << p.pos.Y << " " << p.pos.Z << std::endl;
- }
+ if (m_mods_loaded && m_script->on_spawn_particle(*event->spawn_particle))
+ return;
m_client_event_queue.push(event);
}
}
}
-/******************************************************************************/
-void push_inventory_list(lua_State *L, Inventory *inv, const char *name)
-{
- InventoryList *invlist = inv->getList(name);
- if(invlist == NULL){
- lua_pushnil(L);
- return;
- }
- std::vector<ItemStack> items;
- for(u32 i=0; i<invlist->getSize(); i++)
- items.push_back(invlist->getItem(i));
- push_items(L, items);
-}
-
/******************************************************************************/
void read_inventory_list(lua_State *L, int tableindex,
Inventory *inv, const char *name, Server* srv, int forcesize)
}
}
+void push_inventory_list(lua_State *L, Inventory *inv, const char *name)
+{
+ InventoryList *invlist = inv->getList(name);
+ if(invlist == NULL){
+ lua_pushnil(L);
+ return;
+ }
+ std::vector<ItemStack> items;
+ for(u32 i=0; i<invlist->getSize(); i++)
+ items.push_back(invlist->getItem(i));
+ push_items(L, items);
+}
+
/******************************************************************************/
struct TileAnimationParams read_animation_definition(lua_State *L, int index)
{
return anim;
}
+void push_animation_definition(lua_State *L, struct TileAnimationParams anim)
+{
+ switch (anim.type) {
+ case TAT_NONE:
+ lua_pushnil(L);
+ break;
+ case TAT_VERTICAL_FRAMES:
+ lua_newtable(L);
+ setstringfield(L, -1, "type", "vertical_frames");
+ setfloatfield(L, -1, "aspect_w", anim.vertical_frames.aspect_w);
+ setfloatfield(L, -1, "aspect_h", anim.vertical_frames.aspect_h);
+ setfloatfield(L, -1, "length", anim.vertical_frames.length);
+ break;
+ case TAT_SHEET_2D:
+ lua_newtable(L);
+ setstringfield(L, -1, "type", "sheet_2d");
+ setintfield(L, -1, "frames_w", anim.sheet_2d.frames_w);
+ setintfield(L, -1, "frames_h", anim.sheet_2d.frames_h);
+ setintfield(L, -1, "frame_length", anim.sheet_2d.frame_length);
+ break;
+ }
+}
+
/******************************************************************************/
ToolCapabilities read_tool_capabilities(
lua_State *L, int table)
/**/
}
+/******************************************************************************/
void push_physics_override(lua_State *L, float speed, float jump, float gravity, bool sneak, bool sneak_glitch, bool new_move)
{
lua_createtable(L, 0, 6);
ItemStack read_item (lua_State *L, int index, IItemDefManager *idef);
struct TileAnimationParams read_animation_definition(lua_State *L, int index);
+void push_animation_definition(lua_State *L, struct TileAnimationParams anim);
ToolCapabilities read_tool_capabilities (lua_State *L, int table);
void push_tool_capabilities (lua_State *L,
return readParam<bool>(L, -1);
}
+bool ScriptApiClient::on_spawn_particle(struct ParticleParameters param)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ // Get core.registered_on_play_sound
+
+ lua_getglobal(L, "core");
+ lua_getfield(L, -1, "registered_on_spawn_particle");
+
+ // Push data
+ lua_newtable(L);
+ push_v3f(L, param.pos);
+ lua_setfield(L, -2, "pos");
+ push_v3f(L, param.vel);
+ lua_setfield(L, -2, "velocity");
+ push_v3f(L, param.acc);
+ lua_setfield(L, -2, "acceleration");
+ setfloatfield(L, -1, "expirationtime", param.expirationtime);
+ setboolfield(L, -1, "collisiondetection", param.collisiondetection);
+ setboolfield(L, -1, "collision_removal", param.collision_removal);
+ setboolfield(L, -1, "object_collision", param.object_collision);
+ setboolfield(L, -1, "vertical", param.vertical);
+ push_animation_definition(L, param.animation);
+ lua_setfield(L, -2, "animation");
+ setstringfield(L, -1, "texture", param.texture);
+ setintfield(L, -1, "glow", param.glow);
+ if (param.node.getContent() != CONTENT_IGNORE) {
+ pushnode(L, param.node, getGameDef()->ndef());
+ lua_setfield(L, -2, "node");
+ }
+ setintfield(L, -1, "node_tile", param.node_tile);
+
+ // Call functions
+ runCallbacks(1, RUN_CALLBACKS_MODE_OR);
+ return readParam<bool>(L, -1);
+}
+
bool ScriptApiClient::on_inventory_open(Inventory *inventory)
{
SCRIPTAPI_PRECHECKHEADER
#include "util/string.h"
#include "util/pointedthing.h"
#include "lua_api/l_item.h"
+#include "particles.h"
#ifdef _CRT_MSVCP_CURRENT
#include <cstdint>
bool on_item_use(const ItemStack &item, const PointedThing &pointed);
bool on_recieve_physics_override(float override_speed, float override_jump, float override_gravity, bool sneak, bool sneak_glitch, bool new_move);
bool on_play_sound(SimpleSoundSpec spec);
+ bool on_spawn_particle(struct ParticleParameters param);
bool on_inventory_open(Inventory *inventory);
void open_enderchest();