Add testblock

master
Joachim Stolberg 2022-08-05 17:48:47 +02:00
parent 493422fb1b
commit 1652b154b4
2 changed files with 44 additions and 0 deletions

43
.test/testblock.lua Normal file
View File

@ -0,0 +1,43 @@
local M = minetest.get_meta
minetest.register_node("techage:testblock", {
description = "Testblock",
tiles = {
"techage_top_ta4.png",
"techage_filling_ta4.png^techage_frame_ta4.png",
},
paramtype2 = "facedir",
groups = {cracky=2, crumbly=2, choppy=2},
is_ground_content = false,
after_place_node = function(pos, placer)
local nvm = techage.get_nvm(pos)
nvm.test_val = 1
M(pos):set_int("test_val", 1)
M(pos):set_string("infotext", "Value = " .. 1)
end,
})
minetest.register_lbm({
label = "Update testblock",
name = "techage:update_testblock",
nodenames = {
"techage:testblock",
},
run_at_every_load = true,
action = function(pos, node)
local nvm = techage.get_nvm(pos)
if M(pos):get_int("test_val") == nvm.test_val then
nvm.test_val = nvm.test_val + 1
M(pos):set_int("test_val", nvm.test_val)
M(pos):set_string("infotext", "Value = " .. nvm.test_val)
else
minetest.log("error", "[techage] Memory error at " .. minetest.pos_to_string(pos))
M(pos):set_string("infotext", "Error")
end
end,
})

View File

@ -315,6 +315,7 @@ if techage.recipe_checker_enabled then
dofile(MP.."/recipe_checker.lua")
end
dofile(MP.."/.test/sink.lua")
dofile(MP.."/.test/testblock.lua")
-- Solar
dofile(MP.."/solar/minicell.lua")