aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods
diff options
context:
space:
mode:
authorMinetest-j45 <55553015+Minetest-j45@users.noreply.github.com>2021-08-30 15:22:40 +0100
committerGitHub <noreply@github.com>2021-08-30 15:22:40 +0100
commit7824a4956bf489b4e2cc35e0c97272eee06be6ba (patch)
tree70243765dc1743a83596f9c6eec122fb417ef92c /games/devtest/mods
parent607add326feb44e078b843464ce4a8de09f28743 (diff)
parent35445d24f425c6291a0580b468919ca83de716fd (diff)
downloaddragonfireclient-7824a4956bf489b4e2cc35e0c97272eee06be6ba.tar.xz
Merge pull request #1 from EliasFleckenstein03/master
update
Diffstat (limited to 'games/devtest/mods')
-rw-r--r--games/devtest/mods/basenodes/init.lua36
-rw-r--r--games/devtest/mods/basenodes/textures/default_dirt.pngbin790 -> 7303 bytes
-rw-r--r--games/devtest/mods/basenodes/textures/dirt_with_grass/info.txt3
-rw-r--r--games/devtest/mods/basenodes/textures/info.txt7
-rw-r--r--games/devtest/mods/chest/init.lua16
-rw-r--r--games/devtest/mods/experimental/commands.lua10
-rw-r--r--games/devtest/mods/soundstuff/init.lua11
-rw-r--r--games/devtest/mods/testentities/visuals.lua16
-rw-r--r--games/devtest/mods/testformspec/formspec.lua71
-rw-r--r--games/devtest/mods/testnodes/drawtypes.lua211
-rw-r--r--games/devtest/mods/testnodes/liquids.lua16
-rw-r--r--games/devtest/mods/testnodes/properties.lua6
-rw-r--r--games/devtest/mods/testnodes/settingtypes.txt4
-rw-r--r--games/devtest/mods/testnodes/textures.lua65
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_height_pyramid.pngbin90 -> 0 bytes
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_height_pyramid_normal.pngbin239 -> 0 bytes
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_parallax_extruded.pngbin591 -> 0 bytes
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_parallax_extruded_normal.pngbin143 -> 0 bytes
-rw-r--r--games/devtest/mods/testtools/README.md21
-rw-r--r--games/devtest/mods/testtools/init.lua196
-rw-r--r--games/devtest/mods/testtools/light.lua31
-rw-r--r--games/devtest/mods/testtools/textures/testtools_children_getter.pngbin0 -> 281 bytes
-rw-r--r--games/devtest/mods/testtools/textures/testtools_node_meta_editor.pngbin0 -> 135 bytes
-rw-r--r--games/devtest/mods/unittests/itemdescription.lua11
-rw-r--r--games/devtest/mods/unittests/mod.conf1
-rw-r--r--games/devtest/mods/unittests/textures/default_dirt.pngbin0 -> 790 bytes
26 files changed, 502 insertions, 230 deletions
diff --git a/games/devtest/mods/basenodes/init.lua b/games/devtest/mods/basenodes/init.lua
index 0cb85d808..2c808c35e 100644
--- a/games/devtest/mods/basenodes/init.lua
+++ b/games/devtest/mods/basenodes/init.lua
@@ -1,4 +1,4 @@
-local WATER_ALPHA = 160
+local WATER_ALPHA = "^[opacity:" .. 160
local WATER_VISC = 1
local LAVA_VISC = 7
@@ -128,12 +128,12 @@ minetest.register_node("basenodes:water_source", {
"Drowning damage: 1",
drawtype = "liquid",
waving = 3,
- tiles = {"default_water.png"},
+ tiles = {"default_water.png"..WATER_ALPHA},
special_tiles = {
- {name = "default_water.png", backface_culling = false},
- {name = "default_water.png", backface_culling = true},
+ {name = "default_water.png"..WATER_ALPHA, backface_culling = false},
+ {name = "default_water.png"..WATER_ALPHA, backface_culling = true},
},
- alpha = WATER_ALPHA,
+ use_texture_alpha = "blend",
paramtype = "light",
walkable = false,
pointable = false,
@@ -156,10 +156,12 @@ minetest.register_node("basenodes:water_flowing", {
waving = 3,
tiles = {"default_water_flowing.png"},
special_tiles = {
- {name = "default_water_flowing.png", backface_culling = false},
- {name = "default_water_flowing.png", backface_culling = false},
+ {name = "default_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ {name = "default_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
},
- alpha = WATER_ALPHA,
+ use_texture_alpha = "blend",
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
@@ -181,12 +183,12 @@ minetest.register_node("basenodes:river_water_source", {
"Drowning damage: 1",
drawtype = "liquid",
waving = 3,
- tiles = { "default_river_water.png" },
+ tiles = { "default_river_water.png"..WATER_ALPHA },
special_tiles = {
- {name = "default_river_water.png", backface_culling = false},
- {name = "default_river_water.png", backface_culling = true},
+ {name = "default_river_water.png"..WATER_ALPHA, backface_culling = false},
+ {name = "default_river_water.png"..WATER_ALPHA, backface_culling = true},
},
- alpha = WATER_ALPHA,
+ use_texture_alpha = "blend",
paramtype = "light",
walkable = false,
pointable = false,
@@ -209,12 +211,14 @@ minetest.register_node("basenodes:river_water_flowing", {
"Drowning damage: 1",
drawtype = "flowingliquid",
waving = 3,
- tiles = {"default_river_water_flowing.png"},
+ tiles = {"default_river_water_flowing.png"..WATER_ALPHA},
special_tiles = {
- {name = "default_river_water_flowing.png", backface_culling = false},
- {name = "default_river_water_flowing.png", backface_culling = false},
+ {name = "default_river_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
+ {name = "default_river_water_flowing.png"..WATER_ALPHA,
+ backface_culling = false},
},
- alpha = WATER_ALPHA,
+ use_texture_alpha = "blend",
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
diff --git a/games/devtest/mods/basenodes/textures/default_dirt.png b/games/devtest/mods/basenodes/textures/default_dirt.png
index 58670305d..aa75bffb6 100644
--- a/games/devtest/mods/basenodes/textures/default_dirt.png
+++ b/games/devtest/mods/basenodes/textures/default_dirt.png
Binary files differ
diff --git a/games/devtest/mods/basenodes/textures/dirt_with_grass/info.txt b/games/devtest/mods/basenodes/textures/dirt_with_grass/info.txt
deleted file mode 100644
index 8db21ed9c..000000000
--- a/games/devtest/mods/basenodes/textures/dirt_with_grass/info.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This is for testing loading textures from subfolders.
-If it works correctly, the default_grass_side.png file in this folder is used but
-default_grass.png is not overwritten by the file in this folder.
diff --git a/games/devtest/mods/basenodes/textures/info.txt b/games/devtest/mods/basenodes/textures/info.txt
new file mode 100644
index 000000000..2d4ef7efa
--- /dev/null
+++ b/games/devtest/mods/basenodes/textures/info.txt
@@ -0,0 +1,7 @@
+
+The dirt_with_grass folder is for testing loading textures from subfolders.
+If it works correctly, the default_grass_side.png file in the folder is used but
+default_grass.png is not overwritten by the file in the folder.
+
+default_dirt.png should be overwritten by the default_dirt.png in the unittests
+mod which depends on basenodes.
diff --git a/games/devtest/mods/chest/init.lua b/games/devtest/mods/chest/init.lua
index fc92bfdd1..5798c13e7 100644
--- a/games/devtest/mods/chest/init.lua
+++ b/games/devtest/mods/chest/init.lua
@@ -23,6 +23,18 @@ minetest.register_node("chest:chest", {
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
+ allow_metadata_inventory_put = function(pos, listname, index, stack, player)
+ minetest.chat_send_player(player:get_player_name(), "Allow put: " .. stack:to_string())
+ return stack:get_count()
+ end,
+ allow_metadata_inventory_take = function(pos, listname, index, stack, player)
+ minetest.chat_send_player(player:get_player_name(), "Allow take: " .. stack:to_string())
+ return stack:get_count()
+ end,
+ on_metadata_inventory_put = function(pos, listname, index, stack, player)
+ minetest.chat_send_player(player:get_player_name(), "On put: " .. stack:to_string())
+ end,
+ on_metadata_inventory_take = function(pos, listname, index, stack, player)
+ minetest.chat_send_player(player:get_player_name(), "On take: " .. stack:to_string())
+ end,
})
-
-
diff --git a/games/devtest/mods/experimental/commands.lua b/games/devtest/mods/experimental/commands.lua
index 132b08b0b..e42ae954d 100644
--- a/games/devtest/mods/experimental/commands.lua
+++ b/games/devtest/mods/experimental/commands.lua
@@ -131,10 +131,11 @@ local function place_nodes(param)
p2_max = 63
elseif def.paramtype2 == "leveled" then
p2_max = 127
- elseif def.paramtype2 == "degrotate" and def.drawtype == "plantlike" then
- p2_max = 179
+ elseif def.paramtype2 == "degrotate" and (def.drawtype == "plantlike" or def.drawtype == "mesh") then
+ p2_max = 239
elseif def.paramtype2 == "colorfacedir" or
def.paramtype2 == "colorwallmounted" or
+ def.paramtype2 == "colordegrotate" or
def.paramtype2 == "color" then
p2_max = 255
end
@@ -143,7 +144,8 @@ local function place_nodes(param)
-- Skip undefined param2 values
if not ((def.paramtype2 == "meshoptions" and p2 % 8 > 4) or
(def.paramtype2 == "colorwallmounted" and p2 % 8 > 5) or
- (def.paramtype2 == "colorfacedir" and p2 % 32 > 23)) then
+ ((def.paramtype2 == "colorfacedir" or def.paramtype2 == "colordegrotate")
+ and p2 % 32 > 23)) then
minetest.set_node(pos, { name = itemstring, param2 = p2 })
nodes_placed = nodes_placed + 1
@@ -215,5 +217,5 @@ minetest.register_chatcommand("test_place_nodes", {
})
core.register_on_chatcommand(function(name, command, params)
- minetest.log("caught command '"..command.."', issued by '"..name.."'. Parameters: '"..params.."'")
+ minetest.log("action", "caught command '"..command.."', issued by '"..name.."'. Parameters: '"..params.."'")
end)
diff --git a/games/devtest/mods/soundstuff/init.lua b/games/devtest/mods/soundstuff/init.lua
index 40ad8f562..b263a3f35 100644
--- a/games/devtest/mods/soundstuff/init.lua
+++ b/games/devtest/mods/soundstuff/init.lua
@@ -60,11 +60,13 @@ minetest.register_node("soundstuff:footstep_liquid", {
description = "Liquid Footstep Sound Node",
drawtype = "liquid",
tiles = {
- "soundstuff_node_sound.png^[colorize:#0000FF:127",
+ "soundstuff_node_sound.png^[colorize:#0000FF:127^[opacity:190",
},
special_tiles = {
- {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = false},
- {name = "soundstuff_node_sound.png^[colorize:#0000FF:127", backface_culling = true},
+ {name = "soundstuff_node_sound.png^[colorize:#0000FF:127^[opacity:190",
+ backface_culling = false},
+ {name = "soundstuff_node_sound.png^[colorize:#0000FF:127^[opacity:190",
+ backface_culling = true},
},
liquids_pointable = true,
liquidtype = "source",
@@ -73,7 +75,7 @@ minetest.register_node("soundstuff:footstep_liquid", {
liquid_renewable = false,
liquid_range = 0,
liquid_viscosity = 0,
- alpha = 190,
+ use_texture_alpha = "blend",
paramtype = "light",
walkable = false,
pointable = false,
@@ -92,7 +94,6 @@ minetest.register_node("soundstuff:footstep_climbable", {
tiles = {
"soundstuff_node_climbable.png",
},
- alpha = 120,
paramtype = "light",
sunlight_propagates = true,
walkable = false,
diff --git a/games/devtest/mods/testentities/visuals.lua b/games/devtest/mods/testentities/visuals.lua
index e3b758329..e382ec44c 100644
--- a/games/devtest/mods/testentities/visuals.lua
+++ b/games/devtest/mods/testentities/visuals.lua
@@ -103,23 +103,35 @@ minetest.register_entity("testentities:nametag", {
on_activate = function(self, staticdata)
if staticdata ~= "" then
- self.color = minetest.deserialize(staticdata).color
+ local data = minetest.deserialize(staticdata)
+ self.color = data.color
+ self.bgcolor = data.bgcolor
else
self.color = {
r = math.random(0, 255),
g = math.random(0, 255),
b = math.random(0, 255),
}
+
+ if math.random(0, 10) > 5 then
+ self.bgcolor = {
+ r = math.random(0, 255),
+ g = math.random(0, 255),
+ b = math.random(0, 255),
+ a = math.random(0, 255),
+ }
+ end
end
assert(self.color)
self.object:set_properties({
nametag = tostring(math.random(1000, 10000)),
nametag_color = self.color,
+ nametag_bgcolor = self.bgcolor,
})
end,
get_staticdata = function(self)
- return minetest.serialize({ color = self.color })
+ return minetest.serialize({ color = self.color, bgcolor = self.bgcolor })
end,
})
diff --git a/games/devtest/mods/testformspec/formspec.lua b/games/devtest/mods/testformspec/formspec.lua
index 5495896ce..501b5e354 100644
--- a/games/devtest/mods/testformspec/formspec.lua
+++ b/games/devtest/mods/testformspec/formspec.lua
@@ -33,6 +33,34 @@ local tabheaders_fs = [[
tabheader[8,6;10,1.5;tabs_size2;Height=1.5;1;false;false]
]]
+local inv_style_fs = [[
+ style_type[list;noclip=true]
+ list[current_player;main;-0.75,0.75;2,2]
+
+ real_coordinates[false]
+ list[current_player;main;1.5,0;3,2]
+ real_coordinates[true]
+
+ real_coordinates[false]
+ style_type[list;size=1.1;spacing=0.1]
+ list[current_player;main;5,0;3,2]
+ real_coordinates[true]
+
+ style_type[list;size=.001;spacing=0]
+ list[current_player;main;7,3.5;8,4]
+
+ box[3,3.5;1,1;#000000]
+ box[5,3.5;1,1;#000000]
+ box[4,4.5;1,1;#000000]
+ box[3,5.5;1,1;#000000]
+ box[5,5.5;1,1;#000000]
+ style_type[list;spacing=.25,.125;size=.75,.875]
+ list[current_player;main;3,3.5;3,3]
+
+ style_type[list;spacing=0;size=1.1]
+ list[current_player;main;.5,7;8,4]
+]]
+
local hypertext_basic = [[
<bigger>Normal test</bigger>
This is a normal text.
@@ -199,6 +227,7 @@ local scroll_fs =
"box[1,1;8,6;#00aa]"..
"scroll_container[1,1;8,6;scrbar;vertical]"..
"button[0,1;1,1;lorem;Lorem]"..
+ "animated_image[0,1;4.5,1;clip_animated_image;testformspec_animation.png;4;100]" ..
"button[0,10;1,1;ipsum;Ipsum]"..
"pwdfield[2,2;1,1;lorem2;Lorem]"..
"list[current_player;main;4,4;1,5;]"..
@@ -211,6 +240,8 @@ local scroll_fs =
"tooltip[0,11;3,2;Buz;#f00;#000]"..
"box[0,11;3,2;#00ff00]"..
"hypertext[3,13;3,3;;" .. hypertext_basic .. "]" ..
+ "hypertext[3,17;3,3;;Hypertext with no scrollbar\\; the scroll container should scroll.]" ..
+ "textarea[3,21;3,1;textarea;;More scroll within scroll]" ..
"container[0,18]"..
"box[1,2;3,2;#0a0a]"..
"scroll_container[1,2;3,2;scrbar2;horizontal;0.06]"..
@@ -310,6 +341,9 @@ local pages = {
"size[12,13]real_coordinates[true]" ..
"container[0.5,1.5]" .. tabheaders_fs .. "container_end[]",
+ -- Inv
+ "size[12,13]real_coordinates[true]" .. inv_style_fs,
+
-- Animation
[[
formspec_version[3]
@@ -328,20 +362,51 @@ Number]
animated_image[5.5,0.5;5,2;;testformspec_animation.png;4;100]
animated_image[5.5,2.75;5,2;;testformspec_animation.jpg;4;100]
+ ]],
+
+ -- Model
+ [[
+ formspec_version[3]
+ size[12,13]
style[m1;bgcolor=black]
- model[0.5,6;4,4;m1;testformspec_character.b3d;testformspec_character.png]
- model[5,6;4,4;m2;testformspec_chest.obj;default_chest_top.png,default_chest_top.png,default_chest_side.png,default_chest_side.png,default_chest_front.png,default_chest_inside.png;30,1;true;true]
+ style[m2;bgcolor=black]
+ label[5,1;all defaults]
+ label[5,5.1;angle = 0, 180
+continuous = false
+mouse control = false
+frame loop range = 0,30]
+ label[5,9.2;continuous = true
+mouse control = true]
+ model[0.5,0.1;4,4;m1;testformspec_character.b3d;testformspec_character.png]
+ model[0.5,4.2;4,4;m2;testformspec_character.b3d;testformspec_character.png;0,180;false;false;0,30]
+ model[0.5,8.3;4,4;m3;testformspec_chest.obj;default_chest_top.png,default_chest_top.png,default_chest_side.png,default_chest_side.png,default_chest_front.png,default_chest_inside.png;30,1;true;true]
]],
-- Scroll containers
"formspec_version[3]size[12,13]" ..
scroll_fs,
+
+ -- Sound
+ [[
+ formspec_version[3]
+ size[12,13]
+ style[snd_btn;sound=soundstuff_mono]
+ style[snd_ibtn;sound=soundstuff_mono]
+ style[snd_drp;sound=soundstuff_mono]
+ style[snd_chk;sound=soundstuff_mono]
+ style[snd_tab;sound=soundstuff_mono]
+ button[0.5,0.5;2,1;snd_btn;Sound]
+ image_button[0.5,2;2,1;testformspec_item.png;snd_ibtn;Sound]
+ dropdown[0.5,4;4;snd_drp;Sound,Two,Three;]
+ checkbox[0.5,5.5.5;snd_chk;Sound;]
+ tabheader[0.5,7;8,0.65;snd_tab;Soundtab1,Soundtab2,Soundtab3;1;false;false]
+ ]],
}
local function show_test_formspec(pname, page_id)
page_id = page_id or 2
- local fs = pages[page_id] .. "tabheader[0,0;8,0.65;maintabs;Real Coord,Styles,Noclip,Hypertext,Tabs,Anim,ScrollC;" .. page_id .. ";false;false]"
+ local fs = pages[page_id] .. "tabheader[0,0;8,0.65;maintabs;Real Coord,Styles,Noclip,Hypertext,Tabs,Invs,Anim,Model,ScrollC,Sound;" .. page_id .. ";false;false]"
minetest.show_formspec(pname, "testformspec:formspec", fs)
end
diff --git a/games/devtest/mods/testnodes/drawtypes.lua b/games/devtest/mods/testnodes/drawtypes.lua
index b3ab2b322..2bc7ec2e3 100644
--- a/games/devtest/mods/testnodes/drawtypes.lua
+++ b/games/devtest/mods/testnodes/drawtypes.lua
@@ -15,22 +15,6 @@ testing this node easier and more convenient.
local S = minetest.get_translator("testnodes")
--- If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0.
--- This is due to <https://github.com/minetest/minetest/issues/9209>.
--- This is only added to make the items more visible to avoid confusion, but you will no longer see
--- the default inventory images for these items. When you want to test the default inventory image of drawtypes,
--- this should be turned off.
--- TODO: Remove support for fallback inventory image as soon #9209 is fixed.
-local SHOW_FALLBACK_IMAGE = minetest.settings:get_bool("testnodes_show_fallback_image", false)
-
-local fallback_image = function(img)
- if SHOW_FALLBACK_IMAGE then
- return img
- else
- return nil
- end
-end
-
-- A regular cube
minetest.register_node("testnodes:normal", {
description = S("Normal Drawtype Test Node"),
@@ -145,20 +129,15 @@ minetest.register_node("testnodes:fencelike", {
})
minetest.register_node("testnodes:torchlike", {
- description = S("Torchlike Drawtype Test Node"),
+ description = S("Floor Torchlike Drawtype Test Node"),
drawtype = "torchlike",
paramtype = "light",
- tiles = {
- "testnodes_torchlike_floor.png",
- "testnodes_torchlike_ceiling.png",
- "testnodes_torchlike_wall.png",
- },
+ tiles = { "testnodes_torchlike_floor.png^[colorize:#FF0000:64" },
walkable = false,
sunlight_propagates = true,
groups = { dig_immediate = 3 },
- inventory_image = fallback_image("testnodes_torchlike_floor.png"),
})
minetest.register_node("testnodes:torchlike_wallmounted", {
@@ -176,12 +155,22 @@ minetest.register_node("testnodes:torchlike_wallmounted", {
walkable = false,
sunlight_propagates = true,
groups = { dig_immediate = 3 },
- inventory_image = fallback_image("testnodes_torchlike_floor.png"),
})
+minetest.register_node("testnodes:signlike", {
+ description = S("Floor Signlike Drawtype Test Node"),
+ drawtype = "signlike",
+ paramtype = "light",
+ tiles = { "testnodes_signlike.png^[colorize:#FF0000:64" },
-minetest.register_node("testnodes:signlike", {
+ walkable = false,
+ groups = { dig_immediate = 3 },
+ sunlight_propagates = true,
+})
+
+
+minetest.register_node("testnodes:signlike_wallmounted", {
description = S("Wallmounted Signlike Drawtype Test Node"),
drawtype = "signlike",
paramtype = "light",
@@ -192,7 +181,6 @@ minetest.register_node("testnodes:signlike", {
walkable = false,
groups = { dig_immediate = 3 },
sunlight_propagates = true,
- inventory_image = fallback_image("testnodes_signlike.png"),
})
minetest.register_node("testnodes:plantlike", {
@@ -223,6 +211,30 @@ minetest.register_node("testnodes:plantlike_waving", {
-- param2 will rotate
+local function rotate_on_rightclick(pos, node, clicker)
+ local def = minetest.registered_nodes[node.name]
+ local aux1 = clicker:get_player_control().aux1
+
+ local deg, deg_max
+ local color, color_mult = 0, 0
+ if def.paramtype2 == "degrotate" then
+ deg = node.param2
+ deg_max = 240
+ elseif def.paramtype2 == "colordegrotate" then
+ -- MSB [3x color, 5x rotation] LSB
+ deg = node.param2 % 2^5
+ deg_max = 24
+ color_mult = 2^5
+ color = math.floor(node.param2 / color_mult)
+ end
+
+ deg = (deg + (aux1 and 10 or 1)) % deg_max
+ node.param2 = color * color_mult + deg
+ minetest.swap_node(pos, node)
+ minetest.chat_send_player(clicker:get_player_name(),
+ "Rotation is now " .. deg .. " / " .. deg_max)
+end
+
minetest.register_node("testnodes:plantlike_degrotate", {
description = S("Degrotate Plantlike Drawtype Test Node"),
drawtype = "plantlike",
@@ -230,12 +242,43 @@ minetest.register_node("testnodes:plantlike_degrotate", {
paramtype2 = "degrotate",
tiles = { "testnodes_plantlike_degrotate.png" },
-
+ on_rightclick = rotate_on_rightclick,
+ place_param2 = 7,
walkable = false,
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
+minetest.register_node("testnodes:mesh_degrotate", {
+ description = S("Degrotate Mesh Drawtype Test Node"),
+ drawtype = "mesh",
+ paramtype = "light",
+ paramtype2 = "degrotate",
+ mesh = "testnodes_ocorner.obj",
+ tiles = { "testnodes_mesh_stripes2.png" },
+
+ on_rightclick = rotate_on_rightclick,
+ place_param2 = 10, -- 15°
+ sunlight_propagates = true,
+ groups = { dig_immediate = 3 },
+})
+
+minetest.register_node("testnodes:mesh_colordegrotate", {
+ description = S("Color Degrotate Mesh Drawtype Test Node"),
+ drawtype = "mesh",
+ paramtype = "light",
+ paramtype2 = "colordegrotate",
+ palette = "testnodes_palette_facedir.png",
+ mesh = "testnodes_ocorner.obj",
+ tiles = { "testnodes_mesh_stripes3.png" },
+
+ on_rightclick = rotate_on_rightclick,
+ -- color index 1, 1 step (=15°) rotated
+ place_param2 = 1 * 2^5 + 1,
+ sunlight_propagates = true,
+ groups = { dig_immediate = 3 },
+})
+
-- param2 will change height
minetest.register_node("testnodes:plantlike_leveled", {
description = S("Leveled Plantlike Drawtype Test Node"),
@@ -350,68 +393,72 @@ minetest.register_node("testnodes:plantlike_rooted_degrotate", {
})
-- Demonstrative liquid nodes, source and flowing form.
-minetest.register_node("testnodes:liquid", {
- description = S("Source Liquid Drawtype Test Node"),
- drawtype = "liquid",
- paramtype = "light",
- tiles = {
- "testnodes_liquidsource.png",
- },
- special_tiles = {
- {name="testnodes_liquidsource.png", backface_culling=false},
- {name="testnodes_liquidsource.png", backface_culling=true},
- },
- use_texture_alpha = true,
-
-
- walkable = false,
- liquidtype = "source",
- liquid_range = 1,
- liquid_viscosity = 0,
- liquid_alternative_flowing = "testnodes:liquid_flowing",
- liquid_alternative_source = "testnodes:liquid",
- groups = { dig_immediate = 3 },
-})
-minetest.register_node("testnodes:liquid_flowing", {
- description = S("Flowing Liquid Drawtype Test Node"),
- drawtype = "flowingliquid",
- paramtype = "light",
- paramtype2 = "flowingliquid",
- tiles = {
- "testnodes_liquidflowing.png",
- },
- special_tiles = {
- {name="testnodes_liquidflowing.png", backface_culling=false},
- {name="testnodes_liquidflowing.png", backface_culling=false},
- },
- use_texture_alpha = true,
+-- DRAWTYPE ONLY, NO LIQUID PHYSICS!
+-- Liquid ranges 0 to 8
+for r = 0, 8 do
+ minetest.register_node("testnodes:liquid_"..r, {
+ description = S("Source Liquid Drawtype Test Node, Range @1", r),
+ drawtype = "liquid",
+ paramtype = "light",
+ tiles = {
+ "testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100",
+ },
+ special_tiles = {
+ {name="testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
+ {name="testnodes_liquidsource_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=true},
+ },
+ use_texture_alpha = "blend",
+
+
+ walkable = false,
+ liquid_range = r,
+ liquid_viscosity = 0,
+ liquid_alternative_flowing = "testnodes:liquid_flowing_"..r,
+ liquid_alternative_source = "testnodes:liquid_"..r,
+ groups = { dig_immediate = 3 },
+ })
+ minetest.register_node("testnodes:liquid_flowing_"..r, {
+ description = S("Flowing Liquid Drawtype Test Node, Range @1", r),
+ drawtype = "flowingliquid",
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ tiles = {
+ "testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100",
+ },
+ special_tiles = {
+ {name="testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
+ {name="testnodes_liquidflowing_r"..r..".png^[colorize:#FFFFFF:100", backface_culling=false},
+ },
+ use_texture_alpha = "blend",
+
+
+ walkable = false,
+ liquid_range = r,
+ liquid_viscosity = 0,
+ liquid_alternative_flowing = "testnodes:liquid_flowing_"..r,
+ liquid_alternative_source = "testnodes:liquid_"..r,
+ groups = { dig_immediate = 3 },
+ })
+end
- walkable = false,
- liquidtype = "flowing",
- liquid_range = 1,
- liquid_viscosity = 0,
- liquid_alternative_flowing = "testnodes:liquid_flowing",
- liquid_alternative_source = "testnodes:liquid",
- groups = { dig_immediate = 3 },
-})
+-- Waving liquid test (drawtype only)
minetest.register_node("testnodes:liquid_waving", {
description = S("Waving Source Liquid Drawtype Test Node"),
drawtype = "liquid",
paramtype = "light",
tiles = {
- "testnodes_liquidsource.png^[brighten",
+ "testnodes_liquidsource.png^[colorize:#0000FF:127",
},
special_tiles = {
- {name="testnodes_liquidsource.png^[brighten", backface_culling=false},
- {name="testnodes_liquidsource.png^[brighten", backface_culling=true},
+ {name="testnodes_liquidsource.png^[colorize:#0000FF:127", backface_culling=false},
+ {name="testnodes_liquidsource.png^[colorize:#0000FF:127", backface_culling=true},
},
- use_texture_alpha = true,
+ use_texture_alpha = "blend",
waving = 3,
walkable = false,
- liquidtype = "source",
liquid_range = 1,
liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquid_flowing_waving",
@@ -424,18 +471,17 @@ minetest.register_node("testnodes:liquid_flowing_waving", {
paramtype = "light",
paramtype2 = "flowingliquid",
tiles = {
- "testnodes_liquidflowing.png^[brighten",
+ "testnodes_liquidflowing.png^[colorize:#0000FF:127",
},
special_tiles = {
- {name="testnodes_liquidflowing.png^[brighten", backface_culling=false},
- {name="testnodes_liquidflowing.png^[brighten", backface_culling=false},
+ {name="testnodes_liquidflowing.png^[colorize:#0000FF:127", backface_culling=false},
+ {name="testnodes_liquidflowing.png^[colorize:#0000FF:127", backface_culling=false},
},
- use_texture_alpha = true,
+ use_texture_alpha = "blend",
waving = 3,
walkable = false,
- liquidtype = "flowing",
liquid_range = 1,
liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquid_flowing_waving",
@@ -443,8 +489,6 @@ minetest.register_node("testnodes:liquid_flowing_waving", {
groups = { dig_immediate = 3 },
})
-
-
-- Invisible node
minetest.register_node("testnodes:airlike", {
description = S("Airlike Drawtype Test Node"),
@@ -455,7 +499,6 @@ minetest.register_node("testnodes:airlike", {
walkable = false,
groups = { dig_immediate = 3 },
sunlight_propagates = true,
- inventory_image = fallback_image("testnodes_airlike.png"),
})
-- param2 changes liquid height
@@ -548,7 +591,7 @@ scale("plantlike",
scale("torchlike_wallmounted",
S("Double-sized Wallmounted Torchlike Drawtype Test Node"),
S("Half-sized Wallmounted Torchlike Drawtype Test Node"))
-scale("signlike",
+scale("signlike_wallmounted",
S("Double-sized Wallmounted Signlike Drawtype Test Node"),
S("Half-sized Wallmounted Signlike Drawtype Test Node"))
scale("firelike",
diff --git a/games/devtest/mods/testnodes/liquids.lua b/games/devtest/mods/testnodes/liquids.lua
index e316782ad..3d2ea17f5 100644
--- a/games/devtest/mods/testnodes/liquids.lua
+++ b/games/devtest/mods/testnodes/liquids.lua
@@ -9,11 +9,9 @@ for d=0, 8 do
{name = "testnodes_liquidsource_r"..d..".png", backface_culling = false},
{name = "testnodes_liquidsource_r"..d..".png", backface_culling = true},
},
- alpha = 192,
+ use_texture_alpha = "blend",
paramtype = "light",
walkable = false,
- pointable = false,
- diggable = false,
buildable_to = true,
is_ground_content = false,
liquidtype = "source",
@@ -30,12 +28,10 @@ for d=0, 8 do
{name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false},
{name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false},
},
- alpha = 192,
+ use_texture_alpha = "blend",
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
- pointable = false,
- diggable = false,
buildable_to = true,
is_ground_content = false,
liquidtype = "flowing",
@@ -53,11 +49,9 @@ for d=0, 8 do
{name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = false},
{name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = true},
},
- alpha = 192,
+ use_texture_alpha = "blend",
paramtype = "light",
walkable = false,
- pointable = false,
- diggable = false,
buildable_to = true,
is_ground_content = false,
liquidtype = "source",
@@ -74,12 +68,10 @@ for d=0, 8 do
{name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false},
{name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false},
},
- alpha = 192,
+ use_texture_alpha = "blend",
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
- pointable = false,
- diggable = false,
buildable_to = true,
is_ground_content = false,
liquidtype = "flowing",
diff --git a/games/devtest/mods/testnodes/properties.lua b/games/devtest/mods/testnodes/properties.lua
index 01846a5f0..a52cd1d6f 100644
--- a/games/devtest/mods/testnodes/properties.lua
+++ b/games/devtest/mods/testnodes/properties.lua
@@ -114,11 +114,10 @@ minetest.register_node("testnodes:liquid_nojump", {
{name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false},
{name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = true},
},
- use_texture_alpha = true,
+ use_texture_alpha = "blend",
paramtype = "light",
pointable = false,
liquids_pointable = true,
- diggable = false,
buildable_to = true,
is_ground_content = false,
post_effect_color = {a = 70, r = 255, g = 0, b = 200},
@@ -143,12 +142,11 @@ minetest.register_node("testnodes:liquidflowing_nojump", {
{name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
{name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
},
- use_texture_alpha = true,
+ use_texture_alpha = "blend",
paramtype = "light",
paramtype2 = "flowingliquid",
pointable = false,
liquids_pointable = true,
- diggable = false,
buildable_to = true,
is_ground_content = false,
post_effect_color = {a = 70, r = 255, g = 0, b = 200},
diff --git a/games/devtest/mods/testnodes/settingtypes.txt b/games/devtest/mods/testnodes/settingtypes.txt
deleted file mode 100644
index 7f753bf3e..000000000
--- a/games/devtest/mods/testnodes/settingtypes.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# If set to true, will show an inventory image for nodes that have no inventory image as of Minetest 5.1.0.
-# This is due to <https://github.com/minetest/minetest/issues/9209>.
-# This is only added to make the items more visible to avoid confusion, but you will no longer see the default inventory images for these items. When you want to test the default inventory image of drawtypes, this should be turned off.
-testnodes_show_fallback_image (Use fallback inventory images) bool false
diff --git a/games/devtest/mods/testnodes/textures.lua b/games/devtest/mods/testnodes/textures.lua
index e0724c229..f6e6a0c2a 100644
--- a/games/devtest/mods/testnodes/textures.lua
+++ b/games/devtest/mods/testnodes/textures.lua
@@ -46,77 +46,22 @@ for a=1,#alphas do
tiles = {
"testnodes_alpha"..alpha..".png",
},
- use_texture_alpha = true,
+ use_texture_alpha = "blend",
groups = { dig_immediate = 3 },
})
- -- Transparency set via "alpha" parameter
+ -- Transparency set via texture modifier
minetest.register_node("testnodes:alpha_"..alpha, {
description = S("Alpha Test Node (@1)", alpha),
- -- It seems that only the liquid drawtype supports the alpha parameter
- drawtype = "liquid",
+ drawtype = "glasslike",
paramtype = "light",
tiles = {
- "testnodes_alpha.png",
+ "testnodes_alpha.png^[opacity:" .. alpha,
},
- alpha = alpha,
-
+ use_texture_alpha = "blend",
- liquidtype = "source",
- liquid_range = 0,
- liquid_viscosity = 0,
- liquid_alternative_source = "testnodes:alpha_"..alpha,
- liquid_alternative_flowing = "testnodes:alpha_"..alpha,
groups = { dig_immediate = 3 },
})
end
-
--- Bumpmapping and Parallax Occlusion
-
--- This node has a normal map which corresponds to a pyramid with sides tilted
--- by an angle of 45°, i.e. the normal map contains four vectors which point
--- diagonally away from the surface (e.g. (0.7, 0.7, 0)),
--- and the heights in the height map linearly increase towards the centre,
--- so that the surface corresponds to a simple pyramid.
--- The node can help to determine if e.g. tangent space transformations work
--- correctly.
--- If, for example, the light comes from above, then the (tilted) pyramids
--- should look like they're lit from this light direction on all node faces.
--- The white albedo texture has small black indicators which can be used to see
--- how it is transformed ingame (and thus see if there's rotation around the
--- normal vector).
-minetest.register_node("testnodes:height_pyramid", {
- description = "Bumpmapping and Parallax Occlusion Tester (height pyramid)",
- tiles = {"testnodes_height_pyramid.png"},
- groups = {dig_immediate = 3},
-})
-
--- The stairs nodes should help to validate if shading works correctly for
--- rotated nodes (which have rotated textures).
-stairs.register_stair_and_slab("height_pyramid", "experimantal:height_pyramid",
- {dig_immediate = 3},
- {"testnodes_height_pyramid.png"},
- "Bumpmapping and Parallax Occlusion Tester Stair (height pyramid)",
- "Bumpmapping and Parallax Occlusion Tester Slab (height pyramid)")
-
--- This node has a simple heightmap for parallax occlusion testing and flat
--- normalmap.
--- When parallax occlusion is enabled, the yellow scrawl should stick out of
--- the texture when viewed at an angle.
-minetest.register_node("testnodes:parallax_extruded", {
- description = "Parallax Occlusion Tester",
- tiles = {"testnodes_parallax_extruded.png"},
- groups = {dig_immediate = 3},
-})
-
--- Analogously to the height pyramid stairs nodes,
--- these nodes should help to validate if parallax occlusion works correctly for
--- rotated nodes (which have rotated textures).
-stairs.register_stair_and_slab("parallax_extruded",
- "experimantal:parallax_extruded",
- {dig_immediate = 3},
- {"testnodes_parallax_extruded.png"},
- "Parallax Occlusion Tester Stair",
- "Parallax Occlusion Tester Slab")
diff --git a/games/devtest/mods/testnodes/textures/testnodes_height_pyramid.png b/games/devtest/mods/testnodes/textures/testnodes_height_pyramid.png
deleted file mode 100644
index 8c787b740..000000000
--- a/games/devtest/mods/testnodes/textures/testnodes_height_pyramid.png
+++ /dev/null
Binary files differ
diff --git a/games/devtest/mods/testnodes/textures/testnodes_height_pyramid_normal.png b/games/devtest/mods/testnodes/textures/testnodes_height_pyramid_normal.png
deleted file mode 100644
index 5ab7865f2..000000000
--- a/games/devtest/mods/testnodes/textures/testnodes_height_pyramid_normal.png
+++ /dev/null
Binary files differ
diff --git a/games/devtest/mods/testnodes/textures/testnodes_parallax_extruded.png b/games/devtest/mods/testnodes/textures/testnodes_parallax_extruded.png
deleted file mode 100644
index 7e1c32398..000000000
--- a/games/devtest/mods/testnodes/textures/testnodes_parallax_extruded.png
+++ /dev/null
Binary files differ
diff --git a/games/devtest/mods/testnodes/textures/testnodes_parallax_extruded_normal.png b/games/devtest/mods/testnodes/textures/testnodes_parallax_extruded_normal.png
deleted file mode 100644
index b134699d0..000000000
--- a/games/devtest/mods/testnodes/textures/testnodes_parallax_extruded_normal.png
+++ /dev/null
Binary files differ
diff --git a/games/devtest/mods/testtools/README.md b/games/devtest/mods/testtools/README.md
index 9cfe29ea4..a1eb95ed7 100644
--- a/games/devtest/mods/testtools/README.md
+++ b/games/devtest/mods/testtools/README.md
@@ -33,6 +33,13 @@ Usage:
* Punch node: Make it fall
* Place: Try to teleport up to 2 units upwards, then make it fall
+## Node Meta Editor
+Edit and view metadata of nodes.
+
+Usage:
+
+* Punch: Open node metadata editor
+
## Entity Rotator
Changes the entity rotation (with `set_rotation`).
@@ -90,6 +97,13 @@ Usage:
* Place: Increase move distance
* Sneak+place: Decrease move distance
+## Children Getter
+Shows list of objects that are attached to an object (aka "children") in chat.
+
+Usage:
+* Punch object: Show children of punched object
+* Punch air: Show your own children
+
## Entity Visual Scaler
Change visual size of entities
@@ -97,3 +111,10 @@ Usage:
* Punch entity to increase visual size
* Sneak+punch entity to decrease visual size
+
+## Light Tool
+Show light level of node.
+
+Usage:
+* Punch: Show light info of node in front of the punched node's side
+* Place: Show light info of the node that you touched
diff --git a/games/devtest/mods/testtools/init.lua b/games/devtest/mods/testtools/init.lua
index d578b264a..1041acdeb 100644
--- a/games/devtest/mods/testtools/init.lua
+++ b/games/devtest/mods/testtools/init.lua
@@ -3,8 +3,6 @@ local F = minetest.formspec_escape
dofile(minetest.get_modpath("testtools") .. "/light.lua")
--- TODO: Add a Node Metadata tool
-
minetest.register_tool("testtools:param2tool", {
description = S("Param2 Tool") .."\n"..
S("Modify param2 value of nodes") .."\n"..
@@ -111,25 +109,6 @@ minetest.register_tool("testtools:node_setter", {
end,
})
-minetest.register_on_player_receive_fields(function(player, formname, fields)
- if formname == "testtools:node_setter" then
- local playername = player:get_player_name()
- local witem = player:get_wielded_item()
- if witem:get_name() == "testtools:node_setter" then
- if fields.nodename and fields.param2 then
- local param2 = tonumber(fields.param2)
- if not param2 then
- return
- end
- local meta = witem:get_meta()
- meta:set_string("node", fields.nodename)
- meta:set_int("node_param2", param2)
- player:set_wielded_item(witem)
- end
- end
- end
-end)
-
minetest.register_tool("testtools:remover", {
description = S("Remover") .."\n"..
S("Punch: Remove pointed node or object"),
@@ -634,6 +613,54 @@ minetest.register_tool("testtools:object_attacher", {
end,
})
+local function print_object(obj)
+ if obj:is_player() then
+ return "player '"..obj:get_player_name().."'"
+ elseif obj:get_luaentity() then
+ return "LuaEntity '"..obj:get_luaentity().name.."'"
+ else
+ return "object"
+ end
+end
+
+minetest.register_tool("testtools:children_getter", {
+ description = S("Children Getter") .."\n"..
+ S("Shows list of objects attached to object") .."\n"..
+ S("Punch object to show its 'children'") .."\n"..
+ S("Punch air to show your own 'children'"),
+ inventory_image = "testtools_children_getter.png",
+ groups = { testtool = 1, disable_repair = 1 },
+ on_use = function(itemstack, user, pointed_thing)
+ if user and user:is_player() then
+ local name = user:get_player_name()
+ local selected_object
+ local self_name
+ if pointed_thing.type == "object" then
+ selected_object = pointed_thing.ref
+ elseif pointed_thing.type == "nothing" then
+ selected_object = user
+ else
+ return
+ end
+ self_name = print_object(selected_object)
+ local children = selected_object:get_children()
+ local ret = ""
+ for c=1, #children do
+ ret = ret .. "* " .. print_object(children[c])
+ if c < #children then
+ ret = ret .. "\n"
+ end
+ end
+ if ret == "" then
+ ret = S("No children attached to @1.", self_name)
+ else
+ ret = S("Children of @1:", self_name) .. "\n" .. ret
+ end
+ minetest.chat_send_player(user:get_player_name(), ret)
+ end
+ end,
+})
+
-- Use loadstring to parse param as a Lua value
local function use_loadstring(param, player)
-- For security reasons, require 'server' priv, just in case
@@ -666,6 +693,68 @@ local function use_loadstring(param, player)
return true, errOrResult
end
+-- Node Meta Editor
+local node_meta_posses = {}
+local node_meta_latest_keylist = {}
+
+local function show_node_meta_formspec(user, pos, key, value, keylist)
+ local textlist
+ if keylist then
+ textlist = "textlist[0,0.5;2.5,6.5;keylist;"..keylist.."]"
+ else
+ textlist = ""
+ end
+ minetest.show_formspec(user:get_player_name(),
+ "testtools:node_meta_editor",
+ "size[15,9]"..
+ "label[0,0;"..F(S("Current keys:")).."]"..
+ textlist..
+ "field[3,0.5;12,1;key;"..F(S("Key"))..";"..F(key).."]"..
+ "textarea[3,1.5;12,6;value;"..F(S("Value (use empty value to delete key)"))..";"..F(value).."]"..
+ "button[0,8;3,1;get;"..F(S("Get value")).."]"..
+ "button[4,8;3,1;set;"..F(S("Set value")).."]"..
+ "label[0,7.2;"..F(S("pos = @1", minetest.pos_to_string(pos))).."]")
+end
+
+local function get_node_meta_keylist(meta, playername, escaped)
+ local keys = {}
+ local ekeys = {}
+ local mtable = meta:to_table()
+ for k,_ in pairs(mtable.fields) do
+ table.insert(keys, k)
+ if escaped then
+ table.insert(ekeys, F(k))
+ else
+ table.insert(ekeys, k)
+ end
+ end
+ if playername then
+ node_meta_latest_keylist[playername] = keys
+ end
+ return table.concat(ekeys, ",")
+end
+
+minetest.register_tool("testtools:node_meta_editor", {
+ description = S("Node Meta Editor") .. "\n" ..
+ S("Place: Edit node metadata"),
+ inventory_image = "testtools_node_meta_editor.png",
+ groups = { testtool = 1, disable_repair = 1 },
+ on_place = function(itemstack, user, pointed_thing)
+ if pointed_thing.type ~= "node" then
+ return itemstack
+ end
+ if not user:is_player() then
+ return itemstack
+ end
+ local pos = pointed_thing.under
+ node_meta_posses[user:get_player_name()] = pos
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ show_node_meta_formspec(user, pos, "", "", get_node_meta_keylist(meta, user:get_player_name(), true))
+ return itemstack
+ end,
+})
+
minetest.register_on_player_receive_fields(function(player, formname, fields)
if not (player and player:is_player()) then
return
@@ -728,5 +817,70 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
editor_formspec(name, selected_objects[name], prop_to_string(props[key]), sel)
return
end
+ elseif formname == "testtools:node_setter" then
+ local playername = player:get_player_name()
+ local witem = player:get_wielded_item()
+ if witem:get_name() == "testtools:node_setter" then
+ if fields.nodename and fields.param2 then
+ local param2 = tonumber(fields.param2)
+ if not param2 then
+ return
+ end
+ local meta = witem:get_meta()
+ meta:set_string("node", fields.nodename)
+ meta:set_int("node_param2", param2)
+ player:set_wielded_item(witem)
+ end
+ end
+ elseif formname == "testtools:node_meta_editor" then
+ local name = player:get_player_name()
+ local pos = node_meta_posses[name]
+ if fields.keylist then
+ local evnt = minetest.explode_textlist_event(fields.keylist)
+ if evnt.type == "DCL" or evnt.type == "CHG" then
+ local keylist_table = node_meta_latest_keylist[name]
+ if not pos then
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if not keylist_table then
+ return
+ end
+ if #keylist_table == 0 then
+ return
+ end
+ local key = keylist_table[evnt.index]
+ local value = meta:get_string(key)
+ local keylist_escaped = {}
+ for k,v in pairs(keylist_table) do
+ keylist_escaped[k] = F(v)
+ end
+ local keylist = table.concat(keylist_escaped, ",")
+ show_node_meta_formspec(player, pos, key, value, keylist)
+ return
+ end
+ elseif fields.key and fields.key ~= "" and fields.value then
+ if not pos then
+ return
+ end
+ local meta = minetest.get_meta(pos)
+ if fields.get then
+ local value = meta:get_string(fields.key)
+ show_node_meta_formspec(player, pos, fields.key, value,
+ get_node_meta_keylist(meta, name, true))
+ return
+ elseif fields.set then
+ meta:set_string(fields.key, fields.value)
+ show_node_meta_formspec(player, pos, fields.key, fields.value,
+ get_node_meta_keylist(meta, name, true))
+ return
+ end
+ end
end
end)
+
+minetest.register_on_leaveplayer(function(player)
+ local name = player:get_player_name()
+ node_meta_latest_keylist[name] = nil
+ node_meta_posses[name] = nil
+end)
diff --git a/games/devtest/mods/testtools/light.lua b/games/devtest/mods/testtools/light.lua
index a9458ca6b..afca9a489 100644
--- a/games/devtest/mods/testtools/light.lua
+++ b/games/devtest/mods/testtools/light.lua
@@ -1,22 +1,37 @@
local S = minetest.get_translator("testtools")
-minetest.register_tool("testtools:lighttool", {
- description = S("Light tool"),
- inventory_image = "testtools_lighttool.png",
- groups = { testtool = 1, disable_repair = 1 },
- on_use = function(itemstack, user, pointed_thing)
- local pos = pointed_thing.above
+local function get_func(is_place)
+ return function(itemstack, user, pointed_thing)
+ local pos
+ if is_place then
+ pos = pointed_thing.under
+ else
+ pos = pointed_thing.above
+ end
if pointed_thing.type ~= "node" or not pos then
return
end
local node = minetest.get_node(pos)
+ local pstr = minetest.pos_to_string(pos)
local time = minetest.get_timeofday()
local sunlight = minetest.get_natural_light(pos)
local artificial = minetest.get_artificial_light(node.param1)
- local message = ("param1 0x%02x | time %.5f | sunlight %d | artificial %d")
- :format(node.param1, time, sunlight, artificial)
+ local message = ("pos=%s | param1=0x%02x | " ..
+ "sunlight=%d | artificial=%d | timeofday=%.5f" )
+ :format(pstr, node.param1, sunlight, artificial, time)
minetest.chat_send_player(user:get_player_name(), message)
end
+end
+
+minetest.register_tool("testtools:lighttool", {
+ description = S("Light Tool") .. "\n" ..
+ S("Show light values of node") .. "\n" ..
+ S("Punch: Light of node above touched node") .. "\n" ..
+ S("Place: Light of touched node itself"),
+ inventory_image = "testtools_lighttool.png",
+ groups = { testtool = 1, disable_repair = 1 },
+ on_use = get_func(false),
+ on_place = get_func(true),
})
diff --git a/games/devtest/mods/testtools/textures/testtools_children_getter.png b/games/devtest/mods/testtools/textures/testtools_children_getter.png
new file mode 100644
index 000000000..b7fa34025
--- /dev/null
+++ b/games/devtest/mods/testtools/textures/testtools_children_getter.png
Binary files differ
diff --git a/games/devtest/mods/testtools/textures/testtools_node_meta_editor.png b/games/devtest/mods/testtools/textures/testtools_node_meta_editor.png
new file mode 100644
index 000000000..89eafd65c
--- /dev/null
+++ b/games/devtest/mods/testtools/textures/testtools_node_meta_editor.png
Binary files differ
diff --git a/games/devtest/mods/unittests/itemdescription.lua b/games/devtest/mods/unittests/itemdescription.lua
index 1d0826545..d6ee6551a 100644
--- a/games/devtest/mods/unittests/itemdescription.lua
+++ b/games/devtest/mods/unittests/itemdescription.lua
@@ -26,15 +26,22 @@ minetest.register_chatcommand("item_description", {
})
function unittests.test_short_desc()
+ local function get_short_description(item)
+ return ItemStack(item):get_short_description()
+ end
+
local stack = ItemStack("unittests:colorful_pick")
assert(stack:get_short_description() == "Colorful Pickaxe")
- assert(stack:get_short_description() == minetest.registered_items["unittests:colorful_pick"].short_description)
+ assert(get_short_description("unittests:colorful_pick") == "Colorful Pickaxe")
+ assert(minetest.registered_items["unittests:colorful_pick"].short_description == nil)
assert(stack:get_description() == full_description)
assert(stack:get_description() == minetest.registered_items["unittests:colorful_pick"].description)
stack:get_meta():set_string("description", "Hello World")
- assert(stack:get_short_description() == "Colorful Pickaxe")
+ assert(stack:get_short_description() == "Hello World")
assert(stack:get_description() == "Hello World")
+ assert(get_short_description(stack) == "Hello World")
+ assert(get_short_description("unittests:colorful_pick") == "Colorful Pickaxe")
stack:get_meta():set_string("short_description", "Foo Bar")
assert(stack:get_short_description() == "Foo Bar")
diff --git a/games/devtest/mods/unittests/mod.conf b/games/devtest/mods/unittests/mod.conf
index 0d5e3c959..fa94e01a6 100644
--- a/games/devtest/mods/unittests/mod.conf
+++ b/games/devtest/mods/unittests/mod.conf
@@ -1,2 +1,3 @@
name = unittests
description = Adds automated unit tests for the engine
+depends = basenodes
diff --git a/games/devtest/mods/unittests/textures/default_dirt.png b/games/devtest/mods/unittests/textures/default_dirt.png
new file mode 100644
index 000000000..58670305d
--- /dev/null
+++ b/games/devtest/mods/unittests/textures/default_dirt.png
Binary files differ