diff options
author | Wuzzy <wuzzy2@mail.ru> | 2018-06-14 19:32:10 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-06-14 19:32:10 +0200 |
commit | 3283079e4c91e529ffda0f2837898aef87148440 (patch) | |
tree | 1ed1589ceddcb48b4f79e5c4774f922220b10a5e /games/minimal/mods/experimental/init.lua | |
parent | 9a1d3584c22013860ec4b664858076ab6ddf3ea1 (diff) | |
download | minetest-3283079e4c91e529ffda0f2837898aef87148440.tar.gz minetest-3283079e4c91e529ffda0f2837898aef87148440.tar.bz2 minetest-3283079e4c91e529ffda0f2837898aef87148440.zip |
Minimal: Disable disruptive formspec test by default (#7423)
* Minimal: Explicit log levels
* Minimal: Formspec test now disabled by default
This is done because the formspec test was disruptive.
This test can now be toggled with server command test_formspec first.
Diffstat (limited to 'games/minimal/mods/experimental/init.lua')
-rw-r--r-- | games/minimal/mods/experimental/init.lua | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/games/minimal/mods/experimental/init.lua b/games/minimal/mods/experimental/init.lua index 4d5c61488..4d4e3e90c 100644 --- a/games/minimal/mods/experimental/init.lua +++ b/games/minimal/mods/experimental/init.lua @@ -88,17 +88,17 @@ function on_step(dtime) experimental.t1 = experimental.t1 + dtime if experimental.t1 >= 2 then experimental.t1 = experimental.t1 - 2 - minetest.log("time of day is "..minetest.get_timeofday()) + minetest.log("verbose", "time of day is "..minetest.get_timeofday()) if experimental.day then - minetest.log("forcing day->night") + minetest.log("verbose", "forcing day->night") experimental.day = false minetest.set_timeofday(0.0) else - minetest.log("forcing night->day") + minetest.log("verbose", "forcing night->day") experimental.day = true minetest.set_timeofday(0.5) end - minetest.log("time of day is "..minetest.get_timeofday()) + minetest.log("verbose", "time of day is "..minetest.get_timeofday()) end --]] end @@ -228,7 +228,7 @@ minetest.register_entity("experimental:dummyball", { phasetimer = 0, on_activate = function(self, staticdata) - minetest.log("Dummyball activated!") + minetest.log("action", "Dummyball activated!") end, on_step = function(self, dtime) @@ -750,24 +750,45 @@ minetest.register_chatcommand("bench_bulk_set_node", { end, }) +local formspec_test_active = false + minetest.register_on_player_receive_fields(function(player, formname, fields) - experimental.print_to_everything("Inventory fields 1: player="..player:get_player_name()..", fields="..dump(fields)) + if formspec_test_active then + experimental.print_to_everything("Inventory fields 1: player="..player:get_player_name()..", fields="..dump(fields)) + end end) minetest.register_on_player_receive_fields(function(player, formname, fields) - experimental.print_to_everything("Inventory fields 2: player="..player:get_player_name()..", fields="..dump(fields)) - return true -- Disable the first callback + if formspec_test_active then + experimental.print_to_everything("Inventory fields 2: player="..player:get_player_name()..", fields="..dump(fields)) + return true -- Disable the first callback + end end) minetest.register_on_player_receive_fields(function(player, formname, fields) - experimental.print_to_everything("Inventory fields 3: player="..player:get_player_name()..", fields="..dump(fields)) + if formspec_test_active then + experimental.print_to_everything("Inventory fields 3: player="..player:get_player_name()..", fields="..dump(fields)) + end end) -minetest.log("experimental modname="..dump(minetest.get_current_modname())) -minetest.log("experimental modpath="..dump(minetest.get_modpath("experimental"))) -minetest.log("experimental worldpath="..dump(minetest.get_worldpath())) +minetest.register_chatcommand("test_formspec", { + param = "", + description = "Test 4: Toggle formspec test", + func = function(name, param) + formspec_test_active = not formspec_test_active + if formspec_test_active then + minetest.chat_send_player(name, "Formspec test enabled!") + else + minetest.chat_send_player(name, "Formspec test disabled!") + end + end +}) + +minetest.log("info", "experimental modname="..dump(minetest.get_current_modname())) +minetest.log("info", "experimental modpath="..dump(minetest.get_modpath("experimental"))) +minetest.log("info", "experimental worldpath="..dump(minetest.get_worldpath())) core.register_on_mods_loaded(function() - core.log("Yeah experimental loaded mods.") + core.log("action", "Yeah experimental loaded mods.") end) -- END |