Add testblock
This commit is contained in:
parent
493422fb1b
commit
1652b154b4
43
.test/testblock.lua
Normal file
43
.test/testblock.lua
Normal 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,
|
||||||
|
})
|
||||||
|
|
1
init.lua
1
init.lua
@ -315,6 +315,7 @@ if techage.recipe_checker_enabled then
|
|||||||
dofile(MP.."/recipe_checker.lua")
|
dofile(MP.."/recipe_checker.lua")
|
||||||
end
|
end
|
||||||
dofile(MP.."/.test/sink.lua")
|
dofile(MP.."/.test/sink.lua")
|
||||||
|
dofile(MP.."/.test/testblock.lua")
|
||||||
|
|
||||||
-- Solar
|
-- Solar
|
||||||
dofile(MP.."/solar/minicell.lua")
|
dofile(MP.."/solar/minicell.lua")
|
||||||
|
Loading…
Reference in New Issue
Block a user