Initial commit

This commit is contained in:
2022-10-08 17:16:13 -04:00
commit 385638c5e1
1925 changed files with 872504 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
# Test Nodes
This mod contains a bunch of basic nodes to test development stuff.
Most nodes are kept as minimal as possible in order to show off one particular feature of the engine, to make testing stuff easier.
This mod includes tests for:
* drawtypes
* paramtype2's
* node properties such as damage, drowning, falling, etc.
* other random stuff

View File

@@ -0,0 +1,629 @@
--[[ Drawtype Test: This file tests out and provides examples for
all drawtypes in Minetest. It is attempted to keep the node
definitions as simple and minimal as possible to keep
side-effects to a minimum.
How to read the node definitions:
There are two parts which are separated by 2 newlines:
The first part contains the things that are more or less essential
for defining the drawtype (except description, which is
at the top for readability).
The second part (after the 2 newlines) contains stuff that are
unrelated to the drawtype, stuff that is mostly there to make
testing this node easier and more convenient.
]]
local S = minetest.get_translator("testnodes")
-- A regular cube
minetest.register_node("testnodes:normal", {
description = S("Normal Drawtype Test Node"),
drawtype = "normal",
tiles = { "testnodes_normal.png" },
groups = { dig_immediate = 3 },
})
-- Standard glasslike node
minetest.register_node("testnodes:glasslike", {
description = S("Glasslike Drawtype Test Node"),
drawtype = "glasslike",
paramtype = "light",
tiles = { "testnodes_glasslike.png" },
groups = { dig_immediate = 3 },
})
-- Glasslike framed with the two textures (normal and "detail")
minetest.register_node("testnodes:glasslike_framed", {
description = S("Glasslike Framed Drawtype Test Node"),
drawtype = "glasslike_framed",
paramtype = "light",
tiles = {
"testnodes_glasslike_framed.png",
"testnodes_glasslike_detail.png",
},
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
-- Like the one above, but without the "detail" texture (texture 2).
-- This node was added to see how the engine behaves when the "detail" texture
-- is missing.
minetest.register_node("testnodes:glasslike_framed_no_detail", {
description = S("Glasslike Framed without Detail Drawtype Test Node"),
drawtype = "glasslike_framed",
paramtype = "light",
tiles = { "testnodes_glasslike_framed2.png" },
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:glasslike_framed_optional", {
description = S("Glasslike Framed Optional Drawtype Test Node"),
drawtype = "glasslike_framed_optional",
paramtype = "light",
tiles = {
"testnodes_glasslike_framed_optional.png",
"testnodes_glasslike_detail.png",
},
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:allfaces", {
description = S("Allfaces Drawtype Test Node"),
drawtype = "allfaces",
paramtype = "light",
tiles = { "testnodes_allfaces.png" },
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:allfaces_optional", {
description = S("Allfaces Optional Drawtype Test Node"),
drawtype = "allfaces_optional",
paramtype = "light",
tiles = { "testnodes_allfaces_optional.png" },
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:allfaces_optional_waving", {
description = S("Waving Allfaces Optional Drawtype Test Node"),
drawtype = "allfaces_optional",
paramtype = "light",
tiles = { "testnodes_allfaces_optional.png^[brighten" },
waving = 2,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:firelike", {
description = S("Firelike Drawtype Test Node"),
drawtype = "firelike",
paramtype = "light",
tiles = { "testnodes_firelike.png" },
walkable = false,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:fencelike", {
description = S("Fencelike Drawtype Test Node"),
drawtype = "fencelike",
paramtype = "light",
tiles = { "testnodes_fencelike.png" },
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:torchlike", {
description = S("Floor Torchlike Drawtype Test Node"),
drawtype = "torchlike",
paramtype = "light",
tiles = { "testnodes_torchlike_floor.png^[colorize:#FF0000:64" },
walkable = false,
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:torchlike_wallmounted", {
description = S("Wallmounted Torchlike Drawtype Test Node"),
drawtype = "torchlike",
paramtype = "light",
paramtype2 = "wallmounted",
tiles = {
"testnodes_torchlike_floor.png",
"testnodes_torchlike_ceiling.png",
"testnodes_torchlike_wall.png",
},
walkable = false,
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:signlike", {
description = S("Floor Signlike Drawtype Test Node"),
drawtype = "signlike",
paramtype = "light",
tiles = { "testnodes_signlike.png^[colorize:#FF0000:64" },
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",
paramtype2 = "wallmounted",
tiles = { "testnodes_signlike.png" },
walkable = false,
groups = { dig_immediate = 3 },
sunlight_propagates = true,
})
minetest.register_node("testnodes:plantlike", {
description = S("Plantlike Drawtype Test Node"),
drawtype = "plantlike",
paramtype = "light",
tiles = { "testnodes_plantlike.png" },
walkable = false,
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:plantlike_waving", {
description = S("Waving Plantlike Drawtype Test Node"),
drawtype = "plantlike",
paramtype = "light",
tiles = { "testnodes_plantlike_waving.png" },
waving = 1,
walkable = false,
sunlight_propagates = true,
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",
paramtype = "light",
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"),
drawtype = "plantlike",
paramtype = "light",
paramtype2 = "leveled",
tiles = {
{ name = "testnodes_plantlike_leveled.png", tileable_vertical = true },
},
-- We set a default param2 here only for convenience, to make the "plant" visible after placement
place_param2 = 8,
walkable = false,
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
-- param2 changes shape
minetest.register_node("testnodes:plantlike_meshoptions", {
description = S("Meshoptions Plantlike Drawtype Test Node"),
drawtype = "plantlike",
paramtype = "light",
paramtype2 = "meshoptions",
tiles = { "testnodes_plantlike_meshoptions.png" },
walkable = false,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:plantlike_rooted", {
description = S("Rooted Plantlike Drawtype Test Node"),
drawtype = "plantlike_rooted",
paramtype = "light",
tiles = { "testnodes_plantlike_rooted_base.png" },
special_tiles = { "testnodes_plantlike_rooted.png" },
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",
paramtype = "light",
tiles = {
"testnodes_plantlike_rooted_base.png",
"testnodes_plantlike_rooted_base.png",
"testnodes_plantlike_rooted_base_side_waving.png",
},
special_tiles = { "testnodes_plantlike_rooted_waving.png" },
waving = 1,
groups = { dig_immediate = 3 },
})
-- param2 changes height
minetest.register_node("testnodes:plantlike_rooted_leveled", {
description = S("Leveled Rooted Plantlike Drawtype Test Node"),
drawtype = "plantlike_rooted",
paramtype = "light",
paramtype2 = "leveled",
tiles = {
"testnodes_plantlike_rooted_base.png",
"testnodes_plantlike_rooted_base.png",
"testnodes_plantlike_rooted_base_side_leveled.png",
},
special_tiles = {
{ name = "testnodes_plantlike_rooted_leveled.png", tileable_vertical = true },
},
-- We set a default param2 here only for convenience, to make the "plant" visible after placement
place_param2 = 8,
groups = { dig_immediate = 3 },
})
-- param2 changes shape
minetest.register_node("testnodes:plantlike_rooted_meshoptions", {
description = S("Meshoptions Rooted Plantlike Drawtype Test Node"),
drawtype = "plantlike_rooted",
paramtype = "light",
paramtype2 = "meshoptions",
tiles = {
"testnodes_plantlike_rooted_base.png",
"testnodes_plantlike_rooted_base.png",
"testnodes_plantlike_rooted_base_side_meshoptions.png",
},
special_tiles = {
"testnodes_plantlike_rooted_meshoptions.png",
},
groups = { dig_immediate = 3 },
})
-- param2 changes rotation
minetest.register_node("testnodes:plantlike_rooted_degrotate", {
description = S("Degrotate Rooted Plantlike Drawtype Test Node"),
drawtype = "plantlike_rooted",
paramtype = "light",
paramtype2 = "degrotate",
tiles = {
"testnodes_plantlike_rooted_base.png",
"testnodes_plantlike_rooted_base.png",
"testnodes_plantlike_rooted_base_side_degrotate.png",
},
special_tiles = {
"testnodes_plantlike_rooted_degrotate.png",
},
groups = { dig_immediate = 3 },
})
-- Demonstrative liquid nodes, source and flowing form.
-- 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
-- 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^[colorize:#0000FF:127",
},
special_tiles = {
{name="testnodes_liquidsource.png^[colorize:#0000FF:127", backface_culling=false},
{name="testnodes_liquidsource.png^[colorize:#0000FF:127", backface_culling=true},
},
use_texture_alpha = "blend",
waving = 3,
walkable = false,
liquid_range = 1,
liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquid_flowing_waving",
liquid_alternative_source = "testnodes:liquid_waving",
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:liquid_flowing_waving", {
description = S("Waving Flowing Liquid Drawtype Test Node"),
drawtype = "flowingliquid",
paramtype = "light",
paramtype2 = "flowingliquid",
tiles = {
"testnodes_liquidflowing.png^[colorize:#0000FF:127",
},
special_tiles = {
{name="testnodes_liquidflowing.png^[colorize:#0000FF:127", backface_culling=false},
{name="testnodes_liquidflowing.png^[colorize:#0000FF:127", backface_culling=false},
},
use_texture_alpha = "blend",
waving = 3,
walkable = false,
liquid_range = 1,
liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquid_flowing_waving",
liquid_alternative_source = "testnodes:liquid_waving",
groups = { dig_immediate = 3 },
})
-- Invisible node
minetest.register_node("testnodes:airlike", {
description = S("Airlike Drawtype Test Node"),
drawtype = "airlike",
paramtype = "light",
walkable = false,
groups = { dig_immediate = 3 },
sunlight_propagates = true,
})
-- param2 changes liquid height
minetest.register_node("testnodes:glassliquid", {
description = S("Glasslike Liquid Level Drawtype Test Node"),
drawtype = "glasslike_framed",
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
tiles = {
"testnodes_glasslikeliquid.png",
},
special_tiles = {
"testnodes_liquid.png",
},
groups = { dig_immediate = 3 },
})
-- Adding many raillike examples, primarily to demonstrate the behavior of
-- "raillike groups". Nodes of the same type (rail, groupless, line, street)
-- should connect to nodes of the same "rail type" (=same shape, different
-- color) only.
local rails = {
{ "rail", {"testnodes_rail_straight.png", "testnodes_rail_curved.png", "testnodes_rail_t_junction.png", "testnodes_rail_crossing.png"} },
{ "line", {"testnodes_line_straight.png", "testnodes_line_curved.png", "testnodes_line_t_junction.png", "testnodes_line_crossing.png"}, },
{ "street", {"testnodes_street_straight.png", "testnodes_street_curved.png", "testnodes_street_t_junction.png", "testnodes_street_crossing.png"}, },
-- the "groupless" nodes are nodes in which the "connect_to_raillike" group is not set
{ "groupless", {"testnodes_rail2_straight.png", "testnodes_rail2_curved.png", "testnodes_rail2_t_junction.png", "testnodes_rail2_crossing.png"} },
}
local colors = { "", "cyan", "red" }
for r=1, #rails do
local id = rails[r][1]
local tiles = rails[r][2]
local raillike_group
if id ~= "groupless" then
raillike_group = minetest.raillike_group(id)
end
for c=1, #colors do
local color
if colors[c] ~= "" then
color = colors[c]
end
minetest.register_node("testnodes:raillike_"..id..c, {
description = S("Raillike Drawtype Test Node: @1 @2", id, c),
drawtype = "raillike",
paramtype = "light",
tiles = tiles,
groups = { connect_to_raillike = raillike_group, dig_immediate = 3 },
color = color,
selection_box = {
type = "fixed",
fixed = {{-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}},
},
sunlight_propagates = true,
walkable = false,
})
end
end
-- Add visual_scale variants of previous nodes for half and double size
local scale = function(subname, desc_double, desc_half)
local original = "testnodes:"..subname
local def = table.copy(minetest.registered_items[original])
def.visual_scale = 2.0
def.description = desc_double
minetest.register_node("testnodes:"..subname.."_double", def)
def = table.copy(minetest.registered_items[original])
def.visual_scale = 0.5
def.description = desc_half
minetest.register_node("testnodes:"..subname.."_half", def)
end
scale("allfaces",
S("Double-sized Allfaces Drawtype Test Node"),
S("Half-sized Allfaces Drawtype Test Node"))
scale("allfaces_optional",
S("Double-sized Allfaces Optional Drawtype Test Node"),
S("Half-sized Allfaces Optional Drawtype Test Node"))
scale("allfaces_optional_waving",
S("Double-sized Waving Allfaces Optional Drawtype Test Node"),
S("Half-sized Waving Allfaces Optional Drawtype Test Node"))
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_wallmounted",
S("Double-sized Wallmounted Signlike Drawtype Test Node"),
S("Half-sized Wallmounted Signlike Drawtype Test Node"))
scale("firelike",
S("Double-sized Firelike Drawtype Test Node"),
S("Half-sized Firelike Drawtype Test Node"))

View File

@@ -0,0 +1,11 @@
local path = minetest.get_modpath(minetest.get_current_modname())
dofile(path.."/drawtypes.lua")
dofile(path.."/meshes.lua")
dofile(path.."/nodeboxes.lua")
dofile(path.."/param2.lua")
dofile(path.."/properties.lua")
dofile(path.."/liquids.lua")
dofile(path.."/light.lua")
dofile(path.."/textures.lua")
dofile(path.."/overlays.lua")

View File

@@ -0,0 +1,50 @@
-- Test Nodes: Light test
local S = minetest.get_translator("testnodes")
-- All possible light levels
for i=1, minetest.LIGHT_MAX do
minetest.register_node("testnodes:light"..i, {
description = S("Light Source (@1)", i),
paramtype = "light",
light_source = i,
tiles ={"testnodes_light_"..i..".png"},
drawtype = "glasslike",
walkable = false,
sunlight_propagates = true,
is_ground_content = false,
groups = {dig_immediate=3},
})
end
-- Lets light through, but not sunlight, leading to a
-- reduction in light level when light passes through
minetest.register_node("testnodes:sunlight_filter", {
description = S("Sunlight Filter") .."\n"..
S("Lets light through, but weakens sunlight"),
paramtype = "light",
drawtype = "glasslike",
tiles = {
"testnodes_sunlight_filter.png",
},
groups = { dig_immediate = 3 },
})
-- Lets light and sunlight through without obstruction
minetest.register_node("testnodes:sunlight_propagator", {
description = S("Sunlight Propagator") .."\n"..
S("Lets all light through"),
paramtype = "light",
sunlight_propagates = true,
drawtype = "glasslike",
tiles = {
"testnodes_sunlight_filter.png^[brighten",
},
groups = { dig_immediate = 3 },
})

View File

@@ -0,0 +1,134 @@
-- Add liquids for ranges and viscosity levels 0-8
for d=0, 8 do
minetest.register_node("testnodes:rliquid_"..d, {
description = "Test Liquid Source, Range "..d,
drawtype = "liquid",
tiles = {"testnodes_liquidsource_r"..d..".png"},
special_tiles = {
{name = "testnodes_liquidsource_r"..d..".png", backface_culling = false},
{name = "testnodes_liquidsource_r"..d..".png", backface_culling = true},
},
use_texture_alpha = "blend",
paramtype = "light",
walkable = false,
buildable_to = true,
is_ground_content = false,
liquidtype = "source",
liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d,
liquid_alternative_source = "testnodes:rliquid_"..d,
liquid_range = d,
})
minetest.register_node("testnodes:rliquid_flowing_"..d, {
description = "Flowing Test Liquid, Range "..d,
drawtype = "flowingliquid",
tiles = {"testnodes_liquidflowing_r"..d..".png"},
special_tiles = {
{name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false},
{name = "testnodes_liquidflowing_r"..d..".png", backface_culling = false},
},
use_texture_alpha = "blend",
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
buildable_to = true,
is_ground_content = false,
liquidtype = "flowing",
liquid_alternative_flowing = "testnodes:rliquid_flowing_"..d,
liquid_alternative_source = "testnodes:rliquid_"..d,
liquid_range = d,
})
if d <= 7 then
local mod = "^[colorize:#000000:127"
minetest.register_node("testnodes:vliquid_"..d, {
description = "Test Liquid Source, Viscosity/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,
buildable_to = true,
is_ground_content = false,
liquidtype = "source",
liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d,
liquid_alternative_source = "testnodes:vliquid_"..d,
liquid_viscosity = d,
})
minetest.register_node("testnodes:vliquid_flowing_"..d, {
description = "Flowing Test Liquid, Viscosity/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,
buildable_to = true,
is_ground_content = false,
liquidtype = "flowing",
liquid_alternative_flowing = "testnodes:vliquid_flowing_"..d,
liquid_alternative_source = "testnodes:vliquid_"..d,
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

View File

@@ -0,0 +1,145 @@
-- Meshes
local S = minetest.get_translator("testnodes")
local ocorner_cbox = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
{-0.5, -0.25, -0.25, 0.25, 0, 0.5},
{-0.5, 0, 0, 0, 0.25, 0.5},
{-0.5, 0.25, 0.25, -0.25, 0.5, 0.5}
}
}
local tall_pyr_cbox = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, -0.25, 0.5 },
{ -0.375, -0.25, -0.375, 0.375, 0, 0.375},
{ -0.25, 0, -0.25, 0.25, 0.25, 0.25},
{ -0.125, 0.25, -0.125, 0.125, 0.5, 0.125}
}
}
-- Normal mesh
minetest.register_node("testnodes:mesh", {
description = S("Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes2.png"},
paramtype = "light",
collision_box = tall_pyr_cbox,
groups = {dig_immediate=3},
})
-- Facedir mesh: outer corner slope
minetest.register_node("testnodes:mesh_facedir", {
description = S("Facedir Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_ocorner.obj",
tiles = {"testnodes_mesh_stripes.png"},
paramtype = "light",
paramtype2 = "facedir",
collision_box = ocorner_cbox,
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:mesh_colorfacedir", {
description = S("Color Facedir Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_ocorner.obj",
tiles = {"testnodes_mesh_stripes3.png"},
paramtype = "light",
paramtype2 = "colorfacedir",
palette = "testnodes_palette_facedir.png",
collision_box = ocorner_cbox,
groups = {dig_immediate=3},
})
-- Wallmounted mesh: pyramid
minetest.register_node("testnodes:mesh_wallmounted", {
description = S("Wallmounted Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes2.png"},
paramtype = "light",
paramtype2 = "wallmounted",
collision_box = tall_pyr_cbox,
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:mesh_colorwallmounted", {
description = S("Color Wallmounted Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes3.png"},
paramtype = "light",
paramtype2 = "colorwallmounted",
palette = "testnodes_palette_wallmounted.png",
collision_box = tall_pyr_cbox,
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:mesh_double", {
description = S("Double-sized Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes2.png"},
paramtype = "light",
collision_box = tall_pyr_cbox,
visual_scale = 2,
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:mesh_half", {
description = S("Half-sized Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes2.png"},
paramtype = "light",
collision_box = tall_pyr_cbox,
visual_scale = 0.5,
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:mesh_waving1", {
description = S("Plantlike-waving Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0FFB0"},
paramtype = "light",
collision_box = tall_pyr_cbox,
waving = 1,
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:mesh_waving2", {
description = S("Leaflike-waving Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes4.png^[multiply:#FFFFB0"},
paramtype = "light",
collision_box = tall_pyr_cbox,
waving = 2,
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:mesh_waving3", {
description = S("Liquidlike-waving Mesh Test Node"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes4.png^[multiply:#B0B0FF"},
paramtype = "light",
collision_box = tall_pyr_cbox,
waving = 3,
groups = {dig_immediate=3},
})

View File

@@ -0,0 +1,3 @@
name = testnodes
description = Contains a bunch of basic example nodes for demonstrative purposes, development and testing
depends = stairs

View File

@@ -0,0 +1,23 @@
# Blender v2.73 (sub 0) OBJ File: 'slope_test_ocorner_onetexture.blend'
# www.blender.org
o Cube_Cube.002
v 0.500000 0.500000 0.500000
v -0.500000 -0.500000 0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 -0.500000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vn 0.000000 -1.000000 -0.000000
vn 1.000000 0.000000 0.000000
vn 0.000000 -0.000000 1.000000
vn -0.707100 0.707100 0.000000
vn 0.000000 0.707100 -0.707100
s off
f 3/1/1 2/2/1 4/3/1 5/4/1
f 1/2/2 3/3/2 5/4/2
f 1/1/3 2/3/3 3/4/3
f 1/1/4 4/3/4 2/4/4
f 1/2/5 5/3/5 4/4/5

View File

@@ -0,0 +1,24 @@
# Blender v2.73 (sub 0) OBJ File: 'slope_test_pyramid_onetexture.blend'
# www.blender.org
o Cube
v 0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v -0.000000 0.500000 -0.000000
vt 1.000000 1.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 0.000000
vt 0.500000 1.000000
vn 0.000000 -1.000000 0.000000
vn -0.894400 0.447200 -0.000000
vn 0.000000 0.447200 -0.894400
vn 0.894400 0.447200 0.000000
vn -0.000000 0.447200 0.894400
s off
f 1/1/1 2/2/1 3/3/1 4/4/1
f 3/4/2 5/5/2 4/3/2
f 5/5/3 1/3/3 4/4/3
f 1/4/4 5/5/4 2/3/4
f 2/4/5 5/5/5 3/3/5

View File

@@ -0,0 +1,81 @@
local S = minetest.get_translator("testnodes")
-- Nodebox examples and tests.
-- An simple example nodebox with one centered box
minetest.register_node("testnodes:nodebox_fixed", {
description = S("Fixed Nodebox Test Node"),
tiles = {"testnodes_nodebox.png"},
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
},
groups = {dig_immediate=3},
})
-- 50% higher than a regular node
minetest.register_node("testnodes:nodebox_overhigh", {
description = S("+50% high Nodebox Test Node"),
tiles = {"testnodes_nodebox.png"},
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 1, 0.5},
},
groups = {dig_immediate=3},
})
-- 95% higher than a regular node
minetest.register_node("testnodes:nodebox_overhigh2", {
description = S("+95% high Nodebox Test Node"),
tiles = {"testnodes_nodebox.png"},
drawtype = "nodebox",
paramtype = "light",
node_box = {
type = "fixed",
-- Y max: more is possible, but glitchy
fixed = {-0.5, -0.5, -0.5, 0.5, 1.45, 0.5},
},
groups = {dig_immediate=3},
})
-- Height of nodebox changes with its param2 value
minetest.register_node("testnodes:nodebox_leveled", {
description = S("Leveled Nodebox Test Node"),
tiles = {"testnodes_nodebox.png"},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "leveled",
node_box = {
type = "leveled",
fixed = {-0.5, 0.0, -0.5, 0.5, -0.499, 0.5},
},
groups = {dig_immediate=3},
})
-- Wall-like nodebox that connects to neighbors
minetest.register_node("testnodes:nodebox_connected", {
description = S("Connected Nodebox Test Node"),
tiles = {"testnodes_nodebox.png"},
groups = {connected_nodebox=1, dig_immediate=3},
drawtype = "nodebox",
paramtype = "light",
connects_to = {"group:connected_nodebox"},
connect_sides = {"front", "back", "left", "right"},
node_box = {
type = "connected",
fixed = {-0.125, -0.500, -0.125, 0.125, 0.500, 0.125},
connect_front = {-0.125, -0.500, -0.500, 0.125, 0.400, -0.125},
connect_back = {-0.125, -0.500, 0.125, 0.125, 0.400, 0.500},
connect_left = {-0.500, -0.500, -0.125, -0.125, 0.400, 0.125},
connect_right = {0.125, -0.500, -0.125, 0.500, 0.400, 0.125},
},
})

View File

@@ -0,0 +1,93 @@
local S = minetest.get_translator("testnodes")
minetest.register_node("testnodes:overlay", {
description = S("Texture Overlay Test Node") .. "\n" ..
S("Uncolorized"),
tiles = {{name = "testnodes_overlayable.png"}},
overlay_tiles = {{name = "testnodes_overlay.png"}},
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:overlay_color_all", {
description = S("Texture Overlay Test Node, Colorized") .. "\n" ..
S("param2 changes color"),
tiles = {{name = "testnodes_overlayable.png"}},
overlay_tiles = {{name = "testnodes_overlay.png"}},
paramtype2 = "color",
palette = "testnodes_palette_full.png",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:overlay_color_overlay", {
description = S("Texture Overlay Test Node, Colorized Overlay") .. "\n" ..
S("param2 changes color of overlay"),
tiles = {{name = "testnodes_overlayable.png", color="white"}},
overlay_tiles = {{name = "testnodes_overlay.png"}},
paramtype2 = "color",
palette = "testnodes_palette_full.png",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:overlay_color_overlayed", {
description = S("Texture Overlay Test Node, Colorized Base") .. "\n" ..
S("param2 changes color of base texture"),
tiles = {{name = "testnodes_overlayable.png"}},
overlay_tiles = {{name = "testnodes_overlay.png", color="white"}},
paramtype2 = "color",
palette = "testnodes_palette_full.png",
groups = { dig_immediate = 2 },
})
local global_overlay_color = "#FF2000"
minetest.register_node("testnodes:overlay_global", {
description = S("Texture Overlay Test Node, Global Color") .. "\n" ..
S("Global color = @1", global_overlay_color),
tiles = {{name = "testnodes_overlayable.png"}},
overlay_tiles = {{name = "testnodes_overlay.png"}},
color = global_overlay_color,
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:overlay_global_color_all", {
description = S("Texture Overlay Test Node, Global Color + Colorized") .. "\n" ..
S("Global color = @1", global_overlay_color) .. "\n" ..
S("param2 changes color"),
tiles = {{name = "testnodes_overlayable.png"}},
overlay_tiles = {{name = "testnodes_overlay.png"}},
color = global_overlay_color,
paramtype2 = "color",
palette = "testnodes_palette_full.png",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:overlay_global_color_overlay", {
description = S("Texture Overlay Test Node, Global Color + Colorized Overlay") .. "\n" ..
S("Global color = @1", global_overlay_color) .. "\n" ..
S("param2 changes color of overlay"),
tiles = {{name = "testnodes_overlayable.png", color=global_overlay_color}},
overlay_tiles = {{name = "testnodes_overlay.png"}},
color = global_overlay_color,
paramtype2 = "color",
palette = "testnodes_palette_full.png",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:overlay_global_color_overlayed", {
description = S("Texture Overlay Test Node, Global Color + Colorized Base") .. "\n" ..
S("Global color = @1", global_overlay_color) .. "\n" ..
S("param2 changes color of base texture"),
tiles = {{name = "testnodes_overlayable.png"}},
overlay_tiles = {{name = "testnodes_overlay.png", color=global_overlay_color}},
color = global_overlay_color,
paramtype2 = "color",
palette = "testnodes_palette_full.png",
groups = { dig_immediate = 2 },
})

View File

@@ -0,0 +1,168 @@
-- This file is for misc. param2 tests that aren't covered in drawtypes.lua already.
local S = minetest.get_translator("testnodes")
minetest.register_node("testnodes:facedir", {
description = S("Facedir Test Node"),
paramtype2 = "facedir",
tiles = {
"testnodes_1.png",
"testnodes_2.png",
"testnodes_3.png",
"testnodes_4.png",
"testnodes_5.png",
"testnodes_6.png",
},
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:facedir_nodebox", {
description = S("Facedir Nodebox Test Node"),
tiles = {
"testnodes_1.png",
"testnodes_2.png",
"testnodes_3.png",
"testnodes_4.png",
"testnodes_5.png",
"testnodes_6.png",
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2},
},
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:wallmounted", {
description = S("Wallmounted Test Node"),
paramtype2 = "wallmounted",
tiles = {
"testnodes_1w.png",
"testnodes_2w.png",
"testnodes_3w.png",
"testnodes_4w.png",
"testnodes_5w.png",
"testnodes_6w.png",
},
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:wallmounted_nodebox", {
description = S("Wallmounted Nodebox Test Node"),
paramtype2 = "wallmounted",
paramtype = "light",
tiles = {
"testnodes_1w.png",
"testnodes_2w.png",
"testnodes_3w.png",
"testnodes_4w.png",
"testnodes_5w.png",
"testnodes_6w.png",
},
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 },
},
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:color", {
description = S("Color Test Node"),
paramtype2 = "color",
palette = "testnodes_palette_full.png",
tiles = {
"testnodes_node.png",
},
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:colorfacedir", {
description = S("Color Facedir Test Node"),
paramtype2 = "colorfacedir",
palette = "testnodes_palette_facedir.png",
tiles = {
"testnodes_1g.png",
"testnodes_2g.png",
"testnodes_3g.png",
"testnodes_4g.png",
"testnodes_5g.png",
"testnodes_6g.png",
},
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:colorfacedir_nodebox", {
description = S("Color Facedir Nodebox Test Node"),
tiles = {
"testnodes_1g.png",
"testnodes_2g.png",
"testnodes_3g.png",
"testnodes_4g.png",
"testnodes_5g.png",
"testnodes_6g.png",
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "colorfacedir",
palette = "testnodes_palette_facedir.png",
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.2, 0.2, 0.2},
},
groups = {dig_immediate=3},
})
minetest.register_node("testnodes:colorwallmounted", {
description = S("Color Wallmounted Test Node"),
paramtype2 = "colorwallmounted",
paramtype = "light",
palette = "testnodes_palette_wallmounted.png",
tiles = {
"testnodes_1wg.png",
"testnodes_2wg.png",
"testnodes_3wg.png",
"testnodes_4wg.png",
"testnodes_5wg.png",
"testnodes_6wg.png",
},
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:colorwallmounted_nodebox", {
description = S("Color Wallmounted Nodebox Test Node"),
paramtype2 = "colorwallmounted",
paramtype = "light",
palette = "testnodes_palette_wallmounted.png",
tiles = {
"testnodes_1wg.png",
"testnodes_2wg.png",
"testnodes_3wg.png",
"testnodes_4wg.png",
"testnodes_5wg.png",
"testnodes_6wg.png",
},
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 },
},
groups = { dig_immediate = 3 },
})

View File

@@ -0,0 +1,397 @@
-- Test Nodes: Node property tests
local S = minetest.get_translator("testnodes")
-- Is supposed to fall when it doesn't rest on solid ground
minetest.register_node("testnodes:falling", {
description = S("Falling Node"),
tiles = {
"testnodes_node.png",
"testnodes_node.png",
"testnodes_node_falling.png",
},
groups = { falling_node = 1, dig_immediate = 3 },
})
minetest.register_node("testnodes:falling_facedir", {
description = S("Falling Facedir Node"),
tiles = {
"testnodes_1.png",
"testnodes_2.png",
"testnodes_3.png",
"testnodes_4.png",
"testnodes_5.png",
"testnodes_6.png",
},
paramtype2 = "facedir",
groups = { falling_node = 1, dig_immediate = 3 },
})
-- Same as falling node, but will stop falling on top of liquids
minetest.register_node("testnodes:falling_float", {
description = S("Falling+Floating Node"),
groups = { falling_node = 1, float = 1, dig_immediate = 3 },
tiles = {
"testnodes_node.png",
"testnodes_node.png",
"testnodes_node_falling.png",
},
color = "cyan",
})
-- This node attaches to the floor and drops as item
-- when the floor is gone.
minetest.register_node("testnodes:attached", {
description = S("Floor-Attached Node"),
tiles = {
"testnodes_attached_top.png",
"testnodes_attached_bottom.png",
"testnodes_attached_side.png",
},
groups = { attached_node = 1, dig_immediate = 3 },
})
-- This node attaches to the side of a node and drops as item
-- when the node it attaches to is gone.
minetest.register_node("testnodes:attached_wallmounted", {
description = S("Wallmounted Attached Node"),
paramtype2 = "wallmounted",
tiles = {
"testnodes_attachedw_top.png",
"testnodes_attachedw_bottom.png",
"testnodes_attachedw_side.png",
},
groups = { attached_node = 1, dig_immediate = 3 },
})
-- Jump disabled
minetest.register_node("testnodes:nojump", {
description = S("Non-jumping Node"),
groups = {disable_jump=1, dig_immediate=3},
tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"},
})
-- Jump disabled plant
minetest.register_node("testnodes:nojump_walkable", {
description = S("Non-jumping Plant Node"),
drawtype = "plantlike",
groups = {disable_jump=1, dig_immediate=3},
walkable = false,
tiles = {"testnodes_nojump_top.png"},
})
-- Climbable up and down with jump and sneak keys
minetest.register_node("testnodes:climbable", {
description = S("Climbable Node"),
climbable = true,
walkable = false,
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
tiles ={"testnodes_climbable_side.png"},
drawtype = "glasslike",
groups = {dig_immediate=3},
})
-- Climbable only downwards with sneak key
minetest.register_node("testnodes:climbable_nojump", {
description = S("Downwards-climbable Node"),
climbable = true,
walkable = false,
groups = {disable_jump=1, dig_immediate=3},
drawtype = "glasslike",
tiles ={"testnodes_climbable_nojump_side.png"},
paramtype = "light",
sunlight_propagates = true,
})
-- A liquid in which you can't rise
minetest.register_node("testnodes:liquid_nojump", {
description = S("Non-jumping Liquid Source Node"),
liquidtype = "source",
liquid_range = 1,
liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquidflowing_nojump",
liquid_alternative_source = "testnodes:liquid_nojump",
liquid_renewable = false,
groups = {disable_jump=1, dig_immediate=3},
walkable = false,
drawtype = "liquid",
tiles = {"testnodes_liquidsource.png^[colorize:#FF0000:127"},
special_tiles = {
{name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false},
{name = "testnodes_liquidsource.png^[colorize:#FF0000: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 = 0, b = 200},
})
-- A liquid in which you can't rise (flowing variant)
minetest.register_node("testnodes:liquidflowing_nojump", {
description = S("Non-jumping Flowing Liquid Node"),
liquidtype = "flowing",
liquid_range = 1,
liquid_viscosity = 0,
liquid_alternative_flowing = "testnodes:liquidflowing_nojump",
liquid_alternative_source = "testnodes:liquid_nojump",
liquid_renewable = false,
groups = {disable_jump=1, dig_immediate=3},
walkable = false,
drawtype = "flowingliquid",
tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"},
special_tiles = {
{name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
{name = "testnodes_liquidflowing.png^[colorize:#FF0000: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 = 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
local subname, descnum
if i < 0 then
subname = "m"..math.abs(i)
descnum = tostring(i)
else
subname = tostring(i)
descnum = S("+@1", i)
end
local tex, color, desc
if i > 0 then
local val = math.floor((i/100)*255)
tex = "testnodes_fall_damage_plus.png"
color = { b=0, g=255-val, r=255, a=255 }
desc = S("Fall Damage Node (+@1%)", i)
else
tex = "testnodes_fall_damage_minus.png"
if i == -100 then
color = { r=0, b=0, g=255, a=255 }
else
local val = math.floor((math.abs(i)/100)*255)
color = { r=0, b=255, g=255-val, a=255 }
end
desc = S("Fall Damage Node (-@1%)", math.abs(i))
end
minetest.register_node("testnodes:damage"..subname, {
description = desc,
groups = {fall_damage_add_percent=i, dig_immediate=3},
tiles = { tex },
is_ground_content = false,
color = color,
})
end
end
-- Bouncy nodes (various bounce levels)
for i=-140, 180, 20 do
local val = math.floor(((i-20)/200)*255)
minetest.register_node(("testnodes:bouncy"..i):gsub("-","NEG"), {
description = S("Bouncy Node (@1%)", i),
groups = {bouncy=i, dig_immediate=3},
tiles ={"testnodes_bouncy.png"},
is_ground_content = false,
color = { r=255, g=255-val, b=val, a=255 },
})
end
-- Slippery nodes (various slippery levels)
for i=1, 5 do
minetest.register_node("testnodes:slippery"..i, {
description = S("Slippery Node (@1)", i),
tiles ={"testnodes_slippery.png"},
is_ground_content = false,
groups = {slippery=i, dig_immediate=3},
color = { r=0, g=255, b=math.floor((i/5)*255), a=255 },
})
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"),
buildable_to = true,
tiles = {"testnodes_buildable_to.png"},
is_ground_content = false,
groups = {dig_immediate=3},
})
-- Nodes that deal damage to players that are inside them.
-- Negative damage nodes should heal.
for d=-3,3 do
if d ~= 0 then
local sub, tile
if d > 0 then
sub = tostring(d)
tile = "testnodes_damage.png"
else
sub = "m" .. tostring(math.abs(d))
tile = "testnodes_damage_neg.png"
end
if math.abs(d) == 2 then
tile = tile .. "^[colorize:#000000:70"
elseif math.abs(d) == 3 then
tile = tile .. "^[colorize:#000000:140"
end
minetest.register_node("testnodes:damage_"..sub, {
description = S("Damage Node (@1 damage per second)", d),
damage_per_second = d,
walkable = false,
is_ground_content = false,
drawtype = "allfaces",
paramtype = "light",
sunlight_propagates = true,
tiles = { tile },
groups = {dig_immediate=3},
})
end
end
-- Causes drowning damage
minetest.register_node("testnodes:drowning_1", {
description = S("Drowning Node (@1 damage)", 1),
drowning = 1,
walkable = false,
is_ground_content = false,
drawtype = "allfaces",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_drowning.png" },
groups = {dig_immediate=3},
})

View File

@@ -0,0 +1,290 @@
-- Node texture tests
local S = minetest.get_translator("testnodes")
minetest.register_node("testnodes:6sides", {
description = S("Six Textures Test Node"),
tiles = {
"testnodes_normal1.png",
"testnodes_normal2.png",
"testnodes_normal3.png",
"testnodes_normal4.png",
"testnodes_normal5.png",
"testnodes_normal6.png",
},
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:anim", {
description = S("Animated Test Node"),
tiles = {
{ name = "testnodes_anim.png",
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 4.0,
}, },
},
groups = { dig_immediate = 2 },
})
-- Node texture transparency test
local alphas = { 64, 128, 191 }
for a=1,#alphas do
local alpha = alphas[a]
-- Transparency taken from texture
minetest.register_node("testnodes:alpha_texture_"..alpha, {
description = S("Texture Alpha Test Node (@1)", alpha),
drawtype = "glasslike",
paramtype = "light",
tiles = {
"testnodes_alpha"..alpha..".png",
},
use_texture_alpha = "blend",
groups = { dig_immediate = 3 },
})
-- Transparency set via texture modifier
minetest.register_node("testnodes:alpha_"..alpha, {
description = S("Alpha Test Node (@1)", alpha),
drawtype = "glasslike",
paramtype = "light",
tiles = {
"testnodes_alpha.png^[opacity:" .. alpha,
},
use_texture_alpha = "blend",
groups = { dig_immediate = 3 },
})
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 },
})
--[[
The following nodes can be used to demonstrate the TGA format support.
Minetest supports TGA types 1, 2, 3 & 10. While adding the support for
TGA type 9 (RLE-compressed, color-mapped) is easy, it is not advisable
to do so, as it is not backwards compatible with any Minetest pre-5.5;
content creators should therefore either use TGA type 1 or 10, or PNG.
TODO: Types 1, 2 & 10 should have two test nodes each (i.e. bottom-top
and top-bottom) for 16bpp (A1R5G5B5), 24bpp (B8G8R8), 32bpp (B8G8R8A8)
colors.
Note: Minetest requires the optional TGA footer for a texture to load.
If a TGA image does not load in Minetest, append eight (8) null bytes,
then the string “TRUEVISION-XFILE.”, then another null byte.
]]--
minetest.register_node("testnodes:tga_type1_24bpp_bt", {
description = S("TGA Type 1 (color-mapped RGB) 24bpp bottom-top Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type1_24bpp_bt.tga" },
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type1_24bpp_tb", {
description = S("TGA Type 1 (color-mapped RGB) 24bpp top-bottom Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type1_24bpp_tb.tga" },
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type2_16bpp_bt", {
description = S("TGA Type 2 (uncompressed RGB) 16bpp bottom-top Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type2_16bpp_bt.tga" },
use_texture_alpha = "clip",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type2_16bpp_tb", {
description = S("TGA Type 2 (uncompressed RGB) 16bpp top-bottom Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type2_16bpp_tb.tga" },
use_texture_alpha = "clip",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type2_32bpp_bt", {
description = S("TGA Type 2 (uncompressed RGB) 32bpp bottom-top Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type2_32bpp_bt.tga" },
use_texture_alpha = "blend",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type2_32bpp_tb", {
description = S("TGA Type 2 (uncompressed RGB) 32bpp top-bottom Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type2_32bpp_tb.tga" },
use_texture_alpha = "blend",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type3_16bpp_bt", {
description = S("TGA Type 3 (uncompressed grayscale) 16bpp bottom-top Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type3_16bpp_bt.tga" },
use_texture_alpha = "blend",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type3_16bpp_tb", {
description = S("TGA Type 3 (uncompressed grayscale) 16bpp top-bottom Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type3_16bpp_tb.tga" },
use_texture_alpha = "blend",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type10_32bpp_bt", {
description = S("TGA Type 10 (RLE-compressed RGB) 32bpp bottom-top Test Node"),
tiles = { "testnodes_tga_type10_32bpp_bt.tga" },
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = "blend",
groups = { dig_immediate = 2 },
})
minetest.register_node("testnodes:tga_type10_32bpp_tb", {
description = S("TGA Type 10 (RLE-compressed RGB) 32bpp top-bottom Test Node"),
drawtype = "glasslike",
paramtype = "light",
sunlight_propagates = true,
tiles = { "testnodes_tga_type10_32bpp_tb.tga" },
use_texture_alpha = "blend",
groups = { dig_immediate = 2 },
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Some files were not shown because too many files have changed in this diff Show More