aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods/testnodes
diff options
context:
space:
mode:
Diffstat (limited to 'games/devtest/mods/testnodes')
-rw-r--r--games/devtest/mods/testnodes/drawtypes.lua130
-rw-r--r--games/devtest/mods/testnodes/liquids.lua55
-rw-r--r--games/devtest/mods/testnodes/properties.lua108
-rw-r--r--games/devtest/mods/testnodes/settingtypes.txt4
-rw-r--r--games/devtest/mods/testnodes/textures.lua106
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_climbable_resistance_side.pngbin0 -> 295 bytes
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_move_resistance.pngbin0 -> 221 bytes
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_wallmounted.pngbin0 -> 224 bytes
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_wallmounted.pngbin0 -> 268 bytes
-rw-r--r--games/devtest/mods/testnodes/textures/testnodes_plantlike_wallmounted.pngbin0 -> 268 bytes
10 files changed, 368 insertions, 35 deletions
diff --git a/games/devtest/mods/testnodes/drawtypes.lua b/games/devtest/mods/testnodes/drawtypes.lua
index ff970144d..208774f6c 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", {
@@ -220,9 +208,46 @@ minetest.register_node("testnodes:plantlike_waving", {
groups = { dig_immediate = 3 },
})
+minetest.register_node("testnodes:plantlike_wallmounted", {
+ description = S("Wallmounted Plantlike Drawtype Test Node"),
+ drawtype = "plantlike",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ tiles = { "testnodes_plantlike_wallmounted.png" },
+ leveled = 1,
+
+
+ walkable = false,
+ sunlight_propagates = true,
+ groups = { dig_immediate = 3 },
+})
-- 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 +255,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"),
@@ -277,6 +333,20 @@ minetest.register_node("testnodes:plantlike_rooted", {
groups = { dig_immediate = 3 },
})
+minetest.register_node("testnodes:plantlike_rooted_wallmounted", {
+ description = S("Wallmounted Rooted Plantlike Drawtype Test Node"),
+ drawtype = "plantlike_rooted",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ tiles = {
+ "testnodes_plantlike_rooted_base.png",
+ "testnodes_plantlike_rooted_base.png",
+ "testnodes_plantlike_rooted_base_side_wallmounted.png" },
+ special_tiles = { "testnodes_plantlike_rooted_wallmounted.png" },
+
+ groups = { dig_immediate = 3 },
+})
+
minetest.register_node("testnodes:plantlike_rooted_waving", {
description = S("Waving Rooted Plantlike Drawtype Test Node"),
drawtype = "plantlike_rooted",
@@ -456,7 +526,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
@@ -546,10 +615,13 @@ scale("allfaces_optional_waving",
scale("plantlike",
S("Double-sized Plantlike Drawtype Test Node"),
S("Half-sized Plantlike Drawtype Test Node"))
+scale("plantlike_wallmounted",
+ S("Double-sized Wallmounted Plantlike Drawtype Test Node"),
+ S("Half-sized Wallmounted Plantlike Drawtype Test Node"))
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 3d2ea17f5..be33814af 100644
--- a/games/devtest/mods/testnodes/liquids.lua
+++ b/games/devtest/mods/testnodes/liquids.lua
@@ -40,9 +40,11 @@ for d=0, 8 do
liquid_range = d,
})
+ if d <= 7 then
+
local mod = "^[colorize:#000000:127"
minetest.register_node("testnodes:vliquid_"..d, {
- description = "Test Liquid Source, Viscosity "..d,
+ description = "Test Liquid Source, Viscosity/Resistance "..d,
drawtype = "liquid",
tiles = {"testnodes_liquidsource_r"..d..".png"..mod},
special_tiles = {
@@ -61,7 +63,7 @@ for d=0, 8 do
})
minetest.register_node("testnodes:vliquid_flowing_"..d, {
- description = "Flowing Test Liquid, Viscosity "..d,
+ description = "Flowing Test Liquid, Viscosity/Resistance "..d,
drawtype = "flowingliquid",
tiles = {"testnodes_liquidflowing_r"..d..".png"..mod},
special_tiles = {
@@ -80,4 +82,53 @@ for d=0, 8 do
liquid_viscosity = d,
})
+ mod = "^[colorize:#000000:192"
+ local v = 4
+ minetest.register_node("testnodes:vrliquid_"..d, {
+ description = "Test Liquid Source, Viscosity "..v..", Resistance "..d,
+ drawtype = "liquid",
+ tiles = {"testnodes_liquidsource_r"..d..".png"..mod},
+ special_tiles = {
+ {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = false},
+ {name = "testnodes_liquidsource_r"..d..".png"..mod, backface_culling = true},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ liquidtype = "source",
+ liquid_alternative_flowing = "testnodes:vrliquid_flowing_"..d,
+ liquid_alternative_source = "testnodes:vrliquid_"..d,
+ liquid_viscosity = v,
+ move_resistance = d,
+ })
+
+ minetest.register_node("testnodes:vrliquid_flowing_"..d, {
+ description = "Flowing Test Liquid, Viscosity "..v..", Resistance "..d,
+ drawtype = "flowingliquid",
+ tiles = {"testnodes_liquidflowing_r"..d..".png"..mod},
+ special_tiles = {
+ {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false},
+ {name = "testnodes_liquidflowing_r"..d..".png"..mod, backface_culling = false},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ walkable = false,
+ pointable = false,
+ diggable = false,
+ buildable_to = true,
+ is_ground_content = false,
+ liquidtype = "flowing",
+ liquid_alternative_flowing = "testnodes:vrliquid_flowing_"..d,
+ liquid_alternative_source = "testnodes:vrliquid_"..d,
+ liquid_viscosity = v,
+ move_resistance = d,
+ })
+
+ end
+
end
diff --git a/games/devtest/mods/testnodes/properties.lua b/games/devtest/mods/testnodes/properties.lua
index a52cd1d6f..51f703d7c 100644
--- a/games/devtest/mods/testnodes/properties.lua
+++ b/games/devtest/mods/testnodes/properties.lua
@@ -152,6 +152,66 @@ minetest.register_node("testnodes:liquidflowing_nojump", {
post_effect_color = {a = 70, r = 255, g = 0, b = 200},
})
+-- A liquid which doesn't have liquid movement physics (source variant)
+minetest.register_node("testnodes:liquid_noswim", {
+ description = S("No-swim Liquid Source Node"),
+ liquidtype = "source",
+ liquid_range = 1,
+ liquid_viscosity = 0,
+ liquid_alternative_flowing = "testnodes:liquidflowing_noswim",
+ liquid_alternative_source = "testnodes:liquid_noswim",
+ liquid_renewable = false,
+ liquid_move_physics = false,
+ groups = {dig_immediate=3},
+ walkable = false,
+
+ drawtype = "liquid",
+ tiles = {"testnodes_liquidsource.png^[colorize:#FF00FF:127"},
+ special_tiles = {
+ {name = "testnodes_liquidsource.png^[colorize:#FF00FF:127", backface_culling = false},
+ {name = "testnodes_liquidsource.png^[colorize:#FF00FF:127", backface_culling = true},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ pointable = false,
+ liquids_pointable = true,
+ buildable_to = true,
+ is_ground_content = false,
+ post_effect_color = {a = 70, r = 255, g = 200, b = 200},
+})
+
+-- A liquid which doen't have liquid movement physics (flowing variant)
+minetest.register_node("testnodes:liquidflowing_noswim", {
+ description = S("No-swim Flowing Liquid Node"),
+ liquidtype = "flowing",
+ liquid_range = 1,
+ liquid_viscosity = 0,
+ liquid_alternative_flowing = "testnodes:liquidflowing_noswim",
+ liquid_alternative_source = "testnodes:liquid_noswim",
+ liquid_renewable = false,
+ liquid_move_physics = false,
+ groups = {dig_immediate=3},
+ walkable = false,
+
+
+ drawtype = "flowingliquid",
+ tiles = {"testnodes_liquidflowing.png^[colorize:#FF00FF:127"},
+ special_tiles = {
+ {name = "testnodes_liquidflowing.png^[colorize:#FF00FF:127", backface_culling = false},
+ {name = "testnodes_liquidflowing.png^[colorize:#FF00FF:127", backface_culling = false},
+ },
+ use_texture_alpha = "blend",
+ paramtype = "light",
+ paramtype2 = "flowingliquid",
+ pointable = false,
+ liquids_pointable = true,
+ buildable_to = true,
+ is_ground_content = false,
+ post_effect_color = {a = 70, r = 255, g = 200, b = 200},
+})
+
+
+
-- Nodes that modify fall damage (various damage modifiers)
for i=-100, 100, 25 do
if i ~= 0 then
@@ -216,6 +276,54 @@ for i=1, 5 do
})
end
+-- Move resistance nodes (various resistance levels)
+for r=0, 7 do
+ if r > 0 then
+ minetest.register_node("testnodes:move_resistance"..r, {
+ description = S("Move-resistant Node (@1)", r),
+ walkable = false,
+ move_resistance = r,
+
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_move_resistance.png" },
+ is_ground_content = false,
+ groups = { dig_immediate = 3 },
+ color = { b = 0, g = 255, r = math.floor((r/7)*255), a = 255 },
+ })
+ end
+
+ minetest.register_node("testnodes:move_resistance_liquidlike"..r, {
+ description = S("Move-resistant Node, liquidlike (@1)", r),
+ walkable = false,
+ move_resistance = r,
+ liquid_move_physics = true,
+
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = { "testnodes_move_resistance.png" },
+ is_ground_content = false,
+ groups = { dig_immediate = 3 },
+ color = { b = 255, g = 0, r = math.floor((r/7)*255), a = 255 },
+ })
+end
+
+minetest.register_node("testnodes:climbable_move_resistance_4", {
+ description = S("Climbable Move-resistant Node (4)"),
+ walkable = false,
+ climbable = true,
+ move_resistance = 4,
+
+ drawtype = "glasslike",
+ paramtype = "light",
+ sunlight_propagates = true,
+ tiles = {"testnodes_climbable_resistance_side.png"},
+ is_ground_content = false,
+ groups = { dig_immediate = 3 },
+})
+
-- By placing something on the node, the node itself will be replaced
minetest.register_node("testnodes:buildable_to", {
description = S("Replacable Node"),
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 f6e6a0c2a..dc581b0c7 100644
--- a/games/devtest/mods/testnodes/textures.lua
+++ b/games/devtest/mods/testnodes/textures.lua
@@ -65,3 +65,109 @@ for a=1,#alphas do
})
end
+-- Generate PNG textures
+
+local function mandelbrot(w, h, iterations)
+ local r = {}
+ for y=0, h-1 do
+ for x=0, w-1 do
+ local re = (x - w/2) * 4/w
+ local im = (y - h/2) * 4/h
+ -- zoom in on a nice view
+ re = re / 128 - 0.23
+ im = im / 128 - 0.82
+
+ local px, py = 0, 0
+ local i = 0
+ while px*px + py*py <= 4 and i < iterations do
+ px, py = px*px - py*py + re, 2 * px * py + im
+ i = i + 1
+ end
+ r[w*y+x+1] = i / iterations
+ end
+ end
+ return r
+end
+
+local function gen_checkers(w, h, tile)
+ local r = {}
+ for y=0, h-1 do
+ for x=0, w-1 do
+ local hori = math.floor(x / tile) % 2 == 0
+ local vert = math.floor(y / tile) % 2 == 0
+ r[w*y+x+1] = hori ~= vert and 1 or 0
+ end
+ end
+ return r
+end
+
+local fractal = mandelbrot(512, 512, 128)
+local frac_emb = mandelbrot(64, 64, 64)
+local checker = gen_checkers(512, 512, 32)
+
+local floor = math.floor
+local abs = math.abs
+local data_emb = {}
+local data_mb = {}
+local data_ck = {}
+for i=1, #frac_emb do
+ data_emb[i] = {
+ r = floor(abs(frac_emb[i] * 2 - 1) * 255),
+ g = floor(abs(1 - frac_emb[i]) * 255),
+ b = floor(frac_emb[i] * 255),
+ a = frac_emb[i] < 0.95 and 255 or 0,
+ }
+end
+for i=1, #fractal do
+ data_mb[i] = {
+ r = floor(fractal[i] * 255),
+ g = floor(abs(fractal[i] * 2 - 1) * 255),
+ b = floor(abs(1 - fractal[i]) * 255),
+ a = 255,
+ }
+ data_ck[i] = checker[i] > 0 and "#F80" or "#000"
+end
+
+local textures_path = minetest.get_modpath( minetest.get_current_modname() ) .. "/textures/"
+minetest.safe_file_write(
+ textures_path .. "testnodes_generated_mb.png",
+ minetest.encode_png(512,512,data_mb)
+)
+minetest.safe_file_write(
+ textures_path .. "testnodes_generated_ck.png",
+ minetest.encode_png(512,512,data_ck)
+)
+
+minetest.register_node("testnodes:generated_png_mb", {
+ description = S("Generated Mandelbrot PNG Test Node"),
+ tiles = { "testnodes_generated_mb.png" },
+
+ groups = { dig_immediate = 2 },
+})
+minetest.register_node("testnodes:generated_png_ck", {
+ description = S("Generated Checker PNG Test Node"),
+ tiles = { "testnodes_generated_ck.png" },
+
+ groups = { dig_immediate = 2 },
+})
+
+local png_emb = "[png:" .. minetest.encode_base64(minetest.encode_png(64,64,data_emb))
+
+minetest.register_node("testnodes:generated_png_emb", {
+ description = S("Generated In-Band Mandelbrot PNG Test Node"),
+ tiles = { png_emb },
+
+ groups = { dig_immediate = 2 },
+})
+minetest.register_node("testnodes:generated_png_src_emb", {
+ description = S("Generated In-Band Source Blit Mandelbrot PNG Test Node"),
+ tiles = { png_emb .. "^testnodes_damage_neg.png" },
+
+ groups = { dig_immediate = 2 },
+})
+minetest.register_node("testnodes:generated_png_dst_emb", {
+ description = S("Generated In-Band Dest Blit Mandelbrot PNG Test Node"),
+ tiles = { "testnodes_generated_ck.png^" .. png_emb },
+
+ groups = { dig_immediate = 2 },
+})
diff --git a/games/devtest/mods/testnodes/textures/testnodes_climbable_resistance_side.png b/games/devtest/mods/testnodes/textures/testnodes_climbable_resistance_side.png
new file mode 100644
index 000000000..be01583e6
--- /dev/null
+++ b/games/devtest/mods/testnodes/textures/testnodes_climbable_resistance_side.png
Binary files differ
diff --git a/games/devtest/mods/testnodes/textures/testnodes_move_resistance.png b/games/devtest/mods/testnodes/textures/testnodes_move_resistance.png
new file mode 100644
index 000000000..cac3944bf
--- /dev/null
+++ b/games/devtest/mods/testnodes/textures/testnodes_move_resistance.png
Binary files differ
diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_wallmounted.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_wallmounted.png
new file mode 100644
index 000000000..b0be8d077
--- /dev/null
+++ b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_base_side_wallmounted.png
Binary files differ
diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_wallmounted.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_wallmounted.png
new file mode 100644
index 000000000..421466407
--- /dev/null
+++ b/games/devtest/mods/testnodes/textures/testnodes_plantlike_rooted_wallmounted.png
Binary files differ
diff --git a/games/devtest/mods/testnodes/textures/testnodes_plantlike_wallmounted.png b/games/devtest/mods/testnodes/textures/testnodes_plantlike_wallmounted.png
new file mode 100644
index 000000000..c89b29e30
--- /dev/null
+++ b/games/devtest/mods/testnodes/textures/testnodes_plantlike_wallmounted.png
Binary files differ