mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 06:32:23 +01:00
Rename minetest.*
to core.*
in devtest
This commit is contained in:
parent
d849d51c2d
commit
88c7a54e08
@ -8,19 +8,19 @@ local LAVA_VISC = 7
|
||||
|
||||
-- Register nodes
|
||||
|
||||
minetest.register_node("basenodes:stone", {
|
||||
core.register_node("basenodes:stone", {
|
||||
description = "Stone",
|
||||
tiles = {"default_stone.png"},
|
||||
groups = {cracky=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:desert_stone", {
|
||||
core.register_node("basenodes:desert_stone", {
|
||||
description = "Desert Stone",
|
||||
tiles = {"default_desert_stone.png"},
|
||||
groups = {cracky=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:dirt_with_grass", {
|
||||
core.register_node("basenodes:dirt_with_grass", {
|
||||
description = "Dirt with Grass",
|
||||
tiles ={"default_grass.png",
|
||||
-- a little dot on the bottom to distinguish it from dirt
|
||||
@ -30,7 +30,7 @@ minetest.register_node("basenodes:dirt_with_grass", {
|
||||
groups = {crumbly=3, soil=1},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:dirt_with_snow", {
|
||||
core.register_node("basenodes:dirt_with_snow", {
|
||||
description = "Dirt with Snow",
|
||||
tiles ={"basenodes_dirt_with_snow.png",
|
||||
-- a little dot on the bottom to distinguish it from dirt
|
||||
@ -40,31 +40,31 @@ minetest.register_node("basenodes:dirt_with_snow", {
|
||||
groups = {crumbly=3, soil=1},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:dirt", {
|
||||
core.register_node("basenodes:dirt", {
|
||||
description = "Dirt",
|
||||
tiles ={"default_dirt.png"},
|
||||
groups = {crumbly=3, soil=1},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:sand", {
|
||||
core.register_node("basenodes:sand", {
|
||||
description = "Sand",
|
||||
tiles ={"default_sand.png"},
|
||||
groups = {crumbly=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:desert_sand", {
|
||||
core.register_node("basenodes:desert_sand", {
|
||||
description = "Desert Sand",
|
||||
tiles ={"default_desert_sand.png"},
|
||||
groups = {crumbly=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:gravel", {
|
||||
core.register_node("basenodes:gravel", {
|
||||
description = "Gravel",
|
||||
tiles ={"default_gravel.png"},
|
||||
groups = {crumbly=2},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:junglegrass", {
|
||||
core.register_node("basenodes:junglegrass", {
|
||||
description = "Jungle Grass",
|
||||
drawtype = "plantlike",
|
||||
tiles ={"default_junglegrass.png"},
|
||||
@ -75,14 +75,14 @@ minetest.register_node("basenodes:junglegrass", {
|
||||
groups = {snappy=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:tree", {
|
||||
core.register_node("basenodes:tree", {
|
||||
description = "Normal Tree Trunk",
|
||||
tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
|
||||
is_ground_content = false,
|
||||
groups = {choppy=2,oddly_breakable_by_hand=1},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:leaves", {
|
||||
core.register_node("basenodes:leaves", {
|
||||
description = "Normal Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
tiles = {"default_leaves.png"},
|
||||
@ -91,14 +91,14 @@ minetest.register_node("basenodes:leaves", {
|
||||
groups = {snappy=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:jungletree", {
|
||||
core.register_node("basenodes:jungletree", {
|
||||
description = "Jungle Tree Trunk",
|
||||
tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"},
|
||||
is_ground_content = false,
|
||||
groups = {choppy=2,oddly_breakable_by_hand=1},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:jungleleaves", {
|
||||
core.register_node("basenodes:jungleleaves", {
|
||||
description = "Jungle Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
tiles = {"default_jungleleaves.png"},
|
||||
@ -107,14 +107,14 @@ minetest.register_node("basenodes:jungleleaves", {
|
||||
groups = {snappy=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:pine_tree", {
|
||||
core.register_node("basenodes:pine_tree", {
|
||||
description = "Pine Tree Trunk",
|
||||
tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", "default_pine_tree.png"},
|
||||
is_ground_content = false,
|
||||
groups = {choppy=2,oddly_breakable_by_hand=1},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:pine_needles", {
|
||||
core.register_node("basenodes:pine_needles", {
|
||||
description = "Pine Needles",
|
||||
drawtype = "allfaces_optional",
|
||||
tiles = {"default_pine_needles.png"},
|
||||
@ -123,7 +123,7 @@ minetest.register_node("basenodes:pine_needles", {
|
||||
groups = {snappy=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:water_source", {
|
||||
core.register_node("basenodes:water_source", {
|
||||
description = "Water Source".."\n"..
|
||||
"Swimmable, spreading, renewable liquid".."\n"..
|
||||
"Drowning damage: 1",
|
||||
@ -151,7 +151,7 @@ minetest.register_node("basenodes:water_source", {
|
||||
groups = {water = 3, liquid = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:water_flowing", {
|
||||
core.register_node("basenodes:water_flowing", {
|
||||
description = "Flowing Water".."\n"..
|
||||
"Swimmable, spreading, renewable liquid".."\n"..
|
||||
"Drowning damage: 1",
|
||||
@ -182,7 +182,7 @@ minetest.register_node("basenodes:water_flowing", {
|
||||
groups = {water = 3, liquid = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:river_water_source", {
|
||||
core.register_node("basenodes:river_water_source", {
|
||||
description = "River Water Source".."\n"..
|
||||
"Swimmable, spreading, non-renewable liquid".."\n"..
|
||||
"Drowning damage: 1",
|
||||
@ -212,7 +212,7 @@ minetest.register_node("basenodes:river_water_source", {
|
||||
groups = {water = 3, liquid = 3, },
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:river_water_flowing", {
|
||||
core.register_node("basenodes:river_water_flowing", {
|
||||
description = "Flowing River Water".."\n"..
|
||||
"Swimmable, spreading, non-renewable liquid".."\n"..
|
||||
"Drowning damage: 1",
|
||||
@ -245,7 +245,7 @@ minetest.register_node("basenodes:river_water_flowing", {
|
||||
groups = {water = 3, liquid = 3, },
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:lava_flowing", {
|
||||
core.register_node("basenodes:lava_flowing", {
|
||||
description = "Flowing Lava".."\n"..
|
||||
"Swimmable, spreading, renewable liquid".."\n"..
|
||||
"4 damage per second".."\n"..
|
||||
@ -257,7 +257,7 @@ minetest.register_node("basenodes:lava_flowing", {
|
||||
{name="default_lava_flowing.png", backface_culling = false},
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
light_source = core.LIGHT_MAX,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
@ -273,7 +273,7 @@ minetest.register_node("basenodes:lava_flowing", {
|
||||
groups = {lava=3, liquid=1},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:lava_source", {
|
||||
core.register_node("basenodes:lava_source", {
|
||||
description = "Lava Source".."\n"..
|
||||
"Swimmable, spreading, renewable liquid".."\n"..
|
||||
"4 damage per second".."\n"..
|
||||
@ -285,7 +285,7 @@ minetest.register_node("basenodes:lava_source", {
|
||||
{name = "default_lava.png", backface_culling = true},
|
||||
},
|
||||
paramtype = "light",
|
||||
light_source = minetest.LIGHT_MAX,
|
||||
light_source = core.LIGHT_MAX,
|
||||
walkable = false,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
@ -301,21 +301,21 @@ minetest.register_node("basenodes:lava_source", {
|
||||
groups = {lava=3, liquid=1},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:cobble", {
|
||||
core.register_node("basenodes:cobble", {
|
||||
description = "Cobblestone",
|
||||
tiles ={"default_cobble.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:mossycobble", {
|
||||
core.register_node("basenodes:mossycobble", {
|
||||
description = "Mossy Cobblestone",
|
||||
tiles ={"default_mossycobble.png"},
|
||||
is_ground_content = false,
|
||||
groups = {cracky=3},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:apple", {
|
||||
core.register_node("basenodes:apple", {
|
||||
description = "Apple".."\n"..
|
||||
"Punch: Eat (+2)",
|
||||
drawtype = "plantlike",
|
||||
@ -328,10 +328,10 @@ minetest.register_node("basenodes:apple", {
|
||||
groups = {dig_immediate=3},
|
||||
|
||||
-- Make eatable because why not?
|
||||
on_use = minetest.item_eat(2),
|
||||
on_use = core.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:ice", {
|
||||
core.register_node("basenodes:ice", {
|
||||
description = "Ice",
|
||||
tiles ={"default_ice.png"},
|
||||
groups = {cracky=3},
|
||||
@ -339,7 +339,7 @@ minetest.register_node("basenodes:ice", {
|
||||
|
||||
-- The snow nodes intentionally have different tints to make them more
|
||||
-- distinguishable
|
||||
minetest.register_node("basenodes:snow", {
|
||||
core.register_node("basenodes:snow", {
|
||||
description = "Snow Sheet",
|
||||
tiles = {"basenodes_snow_sheet.png"},
|
||||
groups = {crumbly=3},
|
||||
@ -352,7 +352,7 @@ minetest.register_node("basenodes:snow", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("basenodes:snowblock", {
|
||||
core.register_node("basenodes:snowblock", {
|
||||
description = "Snow Block",
|
||||
tiles ={"default_snow.png"},
|
||||
groups = {crumbly=3},
|
||||
|
@ -24,11 +24,11 @@ Tool materials:
|
||||
]]
|
||||
|
||||
-- The hand
|
||||
if minetest.settings:get_bool("creative_mode") then
|
||||
if core.settings:get_bool("creative_mode") then
|
||||
local digtime = 42
|
||||
local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256}
|
||||
|
||||
minetest.register_item(":", {
|
||||
core.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x = 1, y = 1, z = 2.5},
|
||||
@ -50,7 +50,7 @@ if minetest.settings:get_bool("creative_mode") then
|
||||
}
|
||||
})
|
||||
else
|
||||
minetest.register_item(":", {
|
||||
core.register_item(":", {
|
||||
type = "none",
|
||||
wield_image = "wieldhand.png",
|
||||
wield_scale = {x = 1, y = 1, z = 2.5},
|
||||
@ -69,7 +69,7 @@ else
|
||||
end
|
||||
|
||||
-- Mese Pickaxe: special tool that digs "everything" instantly
|
||||
minetest.register_tool("basetools:pick_mese", {
|
||||
core.register_tool("basetools:pick_mese", {
|
||||
description = "Mese Pickaxe".."\n"..
|
||||
"Digs diggable nodes instantly.",
|
||||
inventory_image = "basetools_mesepick.png",
|
||||
@ -89,7 +89,7 @@ minetest.register_tool("basetools:pick_mese", {
|
||||
|
||||
|
||||
-- A variant of the mese pickaxe that is not affected by the 0.15s digging delay
|
||||
minetest.register_tool("basetools:pick_mese_no_delay", {
|
||||
core.register_tool("basetools:pick_mese_no_delay", {
|
||||
description = "Mese Pickaxe (no delay)".."\n"..
|
||||
"Digs diggable nodes instantly.".."\n"..
|
||||
"There is no delay between digging each node,\n"..
|
||||
@ -114,7 +114,7 @@ minetest.register_tool("basetools:pick_mese_no_delay", {
|
||||
-- Pickaxes: Dig cracky
|
||||
--
|
||||
|
||||
minetest.register_tool("basetools:pick_wood", {
|
||||
core.register_tool("basetools:pick_wood", {
|
||||
description = "Wooden Pickaxe".."\n"..
|
||||
"Digs cracky=3",
|
||||
inventory_image = "basetools_woodpick.png",
|
||||
@ -125,7 +125,7 @@ minetest.register_tool("basetools:pick_wood", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:pick_stone", {
|
||||
core.register_tool("basetools:pick_stone", {
|
||||
description = "Stone Pickaxe".."\n"..
|
||||
"Digs cracky=2..3",
|
||||
inventory_image = "basetools_stonepick.png",
|
||||
@ -136,7 +136,7 @@ minetest.register_tool("basetools:pick_stone", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:pick_steel", {
|
||||
core.register_tool("basetools:pick_steel", {
|
||||
description = "Steel Pickaxe".."\n"..
|
||||
"Digs cracky=1..3",
|
||||
inventory_image = "basetools_steelpick.png",
|
||||
@ -147,7 +147,7 @@ minetest.register_tool("basetools:pick_steel", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:pick_steel_l1", {
|
||||
core.register_tool("basetools:pick_steel_l1", {
|
||||
description = "Steel Pickaxe Level 1".."\n"..
|
||||
"Digs cracky=1..3".."\n"..
|
||||
"maxlevel=1",
|
||||
@ -159,7 +159,7 @@ minetest.register_tool("basetools:pick_steel_l1", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:pick_steel_l2", {
|
||||
core.register_tool("basetools:pick_steel_l2", {
|
||||
description = "Steel Pickaxe Level 2".."\n"..
|
||||
"Digs cracky=1..3".."\n"..
|
||||
"maxlevel=2",
|
||||
@ -176,7 +176,7 @@ minetest.register_tool("basetools:pick_steel_l2", {
|
||||
-- Shovels (dig crumbly)
|
||||
--
|
||||
|
||||
minetest.register_tool("basetools:shovel_wood", {
|
||||
core.register_tool("basetools:shovel_wood", {
|
||||
description = "Wooden Shovel".."\n"..
|
||||
"Digs crumbly=3",
|
||||
inventory_image = "basetools_woodshovel.png",
|
||||
@ -187,7 +187,7 @@ minetest.register_tool("basetools:shovel_wood", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:shovel_stone", {
|
||||
core.register_tool("basetools:shovel_stone", {
|
||||
description = "Stone Shovel".."\n"..
|
||||
"Digs crumbly=2..3",
|
||||
inventory_image = "basetools_stoneshovel.png",
|
||||
@ -198,7 +198,7 @@ minetest.register_tool("basetools:shovel_stone", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:shovel_steel", {
|
||||
core.register_tool("basetools:shovel_steel", {
|
||||
description = "Steel Shovel".."\n"..
|
||||
"Digs crumbly=1..3",
|
||||
inventory_image = "basetools_steelshovel.png",
|
||||
@ -214,7 +214,7 @@ minetest.register_tool("basetools:shovel_steel", {
|
||||
-- Axes (dig choppy)
|
||||
--
|
||||
|
||||
minetest.register_tool("basetools:axe_wood", {
|
||||
core.register_tool("basetools:axe_wood", {
|
||||
description = "Wooden Axe".."\n"..
|
||||
"Digs choppy=3",
|
||||
inventory_image = "basetools_woodaxe.png",
|
||||
@ -225,7 +225,7 @@ minetest.register_tool("basetools:axe_wood", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:axe_stone", {
|
||||
core.register_tool("basetools:axe_stone", {
|
||||
description = "Stone Axe".."\n"..
|
||||
"Digs choppy=2..3",
|
||||
inventory_image = "basetools_stoneaxe.png",
|
||||
@ -236,7 +236,7 @@ minetest.register_tool("basetools:axe_stone", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:axe_steel", {
|
||||
core.register_tool("basetools:axe_steel", {
|
||||
description = "Steel Axe".."\n"..
|
||||
"Digs choppy=1..3",
|
||||
inventory_image = "basetools_steelaxe.png",
|
||||
@ -252,7 +252,7 @@ minetest.register_tool("basetools:axe_steel", {
|
||||
-- Shears (dig snappy)
|
||||
--
|
||||
|
||||
minetest.register_tool("basetools:shears_wood", {
|
||||
core.register_tool("basetools:shears_wood", {
|
||||
description = "Wooden Shears".."\n"..
|
||||
"Digs snappy=3",
|
||||
inventory_image = "basetools_woodshears.png",
|
||||
@ -263,7 +263,7 @@ minetest.register_tool("basetools:shears_wood", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:shears_stone", {
|
||||
core.register_tool("basetools:shears_stone", {
|
||||
description = "Stone Shears".."\n"..
|
||||
"Digs snappy=2..3",
|
||||
inventory_image = "basetools_stoneshears.png",
|
||||
@ -274,7 +274,7 @@ minetest.register_tool("basetools:shears_stone", {
|
||||
},
|
||||
},
|
||||
})
|
||||
minetest.register_tool("basetools:shears_steel", {
|
||||
core.register_tool("basetools:shears_steel", {
|
||||
description = "Steel Shears".."\n"..
|
||||
"Digs snappy=1..3",
|
||||
inventory_image = "basetools_steelshears.png",
|
||||
@ -290,7 +290,7 @@ minetest.register_tool("basetools:shears_steel", {
|
||||
-- Swords (deal damage)
|
||||
--
|
||||
|
||||
minetest.register_tool("basetools:sword_wood", {
|
||||
core.register_tool("basetools:sword_wood", {
|
||||
description = "Wooden Sword".."\n"..
|
||||
"Damage: fleshy=2",
|
||||
inventory_image = "basetools_woodsword.png",
|
||||
@ -299,7 +299,7 @@ minetest.register_tool("basetools:sword_wood", {
|
||||
damage_groups = {fleshy=2},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:sword_stone", {
|
||||
core.register_tool("basetools:sword_stone", {
|
||||
description = "Stone Sword".."\n"..
|
||||
"Damage: fleshy=5",
|
||||
inventory_image = "basetools_stonesword.png",
|
||||
@ -309,7 +309,7 @@ minetest.register_tool("basetools:sword_stone", {
|
||||
damage_groups = {fleshy=5},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:sword_steel", {
|
||||
core.register_tool("basetools:sword_steel", {
|
||||
description = "Steel Sword".."\n"..
|
||||
"Damage: fleshy=10",
|
||||
inventory_image = "basetools_steelsword.png",
|
||||
@ -319,7 +319,7 @@ minetest.register_tool("basetools:sword_steel", {
|
||||
damage_groups = {fleshy=10},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:sword_titanium", {
|
||||
core.register_tool("basetools:sword_titanium", {
|
||||
description = "Titanium Sword".."\n"..
|
||||
"Damage: fleshy=100",
|
||||
inventory_image = "basetools_titaniumsword.png",
|
||||
@ -329,7 +329,7 @@ minetest.register_tool("basetools:sword_titanium", {
|
||||
damage_groups = {fleshy=100},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:sword_blood", {
|
||||
core.register_tool("basetools:sword_blood", {
|
||||
description = "Blood Sword".."\n"..
|
||||
"Damage: fleshy=1000",
|
||||
inventory_image = "basetools_bloodsword.png",
|
||||
@ -341,7 +341,7 @@ minetest.register_tool("basetools:sword_blood", {
|
||||
})
|
||||
|
||||
-- Max. damage sword
|
||||
minetest.register_tool("basetools:sword_mese", {
|
||||
core.register_tool("basetools:sword_mese", {
|
||||
description = "Mese Sword".."\n"..
|
||||
"Damage: fleshy=32767, fiery=32767, icy=32767".."\n"..
|
||||
"Full Punch Interval: 0.0s",
|
||||
@ -354,7 +354,7 @@ minetest.register_tool("basetools:sword_mese", {
|
||||
})
|
||||
|
||||
-- Fire/Ice sword: Deal damage to non-fleshy damage groups
|
||||
minetest.register_tool("basetools:sword_fire", {
|
||||
core.register_tool("basetools:sword_fire", {
|
||||
description = "Fire Sword".."\n"..
|
||||
"Damage: icy=10",
|
||||
inventory_image = "basetools_firesword.png",
|
||||
@ -364,7 +364,7 @@ minetest.register_tool("basetools:sword_fire", {
|
||||
damage_groups = {icy=10},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:sword_ice", {
|
||||
core.register_tool("basetools:sword_ice", {
|
||||
description = "Ice Sword".."\n"..
|
||||
"Damage: fiery=10",
|
||||
inventory_image = "basetools_icesword.png",
|
||||
@ -374,7 +374,7 @@ minetest.register_tool("basetools:sword_ice", {
|
||||
damage_groups = {fiery=10},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:sword_elemental", {
|
||||
core.register_tool("basetools:sword_elemental", {
|
||||
description = "Elemental Sword".."\n"..
|
||||
"Damage: fiery=10, icy=10",
|
||||
inventory_image = "basetools_elementalsword.png",
|
||||
@ -386,7 +386,7 @@ minetest.register_tool("basetools:sword_elemental", {
|
||||
})
|
||||
|
||||
-- Healing weapons: heal HP
|
||||
minetest.register_tool("basetools:dagger_heal", {
|
||||
core.register_tool("basetools:dagger_heal", {
|
||||
description = "Healing Dagger".."\n"..
|
||||
"Heal: fleshy=1".."\n"..
|
||||
"Full Punch Interval: 0.5s",
|
||||
@ -396,7 +396,7 @@ minetest.register_tool("basetools:dagger_heal", {
|
||||
damage_groups = {fleshy=-1},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:sword_heal", {
|
||||
core.register_tool("basetools:sword_heal", {
|
||||
description = "Healing Sword".."\n"..
|
||||
"Heal: fleshy=10",
|
||||
inventory_image = "basetools_healsword.png",
|
||||
@ -405,7 +405,7 @@ minetest.register_tool("basetools:sword_heal", {
|
||||
damage_groups = {fleshy=-10},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:sword_heal_super", {
|
||||
core.register_tool("basetools:sword_heal_super", {
|
||||
description = "Super Healing Sword".."\n"..
|
||||
"Heal: fleshy=32768, fiery=32768, icy=32768",
|
||||
inventory_image = "basetools_superhealsword.png",
|
||||
@ -419,7 +419,7 @@ minetest.register_tool("basetools:sword_heal_super", {
|
||||
--
|
||||
-- Dagger: Low damage, fast punch interval
|
||||
--
|
||||
minetest.register_tool("basetools:dagger_wood", {
|
||||
core.register_tool("basetools:dagger_wood", {
|
||||
description = "Wooden Dagger".."\n"..
|
||||
"Damage: fleshy=1".."\n"..
|
||||
"Full Punch Interval: 0.5s",
|
||||
@ -430,7 +430,7 @@ minetest.register_tool("basetools:dagger_wood", {
|
||||
damage_groups = {fleshy=1},
|
||||
}
|
||||
})
|
||||
minetest.register_tool("basetools:dagger_steel", {
|
||||
core.register_tool("basetools:dagger_steel", {
|
||||
description = "Steel Dagger".."\n"..
|
||||
"Damage: fleshy=2".."\n"..
|
||||
"Full Punch Interval: 0.5s",
|
||||
@ -492,7 +492,7 @@ for i, params in ipairs(tool_params) do
|
||||
local uses = params.uses
|
||||
local ustring = uses.."-Use"..(uses == 1 and "" or "s")
|
||||
local color = string.format("#FF00%02X", math.floor(((i-1)/#tool_params) * 255))
|
||||
minetest.register_tool("basetools:pick_uses_"..string.format("%05d", uses), {
|
||||
core.register_tool("basetools:pick_uses_"..string.format("%05d", uses), {
|
||||
description = ustring.." Pickaxe".."\n"..
|
||||
"Digs cracky=3"..
|
||||
(params.wear_description and "\n".."Wear bar: " .. params.wear_description or ""),
|
||||
@ -506,7 +506,7 @@ for i, params in ipairs(tool_params) do
|
||||
wear_color = params.wear_color
|
||||
})
|
||||
|
||||
minetest.register_tool("basetools:sword_uses_"..string.format("%05d", uses), {
|
||||
core.register_tool("basetools:sword_uses_"..string.format("%05d", uses), {
|
||||
description = ustring.." Sword".."\n"..
|
||||
"Damage: fleshy=1",
|
||||
inventory_image = "basetools_usessword.png^[colorize:"..color..":127",
|
||||
@ -517,11 +517,11 @@ for i, params in ipairs(tool_params) do
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("wear_color", {
|
||||
core.register_chatcommand("wear_color", {
|
||||
params = "[idx]",
|
||||
description = "Set wear bar color override",
|
||||
func = function(player_name, param)
|
||||
local player = minetest.get_player_by_name(player_name)
|
||||
local player = core.get_player_by_name(player_name)
|
||||
if not player then return end
|
||||
|
||||
local wear_color = nil
|
||||
@ -551,7 +551,7 @@ local wear_on_use = function(itemstack, user, pointed_thing)
|
||||
local color = math.random(0, 0xFFFFFF)
|
||||
local colorstr = string.format("#%06x", color)
|
||||
meta:set_wear_bar_params(colorstr)
|
||||
minetest.log("action", "[basetool] Wear bar color of "..itemstack:get_name().." changed to "..colorstr)
|
||||
core.log("action", "[basetool] Wear bar color of "..itemstack:get_name().." changed to "..colorstr)
|
||||
itemstack:set_wear(math.random(0, 65535))
|
||||
return itemstack
|
||||
end
|
||||
@ -563,7 +563,7 @@ local wear_on_place = function(itemstack, user, pointed_thing)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_tool("basetools:random_wear_bar", {
|
||||
core.register_tool("basetools:random_wear_bar", {
|
||||
description = "Wear Bar Color Test\n" ..
|
||||
"Punch: Set random color & wear\n" ..
|
||||
"Place: Clear color",
|
||||
|
@ -6,17 +6,17 @@ local function bench_name2content()
|
||||
local t = {}
|
||||
_G._bench_content_ids_data[t] = true
|
||||
|
||||
local get_content_id = minetest.get_content_id
|
||||
local get_content_id = core.get_content_id
|
||||
|
||||
local start = minetest.get_us_time()
|
||||
local start = core.get_us_time()
|
||||
|
||||
for i = 1, 200 do
|
||||
for name in pairs(minetest.registered_nodes) do
|
||||
for name in pairs(core.registered_nodes) do
|
||||
t[#t + 1] = get_content_id(name)
|
||||
end
|
||||
end
|
||||
|
||||
local finish = minetest.get_us_time()
|
||||
local finish = core.get_us_time()
|
||||
|
||||
return (finish - start) / 1000
|
||||
end
|
||||
@ -28,13 +28,13 @@ local function bench_content2name()
|
||||
-- Try to estimate the highest content ID that's used
|
||||
-- (not accurate but good enough for this test)
|
||||
local n = 0
|
||||
for _ in pairs(minetest.registered_nodes) do
|
||||
for _ in pairs(core.registered_nodes) do
|
||||
n = n + 1
|
||||
end
|
||||
|
||||
local get_name_from_content_id = minetest.get_name_from_content_id
|
||||
local get_name_from_content_id = core.get_name_from_content_id
|
||||
|
||||
local start = minetest.get_us_time()
|
||||
local start = core.get_us_time()
|
||||
|
||||
for i = 1, 200 do
|
||||
for j = 0, n do
|
||||
@ -42,30 +42,30 @@ local function bench_content2name()
|
||||
end
|
||||
end
|
||||
|
||||
local finish = minetest.get_us_time()
|
||||
local finish = core.get_us_time()
|
||||
|
||||
return (finish - start) / 1000
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("bench_name2content", {
|
||||
core.register_chatcommand("bench_name2content", {
|
||||
params = "",
|
||||
description = "Benchmark: Conversion from node names to content IDs",
|
||||
func = function(name, param)
|
||||
minetest.chat_send_player(name, "Benchmarking minetest.get_content_id. Warming up ...")
|
||||
core.chat_send_player(name, "Benchmarking core.get_content_id. Warming up ...")
|
||||
bench_name2content()
|
||||
minetest.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
core.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
local time = bench_name2content()
|
||||
return true, ("Time: %.2f ms"):format(time)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("bench_content2name", {
|
||||
core.register_chatcommand("bench_content2name", {
|
||||
params = "",
|
||||
description = "Benchmark: Conversion from content IDs to node names",
|
||||
func = function(name, param)
|
||||
minetest.chat_send_player(name, "Benchmarking minetest.get_name_from_content_id. Warming up ...")
|
||||
core.chat_send_player(name, "Benchmarking core.get_name_from_content_id. Warming up ...")
|
||||
bench_content2name()
|
||||
minetest.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
core.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
local time = bench_content2name()
|
||||
return true, ("Time: %.2f ms"):format(time)
|
||||
end,
|
||||
@ -87,32 +87,32 @@ local function get_positions_cube(ppos)
|
||||
return pos_list
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("bench_bulk_set_node", {
|
||||
core.register_chatcommand("bench_bulk_set_node", {
|
||||
params = "",
|
||||
description = "Benchmark: Bulk-set 99×99×99 stone nodes",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
local pos_list = get_positions_cube(player:get_pos())
|
||||
|
||||
minetest.chat_send_player(name, "Benchmarking minetest.bulk_set_node. Warming up ...")
|
||||
core.chat_send_player(name, "Benchmarking core.bulk_set_node. Warming up ...")
|
||||
|
||||
-- warm up with stone to prevent having different callbacks
|
||||
-- due to different node topology
|
||||
minetest.bulk_set_node(pos_list, {name = "mapgen_stone"})
|
||||
core.bulk_set_node(pos_list, {name = "mapgen_stone"})
|
||||
|
||||
minetest.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
core.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
|
||||
local start_time = minetest.get_us_time()
|
||||
local start_time = core.get_us_time()
|
||||
for i=1,#pos_list do
|
||||
minetest.set_node(pos_list[i], {name = "mapgen_stone"})
|
||||
core.set_node(pos_list[i], {name = "mapgen_stone"})
|
||||
end
|
||||
local middle_time = minetest.get_us_time()
|
||||
minetest.bulk_set_node(pos_list, {name = "mapgen_stone"})
|
||||
local end_time = minetest.get_us_time()
|
||||
local msg = string.format("Benchmark results: minetest.set_node loop: %.2f ms; minetest.bulk_set_node: %.2f ms",
|
||||
local middle_time = core.get_us_time()
|
||||
core.bulk_set_node(pos_list, {name = "mapgen_stone"})
|
||||
local end_time = core.get_us_time()
|
||||
local msg = string.format("Benchmark results: core.set_node loop: %.2f ms; core.bulk_set_node: %.2f ms",
|
||||
((middle_time - start_time)) / 1000,
|
||||
((end_time - middle_time)) / 1000
|
||||
)
|
||||
@ -120,19 +120,19 @@ minetest.register_chatcommand("bench_bulk_set_node", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("bench_bulk_get_node", {
|
||||
core.register_chatcommand("bench_bulk_get_node", {
|
||||
params = "",
|
||||
description = "Benchmark: Bulk-get 99×99×99 nodes",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
local pos_list = get_positions_cube(player:get_pos())
|
||||
local function bench()
|
||||
local start_time = minetest.get_us_time()
|
||||
local start_time = core.get_us_time()
|
||||
for i=1,#pos_list do
|
||||
local n = minetest.get_node(pos_list[i])
|
||||
local n = core.get_node(pos_list[i])
|
||||
-- Make sure the name lookup is never optimized away.
|
||||
-- Table allocation might still be omitted. But only accessing
|
||||
-- the name of a node is a common pattern anyways.
|
||||
@ -140,47 +140,47 @@ minetest.register_chatcommand("bench_bulk_get_node", {
|
||||
error("should never happen")
|
||||
end
|
||||
end
|
||||
return minetest.get_us_time() - start_time
|
||||
return core.get_us_time() - start_time
|
||||
end
|
||||
|
||||
minetest.chat_send_player(name, "Benchmarking minetest.get_node. Warming up ...")
|
||||
core.chat_send_player(name, "Benchmarking core.get_node. Warming up ...")
|
||||
bench()
|
||||
|
||||
minetest.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
core.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
local result_us = bench()
|
||||
|
||||
local msg = string.format("Benchmark results: minetest.get_node loop 1: %.2f ms",
|
||||
local msg = string.format("Benchmark results: core.get_node loop 1: %.2f ms",
|
||||
result_us / 1000)
|
||||
return true, msg
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("bench_bulk_swap_node", {
|
||||
core.register_chatcommand("bench_bulk_swap_node", {
|
||||
params = "",
|
||||
description = "Benchmark: Bulk-swap 99×99×99 stone nodes",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
local pos_list = get_positions_cube(player:get_pos())
|
||||
|
||||
minetest.chat_send_player(name, "Benchmarking minetest.bulk_swap_node. Warming up ...")
|
||||
core.chat_send_player(name, "Benchmarking core.bulk_swap_node. Warming up ...")
|
||||
|
||||
-- warm up because first execution otherwise becomes
|
||||
-- significantly slower
|
||||
minetest.bulk_swap_node(pos_list, {name = "mapgen_stone"})
|
||||
core.bulk_swap_node(pos_list, {name = "mapgen_stone"})
|
||||
|
||||
minetest.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
core.chat_send_player(name, "Warming up finished, now benchmarking ...")
|
||||
|
||||
local start_time = minetest.get_us_time()
|
||||
local start_time = core.get_us_time()
|
||||
for i=1,#pos_list do
|
||||
minetest.swap_node(pos_list[i], {name = "mapgen_stone"})
|
||||
core.swap_node(pos_list[i], {name = "mapgen_stone"})
|
||||
end
|
||||
local middle_time = minetest.get_us_time()
|
||||
minetest.bulk_swap_node(pos_list, {name = "mapgen_stone"})
|
||||
local end_time = minetest.get_us_time()
|
||||
local msg = string.format("Benchmark results: minetest.swap_node loop: %.2f ms; minetest.bulk_swap_node: %.2f ms",
|
||||
local middle_time = core.get_us_time()
|
||||
core.bulk_swap_node(pos_list, {name = "mapgen_stone"})
|
||||
local end_time = core.get_us_time()
|
||||
local msg = string.format("Benchmark results: core.swap_node loop: %.2f ms; core.bulk_swap_node: %.2f ms",
|
||||
((middle_time - start_time)) / 1000,
|
||||
((end_time - middle_time)) / 1000
|
||||
)
|
||||
|
@ -4,8 +4,8 @@
|
||||
-- The itemstrings are deliberately kept descriptive to keep them easy to
|
||||
-- recognize.
|
||||
|
||||
minetest.register_node("broken:node_with_empty_definition", {})
|
||||
minetest.register_tool("broken:tool_with_empty_definition", {})
|
||||
minetest.register_craftitem("broken:craftitem_with_empty_definition", {})
|
||||
core.register_node("broken:node_with_empty_definition", {})
|
||||
core.register_tool("broken:tool_with_empty_definition", {})
|
||||
core.register_craftitem("broken:craftitem_with_empty_definition", {})
|
||||
|
||||
minetest.register_entity("broken:entity_with_empty_definition", {})
|
||||
core.register_entity("broken:entity_with_empty_definition", {})
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- Bucket: Punch liquid source or flowing liquid to collect it
|
||||
|
||||
minetest.register_tool("bucket:bucket", {
|
||||
core.register_tool("bucket:bucket", {
|
||||
description = "Bucket".."\n"..
|
||||
"Picks up liquid nodes",
|
||||
inventory_image = "bucket.png",
|
||||
@ -13,10 +13,10 @@ minetest.register_tool("bucket:bucket", {
|
||||
return
|
||||
end
|
||||
-- Check if pointing to a liquid
|
||||
local n = minetest.get_node(pointed_thing.under)
|
||||
local def = minetest.registered_nodes[n.name]
|
||||
local n = core.get_node(pointed_thing.under)
|
||||
local def = core.registered_nodes[n.name]
|
||||
if def ~= nil and (def.liquidtype == "source" or def.liquidtype == "flowing") then
|
||||
minetest.add_node(pointed_thing.under, {name="air"})
|
||||
core.add_node(pointed_thing.under, {name="air"})
|
||||
local inv = user:get_inventory()
|
||||
if inv then
|
||||
inv:add_item("main", ItemStack(n.name))
|
||||
|
@ -1,8 +1,8 @@
|
||||
-- Entities that test their callbacks
|
||||
|
||||
local message = function(msg)
|
||||
minetest.log("action", "[callbacks] "..msg)
|
||||
minetest.chat_send_all(msg)
|
||||
core.log("action", "[callbacks] "..msg)
|
||||
core.chat_send_all(msg)
|
||||
end
|
||||
|
||||
local get_object_name = function(obj)
|
||||
@ -18,11 +18,11 @@ local get_object_name = function(obj)
|
||||
end
|
||||
|
||||
local spos = function(self)
|
||||
return minetest.pos_to_string(vector.round(self.object:get_pos()))
|
||||
return core.pos_to_string(vector.round(self.object:get_pos()))
|
||||
end
|
||||
|
||||
-- Callback test entity (all callbacks except on_step)
|
||||
minetest.register_entity("callbacks:callback", {
|
||||
core.register_entity("callbacks:callback", {
|
||||
initial_properties = {
|
||||
visual = "upright_sprite",
|
||||
textures = { "callbacks_callback_entity.png" },
|
||||
@ -69,7 +69,7 @@ minetest.register_entity("callbacks:callback", {
|
||||
})
|
||||
|
||||
-- Only test on_step callback
|
||||
minetest.register_entity("callbacks:callback_step", {
|
||||
core.register_entity("callbacks:callback_step", {
|
||||
visual = "upright_sprite",
|
||||
textures = { "callbacks_callback_entity_step.png" },
|
||||
on_step = function(self, dtime)
|
||||
@ -78,7 +78,7 @@ minetest.register_entity("callbacks:callback_step", {
|
||||
})
|
||||
|
||||
-- Callback punch with nil puncher
|
||||
minetest.register_entity("callbacks:callback_puncher", {
|
||||
core.register_entity("callbacks:callback_puncher", {
|
||||
initial_properties = {
|
||||
visual = "upright_sprite",
|
||||
textures = { "callbacks_callback_entity.png" },
|
||||
|
@ -1,4 +1,4 @@
|
||||
dofile(minetest.get_modpath("callbacks").."/items.lua")
|
||||
dofile(minetest.get_modpath("callbacks").."/nodes.lua")
|
||||
dofile(minetest.get_modpath("callbacks").."/entities.lua")
|
||||
dofile(minetest.get_modpath("callbacks").."/players.lua")
|
||||
dofile(core.get_modpath("callbacks").."/items.lua")
|
||||
dofile(core.get_modpath("callbacks").."/nodes.lua")
|
||||
dofile(core.get_modpath("callbacks").."/entities.lua")
|
||||
dofile(core.get_modpath("callbacks").."/players.lua")
|
||||
|
@ -3,11 +3,11 @@
|
||||
--
|
||||
|
||||
local function print_to_everything(msg)
|
||||
minetest.log("action", "[callbacks] " .. msg)
|
||||
minetest.chat_send_all(msg)
|
||||
core.log("action", "[callbacks] " .. msg)
|
||||
core.chat_send_all(msg)
|
||||
end
|
||||
|
||||
minetest.register_craftitem("callbacks:callback_item_1", {
|
||||
core.register_craftitem("callbacks:callback_item_1", {
|
||||
description = "Callback Test Item 1".."\n"..
|
||||
"Tests callbacks: on_secondary_use, on_drop, on_pickup, on_use, after_use".."\n"..
|
||||
"Punch/Drop + Sneak: Switch to Callback Test Item 2".."\n"..
|
||||
@ -34,7 +34,7 @@ minetest.register_craftitem("callbacks:callback_item_1", {
|
||||
itemstack:set_name("callbacks:callback_item_2")
|
||||
end
|
||||
|
||||
return minetest.item_drop(itemstack, dropper, pos)
|
||||
return core.item_drop(itemstack, dropper, pos)
|
||||
end,
|
||||
|
||||
on_pickup = function(itemstack, picker, pointed_thing, ...)
|
||||
@ -50,7 +50,7 @@ minetest.register_craftitem("callbacks:callback_item_1", {
|
||||
-- Pick up one item of the other kind at once
|
||||
local taken = itemstack:take_item()
|
||||
taken:set_name("callbacks:callback_item_2")
|
||||
local leftover = minetest.item_pickup(taken, picker, pointed_thing, ...)
|
||||
local leftover = core.item_pickup(taken, picker, pointed_thing, ...)
|
||||
leftover:set_name("callbacks:callback_item_1")
|
||||
itemstack:add_item(leftover)
|
||||
return itemstack
|
||||
@ -59,10 +59,10 @@ minetest.register_craftitem("callbacks:callback_item_1", {
|
||||
return
|
||||
elseif ctrl.left then
|
||||
-- Eat it
|
||||
return minetest.do_item_eat(2, nil, itemstack, picker, pointed_thing)
|
||||
return core.do_item_eat(2, nil, itemstack, picker, pointed_thing)
|
||||
else
|
||||
-- Normal: pick up everything
|
||||
return minetest.item_pickup(itemstack, picker, pointed_thing, ...)
|
||||
return core.item_pickup(itemstack, picker, pointed_thing, ...)
|
||||
end
|
||||
end,
|
||||
|
||||
@ -87,7 +87,7 @@ minetest.register_craftitem("callbacks:callback_item_1", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("callbacks:callback_item_2", {
|
||||
core.register_craftitem("callbacks:callback_item_2", {
|
||||
description = "Callback Test Item 2".."\n"..
|
||||
"Punch to switch to Callback Test Item 1",
|
||||
inventory_image = "callbacks_callback_item_2.png",
|
||||
@ -102,7 +102,7 @@ minetest.register_craftitem("callbacks:callback_item_2", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_item_pickup(function(itemstack, picker, pointed_thing, time_from_last_punch, ...)
|
||||
core.register_on_item_pickup(function(itemstack, picker, pointed_thing, time_from_last_punch, ...)
|
||||
assert(not pointed_thing or pointed_thing.ref:get_luaentity().name == "__builtin:item")
|
||||
|
||||
local item_name = itemstack:get_name()
|
||||
|
@ -1,29 +1,29 @@
|
||||
local function print_to_everything(msg)
|
||||
minetest.log("action", "[callbacks] " .. msg)
|
||||
minetest.chat_send_all(msg)
|
||||
core.log("action", "[callbacks] " .. msg)
|
||||
core.chat_send_all(msg)
|
||||
end
|
||||
|
||||
minetest.register_node("callbacks:callback_node", {
|
||||
core.register_node("callbacks:callback_node", {
|
||||
description = "Callback Test Node (construct/destruct/timer)".."\n"..
|
||||
"Tests callbacks: on_construct, after_place_node, on_destruct, after_destruct, after_dig_node, on_timer",
|
||||
tiles = {"callbacks_callback_node.png"},
|
||||
groups = {callback_test=1, dig_immediate=3},
|
||||
-- This was known to cause a bug in minetest.item_place_node() when used
|
||||
-- via minetest.place_node(), causing a placer with no position
|
||||
-- This was known to cause a bug in core.item_place_node() when used
|
||||
-- via core.place_node(), causing a placer with no position
|
||||
paramtype2 = "facedir",
|
||||
drop = "",
|
||||
|
||||
on_construct = function(pos)
|
||||
print_to_everything("callbacks:callback_node:on_construct("..minetest.pos_to_string(pos)..")")
|
||||
local meta = minetest.get_meta(pos)
|
||||
print_to_everything("callbacks:callback_node:on_construct("..core.pos_to_string(pos)..")")
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("mine", "test")
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
local timer = core.get_node_timer(pos)
|
||||
timer:start(4, 3)
|
||||
end,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
print_to_everything("callbacks:callback_node:after_place_node("..minetest.pos_to_string(pos)..")")
|
||||
local meta = minetest.get_meta(pos)
|
||||
print_to_everything("callbacks:callback_node:after_place_node("..core.pos_to_string(pos)..")")
|
||||
local meta = core.get_meta(pos)
|
||||
if meta:get_string("mine") == "test" then
|
||||
print_to_everything("correct metadata found")
|
||||
else
|
||||
@ -32,15 +32,15 @@ minetest.register_node("callbacks:callback_node", {
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
print_to_everything("callbacks:callback_node:on_destruct("..minetest.pos_to_string(pos)..")")
|
||||
print_to_everything("callbacks:callback_node:on_destruct("..core.pos_to_string(pos)..")")
|
||||
end,
|
||||
|
||||
after_destruct = function(pos)
|
||||
print_to_everything("callbacks:callback_node:after_destruct("..minetest.pos_to_string(pos)..")")
|
||||
print_to_everything("callbacks:callback_node:after_destruct("..core.pos_to_string(pos)..")")
|
||||
end,
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
print_to_everything("callbacks:callback_node:after_dig_node("..minetest.pos_to_string(pos)..")")
|
||||
print_to_everything("callbacks:callback_node:after_dig_node("..core.pos_to_string(pos)..")")
|
||||
end,
|
||||
|
||||
on_timer = function(pos, elapsed)
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
local message = function(msg)
|
||||
minetest.log("action", "[callbacks] "..msg)
|
||||
minetest.chat_send_all(msg)
|
||||
core.log("action", "[callbacks] "..msg)
|
||||
core.chat_send_all(msg)
|
||||
end
|
||||
|
||||
core.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage)
|
||||
|
@ -1,9 +1,9 @@
|
||||
local function print_to_everything(msg)
|
||||
minetest.log("action", "[chest] " .. msg)
|
||||
minetest.chat_send_all(msg)
|
||||
core.log("action", "[chest] " .. msg)
|
||||
core.chat_send_all(msg)
|
||||
end
|
||||
|
||||
minetest.register_node("chest:chest", {
|
||||
core.register_node("chest:chest", {
|
||||
description = "Chest" .. "\n" ..
|
||||
"32 inventory slots",
|
||||
tiles ={"chest_chest.png^[sheet:2x2:0,0", "chest_chest.png^[sheet:2x2:0,0",
|
||||
@ -13,7 +13,7 @@ minetest.register_node("chest:chest", {
|
||||
groups = {dig_immediate=2,choppy=3,meta_is_privatizable=1},
|
||||
is_ground_content = false,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
"size[8,9]"..
|
||||
"list[current_name;main;0,0;8,4;]"..
|
||||
@ -24,7 +24,7 @@ minetest.register_node("chest:chest", {
|
||||
inv:set_size("main", 8*4)
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local meta = core.get_meta(pos);
|
||||
local inv = meta:get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
|
@ -2,12 +2,12 @@ local ALLOW_PUT_MAX = 1
|
||||
local ALLOW_TAKE_MAX = 4
|
||||
|
||||
local function print_to_everything(msg)
|
||||
minetest.log("action", "[chest] " .. msg)
|
||||
minetest.chat_send_all(msg)
|
||||
core.log("action", "[chest] " .. msg)
|
||||
core.chat_send_all(msg)
|
||||
end
|
||||
|
||||
-- Create a detached inventory
|
||||
local inv = minetest.create_detached_inventory("detached_inventory", {
|
||||
local inv = core.create_detached_inventory("detached_inventory", {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
print_to_everything("Detached inventory: "..player:get_player_name().." triggered allow_move")
|
||||
return count -- Allow all
|
||||
@ -34,7 +34,7 @@ inv:set_size("main", 8*3)
|
||||
|
||||
|
||||
-- Add a special chest to grant access to this inventory
|
||||
minetest.register_node("chest:detached_chest", {
|
||||
core.register_node("chest:detached_chest", {
|
||||
description = "Detached Chest" .. "\n" ..
|
||||
"Grants access to a shared detached inventory" .."\n" ..
|
||||
"Max. item put count: "..ALLOW_PUT_MAX .."\n"..
|
||||
@ -46,7 +46,7 @@ minetest.register_node("chest:detached_chest", {
|
||||
groups = {dig_immediate=2,choppy=3,meta_is_privatizable=1},
|
||||
is_ground_content = false,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
"size[8,9]"..
|
||||
"list[detached:detached_inventory;main;0,0;8,3;0]"..
|
||||
|
@ -1,2 +1,2 @@
|
||||
dofile(minetest.get_modpath("chest").."/chest.lua")
|
||||
dofile(minetest.get_modpath("chest").."/detached.lua")
|
||||
dofile(core.get_modpath("chest").."/chest.lua")
|
||||
dofile(core.get_modpath("chest").."/detached.lua")
|
||||
|
@ -1,5 +1,5 @@
|
||||
local F = minetest.formspec_escape
|
||||
local S = minetest.get_translator("chest_of_everything")
|
||||
local F = core.formspec_escape
|
||||
local S = core.get_translator("chest_of_everything")
|
||||
|
||||
local detached_inventories = {}
|
||||
|
||||
@ -22,7 +22,7 @@ local all_items_list -- cached list of all items
|
||||
-- Create detached inventories
|
||||
local function add_detached_inventories(player)
|
||||
local name = player:get_player_name()
|
||||
local inv_items = minetest.create_detached_inventory("chest_of_everything_items_"..name, {
|
||||
local inv_items = core.create_detached_inventory("chest_of_everything_items_"..name, {
|
||||
allow_move = function(inv, from_list, from_index, to_list, to_index, count, player)
|
||||
return 0
|
||||
end,
|
||||
@ -33,7 +33,7 @@ local function add_detached_inventories(player)
|
||||
return -1
|
||||
end,
|
||||
}, name)
|
||||
local inv_trash = minetest.create_detached_inventory("chest_of_everything_trash_"..name, {
|
||||
local inv_trash = core.create_detached_inventory("chest_of_everything_trash_"..name, {
|
||||
allow_take = function(inv, listname, index, stack, player)
|
||||
return 0
|
||||
end,
|
||||
@ -58,14 +58,14 @@ local sort_items_by_type = function(item1, item2)
|
||||
* Other items
|
||||
* Items from the 'broken' mod
|
||||
* Dummy items ]]
|
||||
local def1 = minetest.registered_items[item1]
|
||||
local def2 = minetest.registered_items[item2]
|
||||
local def1 = core.registered_items[item1]
|
||||
local def2 = core.registered_items[item2]
|
||||
local tool1 = def1.type == "tool"
|
||||
local tool2 = def2.type == "tool"
|
||||
local testtool1 = minetest.get_item_group(item1, "testtool") == 1
|
||||
local testtool2 = minetest.get_item_group(item2, "testtool") == 1
|
||||
local dummy1 = minetest.get_item_group(item1, "dummy") == 1
|
||||
local dummy2 = minetest.get_item_group(item2, "dummy") == 1
|
||||
local testtool1 = core.get_item_group(item1, "testtool") == 1
|
||||
local testtool2 = core.get_item_group(item2, "testtool") == 1
|
||||
local dummy1 = core.get_item_group(item1, "dummy") == 1
|
||||
local dummy2 = core.get_item_group(item2, "dummy") == 1
|
||||
local broken1 = def1.mod_origin == "broken"
|
||||
local broken2 = def2.mod_origin == "broken"
|
||||
local craftitem1 = def1.type == "craft"
|
||||
@ -113,7 +113,7 @@ local collect_items = function(filter, lang_code)
|
||||
filter = string.trim(filter)
|
||||
filter = string.lower(filter) -- to make sure the search is case-insensitive
|
||||
end
|
||||
for itemstring, def in pairs(minetest.registered_items) do
|
||||
for itemstring, def in pairs(core.registered_items) do
|
||||
if itemstring ~= "" and itemstring ~= "unknown" and itemstring ~= "ignore" then
|
||||
if filter and lang_code then
|
||||
local desc = ItemStack(itemstring):get_description()
|
||||
@ -124,7 +124,7 @@ local collect_items = function(filter, lang_code)
|
||||
matches = string.match(ldesc, filter) ~= nil
|
||||
-- Second, try to match translated description
|
||||
if not matches then
|
||||
local tdesc = minetest.get_translated_string(lang_code, desc)
|
||||
local tdesc = core.get_translated_string(lang_code, desc)
|
||||
if tdesc ~= "" then
|
||||
tdesc = string.lower(tdesc)
|
||||
matches = string.match(tdesc, filter) ~= nil
|
||||
@ -134,7 +134,7 @@ local collect_items = function(filter, lang_code)
|
||||
if not matches then
|
||||
local sdesc = ItemStack(itemstring):get_short_description()
|
||||
if sdesc ~= "" then
|
||||
sdesc = minetest.get_translated_string(lang_code, sdesc)
|
||||
sdesc = core.get_translated_string(lang_code, sdesc)
|
||||
sdesc = string.lower(sdesc)
|
||||
matches = string.match(sdesc, filter) ~= nil
|
||||
end
|
||||
@ -172,7 +172,7 @@ local function update_inventory(name)
|
||||
if search == "" then
|
||||
items = all_items_list
|
||||
else
|
||||
local lang_code = minetest.get_player_information(name).lang_code
|
||||
local lang_code = core.get_player_information(name).lang_code
|
||||
items = collect_items(search, lang_code)
|
||||
end
|
||||
local max_page = math.ceil(#items / SLOTS)
|
||||
@ -197,7 +197,7 @@ local function get_formspec(page, name)
|
||||
if not name then
|
||||
return ""
|
||||
end
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
local playerinvsize = player:get_inventory():get_size("main")
|
||||
local hotbarsize = player:hud_get_hotbar_itemcount()
|
||||
local pinv_w, pinv_h, pinv_x
|
||||
@ -250,11 +250,11 @@ end
|
||||
local show_formspec = function(name)
|
||||
local page = current_pages[name]
|
||||
local form = get_formspec(page, name)
|
||||
minetest.show_formspec(name, "chest_of_everything:getitem", form)
|
||||
core.show_formspec(name, "chest_of_everything:getitem", form)
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "chest_of_everything:getitem" then
|
||||
return
|
||||
end
|
||||
@ -296,7 +296,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_tool("chest_of_everything:bag", {
|
||||
core.register_tool("chest_of_everything:bag", {
|
||||
description = S("Bag of Everything") .. "\n" ..
|
||||
S("Grants access to all items"),
|
||||
inventory_image = "chest_of_everything_bag.png",
|
||||
@ -310,7 +310,7 @@ minetest.register_tool("chest_of_everything:bag", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("chest_of_everything:chest", {
|
||||
core.register_node("chest_of_everything:chest", {
|
||||
description = S("Chest of Everything") .. "\n" ..
|
||||
S("Grants access to all items"),
|
||||
tiles ={"chest_of_everything_chest.png^[sheet:2x2:0,0", "chest_of_everything_chest.png^[sheet:2x2:0,0",
|
||||
@ -320,7 +320,7 @@ minetest.register_node("chest_of_everything:chest", {
|
||||
groups = { dig_immediate=2, choppy=3 },
|
||||
is_ground_content = false,
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", S("Chest of Everything"))
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
@ -332,11 +332,11 @@ minetest.register_node("chest_of_everything:chest", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
core.register_on_mods_loaded(function()
|
||||
all_items_list = collect_items()
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
core.register_on_joinplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
current_searches[name] = ""
|
||||
current_pages[name] = 1
|
||||
@ -345,7 +345,7 @@ minetest.register_on_joinplayer(function(player)
|
||||
update_inventory(name)
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
core.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
current_pages[name] = nil
|
||||
current_max_pages[name] = nil
|
||||
|
@ -20,7 +20,7 @@ for g=1, #groups do
|
||||
elseif l==2 then
|
||||
tile = tile .. "^[colorize:#FF0000:127"
|
||||
end
|
||||
minetest.register_node("dignodes:"..gr.."_"..r.."_"..l, {
|
||||
core.register_node("dignodes:"..gr.."_"..r.."_"..l, {
|
||||
description = d,
|
||||
tiles = { tile },
|
||||
groups = { [gr] = r, level = l },
|
||||
@ -31,7 +31,7 @@ for g=1, #groups do
|
||||
end
|
||||
|
||||
-- Node without any digging groups
|
||||
minetest.register_node("dignodes:none", {
|
||||
core.register_node("dignodes:none", {
|
||||
description = "Dig Test Node: groupless".."\n"..
|
||||
"Can't be dug by normal digging tools".."\n"..
|
||||
"(use the Remover tool to remove)",
|
||||
|
@ -12,21 +12,21 @@ local give_initial_stuff = function(player)
|
||||
give_if_not_gotten_already(inv, "main", "bucket:bucket")
|
||||
give_if_not_gotten_already(inv, "main", "testnodes:light14")
|
||||
give_if_not_gotten_already(inv, "main", "chest_of_everything:bag")
|
||||
minetest.log("action", "[give_initial_stuff] Giving initial stuff to "..player:get_player_name())
|
||||
core.log("action", "[give_initial_stuff] Giving initial stuff to "..player:get_player_name())
|
||||
end
|
||||
|
||||
minetest.register_on_newplayer(function(player)
|
||||
if minetest.settings:get_bool("give_initial_stuff", true) then
|
||||
core.register_on_newplayer(function(player)
|
||||
if core.settings:get_bool("give_initial_stuff", true) then
|
||||
give_initial_stuff(player)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("stuff", {
|
||||
core.register_chatcommand("stuff", {
|
||||
params = "",
|
||||
privs = { give = true },
|
||||
description = "Give yourself initial items",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player or not player:is_player() then
|
||||
return false, "No player."
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
local function register_entity(name, textures, backface_culling)
|
||||
minetest.register_entity("gltf:" .. name, {
|
||||
core.register_entity("gltf:" .. name, {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "gltf_" .. name .. ".gltf",
|
||||
@ -18,7 +18,7 @@ do
|
||||
register_entity("blender_cube", cube_textures)
|
||||
register_entity("blender_cube_scaled", cube_textures)
|
||||
register_entity("blender_cube_matrix_transform", cube_textures)
|
||||
minetest.register_entity("gltf:blender_cube_glb", {
|
||||
core.register_entity("gltf:blender_cube_glb", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "gltf_blender_cube.glb",
|
||||
@ -31,7 +31,7 @@ end
|
||||
register_entity("snow_man", {"gltf_snow_man.png"})
|
||||
register_entity("spider", {"gltf_spider.png"})
|
||||
|
||||
minetest.register_entity("gltf:spider_animated", {
|
||||
core.register_entity("gltf:spider_animated", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "gltf_spider_animated.gltf",
|
||||
@ -42,7 +42,7 @@ minetest.register_entity("gltf:spider_animated", {
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_entity("gltf:simple_skin", {
|
||||
core.register_entity("gltf:simple_skin", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
visual_size = vector.new(5, 5, 5),
|
||||
@ -57,7 +57,7 @@ minetest.register_entity("gltf:simple_skin", {
|
||||
|
||||
-- The claws rendering incorrectly from one side is expected behavior:
|
||||
-- They use an unsupported double-sided material.
|
||||
minetest.register_entity("gltf:frog", {
|
||||
core.register_entity("gltf:frog", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "gltf_frog.gltf",
|
||||
@ -70,14 +70,14 @@ minetest.register_entity("gltf:frog", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("gltf:frog", {
|
||||
core.register_node("gltf:frog", {
|
||||
description = "glTF frog, but it's a node",
|
||||
tiles = {{name = "gltf_frog.png", backface_culling = false}},
|
||||
drawtype = "mesh",
|
||||
mesh = "gltf_frog.gltf",
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("show_model", {
|
||||
core.register_chatcommand("show_model", {
|
||||
params = "<model> [textures]",
|
||||
description = "Show a model (defaults to gltf models, for example '/show_model frog').",
|
||||
func = function(name, param)
|
||||
@ -86,7 +86,7 @@ minetest.register_chatcommand("show_model", {
|
||||
model = "gltf_" .. param .. ".gltf"
|
||||
textures = "gltf_" .. param .. ".png"
|
||||
end
|
||||
minetest.show_formspec(name, "gltf:model", table.concat{
|
||||
core.show_formspec(name, "gltf:model", table.concat{
|
||||
"formspec_version[7]",
|
||||
"size[10,10]",
|
||||
"model[0,0;10,10;model;", model, ";", textures, ";0,0;true;true;0,0;0]",
|
||||
|
@ -1,9 +1,9 @@
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
core.register_on_joinplayer(function(player)
|
||||
local cb = function(player)
|
||||
if not player or not player:is_player() then
|
||||
return
|
||||
end
|
||||
minetest.chat_send_player(player:get_player_name(), "This is the \"Development Test\" [devtest], meant only for testing and development.")
|
||||
core.chat_send_player(player:get_player_name(), "This is the \"Development Test\" [devtest], meant only for testing and development.")
|
||||
end
|
||||
minetest.after(2.0, cb, player)
|
||||
core.after(2.0, cb, player)
|
||||
end)
|
||||
|
@ -63,11 +63,11 @@ local function dump_lighting(lighting)
|
||||
return result
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("set_lighting", {
|
||||
core.register_chatcommand("set_lighting", {
|
||||
params = "",
|
||||
description = "Tune lighting parameters",
|
||||
func = function(player_name, param)
|
||||
local player = minetest.get_player_by_name(player_name);
|
||||
local player = core.get_player_by_name(player_name);
|
||||
if not player then return end
|
||||
|
||||
local lighting = player:get_lighting()
|
||||
@ -107,14 +107,14 @@ minetest.register_chatcommand("set_lighting", {
|
||||
}
|
||||
table.insert_all(form, content)
|
||||
|
||||
minetest.show_formspec(player_name, "lighting", table.concat(form))
|
||||
core.show_formspec(player_name, "lighting", table.concat(form))
|
||||
local debug_value = dump_lighting(lighting)
|
||||
local debug_ui = player:hud_add({type="text", position={x=0.1, y=0.3}, scale={x=1,y=1}, alignment = {x=1, y=1}, text=debug_value, number=0xFFFFFF})
|
||||
player:get_meta():set_int("lighting_hud", debug_ui)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "lighting" then return end
|
||||
|
||||
if not player then return end
|
||||
@ -137,7 +137,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
for _,v in ipairs(parameters) do
|
||||
|
||||
if fields[section.n.."."..v.n] then
|
||||
local event = minetest.explode_scrollbar_event(fields[section.n.."."..v.n])
|
||||
local event = core.explode_scrollbar_event(fields[section.n.."."..v.n])
|
||||
if event.type == "CHG" then
|
||||
local value = v.min + (v.max - v.min) * (event.value / 1000);
|
||||
if v.type == "log2" then
|
||||
|
@ -1,16 +1,16 @@
|
||||
local modname = minetest.get_current_modname()
|
||||
local modname = core.get_current_modname()
|
||||
local prefix = "["..modname.."] "
|
||||
|
||||
-- Startup info
|
||||
minetest.log("action", prefix.."modname="..dump(modname))
|
||||
minetest.log("action", prefix.."modpath="..dump(minetest.get_modpath(modname)))
|
||||
minetest.log("action", prefix.."worldpath="..dump(minetest.get_worldpath()))
|
||||
core.log("action", prefix.."modname="..dump(modname))
|
||||
core.log("action", prefix.."modpath="..dump(core.get_modpath(modname)))
|
||||
core.log("action", prefix.."worldpath="..dump(core.get_worldpath()))
|
||||
|
||||
-- Callback info
|
||||
minetest.register_on_mods_loaded(function()
|
||||
minetest.log("action", prefix.."Callback: on_mods_loaded()")
|
||||
core.register_on_mods_loaded(function()
|
||||
core.log("action", prefix.."Callback: on_mods_loaded()")
|
||||
end)
|
||||
|
||||
minetest.register_on_chatcommand(function(name, command, params)
|
||||
minetest.log("action", prefix.."Caught command '"..command.."', issued by '"..name.."'. Parameters: '"..params.."'")
|
||||
core.register_on_chatcommand(function(name, command, params)
|
||||
core.log("action", prefix.."Caught command '"..command.."', issued by '"..name.."'. Parameters: '"..params.."'")
|
||||
end)
|
||||
|
@ -4,46 +4,46 @@
|
||||
|
||||
-- ESSENTIAL node aliases
|
||||
-- Basic nodes
|
||||
minetest.register_alias("mapgen_stone", "basenodes:stone")
|
||||
minetest.register_alias("mapgen_water_source", "basenodes:water_source")
|
||||
minetest.register_alias("mapgen_river_water_source", "basenodes:river_water_source")
|
||||
core.register_alias("mapgen_stone", "basenodes:stone")
|
||||
core.register_alias("mapgen_water_source", "basenodes:water_source")
|
||||
core.register_alias("mapgen_river_water_source", "basenodes:river_water_source")
|
||||
|
||||
-- Additional essential aliases for v6
|
||||
minetest.register_alias("mapgen_lava_source", "basenodes:lava_source")
|
||||
minetest.register_alias("mapgen_dirt", "basenodes:dirt")
|
||||
minetest.register_alias("mapgen_dirt_with_grass", "basenodes:dirt_with_grass")
|
||||
minetest.register_alias("mapgen_sand", "basenodes:sand")
|
||||
minetest.register_alias("mapgen_tree", "basenodes:tree")
|
||||
minetest.register_alias("mapgen_leaves", "basenodes:leaves")
|
||||
minetest.register_alias("mapgen_apple", "basenodes:apple")
|
||||
core.register_alias("mapgen_lava_source", "basenodes:lava_source")
|
||||
core.register_alias("mapgen_dirt", "basenodes:dirt")
|
||||
core.register_alias("mapgen_dirt_with_grass", "basenodes:dirt_with_grass")
|
||||
core.register_alias("mapgen_sand", "basenodes:sand")
|
||||
core.register_alias("mapgen_tree", "basenodes:tree")
|
||||
core.register_alias("mapgen_leaves", "basenodes:leaves")
|
||||
core.register_alias("mapgen_apple", "basenodes:apple")
|
||||
|
||||
-- Essential alias for dungeons
|
||||
minetest.register_alias("mapgen_cobble", "basenodes:cobble")
|
||||
core.register_alias("mapgen_cobble", "basenodes:cobble")
|
||||
|
||||
-- Optional aliases for v6 (they all have fallback values in the engine)
|
||||
if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then
|
||||
minetest.register_alias("mapgen_gravel", "basenodes:gravel")
|
||||
minetest.register_alias("mapgen_desert_stone", "basenodes:desert_stone")
|
||||
minetest.register_alias("mapgen_desert_sand", "basenodes:desert_sand")
|
||||
minetest.register_alias("mapgen_dirt_with_snow", "basenodes:dirt_with_snow")
|
||||
minetest.register_alias("mapgen_snowblock", "basenodes:snowblock")
|
||||
minetest.register_alias("mapgen_snow", "basenodes:snow")
|
||||
minetest.register_alias("mapgen_ice", "basenodes:ice")
|
||||
minetest.register_alias("mapgen_junglegrass", "basenodes:junglegrass")
|
||||
minetest.register_alias("mapgen_jungletree", "basenodes:jungletree")
|
||||
minetest.register_alias("mapgen_jungleleaves", "basenodes:jungleleaves")
|
||||
minetest.register_alias("mapgen_pine_tree", "basenodes:pine_tree")
|
||||
minetest.register_alias("mapgen_pine_needles", "basenodes:pine_needles")
|
||||
if core.settings:get_bool("devtest_v6_mapgen_aliases", false) then
|
||||
core.register_alias("mapgen_gravel", "basenodes:gravel")
|
||||
core.register_alias("mapgen_desert_stone", "basenodes:desert_stone")
|
||||
core.register_alias("mapgen_desert_sand", "basenodes:desert_sand")
|
||||
core.register_alias("mapgen_dirt_with_snow", "basenodes:dirt_with_snow")
|
||||
core.register_alias("mapgen_snowblock", "basenodes:snowblock")
|
||||
core.register_alias("mapgen_snow", "basenodes:snow")
|
||||
core.register_alias("mapgen_ice", "basenodes:ice")
|
||||
core.register_alias("mapgen_junglegrass", "basenodes:junglegrass")
|
||||
core.register_alias("mapgen_jungletree", "basenodes:jungletree")
|
||||
core.register_alias("mapgen_jungleleaves", "basenodes:jungleleaves")
|
||||
core.register_alias("mapgen_pine_tree", "basenodes:pine_tree")
|
||||
core.register_alias("mapgen_pine_needles", "basenodes:pine_needles")
|
||||
end
|
||||
-- Optional alias for mossycobble (should fall back to cobble)
|
||||
if minetest.settings:get_bool("devtest_dungeon_mossycobble", false) then
|
||||
minetest.register_alias("mapgen_mossycobble", "basenodes:mossycobble")
|
||||
if core.settings:get_bool("devtest_dungeon_mossycobble", false) then
|
||||
core.register_alias("mapgen_mossycobble", "basenodes:mossycobble")
|
||||
end
|
||||
-- Optional aliases for dungeon stairs (should fall back to full nodes)
|
||||
if minetest.settings:get_bool("devtest_dungeon_stairs", false) then
|
||||
minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
|
||||
if minetest.settings:get_bool("devtest_v6_mapgen_aliases", false) then
|
||||
minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone")
|
||||
if core.settings:get_bool("devtest_dungeon_stairs", false) then
|
||||
core.register_alias("mapgen_stair_cobble", "stairs:stair_cobble")
|
||||
if core.settings:get_bool("devtest_v6_mapgen_aliases", false) then
|
||||
core.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone")
|
||||
end
|
||||
end
|
||||
|
||||
@ -51,11 +51,11 @@ end
|
||||
-- Register biomes for biome API
|
||||
--
|
||||
|
||||
minetest.clear_registered_biomes()
|
||||
minetest.clear_registered_decorations()
|
||||
core.clear_registered_biomes()
|
||||
core.clear_registered_decorations()
|
||||
|
||||
if minetest.settings:get_bool("devtest_register_biomes", true) then
|
||||
minetest.register_biome({
|
||||
if core.settings:get_bool("devtest_register_biomes", true) then
|
||||
core.register_biome({
|
||||
name = "mapgen:grassland",
|
||||
node_top = "basenodes:dirt_with_grass",
|
||||
depth_top = 1,
|
||||
@ -72,7 +72,7 @@ if minetest.settings:get_bool("devtest_register_biomes", true) then
|
||||
humidity_point = 50,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
core.register_biome({
|
||||
name = "mapgen:grassland_ocean",
|
||||
node_top = "basenodes:sand",
|
||||
depth_top = 1,
|
||||
@ -90,7 +90,7 @@ if minetest.settings:get_bool("devtest_register_biomes", true) then
|
||||
humidity_point = 50,
|
||||
})
|
||||
|
||||
minetest.register_biome({
|
||||
core.register_biome({
|
||||
name = "mapgen:grassland_under",
|
||||
node_cave_liquid = {"basenodes:water_source", "basenodes:lava_source"},
|
||||
node_dungeon = "basenodes:cobble",
|
||||
|
@ -1,10 +1,10 @@
|
||||
--
|
||||
-- Mod channels experimental handlers
|
||||
--
|
||||
local mod_channel = minetest.mod_channel_join("experimental_preview")
|
||||
local mod_channel = core.mod_channel_join("experimental_preview")
|
||||
|
||||
minetest.register_on_modchannel_message(function(channel, sender, message)
|
||||
minetest.log("action", "[modchannels] Server received message `" .. message
|
||||
core.register_on_modchannel_message(function(channel, sender, message)
|
||||
core.log("action", "[modchannels] Server received message `" .. message
|
||||
.. "` on channel `" .. channel .. "` from sender `" .. sender .. "`")
|
||||
|
||||
if mod_channel:is_writeable() then
|
||||
|
@ -2,7 +2,7 @@
|
||||
local walk_speed = 2
|
||||
local walk_distance = 10
|
||||
|
||||
minetest.register_entity("soundstuff:bigfoot", {
|
||||
core.register_entity("soundstuff:bigfoot", {
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collisionbox = {-1, -1, -1, 1, 1, 1},
|
||||
@ -31,18 +31,18 @@ minetest.register_entity("soundstuff:bigfoot", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("spawn_bigfoot", {
|
||||
core.register_chatcommand("spawn_bigfoot", {
|
||||
params = "",
|
||||
description = "Spawn a big foot object that makes footstep sounds",
|
||||
func = function(name, _param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
local pos = player:get_pos()
|
||||
pos.y = pos.y + player:get_properties().collisionbox[2]
|
||||
pos.y = pos.y - (-1) -- bigfoot collisionbox goes 1 down
|
||||
minetest.add_entity(pos, "soundstuff:bigfoot")
|
||||
core.add_entity(pos, "soundstuff:bigfoot")
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
local path = minetest.get_modpath("soundstuff") .. "/"
|
||||
local path = core.get_modpath("soundstuff") .. "/"
|
||||
dofile(path .. "sound_event_items.lua")
|
||||
dofile(path .. "jukebox.lua")
|
||||
dofile(path .. "bigfoot.lua")
|
||||
|
@ -1,4 +1,4 @@
|
||||
local F = minetest.formspec_escape
|
||||
local F = core.formspec_escape
|
||||
|
||||
-- hashed node pos -> sound handle
|
||||
local played_sounds = {}
|
||||
@ -57,8 +57,8 @@ local function get_all_metadata(meta)
|
||||
end
|
||||
|
||||
local function log_msg(msg)
|
||||
minetest.log("action", msg)
|
||||
minetest.chat_send_all(msg)
|
||||
core.log("action", msg)
|
||||
core.chat_send_all(msg)
|
||||
end
|
||||
|
||||
local function try_call(f, ...)
|
||||
@ -74,11 +74,11 @@ local function try_call(f, ...)
|
||||
end
|
||||
|
||||
local function show_formspec(pos, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
|
||||
local md = get_all_metadata(meta)
|
||||
|
||||
local pos_hash = minetest.hash_node_position(pos)
|
||||
local pos_hash = core.hash_node_position(pos)
|
||||
local sound_handle = played_sounds[pos_hash]
|
||||
|
||||
local fs = {}
|
||||
@ -195,17 +195,17 @@ local function show_formspec(pos, player)
|
||||
button_exit[10.75,11;3,0.75;btn_save_quit;Save & Quit]
|
||||
]])
|
||||
|
||||
minetest.show_formspec(player:get_player_name(), "soundstuff:jukebox@"..pos:to_string(),
|
||||
core.show_formspec(player:get_player_name(), "soundstuff:jukebox@"..pos:to_string(),
|
||||
table.concat(fs))
|
||||
end
|
||||
|
||||
minetest.register_node("soundstuff:jukebox", {
|
||||
core.register_node("soundstuff:jukebox", {
|
||||
description = "Jukebox\nAllows to play arbitrary sounds.",
|
||||
tiles = {"soundstuff_jukebox.png"},
|
||||
groups = {dig_immediate = 2},
|
||||
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
-- SimpleSoundSpec
|
||||
meta:set_string("sss.name", "")
|
||||
meta:set_string("sss.gain", "")
|
||||
@ -236,18 +236,18 @@ minetest.register_node("soundstuff:jukebox", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname:sub(1, 19) ~= "soundstuff:jukebox@" then
|
||||
return false
|
||||
end
|
||||
|
||||
local pos = vector.from_string(formname, 20)
|
||||
if not pos or pos ~= pos:round() then
|
||||
minetest.log("error", "[soundstuff:jukebox] Invalid formname.")
|
||||
core.log("error", "[soundstuff:jukebox] Invalid formname.")
|
||||
return true
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
|
||||
for _, k in ipairs(meta_keys) do
|
||||
if fields[k] then
|
||||
@ -256,7 +256,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
meta:mark_as_private(meta_keys)
|
||||
|
||||
local pos_hash = minetest.hash_node_position(pos)
|
||||
local pos_hash = core.hash_node_position(pos)
|
||||
local sound_handle = played_sounds[pos_hash]
|
||||
|
||||
if not sound_handle then
|
||||
@ -274,17 +274,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
pitch = tonumber(md.sparam.pitch),
|
||||
fade = tonumber(md.sparam.fade),
|
||||
start_time = tonumber(md.sparam.start_time),
|
||||
loop = minetest.is_yes(md.sparam.loop),
|
||||
loop = core.is_yes(md.sparam.loop),
|
||||
pos = vector.from_string(md.sparam.pos),
|
||||
object = testtools.get_branded_object(md.sparam.object),
|
||||
to_player = md.sparam.to_player,
|
||||
exclude_player = md.sparam.exclude_player,
|
||||
max_hear_distance = tonumber(md.sparam.max_hear_distance),
|
||||
}
|
||||
local ephemeral = minetest.is_yes(md.ephemeral)
|
||||
local ephemeral = core.is_yes(md.ephemeral)
|
||||
|
||||
log_msg(string.format(
|
||||
"[soundstuff:jukebox] Playing sound: minetest.sound_play(%s, %s, %s)",
|
||||
"[soundstuff:jukebox] Playing sound: core.sound_play(%s, %s, %s)",
|
||||
string.format("{name=\"%s\", gain=%s, pitch=%s, fade=%s}",
|
||||
sss.name, sss.gain, sss.pitch, sss.fade),
|
||||
string.format("{gain=%s, pitch=%s, fade=%s, start_time=%s, loop=%s, pos=%s, "
|
||||
@ -295,7 +295,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
sparam.max_hear_distance),
|
||||
tostring(ephemeral)))
|
||||
|
||||
sound_handle = try_call(minetest.sound_play, sss, sparam, ephemeral)
|
||||
sound_handle = try_call(core.sound_play, sss, sparam, ephemeral)
|
||||
|
||||
played_sounds[pos_hash] = sound_handle
|
||||
show_formspec(pos, player)
|
||||
@ -303,9 +303,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
|
||||
else
|
||||
if fields.btn_stop then
|
||||
log_msg("[soundstuff:jukebox] Stopping sound: minetest.sound_stop(<handle>)")
|
||||
log_msg("[soundstuff:jukebox] Stopping sound: core.sound_stop(<handle>)")
|
||||
|
||||
try_call(minetest.sound_stop, sound_handle)
|
||||
try_call(core.sound_stop, sound_handle)
|
||||
|
||||
elseif fields.btn_release then
|
||||
log_msg("[soundstuff:jukebox] Releasing handle.")
|
||||
@ -320,10 +320,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
local gain = tonumber(md.fade.gain)
|
||||
|
||||
log_msg(string.format(
|
||||
"[soundstuff:jukebox] Fading sound: minetest.sound_fade(<handle>, %s, %s)",
|
||||
"[soundstuff:jukebox] Fading sound: core.sound_fade(<handle>, %s, %s)",
|
||||
step, gain))
|
||||
|
||||
try_call(minetest.sound_fade, sound_handle, step, gain)
|
||||
try_call(core.sound_fade, sound_handle, step, gain)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
local drive_speed = 20
|
||||
local drive_distance = 30
|
||||
|
||||
minetest.register_entity("soundstuff:racecar", {
|
||||
core.register_entity("soundstuff:racecar", {
|
||||
initial_properties = {
|
||||
physical = false,
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
|
@ -7,7 +7,7 @@ local simple_nodes = {
|
||||
}
|
||||
|
||||
for k,v in pairs(simple_nodes) do
|
||||
minetest.register_node("soundstuff:"..k, {
|
||||
core.register_node("soundstuff:"..k, {
|
||||
description = v[1].."\n"..v[3],
|
||||
tiles = {"soundstuff_node_sound.png","soundstuff_node_sound.png",v[2]},
|
||||
groups = {dig_immediate=2},
|
||||
@ -17,7 +17,7 @@ for k,v in pairs(simple_nodes) do
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("soundstuff:place_failed_attached", {
|
||||
core.register_node("soundstuff:place_failed_attached", {
|
||||
description = "Attached Place Failed Sound Node".."\n"..
|
||||
"Attached to the floor; plays a sound when you try to place it but failed",
|
||||
tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_place_failed.png"},
|
||||
@ -33,7 +33,7 @@ minetest.register_node("soundstuff:place_failed_attached", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("soundstuff:fall", {
|
||||
core.register_node("soundstuff:fall", {
|
||||
description = "Fall Sound Node".."\n"..
|
||||
"Falls and plays sound if node below is gone",
|
||||
tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"},
|
||||
@ -43,7 +43,7 @@ minetest.register_node("soundstuff:fall", {
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("soundstuff:fall_attached", {
|
||||
core.register_node("soundstuff:fall_attached", {
|
||||
description = "Attached Fall Sound Node".."\n"..
|
||||
"Drops as item and plays sound if node below is gone",
|
||||
tiles = {"soundstuff_node_sound.png", "soundstuff_node_sound.png", "soundstuff_node_fall.png"},
|
||||
@ -59,7 +59,7 @@ minetest.register_node("soundstuff:fall_attached", {
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("soundstuff:footstep_liquid", {
|
||||
core.register_node("soundstuff:footstep_liquid", {
|
||||
description = "Liquid Footstep Sound Node".."\n"..
|
||||
"Plays sound when moving inside it; swimmable",
|
||||
drawtype = "liquid",
|
||||
@ -92,7 +92,7 @@ minetest.register_node("soundstuff:footstep_liquid", {
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("soundstuff:footstep_climbable", {
|
||||
core.register_node("soundstuff:footstep_climbable", {
|
||||
description = "Climbable Footstep Sound Node".."\n"..
|
||||
"Plays sound when moving inside it; can climb up and down here",
|
||||
drawtype = "allfaces",
|
||||
@ -112,17 +112,17 @@ minetest.register_node("soundstuff:footstep_climbable", {
|
||||
|
||||
|
||||
|
||||
minetest.register_craftitem("soundstuff:eat", {
|
||||
core.register_craftitem("soundstuff:eat", {
|
||||
description = "Eat Sound Item".."\n"..
|
||||
"Makes a sound when 'eaten' (with punch key)",
|
||||
inventory_image = "soundstuff_eat.png",
|
||||
on_use = minetest.item_eat(0),
|
||||
on_use = core.item_eat(0),
|
||||
sound = {
|
||||
eat = { name = "soundstuff_mono", gain = 1.0 },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("soundstuff:breaks", {
|
||||
core.register_tool("soundstuff:breaks", {
|
||||
description = "Break Sound Tool".."\n"..
|
||||
"Digs cracky=3 and more".."\n"..
|
||||
"Makes a sound when it breaks",
|
||||
@ -142,7 +142,7 @@ minetest.register_tool("soundstuff:breaks", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_tool("soundstuff:punch_use", {
|
||||
core.register_tool("soundstuff:punch_use", {
|
||||
description = "Punch Use Sound Tool\n"..
|
||||
"Digs cracky=3 and more\n"..
|
||||
"Makes a sound when used on node or entity",
|
||||
@ -161,7 +161,7 @@ minetest.register_tool("soundstuff:punch_use", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_tool("soundstuff:punch_use_air", {
|
||||
core.register_tool("soundstuff:punch_use_air", {
|
||||
description = "Punch Use (Air) Sound Tool\n"..
|
||||
"Makes a sound when used pointing at nothing",
|
||||
inventory_image = "soundstuff_node_dig.png",
|
||||
@ -171,26 +171,26 @@ minetest.register_tool("soundstuff:punch_use_air", {
|
||||
})
|
||||
|
||||
-- Plays sound repeatedly
|
||||
minetest.register_node("soundstuff:positional", {
|
||||
core.register_node("soundstuff:positional", {
|
||||
description = "Positional Sound Node".."\n"..
|
||||
"Repeatedly plays a sound at the node location",
|
||||
on_construct = function(pos)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
local timer = core.get_node_timer(pos)
|
||||
timer:start(0)
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
local node = core.get_node(pos)
|
||||
local dist = node.param2
|
||||
if dist == 0 then
|
||||
dist = nil
|
||||
end
|
||||
minetest.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist })
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
core.sound_play("soundstuff_mono", { pos = pos, max_hear_distance = dist })
|
||||
local timer = core.get_node_timer(pos)
|
||||
timer:start(0.7)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
node.param2 = (node.param2 + 1) % 64
|
||||
minetest.set_node(pos, node)
|
||||
core.set_node(pos, node)
|
||||
if clicker and clicker:is_player() then
|
||||
local dist = node.param2
|
||||
local diststr
|
||||
@ -199,7 +199,7 @@ minetest.register_node("soundstuff:positional", {
|
||||
else
|
||||
diststr = tostring(dist)
|
||||
end
|
||||
minetest.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr)
|
||||
core.chat_send_player(clicker:get_player_name(), "max_hear_distance = " .. diststr)
|
||||
end
|
||||
end,
|
||||
|
||||
|
@ -2,7 +2,7 @@ stairs = {}
|
||||
|
||||
-- Node will be called stairs:stair_<subname>
|
||||
function stairs.register_stair(subname, recipeitem, groups, images, description)
|
||||
minetest.register_node(":stairs:stair_" .. subname, {
|
||||
core.register_node(":stairs:stair_" .. subname, {
|
||||
description = description.."\n"..
|
||||
"param2 = facedir rotation (0..23)",
|
||||
drawtype = "nodebox",
|
||||
@ -23,7 +23,7 @@ end
|
||||
|
||||
-- Node will be called stairs:slab_<subname>
|
||||
function stairs.register_slab(subname, recipeitem, groups, images, description)
|
||||
minetest.register_node(":stairs:slab_" .. subname, {
|
||||
core.register_node(":stairs:slab_" .. subname, {
|
||||
description = description,
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- After ABM node
|
||||
minetest.register_node("testabms:after_abm", {
|
||||
core.register_node("testabms:after_abm", {
|
||||
description = S("After ABM processed node."),
|
||||
drawtype = "normal",
|
||||
tiles = { "testabms_after_node.png" },
|
||||
|
@ -1,9 +1,9 @@
|
||||
-- test ABMs with different chances
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- ABM chance 5 node
|
||||
minetest.register_node("testabms:chance_5", {
|
||||
core.register_node("testabms:chance_5", {
|
||||
description = S("Node for test ABM chance_5"),
|
||||
drawtype = "normal",
|
||||
tiles = { "testabms_wait_node.png" },
|
||||
@ -11,25 +11,25 @@ minetest.register_node("testabms:chance_5", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "Waiting for ABM testabms:chance_5")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:chance_5",
|
||||
nodenames = "testabms:chance_5",
|
||||
interval = 10,
|
||||
chance = 5,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "ABM testabsm:chance_5 changed this node.")
|
||||
end
|
||||
})
|
||||
|
||||
-- ABM chance 20 node
|
||||
minetest.register_node("testabms:chance_20", {
|
||||
core.register_node("testabms:chance_20", {
|
||||
description = S("Node for test ABM chance_20"),
|
||||
drawtype = "normal",
|
||||
tiles = { "testabms_wait_node.png" },
|
||||
@ -37,19 +37,19 @@ minetest.register_node("testabms:chance_20", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "Waiting for ABM testabms:chance_20")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:chance_20",
|
||||
nodenames = "testabms:chance_20",
|
||||
interval = 10,
|
||||
chance = 20,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "ABM testabsm:chance_20 changed this node.")
|
||||
end
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||
local path = core.get_modpath(core.get_current_modname())
|
||||
|
||||
dofile(path.."/after_node.lua")
|
||||
dofile(path.."/chances.lua")
|
||||
|
@ -1,9 +1,9 @@
|
||||
-- test ABMs with different interval
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- ABM inteval 1 node
|
||||
minetest.register_node("testabms:interval_1", {
|
||||
core.register_node("testabms:interval_1", {
|
||||
description = S("Node for test ABM interval_1"),
|
||||
drawtype = "normal",
|
||||
tiles = { "testabms_wait_node.png" },
|
||||
@ -11,25 +11,25 @@ minetest.register_node("testabms:interval_1", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "Waiting for ABM testabms:interval_1")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:interval_1",
|
||||
nodenames = "testabms:interval_1",
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "ABM testabsm:interval_1 changed this node.")
|
||||
end
|
||||
})
|
||||
|
||||
-- ABM interval 60 node
|
||||
minetest.register_node("testabms:interval_60", {
|
||||
core.register_node("testabms:interval_60", {
|
||||
description = S("Node for test ABM interval_60"),
|
||||
drawtype = "normal",
|
||||
tiles = { "testabms_wait_node.png" },
|
||||
@ -37,19 +37,19 @@ minetest.register_node("testabms:interval_60", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "Waiting for ABM testabms:interval_60")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:interval_60",
|
||||
nodenames = "testabms:interval_60",
|
||||
interval = 60,
|
||||
chance = 1,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "ABM testabsm:interval_60 changed this node.")
|
||||
end
|
||||
})
|
||||
|
@ -1,9 +1,9 @@
|
||||
-- test ABMs with min_y and max_y
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- ABM min_y node
|
||||
minetest.register_node("testabms:min_y", {
|
||||
core.register_node("testabms:min_y", {
|
||||
description = S("Node for test ABM min_y."),
|
||||
drawtype = "normal",
|
||||
tiles = { "testabms_wait_node.png" },
|
||||
@ -11,26 +11,26 @@ minetest.register_node("testabms:min_y", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "Waiting for ABM testabms:min_y at y "..pos.y.." with min_y = 0")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:min_y",
|
||||
nodenames = "testabms:min_y",
|
||||
interval = 10,
|
||||
chance = 1,
|
||||
min_y = 0,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "ABM testabsm:min_y changed this node.")
|
||||
end
|
||||
})
|
||||
|
||||
-- ABM max_y node
|
||||
minetest.register_node("testabms:max_y", {
|
||||
core.register_node("testabms:max_y", {
|
||||
description = S("Node for test ABM max_y."),
|
||||
drawtype = "normal",
|
||||
tiles = { "testabms_wait_node.png" },
|
||||
@ -38,20 +38,20 @@ minetest.register_node("testabms:max_y", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "Waiting for ABM testabms:max_y at y "..pos.y.." with max_y = 0")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:max_y",
|
||||
nodenames = "testabms:max_y",
|
||||
interval = 10,
|
||||
chance = 1,
|
||||
max_y = 0,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext", "ABM testabsm:max_y changed this node.")
|
||||
end
|
||||
})
|
||||
|
@ -1,9 +1,9 @@
|
||||
-- test ABMs with neighbor and without_neighbor
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- ABM required neighbor
|
||||
minetest.register_node("testabms:required_neighbor", {
|
||||
core.register_node("testabms:required_neighbor", {
|
||||
description = S("Node for test ABM required_neighbor.") .. "\n"
|
||||
.. S("Sensitive neighbor node is testnodes:normal."),
|
||||
drawtype = "normal",
|
||||
@ -12,29 +12,29 @@ minetest.register_node("testabms:required_neighbor", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext",
|
||||
"Waiting for ABM testabms:required_neighbor "
|
||||
.. "(normal drawtype testnode sensitive)")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:required_neighbor",
|
||||
nodenames = "testabms:required_neighbor",
|
||||
neighbors = {"testnodes:normal"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext",
|
||||
"ABM testabsm:required_neighbor changed this node.")
|
||||
end
|
||||
})
|
||||
|
||||
-- ABM missing neighbor node
|
||||
minetest.register_node("testabms:missing_neighbor", {
|
||||
core.register_node("testabms:missing_neighbor", {
|
||||
description = S("Node for test ABM missing_neighbor.") .. "\n"
|
||||
.. S("Sensitive neighbor node is testnodes:normal."),
|
||||
drawtype = "normal",
|
||||
@ -43,29 +43,29 @@ minetest.register_node("testabms:missing_neighbor", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext",
|
||||
"Waiting for ABM testabms:missing_neighbor"
|
||||
.. " (normal drawtype testnode sensitive)")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:missing_neighbor",
|
||||
nodenames = "testabms:missing_neighbor",
|
||||
without_neighbors = {"testnodes:normal"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext",
|
||||
"ABM testabsm:missing_neighbor changed this node.")
|
||||
end
|
||||
})
|
||||
|
||||
-- ABM required and missing neighbor node
|
||||
minetest.register_node("testabms:required_missing_neighbor", {
|
||||
core.register_node("testabms:required_missing_neighbor", {
|
||||
description = S("Node for test ABM required_missing_neighbor.") .. "\n"
|
||||
.. S("Sensitive neighbor nodes are testnodes:normal and testnodes:glasslike."),
|
||||
drawtype = "normal",
|
||||
@ -74,7 +74,7 @@ minetest.register_node("testabms:required_missing_neighbor", {
|
||||
groups = { dig_immediate = 3 },
|
||||
|
||||
on_construct = function (pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext",
|
||||
"Waiting for ABM testabms:required_missing_neighbor"
|
||||
.. " (wint normal drawtype testnode and no glasslike"
|
||||
@ -82,7 +82,7 @@ minetest.register_node("testabms:required_missing_neighbor", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
core.register_abm({
|
||||
label = "testabms:required_missing_neighbor",
|
||||
nodenames = "testabms:required_missing_neighbor",
|
||||
neighbors = {"testnodes:normal"},
|
||||
@ -90,8 +90,8 @@ minetest.register_abm({
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function (pos)
|
||||
minetest.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = minetest.get_meta(pos)
|
||||
core.swap_node(pos, {name="testabms:after_abm"})
|
||||
local meta = core.get_meta(pos)
|
||||
meta:set_string("infotext",
|
||||
"ABM testabsm:required_missing_neighbor changed this node.")
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ local phasearmor = {
|
||||
}
|
||||
local max_phase = 12
|
||||
|
||||
minetest.register_entity("testentities:armorball", {
|
||||
core.register_entity("testentities:armorball", {
|
||||
initial_properties = {
|
||||
hp_max = 20,
|
||||
physical = false,
|
||||
@ -33,7 +33,7 @@ minetest.register_entity("testentities:armorball", {
|
||||
_phase = 7,
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
minetest.log("action", "[testentities] armorball.on_activate")
|
||||
core.log("action", "[testentities] armorball.on_activate")
|
||||
self.object:set_armor_groups(phasearmor[self._phase])
|
||||
self.object:set_sprite({x=0, y=self._phase})
|
||||
end,
|
||||
@ -56,6 +56,6 @@ minetest.register_entity("testentities:armorball", {
|
||||
if not name then
|
||||
return
|
||||
end
|
||||
minetest.chat_send_player(name, "time_from_last_punch="..string.format("%.3f", time_from_last_punch).."; damage="..tostring(damage))
|
||||
core.chat_send_player(name, "time_from_last_punch="..string.format("%.3f", time_from_last_punch).."; damage="..tostring(damage))
|
||||
end,
|
||||
})
|
||||
|
@ -1,5 +1,5 @@
|
||||
dofile(minetest.get_modpath("testentities").."/visuals.lua")
|
||||
dofile(minetest.get_modpath("testentities").."/observers.lua")
|
||||
dofile(minetest.get_modpath("testentities").."/selectionbox.lua")
|
||||
dofile(minetest.get_modpath("testentities").."/armor.lua")
|
||||
dofile(minetest.get_modpath("testentities").."/pointable.lua")
|
||||
dofile(core.get_modpath("testentities").."/visuals.lua")
|
||||
dofile(core.get_modpath("testentities").."/observers.lua")
|
||||
dofile(core.get_modpath("testentities").."/selectionbox.lua")
|
||||
dofile(core.get_modpath("testentities").."/armor.lua")
|
||||
dofile(core.get_modpath("testentities").."/pointable.lua")
|
||||
|
@ -1,13 +1,13 @@
|
||||
local function player_names_excluding(exclude_player_name)
|
||||
local player_names = {}
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
for _, player in ipairs(core.get_connected_players()) do
|
||||
player_names[player:get_player_name()] = true
|
||||
end
|
||||
player_names[exclude_player_name] = nil
|
||||
return player_names
|
||||
end
|
||||
|
||||
minetest.register_entity("testentities:observable", {
|
||||
core.register_entity("testentities:observable", {
|
||||
initial_properties = {
|
||||
visual = "sprite",
|
||||
textures = { "testentities_sprite.png" },
|
||||
|
@ -3,7 +3,7 @@
|
||||
-- Register wrapper for compactness
|
||||
local function register_pointable_testentity(name, pointable)
|
||||
local texture = "testnodes_"..name..".png"
|
||||
minetest.register_entity("testentities:"..name, {
|
||||
core.register_entity("testentities:"..name, {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
visual_size = {x = 0.6, y = 0.6, z = 0.6},
|
||||
|
@ -12,7 +12,7 @@ end
|
||||
|
||||
local active_selectionbox_entities = 0 -- count active entities
|
||||
|
||||
minetest.register_entity("testentities:selectionbox", {
|
||||
core.register_entity("testentities:selectionbox", {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
infotext = "Punch to randomize rotation, rightclick to toggle rotation"
|
||||
@ -45,16 +45,16 @@ minetest.register_entity("testentities:selectionbox", {
|
||||
})
|
||||
|
||||
local hud_ids = {}
|
||||
minetest.register_globalstep(function()
|
||||
core.register_globalstep(function()
|
||||
if active_selectionbox_entities == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
for _, player in pairs(core.get_connected_players()) do
|
||||
local offset = player:get_eye_offset()
|
||||
offset.y = offset.y + player:get_properties().eye_height
|
||||
local pos1 = vector.add(player:get_pos(), offset)
|
||||
local raycast = minetest.raycast(pos1, vector.add(pos1, vector.multiply(player:get_look_dir(), 10)), true, false)
|
||||
local raycast = core.raycast(pos1, vector.add(pos1, vector.multiply(player:get_look_dir(), 10)), true, false)
|
||||
local pointed_thing = raycast()
|
||||
if pointed_thing.ref == player then
|
||||
pointed_thing = raycast()
|
||||
@ -73,13 +73,13 @@ minetest.register_globalstep(function()
|
||||
alignment = {x=0, y=0},
|
||||
})
|
||||
local shade = math.random(0, 0xFF)
|
||||
minetest.add_particle({
|
||||
core.add_particle({
|
||||
-- Random shade of red for the intersection point
|
||||
texture = color(0x10000 * shade),
|
||||
pos = pointed_thing.intersection_point,
|
||||
size = 0.1
|
||||
})
|
||||
minetest.add_particle({
|
||||
core.add_particle({
|
||||
-- Same shade of green for the corresponding intersection normal
|
||||
texture = color(0x100 * shade),
|
||||
pos = vector.add(pointed_thing.intersection_point, pointed_thing.intersection_normal * 0.1),
|
||||
|
@ -1,13 +1,13 @@
|
||||
-- Minimal test entities to test visuals
|
||||
|
||||
minetest.register_entity("testentities:sprite", {
|
||||
core.register_entity("testentities:sprite", {
|
||||
initial_properties = {
|
||||
visual = "sprite",
|
||||
textures = { "testentities_sprite.png" },
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("testentities:upright_sprite", {
|
||||
core.register_entity("testentities:upright_sprite", {
|
||||
initial_properties = {
|
||||
visual = "upright_sprite",
|
||||
textures = {
|
||||
@ -17,7 +17,7 @@ minetest.register_entity("testentities:upright_sprite", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("testentities:cube", {
|
||||
core.register_entity("testentities:cube", {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
textures = {
|
||||
@ -31,21 +31,21 @@ minetest.register_entity("testentities:cube", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("testentities:item", {
|
||||
core.register_entity("testentities:item", {
|
||||
initial_properties = {
|
||||
visual = "item",
|
||||
wield_item = "testnodes:normal",
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("testentities:wielditem", {
|
||||
core.register_entity("testentities:wielditem", {
|
||||
initial_properties = {
|
||||
visual = "wielditem",
|
||||
wield_item = "testnodes:normal",
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("testentities:mesh", {
|
||||
core.register_entity("testentities:mesh", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "testnodes_pyramid.obj",
|
||||
@ -55,7 +55,7 @@ minetest.register_entity("testentities:mesh", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("testentities:mesh_unshaded", {
|
||||
core.register_entity("testentities:mesh_unshaded", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "testnodes_pyramid.obj",
|
||||
@ -66,7 +66,7 @@ minetest.register_entity("testentities:mesh_unshaded", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_entity("testentities:sam", {
|
||||
core.register_entity("testentities:sam", {
|
||||
initial_properties = {
|
||||
visual = "mesh",
|
||||
mesh = "testentities_sam.b3d",
|
||||
@ -82,7 +82,7 @@ minetest.register_entity("testentities:sam", {
|
||||
-- Advanced visual tests
|
||||
|
||||
-- An entity for testing animated and yaw-modulated sprites
|
||||
minetest.register_entity("testentities:yawsprite", {
|
||||
core.register_entity("testentities:yawsprite", {
|
||||
initial_properties = {
|
||||
selectionbox = {-0.3, -0.5, -0.3, 0.3, 0.3, 0.3},
|
||||
visual = "sprite",
|
||||
@ -97,7 +97,7 @@ minetest.register_entity("testentities:yawsprite", {
|
||||
})
|
||||
|
||||
-- An entity for testing animated upright sprites
|
||||
minetest.register_entity("testentities:upright_animated", {
|
||||
core.register_entity("testentities:upright_animated", {
|
||||
initial_properties = {
|
||||
visual = "upright_sprite",
|
||||
textures = {"testnodes_anim.png"},
|
||||
@ -108,7 +108,7 @@ minetest.register_entity("testentities:upright_animated", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_entity("testentities:nametag", {
|
||||
core.register_entity("testentities:nametag", {
|
||||
initial_properties = {
|
||||
visual = "sprite",
|
||||
textures = { "testentities_sprite.png" },
|
||||
@ -116,7 +116,7 @@ minetest.register_entity("testentities:nametag", {
|
||||
|
||||
on_activate = function(self, staticdata)
|
||||
if staticdata ~= "" then
|
||||
local data = minetest.deserialize(staticdata)
|
||||
local data = core.deserialize(staticdata)
|
||||
self.color = data.color
|
||||
self.bgcolor = data.bgcolor
|
||||
else
|
||||
@ -145,6 +145,6 @@ minetest.register_entity("testentities:nametag", {
|
||||
end,
|
||||
|
||||
get_staticdata = function(self)
|
||||
return minetest.serialize({ color = self.color, bgcolor = self.bgcolor })
|
||||
return core.serialize({ color = self.color, bgcolor = self.bgcolor })
|
||||
end,
|
||||
})
|
||||
|
@ -1,35 +1,35 @@
|
||||
local S = minetest.get_translator("testfood")
|
||||
local S = core.get_translator("testfood")
|
||||
|
||||
minetest.register_craftitem("testfood:good1", {
|
||||
core.register_craftitem("testfood:good1", {
|
||||
description = S("Good Food (+1)").."\n"..
|
||||
S("Punch: Eat"),
|
||||
inventory_image = "testfood_good.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
on_use = core.item_eat(1),
|
||||
})
|
||||
minetest.register_craftitem("testfood:good5", {
|
||||
core.register_craftitem("testfood:good5", {
|
||||
description = S("Good Food (+5)").."\n"..
|
||||
S("Punch: Eat"),
|
||||
inventory_image = "testfood_good2.png",
|
||||
on_use = minetest.item_eat(5),
|
||||
on_use = core.item_eat(5),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("testfood:bad1", {
|
||||
core.register_craftitem("testfood:bad1", {
|
||||
description = S("Bad Food (-1)").."\n"..
|
||||
S("Punch: Eat"),
|
||||
inventory_image = "testfood_bad.png",
|
||||
on_use = minetest.item_eat(-1),
|
||||
on_use = core.item_eat(-1),
|
||||
})
|
||||
minetest.register_craftitem("testfood:bad5", {
|
||||
core.register_craftitem("testfood:bad5", {
|
||||
description = S("Bad Food (-5)").."\n"..
|
||||
S("Punch: Eat"),
|
||||
inventory_image = "testfood_bad2.png",
|
||||
on_use = minetest.item_eat(-5),
|
||||
on_use = core.item_eat(-5),
|
||||
})
|
||||
|
||||
minetest.register_craftitem("testfood:replace1", {
|
||||
core.register_craftitem("testfood:replace1", {
|
||||
description = S("Replacing Food (+1)").."\n"..
|
||||
S("Punch: Eat and replace with 'Good Food (+1)'"),
|
||||
inventory_image = "testfood_replace.png",
|
||||
on_use = minetest.item_eat(1, "testfood:good1"),
|
||||
on_use = core.item_eat(1, "testfood:good1"),
|
||||
})
|
||||
|
||||
|
@ -6,30 +6,30 @@ local out = function(player, formname, fields, number)
|
||||
snum = " "..number
|
||||
end
|
||||
local msg = "Formspec callback"..snum..": player="..player:get_player_name()..", formname=\""..tostring(formname).."\", fields="..dump(fields)
|
||||
minetest.chat_send_player(player:get_player_name(), msg)
|
||||
minetest.log("action", msg)
|
||||
core.chat_send_player(player:get_player_name(), msg)
|
||||
core.log("action", msg)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if callback_test == 1 then
|
||||
out(player, formname, fields)
|
||||
elseif callback_test == 2 then
|
||||
out(player, formname, fields, 1)
|
||||
end
|
||||
end)
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if callback_test == 2 then
|
||||
out(player, formname, fields, 2)
|
||||
return true -- Disable the first callback
|
||||
end
|
||||
end)
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if callback_test == 2 then
|
||||
out(player, formname, fields, 3)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("test_formspec_callbacks", {
|
||||
core.register_chatcommand("test_formspec_callbacks", {
|
||||
params = "[ 0 | 1 | 2 ]",
|
||||
description = "Test: Change formspec callbacks testing mode",
|
||||
func = function(name, param)
|
||||
@ -40,12 +40,12 @@ minetest.register_chatcommand("test_formspec_callbacks", {
|
||||
callback_test = mode
|
||||
end
|
||||
if callback_test == 1 then
|
||||
minetest.chat_send_player(name, "Formspec callback test mode 1 enabled: Logging only")
|
||||
core.chat_send_player(name, "Formspec callback test mode 1 enabled: Logging only")
|
||||
elseif callback_test == 2 then
|
||||
minetest.chat_send_player(name, "Formspec callback test mode 2 enabled: Three callbacks, disable pre-registered callbacks")
|
||||
core.chat_send_player(name, "Formspec callback test mode 2 enabled: Three callbacks, disable pre-registered callbacks")
|
||||
else
|
||||
callback_test = 0
|
||||
minetest.chat_send_player(name, "Formspec callback test disabled!")
|
||||
core.chat_send_player(name, "Formspec callback test disabled!")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -1,13 +1,13 @@
|
||||
-- This code adds dummy items that are supposed to be used in formspecs
|
||||
-- for testing item_image formspec elements.
|
||||
|
||||
minetest.register_node("testformspec:node", {
|
||||
core.register_node("testformspec:node", {
|
||||
description = "Formspec Test Node",
|
||||
tiles = { "testformspec_node.png" },
|
||||
groups = { dig_immediate = 3, dummy = 1 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem("testformspec:item", {
|
||||
core.register_craftitem("testformspec:item", {
|
||||
description = "Formspec Test Item",
|
||||
inventory_image = "testformspec_item.png",
|
||||
groups = { dummy = 1 },
|
||||
|
@ -1,7 +1,7 @@
|
||||
local color = minetest.colorize
|
||||
local color = core.colorize
|
||||
|
||||
-- \208\176 is a cyrillic small a
|
||||
local unsafe_url = minetest.formspec_escape("https://u:p@wikipedi\208\176.org:1233/heIIoll?a=b#c")
|
||||
local unsafe_url = core.formspec_escape("https://u:p@wikipedi\208\176.org:1233/heIIoll?a=b#c")
|
||||
|
||||
local clip_fs = [[
|
||||
style_type[label,button,image_button,item_image_button,
|
||||
@ -178,8 +178,8 @@ This is a test of the global tag. The parameters are:
|
||||
background=gray margin=20 valign=bottom halign=right color=pink hovercolor=purple size=12 font=mono
|
||||
<action name=global>action</action>]]
|
||||
|
||||
local hypertext_fs = "hypertext[0,0;11,9;hypertext;"..minetest.formspec_escape(hypertext_basic).."]"..
|
||||
"hypertext[0,9.5;11,2.5;hypertext;"..minetest.formspec_escape(hypertext_global).."]"
|
||||
local hypertext_fs = "hypertext[0,0;11,9;hypertext;"..core.formspec_escape(hypertext_basic).."]"..
|
||||
"hypertext[0,9.5;11,2.5;hypertext;"..core.formspec_escape(hypertext_global).."]"
|
||||
|
||||
local style_fs = [[
|
||||
style[one_btn1;bgcolor=red;textcolor=yellow;bgcolor_hovered=orange;
|
||||
@ -255,11 +255,11 @@ local style_fs = [[
|
||||
|
||||
style[one_f3;textcolor=yellow]
|
||||
textarea[0,7.025;2.5,0.8;one_f3;Label;]] ..
|
||||
minetest.formspec_escape("Yellow Text\nLine two") .. [[ ]
|
||||
core.formspec_escape("Yellow Text\nLine two") .. [[ ]
|
||||
|
||||
style[one_f4;border=false;textcolor=cyan]
|
||||
textarea[0,8.324999999999999;2.5,0.8;one_f4;Label;]] ..
|
||||
minetest.formspec_escape("Borderless Cyan Text\nLine two") .. [[ ]
|
||||
core.formspec_escape("Borderless Cyan Text\nLine two") .. [[ ]
|
||||
|
||||
container_end[]
|
||||
]]
|
||||
@ -529,10 +529,10 @@ local function show_test_formspec(pname)
|
||||
|
||||
local fs = page .. "tabheader[0,0;11,0.65;maintabs;Real Coord,Styles,Noclip,Table,Hypertext,Tabs,Invs,Window,Anim,Model,ScrollC,Sound,Background,Unsized;" .. page_id .. ";false;false]"
|
||||
|
||||
minetest.show_formspec(pname, "testformspec:formspec", fs)
|
||||
core.show_formspec(pname, "testformspec:formspec", fs)
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "testformspec:formspec" then
|
||||
return false
|
||||
end
|
||||
@ -544,15 +544,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
|
||||
if fields.ani_img_1 and fields.ani_btn_1 then
|
||||
minetest.chat_send_player(player:get_player_name(), "ani_img_1 = " .. tostring(fields.ani_img_1))
|
||||
core.chat_send_player(player:get_player_name(), "ani_img_1 = " .. tostring(fields.ani_img_1))
|
||||
return true
|
||||
elseif fields.ani_img_2 and fields.ani_btn_2 then
|
||||
minetest.chat_send_player(player:get_player_name(), "ani_img_2 = " .. tostring(fields.ani_img_2))
|
||||
core.chat_send_player(player:get_player_name(), "ani_img_2 = " .. tostring(fields.ani_img_2))
|
||||
return true
|
||||
end
|
||||
|
||||
if fields.hypertext then
|
||||
minetest.chat_send_player(player:get_player_name(), "Hypertext action received: " .. tostring(fields.hypertext))
|
||||
core.chat_send_player(player:get_player_name(), "Hypertext action received: " .. tostring(fields.hypertext))
|
||||
return true
|
||||
end
|
||||
|
||||
@ -577,11 +577,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("test_formspec", {
|
||||
core.register_chatcommand("test_formspec", {
|
||||
params = "",
|
||||
description = "Open the test formspec",
|
||||
func = function(name)
|
||||
if not minetest.get_player_by_name(name) then
|
||||
if not core.get_player_by_name(name) then
|
||||
return false, "You need to be online!"
|
||||
end
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
dofile(minetest.get_modpath("testformspec").."/dummy_items.lua")
|
||||
dofile(minetest.get_modpath("testformspec").."/formspec.lua")
|
||||
dofile(minetest.get_modpath("testformspec").."/callbacks.lua")
|
||||
dofile(core.get_modpath("testformspec").."/dummy_items.lua")
|
||||
dofile(core.get_modpath("testformspec").."/formspec.lua")
|
||||
dofile(core.get_modpath("testformspec").."/callbacks.lua")
|
||||
|
@ -34,14 +34,14 @@ local function show_fullscreen_fs(name, window)
|
||||
("label[%f,%f;%s]"):format(size.x / 2, size.y / 2 + 1, touch_text),
|
||||
}
|
||||
|
||||
minetest.show_formspec(name, "testfullscreenfs:fs", table.concat(fs))
|
||||
minetest.chat_send_player(name, ("Calculated size of %f, %f"):format(size.x, size.y))
|
||||
core.show_formspec(name, "testfullscreenfs:fs", table.concat(fs))
|
||||
core.chat_send_player(name, ("Calculated size of %f, %f"):format(size.x, size.y))
|
||||
last_window_info[name] = window
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("testfullscreenfs", {
|
||||
core.register_chatcommand("testfullscreenfs", {
|
||||
func = function(name)
|
||||
local window = minetest.get_player_window_information(name)
|
||||
local window = core.get_player_window_information(name)
|
||||
if not window then
|
||||
return false, "Unable to get window info"
|
||||
end
|
||||
@ -51,21 +51,21 @@ minetest.register_chatcommand("testfullscreenfs", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_globalstep(function()
|
||||
core.register_globalstep(function()
|
||||
for name, last_window in pairs(last_window_info) do
|
||||
local window = minetest.get_player_window_information(name)
|
||||
local window = core.get_player_window_information(name)
|
||||
if window and not window_info_equal(last_window, window) then
|
||||
show_fullscreen_fs(name, window)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname == "testfullscreenfs:fs" and fields.quit then
|
||||
last_window_info[player:get_player_name()] = nil
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
core.register_on_leaveplayer(function(player)
|
||||
last_window_info[player:get_player_name()] = nil
|
||||
end)
|
||||
|
@ -1,2 +1,2 @@
|
||||
name = testfullscreenfs
|
||||
description = Test mod to use minetest.get_player_window_information()
|
||||
description = Test mod to use core.get_player_window_information()
|
||||
|
@ -8,8 +8,8 @@ local font_states = {
|
||||
{4, "Monospace font"},
|
||||
{5, "Bold and monospace font"},
|
||||
{7, "ZOMG all the font styles"},
|
||||
{7, "Colors test! " .. minetest.colorize("green", "Green") ..
|
||||
minetest.colorize("red", "\nRed") .. " END"},
|
||||
{7, "Colors test! " .. core.colorize("green", "Green") ..
|
||||
core.colorize("red", "\nRed") .. " END"},
|
||||
}
|
||||
|
||||
|
||||
@ -33,13 +33,13 @@ end
|
||||
local font_etime = 0
|
||||
local font_state = 0
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
core.register_globalstep(function(dtime)
|
||||
font_etime = font_etime + dtime
|
||||
if font_etime < 1 then
|
||||
return
|
||||
end
|
||||
font_etime = 0
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
for _, player in ipairs(core.get_connected_players()) do
|
||||
local huds = player_font_huds[player:get_player_name()]
|
||||
if huds then
|
||||
for i, hud_id in ipairs(huds) do
|
||||
@ -52,11 +52,11 @@ minetest.register_globalstep(function(dtime)
|
||||
font_state = font_state + 1
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("hudfonts", {
|
||||
core.register_chatcommand("hudfonts", {
|
||||
params = "[<HUD elements>]",
|
||||
description = "Show/Hide some text on the HUD with various font options",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
local param = tonumber(param) or 0
|
||||
param = math.min(math.max(param, 1), #font_states)
|
||||
if player_font_huds[name] == nil then
|
||||
@ -64,14 +64,14 @@ minetest.register_chatcommand("hudfonts", {
|
||||
for i = 1, param do
|
||||
table.insert(player_font_huds[name], add_font_hud(player, i))
|
||||
end
|
||||
minetest.chat_send_player(name, ("%d text HUD element(s) added."):format(param))
|
||||
core.chat_send_player(name, ("%d text HUD element(s) added."):format(param))
|
||||
else
|
||||
local huds = player_font_huds[name]
|
||||
if huds then
|
||||
for _, hud_id in ipairs(huds) do
|
||||
player:hud_remove(hud_id)
|
||||
end
|
||||
minetest.chat_send_player(name, "All text HUD elements removed.")
|
||||
core.chat_send_player(name, "All text HUD elements removed.")
|
||||
end
|
||||
player_font_huds[name] = nil
|
||||
end
|
||||
@ -82,11 +82,11 @@ minetest.register_chatcommand("hudfonts", {
|
||||
-- Testing waypoint capabilities
|
||||
|
||||
local player_waypoints = {}
|
||||
minetest.register_chatcommand("hudwaypoints", {
|
||||
core.register_chatcommand("hudwaypoints", {
|
||||
params = "[ add | add_change | remove ]",
|
||||
description = "Create HUD waypoints at your position for testing (add: Add waypoints and change them after 0.5s (default). add_change: Add waypoints and change immediately. remove: Remove all waypoints)",
|
||||
func = function(name, params)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
@ -142,13 +142,13 @@ minetest.register_chatcommand("hudwaypoints", {
|
||||
if hidden_distance then
|
||||
chplayer:hud_change(hidden_distance, "number", 0x0000FF)
|
||||
end
|
||||
minetest.chat_send_player(chplayer:get_player_name(), "Waypoints changed.")
|
||||
core.chat_send_player(chplayer:get_player_name(), "Waypoints changed.")
|
||||
end
|
||||
if params == "add_change" then
|
||||
-- change immediate
|
||||
change(player)
|
||||
else
|
||||
minetest.after(0.5, change, player)
|
||||
core.after(0.5, change, player)
|
||||
end
|
||||
local image_waypoint = player:hud_add {
|
||||
type = "image_waypoint",
|
||||
@ -182,15 +182,15 @@ minetest.register_chatcommand("hudwaypoints", {
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
core.register_on_joinplayer(function(player)
|
||||
player:set_properties({zoom_fov = 15})
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("zoomfov", {
|
||||
core.register_chatcommand("zoomfov", {
|
||||
params = "[<FOV>]",
|
||||
description = "Set or display your zoom_fov",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
@ -241,12 +241,12 @@ local hud_hotbar_defs = {
|
||||
|
||||
|
||||
local player_hud_hotbars= {}
|
||||
minetest.register_chatcommand("hudhotbars", {
|
||||
core.register_chatcommand("hudhotbars", {
|
||||
description = "Shows some test Lua HUD elements of type hotbar. " ..
|
||||
"(add: Adds elements (default). remove: Removes elements)",
|
||||
params = "[ add | remove ]",
|
||||
func = function(name, params)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
@ -310,11 +310,11 @@ local hud_inventory_defs = {
|
||||
}
|
||||
|
||||
local player_hud_inventories= {}
|
||||
minetest.register_chatcommand("hudinventories", {
|
||||
core.register_chatcommand("hudinventories", {
|
||||
description = "Shows some test Lua HUD elements of type inventory. (add: Adds elements (default). remove: Removes elements)",
|
||||
params = "[ add | remove ]",
|
||||
func = function(name, params)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
@ -341,7 +341,7 @@ minetest.register_chatcommand("hudinventories", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
core.register_on_leaveplayer(function(player)
|
||||
local playername = player:get_player_name()
|
||||
player_font_huds[playername] = nil
|
||||
player_waypoints[playername] = nil
|
||||
@ -349,10 +349,10 @@ minetest.register_on_leaveplayer(function(player)
|
||||
player_hud_inventories[playername] = nil
|
||||
end)
|
||||
|
||||
minetest.register_chatcommand("hudprint", {
|
||||
core.register_chatcommand("hudprint", {
|
||||
description = "Writes all used Lua HUD elements into chat.",
|
||||
func = function(name, params)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
@ -372,11 +372,11 @@ minetest.register_chatcommand("hudprint", {
|
||||
local hud_flags = {"hotbar", "healthbar", "crosshair", "wielditem", "breathbar",
|
||||
"minimap", "minimap_radar", "basic_debug", "chat"}
|
||||
|
||||
minetest.register_chatcommand("hudtoggleflag", {
|
||||
core.register_chatcommand("hudtoggleflag", {
|
||||
description = "Toggles a hud flag.",
|
||||
params = "[ ".. table.concat(hud_flags, " | ") .." ]",
|
||||
func = function(name, params)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
local S = minetest.get_translator("testitems")
|
||||
local S = core.get_translator("testitems")
|
||||
|
||||
--
|
||||
-- Texture overlays for items
|
||||
@ -13,7 +13,7 @@ local overlay_on_use = function(itemstack, user, pointed_thing)
|
||||
local color = math.random(0x0, 0xFFFFFF)
|
||||
local colorstr = string.format("#%06x", color)
|
||||
meta:set_string("color", colorstr)
|
||||
minetest.log("action", "[testitems] Color of "..itemstack:get_name().." changed to "..colorstr)
|
||||
core.log("action", "[testitems] Color of "..itemstack:get_name().." changed to "..colorstr)
|
||||
return itemstack
|
||||
end
|
||||
-- Place handler to clear item metadata color
|
||||
@ -23,7 +23,7 @@ local overlay_on_place = function(itemstack, user, pointed_thing)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_craftitem("testitems:overlay_meta", {
|
||||
core.register_craftitem("testitems:overlay_meta", {
|
||||
description = S("Texture Overlay Test Item, Meta Color") .. "\n" ..
|
||||
S("Image must be a square with rainbow cross (inventory and wield)") .. "\n" ..
|
||||
S("Item meta color must only change square color") .. "\n" ..
|
||||
@ -41,7 +41,7 @@ minetest.register_craftitem("testitems:overlay_meta", {
|
||||
on_secondary_use = overlay_on_place,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("testitems:overlay_global", {
|
||||
core.register_craftitem("testitems:overlay_global", {
|
||||
description = S("Texture Overlay Test Item, Global Color") .. "\n" ..
|
||||
S("Image must be an orange square with rainbow cross (inventory and wield)"),
|
||||
-- Base texture: A grayscale square (to be colorized)
|
||||
@ -53,7 +53,7 @@ minetest.register_craftitem("testitems:overlay_global", {
|
||||
color = GLOBAL_COLOR_ARG,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("testitems:image_meta", {
|
||||
core.register_craftitem("testitems:image_meta", {
|
||||
description = S("Image Override Meta Test Item"),
|
||||
inventory_image = "default_apple.png",
|
||||
wield_image = "basetools_icesword.png",
|
||||
@ -63,7 +63,7 @@ minetest.register_craftitem("testitems:image_meta", {
|
||||
local state = meta:get_int("state")
|
||||
state = (state + 1) % 5
|
||||
meta:set_int("state", state)
|
||||
minetest.chat_send_player(player:get_player_name(), "State " .. state)
|
||||
core.chat_send_player(player:get_player_name(), "State " .. state)
|
||||
|
||||
if state == 0 then
|
||||
meta:set_string("inventory_image", "")
|
||||
@ -91,7 +91,7 @@ minetest.register_craftitem("testitems:image_meta", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craftitem("testitems:telescope_stick", {
|
||||
core.register_craftitem("testitems:telescope_stick", {
|
||||
description = S("Telescope Stick (Increases range on use.)"),
|
||||
inventory_image = "testitems_telescope_stick.png",
|
||||
on_use = function(itemstack, player)
|
||||
@ -101,7 +101,7 @@ minetest.register_craftitem("testitems:telescope_stick", {
|
||||
range = 0
|
||||
end
|
||||
meta:set_float("range", range)
|
||||
minetest.chat_send_player(player:get_player_name(), "Telescope Stick range set to "..range)
|
||||
core.chat_send_player(player:get_player_name(), "Telescope Stick range set to "..range)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
@ -25,12 +25,12 @@ local function place_nodes(param)
|
||||
local pos = param.pos
|
||||
local start_pos = param.start_pos
|
||||
table.sort(nodes)
|
||||
minetest.chat_send_player(name, "Placing nodes …")
|
||||
core.chat_send_player(name, "Placing nodes …")
|
||||
local nodes_placed = 0
|
||||
local aborted = false
|
||||
for n=1, #nodes do
|
||||
local itemstring = nodes[n]
|
||||
local def = minetest.registered_nodes[itemstring]
|
||||
local def = core.registered_nodes[itemstring]
|
||||
local p2_max = 0
|
||||
if param.param ~= "no_param2" then
|
||||
-- Also test the param2 values of the nodes
|
||||
@ -64,7 +64,7 @@ local function place_nodes(param)
|
||||
((def.paramtype2 == "colorfacedir" or def.paramtype2 == "colordegrotate")
|
||||
and p2 % 32 > 23)) then
|
||||
|
||||
minetest.set_node(pos, { name = itemstring, param2 = p2 })
|
||||
core.set_node(pos, { name = itemstring, param2 = p2 })
|
||||
nodes_placed = nodes_placed + 1
|
||||
pos = advance_pos(pos, start_pos)
|
||||
if not pos then
|
||||
@ -78,9 +78,9 @@ local function place_nodes(param)
|
||||
end
|
||||
end
|
||||
if aborted then
|
||||
minetest.chat_send_player(name, "Not all nodes could be placed, please move further away from the world boundary. Nodes placed: "..nodes_placed)
|
||||
core.chat_send_player(name, "Not all nodes could be placed, please move further away from the world boundary. Nodes placed: "..nodes_placed)
|
||||
end
|
||||
minetest.chat_send_player(name, "Nodes placed: "..nodes_placed..".")
|
||||
core.chat_send_player(name, "Nodes placed: "..nodes_placed..".")
|
||||
end
|
||||
|
||||
local function after_emerge(blockpos, action, calls_remaining, param)
|
||||
@ -89,11 +89,11 @@ local function after_emerge(blockpos, action, calls_remaining, param)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("test_place_nodes", {
|
||||
core.register_chatcommand("test_place_nodes", {
|
||||
params = "[ no_param2 ]",
|
||||
description = "Test: Place all nodes (except dummy and callback nodes) and optionally their permissible param2 variants",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
@ -112,12 +112,12 @@ minetest.register_chatcommand("test_place_nodes", {
|
||||
local aborted = false
|
||||
local nodes = {}
|
||||
local emerge_estimate = 0
|
||||
for itemstring, def in pairs(minetest.registered_nodes) do
|
||||
for itemstring, def in pairs(core.registered_nodes) do
|
||||
if itemstring ~= "ignore" and
|
||||
-- Skip callback test and dummy nodes
|
||||
-- to avoid clutter and chat spam
|
||||
minetest.get_item_group(itemstring, "callback_test") == 0 and
|
||||
minetest.get_item_group(itemstring, "dummy") == 0 then
|
||||
core.get_item_group(itemstring, "callback_test") == 0 and
|
||||
core.get_item_group(itemstring, "dummy") == 0 then
|
||||
table.insert(nodes, itemstring)
|
||||
if def.paramtype2 == 0 then
|
||||
emerge_estimate = emerge_estimate + 1
|
||||
@ -130,7 +130,7 @@ minetest.register_chatcommand("test_place_nodes", {
|
||||
-- Note we will emerge much more than we need to (overestimation),
|
||||
-- the estimation code could be improved performance-wise …
|
||||
local length = 16 + math.ceil(emerge_estimate / 24) * 2
|
||||
minetest.emerge_area(start_pos,
|
||||
core.emerge_area(start_pos,
|
||||
{ x = start_pos.x + 46, y = start_pos.y, z = start_pos.z + length },
|
||||
after_emerge, { nodes = nodes, name = name, pos = pos, start_pos = start_pos, param = param })
|
||||
return true, "Emerging area …"
|
||||
|
@ -13,10 +13,10 @@ unrelated to the drawtype, stuff that is mostly there to make
|
||||
testing this node easier and more convenient.
|
||||
]]
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- A regular cube
|
||||
minetest.register_node("testnodes:normal", {
|
||||
core.register_node("testnodes:normal", {
|
||||
description = S("\"normal\" Drawtype Test Node").."\n"..
|
||||
S("Opaque texture"),
|
||||
drawtype = "normal",
|
||||
@ -26,7 +26,7 @@ minetest.register_node("testnodes:normal", {
|
||||
})
|
||||
|
||||
-- Standard glasslike node
|
||||
minetest.register_node("testnodes:glasslike", {
|
||||
core.register_node("testnodes:glasslike", {
|
||||
description = S("\"glasslike\" Drawtype Test Node").."\n"..
|
||||
S("Transparent node with hidden backfaces"),
|
||||
drawtype = "glasslike",
|
||||
@ -37,7 +37,7 @@ minetest.register_node("testnodes:glasslike", {
|
||||
})
|
||||
|
||||
-- Glasslike framed with the two textures (normal and "detail")
|
||||
minetest.register_node("testnodes:glasslike_framed", {
|
||||
core.register_node("testnodes:glasslike_framed", {
|
||||
description = S("\"glasslike_framed\" Drawtype Test Node").."\n"..
|
||||
S("Transparent node with hidden backfaces").."\n"..
|
||||
S("Frame connects to neighbors"),
|
||||
@ -56,7 +56,7 @@ minetest.register_node("testnodes:glasslike_framed", {
|
||||
-- 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", {
|
||||
core.register_node("testnodes:glasslike_framed_no_detail", {
|
||||
description = S("\"glasslike_framed\" Drawtype without Detail Test Node").."\n"..
|
||||
S("Transparent node with hidden backfaces").."\n"..
|
||||
S("Frame connects to neighbors, but the 'detail' tile is not used"),
|
||||
@ -70,7 +70,7 @@ minetest.register_node("testnodes:glasslike_framed_no_detail", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("testnodes:glasslike_framed_optional", {
|
||||
core.register_node("testnodes:glasslike_framed_optional", {
|
||||
description = S("\"glasslike_framed_optional\" Drawtype Test Node").."\n"..
|
||||
S("Transparent node with hidden backfaces").."\n"..
|
||||
S("Frame connects if 'connected_glass' setting is true"),
|
||||
@ -88,7 +88,7 @@ minetest.register_node("testnodes:glasslike_framed_optional", {
|
||||
|
||||
|
||||
|
||||
minetest.register_node("testnodes:allfaces", {
|
||||
core.register_node("testnodes:allfaces", {
|
||||
description = S("\"allfaces\" Drawtype Test Node").."\n"..
|
||||
S("Transparent node with visible internal backfaces"),
|
||||
drawtype = "allfaces",
|
||||
@ -98,7 +98,7 @@ minetest.register_node("testnodes:allfaces", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:allfaces_6", {
|
||||
core.register_node("testnodes:allfaces_6", {
|
||||
description = S("\"allfaces 6 Textures\" Drawtype Test Node").."\n"..
|
||||
S("Transparent node with visible internal backfaces"),
|
||||
drawtype = "allfaces",
|
||||
@ -121,7 +121,7 @@ local allfaces_optional_tooltip = ""..
|
||||
S("* 'simple': transparent with hidden backfaces").."\n"..
|
||||
S("* 'opaque': opaque")
|
||||
|
||||
minetest.register_node("testnodes:allfaces_optional", {
|
||||
core.register_node("testnodes:allfaces_optional", {
|
||||
description = S("\"allfaces_optional\" Drawtype Test Node").."\n"..
|
||||
allfaces_optional_tooltip,
|
||||
drawtype = "allfaces_optional",
|
||||
@ -131,7 +131,7 @@ minetest.register_node("testnodes:allfaces_optional", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:allfaces_optional_waving", {
|
||||
core.register_node("testnodes:allfaces_optional_waving", {
|
||||
description = S("Waving \"allfaces_optional\" Drawtype Test Node").."\n"..
|
||||
allfaces_optional_tooltip.."\n"..
|
||||
S("Waves if waving leaves are enabled by client"),
|
||||
@ -143,7 +143,7 @@ minetest.register_node("testnodes:allfaces_optional_waving", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:firelike", {
|
||||
core.register_node("testnodes:firelike", {
|
||||
description = S("\"firelike\" Drawtype Test Node").."\n"..
|
||||
S("Changes shape based on neighbors"),
|
||||
drawtype = "firelike",
|
||||
@ -155,7 +155,7 @@ minetest.register_node("testnodes:firelike", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:fencelike", {
|
||||
core.register_node("testnodes:fencelike", {
|
||||
description = S("\"fencelike\" Drawtype Test Node").."\n"..
|
||||
S("Connects to neighbors"),
|
||||
drawtype = "fencelike",
|
||||
@ -165,7 +165,7 @@ minetest.register_node("testnodes:fencelike", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:torchlike", {
|
||||
core.register_node("testnodes:torchlike", {
|
||||
description = S("Floor \"torchlike\" Drawtype Test Node").."\n"..
|
||||
S("Always on floor"),
|
||||
drawtype = "torchlike",
|
||||
@ -178,7 +178,7 @@ minetest.register_node("testnodes:torchlike", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:torchlike_wallmounted", {
|
||||
core.register_node("testnodes:torchlike_wallmounted", {
|
||||
description = S("Wallmounted \"torchlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)"),
|
||||
drawtype = "torchlike",
|
||||
@ -196,7 +196,7 @@ minetest.register_node("testnodes:torchlike_wallmounted", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:torchlike_wallmounted_rot", {
|
||||
core.register_node("testnodes:torchlike_wallmounted_rot", {
|
||||
description = S("Wallmounted Rotatable Torchlike Drawtype Test Node"),
|
||||
drawtype = "torchlike",
|
||||
paramtype = "light",
|
||||
@ -214,7 +214,7 @@ minetest.register_node("testnodes:torchlike_wallmounted_rot", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:signlike", {
|
||||
core.register_node("testnodes:signlike", {
|
||||
description = S("Floor \"signlike\" Drawtype Test Node").."\n"..
|
||||
S("Always on floor"),
|
||||
drawtype = "signlike",
|
||||
@ -226,7 +226,7 @@ minetest.register_node("testnodes:signlike", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:signlike_wallmounted", {
|
||||
core.register_node("testnodes:signlike_wallmounted", {
|
||||
description = S("Wallmounted \"signlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)"),
|
||||
drawtype = "signlike",
|
||||
@ -240,7 +240,7 @@ minetest.register_node("testnodes:signlike_wallmounted", {
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:signlike_rot", {
|
||||
core.register_node("testnodes:signlike_rot", {
|
||||
description = S("Wallmounted Rotatable Signlike Drawtype Test Node"),
|
||||
drawtype = "signlike",
|
||||
paramtype = "light",
|
||||
@ -256,7 +256,7 @@ minetest.register_node("testnodes:signlike_rot", {
|
||||
|
||||
|
||||
|
||||
minetest.register_node("testnodes:plantlike", {
|
||||
core.register_node("testnodes:plantlike", {
|
||||
description = S("\"plantlike\" Drawtype Test Node"),
|
||||
drawtype = "plantlike",
|
||||
paramtype = "light",
|
||||
@ -268,7 +268,7 @@ minetest.register_node("testnodes:plantlike", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:plantlike_waving", {
|
||||
core.register_node("testnodes:plantlike_waving", {
|
||||
description = S("Waving \"plantlike\" Drawtype Test Node").."\n"..
|
||||
S("Waves if waving plants are enabled by client"),
|
||||
drawtype = "plantlike",
|
||||
@ -282,7 +282,7 @@ minetest.register_node("testnodes:plantlike_waving", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:plantlike_wallmounted", {
|
||||
core.register_node("testnodes:plantlike_wallmounted", {
|
||||
description = S("Wallmounted \"plantlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)"),
|
||||
drawtype = "plantlike",
|
||||
@ -300,7 +300,7 @@ minetest.register_node("testnodes:plantlike_wallmounted", {
|
||||
|
||||
-- param2 will rotate
|
||||
local function rotate_on_rightclick(pos, node, clicker)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
local def = core.registered_nodes[node.name]
|
||||
local aux1 = clicker:get_player_control().aux1
|
||||
|
||||
local deg, deg_max
|
||||
@ -318,12 +318,12 @@ local function rotate_on_rightclick(pos, node, clicker)
|
||||
|
||||
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(),
|
||||
core.swap_node(pos, node)
|
||||
core.chat_send_player(clicker:get_player_name(),
|
||||
"Rotation is now " .. deg .. " / " .. deg_max)
|
||||
end
|
||||
|
||||
minetest.register_node("testnodes:plantlike_degrotate", {
|
||||
core.register_node("testnodes:plantlike_degrotate", {
|
||||
description = S("Degrotate \"plantlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = horizontal rotation (0..239)"),
|
||||
drawtype = "plantlike",
|
||||
@ -338,7 +338,7 @@ minetest.register_node("testnodes:plantlike_degrotate", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:mesh_degrotate", {
|
||||
core.register_node("testnodes:mesh_degrotate", {
|
||||
description = S("Degrotate \"mesh\" Drawtype Test Node").."\n"..
|
||||
S("param2 = horizontal rotation (0..239)"),
|
||||
drawtype = "mesh",
|
||||
@ -353,7 +353,7 @@ minetest.register_node("testnodes:mesh_degrotate", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:mesh_colordegrotate", {
|
||||
core.register_node("testnodes:mesh_colordegrotate", {
|
||||
description = S("Colordegrotate \"mesh\" Drawtype Test Node").."\n"..
|
||||
S("param2 = color + horizontal rotation (0..23, 32..55, ...)"),
|
||||
drawtype = "mesh",
|
||||
@ -371,7 +371,7 @@ minetest.register_node("testnodes:mesh_colordegrotate", {
|
||||
})
|
||||
|
||||
-- param2 will change height
|
||||
minetest.register_node("testnodes:plantlike_leveled", {
|
||||
core.register_node("testnodes:plantlike_leveled", {
|
||||
description = S("Leveled \"plantlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = height (0..255)"),
|
||||
drawtype = "plantlike",
|
||||
@ -390,7 +390,7 @@ minetest.register_node("testnodes:plantlike_leveled", {
|
||||
})
|
||||
|
||||
-- param2 changes shape
|
||||
minetest.register_node("testnodes:plantlike_meshoptions", {
|
||||
core.register_node("testnodes:plantlike_meshoptions", {
|
||||
description = S("Meshoptions \"plantlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = plant shape"),
|
||||
drawtype = "plantlike",
|
||||
@ -403,7 +403,7 @@ minetest.register_node("testnodes:plantlike_meshoptions", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:plantlike_rooted", {
|
||||
core.register_node("testnodes:plantlike_rooted", {
|
||||
description = S("\"rooted_plantlike\" Drawtype Test Node"),
|
||||
drawtype = "plantlike_rooted",
|
||||
paramtype = "light",
|
||||
@ -413,7 +413,7 @@ minetest.register_node("testnodes:plantlike_rooted", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:plantlike_rooted_wallmounted", {
|
||||
core.register_node("testnodes:plantlike_rooted_wallmounted", {
|
||||
description = S("Wallmounted \"rooted_plantlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)"),
|
||||
drawtype = "plantlike_rooted",
|
||||
@ -428,7 +428,7 @@ minetest.register_node("testnodes:plantlike_rooted_wallmounted", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:plantlike_rooted_waving", {
|
||||
core.register_node("testnodes:plantlike_rooted_waving", {
|
||||
description = S("Waving \"rooted_plantlike\" Drawtype Test Node").."\n"..
|
||||
S("Waves if waving plants are enabled by client"),
|
||||
drawtype = "plantlike_rooted",
|
||||
@ -445,7 +445,7 @@ minetest.register_node("testnodes:plantlike_rooted_waving", {
|
||||
})
|
||||
|
||||
-- param2 changes height
|
||||
minetest.register_node("testnodes:plantlike_rooted_leveled", {
|
||||
core.register_node("testnodes:plantlike_rooted_leveled", {
|
||||
description = S("Leveled \"rooted_plantlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = height (0..255)"),
|
||||
drawtype = "plantlike_rooted",
|
||||
@ -467,7 +467,7 @@ minetest.register_node("testnodes:plantlike_rooted_leveled", {
|
||||
})
|
||||
|
||||
-- param2 changes shape
|
||||
minetest.register_node("testnodes:plantlike_rooted_meshoptions", {
|
||||
core.register_node("testnodes:plantlike_rooted_meshoptions", {
|
||||
description = S("Meshoptions \"rooted_plantlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = plant shape"),
|
||||
drawtype = "plantlike_rooted",
|
||||
@ -486,7 +486,7 @@ minetest.register_node("testnodes:plantlike_rooted_meshoptions", {
|
||||
})
|
||||
|
||||
-- param2 changes rotation
|
||||
minetest.register_node("testnodes:plantlike_rooted_degrotate", {
|
||||
core.register_node("testnodes:plantlike_rooted_degrotate", {
|
||||
description = S("Degrotate \"rooted_plantlike\" Drawtype Test Node").."\n"..
|
||||
S("param2 = horizontal rotation (0..239)"),
|
||||
drawtype = "plantlike_rooted",
|
||||
@ -508,7 +508,7 @@ minetest.register_node("testnodes:plantlike_rooted_degrotate", {
|
||||
-- DRAWTYPE ONLY, NO LIQUID PHYSICS!
|
||||
-- Liquid ranges 0 to 8
|
||||
for r = 0, 8 do
|
||||
minetest.register_node("testnodes:liquid_"..r, {
|
||||
core.register_node("testnodes:liquid_"..r, {
|
||||
description = S("\"liquid\" Drawtype Test Node, Range @1", r).."\n"..
|
||||
S("Drawtype only; all liquid physics are disabled"),
|
||||
drawtype = "liquid",
|
||||
@ -530,7 +530,7 @@ for r = 0, 8 do
|
||||
liquid_alternative_source = "testnodes:liquid_"..r,
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
minetest.register_node("testnodes:liquid_flowing_"..r, {
|
||||
core.register_node("testnodes:liquid_flowing_"..r, {
|
||||
description = S("\"flowingliquid\" Drawtype Test Node, Range @1", r).."\n"..
|
||||
S("Drawtype only; all liquid physics are disabled").."\n"..
|
||||
S("param2 = flowing liquid level"),
|
||||
@ -558,7 +558,7 @@ for r = 0, 8 do
|
||||
end
|
||||
|
||||
-- Waving liquid test (drawtype only)
|
||||
minetest.register_node("testnodes:liquid_waving", {
|
||||
core.register_node("testnodes:liquid_waving", {
|
||||
description = S("Waving \"liquid\" Drawtype Test Node").."\n"..
|
||||
S("Drawtype only; all liquid physics are disabled").."\n"..
|
||||
S("Waves if waving liquids are enabled by client"),
|
||||
@ -582,7 +582,7 @@ minetest.register_node("testnodes:liquid_waving", {
|
||||
liquid_alternative_source = "testnodes:liquid_waving",
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
minetest.register_node("testnodes:liquid_flowing_waving", {
|
||||
core.register_node("testnodes:liquid_flowing_waving", {
|
||||
description = S("Waving \"flowingliquid\" Drawtype Test Node").."\n"..
|
||||
S("Drawtype only; all liquid physics are disabled").."\n"..
|
||||
S("param2 = flowing liquid level").."\n"..
|
||||
@ -610,7 +610,7 @@ minetest.register_node("testnodes:liquid_flowing_waving", {
|
||||
})
|
||||
|
||||
-- Invisible node
|
||||
minetest.register_node("testnodes:airlike", {
|
||||
core.register_node("testnodes:airlike", {
|
||||
description = S("\"airlike\" Drawtype Test Node").."\n"..
|
||||
S("Invisible node").."\n"..
|
||||
S("Inventory/wield image = no_texture_airlike.png"),
|
||||
@ -626,7 +626,7 @@ minetest.register_node("testnodes:airlike", {
|
||||
})
|
||||
|
||||
-- param2 changes liquid height
|
||||
minetest.register_node("testnodes:glassliquid", {
|
||||
core.register_node("testnodes:glassliquid", {
|
||||
description = S("\"glasslike_framed\" Drawtype with Liquid Test Node").."\n"..
|
||||
S("param2 = liquid level (0..63)"),
|
||||
drawtype = "glasslike_framed",
|
||||
@ -661,14 +661,14 @@ for r=1, #rails do
|
||||
local tt = rails[r][3]
|
||||
local raillike_group
|
||||
if id ~= "groupless" then
|
||||
raillike_group = minetest.raillike_group(id)
|
||||
raillike_group = core.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, {
|
||||
core.register_node("testnodes:raillike_"..id..c, {
|
||||
description = S("\"raillike\" Drawtype Test Node: @1 @2", id, c).."\n"..
|
||||
tt,
|
||||
drawtype = "raillike",
|
||||
@ -693,7 +693,7 @@ end
|
||||
-- Add visual_scale variants of previous nodes for half and double size
|
||||
local scale = function(subname, append)
|
||||
local original = "testnodes:"..subname
|
||||
local def = table.copy(minetest.registered_items[original])
|
||||
local def = table.copy(core.registered_items[original])
|
||||
local orig_desc
|
||||
if append and type(append) == "string" then
|
||||
orig_desc = ItemStack(original):get_short_description()
|
||||
@ -705,11 +705,11 @@ local scale = function(subname, append)
|
||||
end
|
||||
def.visual_scale = 2.0
|
||||
def.description = S("Double-sized @1", orig_desc)
|
||||
minetest.register_node("testnodes:"..subname.."_double", def)
|
||||
def = table.copy(minetest.registered_items[original])
|
||||
core.register_node("testnodes:"..subname.."_double", def)
|
||||
def = table.copy(core.registered_items[original])
|
||||
def.visual_scale = 0.5
|
||||
def.description = S("Half-sized @1", orig_desc)
|
||||
minetest.register_node("testnodes:"..subname.."_half", def)
|
||||
core.register_node("testnodes:"..subname.."_half", def)
|
||||
end
|
||||
|
||||
local allfaces_newsize_tt = ""..
|
||||
|
@ -1,4 +1,4 @@
|
||||
local path = minetest.get_modpath(minetest.get_current_modname())
|
||||
local path = core.get_modpath(core.get_current_modname())
|
||||
|
||||
dofile(path.."/drawtypes.lua")
|
||||
dofile(path.."/meshes.lua")
|
||||
|
@ -1,10 +1,10 @@
|
||||
-- Test Nodes: Light test
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- All possible light levels
|
||||
for i=1, minetest.LIGHT_MAX do
|
||||
minetest.register_node("testnodes:light"..string.format("%02d", i), {
|
||||
for i=1, core.LIGHT_MAX do
|
||||
core.register_node("testnodes:light"..string.format("%02d", i), {
|
||||
description = S("Light Source (@1)", i),
|
||||
paramtype = "light",
|
||||
light_source = i,
|
||||
@ -21,7 +21,7 @@ end
|
||||
|
||||
-- Lets light through, but not sunlight, leading to a
|
||||
-- reduction in light level when light passes through
|
||||
minetest.register_node("testnodes:sunlight_filter", {
|
||||
core.register_node("testnodes:sunlight_filter", {
|
||||
description = S("Sunlight Filter") .."\n"..
|
||||
S("Lets light through, but weakens sunlight"),
|
||||
paramtype = "light",
|
||||
@ -35,7 +35,7 @@ minetest.register_node("testnodes:sunlight_filter", {
|
||||
})
|
||||
|
||||
-- Lets light and sunlight through without obstruction
|
||||
minetest.register_node("testnodes:sunlight_propagator", {
|
||||
core.register_node("testnodes:sunlight_propagator", {
|
||||
description = S("Sunlight Propagator") .."\n"..
|
||||
S("Lets all light through"),
|
||||
paramtype = "light",
|
||||
|
@ -7,7 +7,7 @@ for d=0, 8 do
|
||||
else
|
||||
tt_normal = "\n".."Swimmable, spreading, renewable liquid"
|
||||
end
|
||||
minetest.register_node("testnodes:rliquid_"..d, {
|
||||
core.register_node("testnodes:rliquid_"..d, {
|
||||
description = "Test Liquid Source, Range "..d..
|
||||
tt_normal .. "\n" .. "(falling & floating node)",
|
||||
drawtype = "liquid",
|
||||
@ -29,7 +29,7 @@ for d=0, 8 do
|
||||
groups = {float = 1, falling_node = 1},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:rliquid_flowing_"..d, {
|
||||
core.register_node("testnodes:rliquid_flowing_"..d, {
|
||||
description = "Flowing Test Liquid, Range "..d..
|
||||
tt_normal,
|
||||
drawtype = "flowingliquid",
|
||||
@ -58,7 +58,7 @@ for d=0, 8 do
|
||||
end
|
||||
|
||||
local mod = "^[colorize:#000000:127"
|
||||
minetest.register_node("testnodes:vliquid_"..d, {
|
||||
core.register_node("testnodes:vliquid_"..d, {
|
||||
description = "Test Liquid Source, Viscosity/Resistance "..d.."\n"..
|
||||
"Swimmable, spreading, renewable liquid"..
|
||||
tt_reduced,
|
||||
@ -79,7 +79,7 @@ for d=0, 8 do
|
||||
liquid_viscosity = d,
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:vliquid_flowing_"..d, {
|
||||
core.register_node("testnodes:vliquid_flowing_"..d, {
|
||||
description = "Flowing Test Liquid, Viscosity/Resistance "..d.."\n"..
|
||||
"Swimmable, spreading, renewable liquid"..
|
||||
tt_reduced,
|
||||
@ -103,7 +103,7 @@ for d=0, 8 do
|
||||
|
||||
mod = "^[colorize:#000000:192"
|
||||
local v = 4
|
||||
minetest.register_node("testnodes:vrliquid_"..d, {
|
||||
core.register_node("testnodes:vrliquid_"..d, {
|
||||
description = "Test Liquid Source, Viscosity "..v..", Resistance "..d.."\n"..
|
||||
"Swimmable, spreading, renewable liquid"..
|
||||
tt_reduced,
|
||||
@ -127,7 +127,7 @@ for d=0, 8 do
|
||||
move_resistance = d,
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:vrliquid_flowing_"..d, {
|
||||
core.register_node("testnodes:vrliquid_flowing_"..d, {
|
||||
description = "Flowing Test Liquid, Viscosity "..v..", Resistance "..d.."\n"..
|
||||
"Swimmable, spreading, renewable liquid"..
|
||||
tt_reduced,
|
||||
|
@ -1,6 +1,6 @@
|
||||
-- Meshes
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
local ocorner_cbox = {
|
||||
type = "fixed",
|
||||
@ -23,7 +23,7 @@ local tall_pyr_cbox = {
|
||||
}
|
||||
|
||||
-- Normal mesh
|
||||
minetest.register_node("testnodes:mesh", {
|
||||
core.register_node("testnodes:mesh", {
|
||||
description = S("Mesh Test Node"),
|
||||
drawtype = "mesh",
|
||||
mesh = "testnodes_pyramid.obj",
|
||||
@ -35,7 +35,7 @@ minetest.register_node("testnodes:mesh", {
|
||||
})
|
||||
|
||||
-- Facedir mesh: outer corner slope
|
||||
minetest.register_node("testnodes:mesh_facedir", {
|
||||
core.register_node("testnodes:mesh_facedir", {
|
||||
description = S("Facedir Mesh Test Node").."\n"..
|
||||
S("param2 = facedir rotation (0..23)"),
|
||||
drawtype = "mesh",
|
||||
@ -48,7 +48,7 @@ minetest.register_node("testnodes:mesh_facedir", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:mesh_colorfacedir", {
|
||||
core.register_node("testnodes:mesh_colorfacedir", {
|
||||
description = S("Color Facedir Mesh Test Node").."\n"..
|
||||
S("param2 = color + facedir rotation (0..23, 32..55, ...)"),
|
||||
drawtype = "mesh",
|
||||
@ -62,7 +62,7 @@ minetest.register_node("testnodes:mesh_colorfacedir", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:mesh_4dir", {
|
||||
core.register_node("testnodes:mesh_4dir", {
|
||||
description = S("4dir Mesh Test Node").."\n"..
|
||||
S("param2 = 4dir rotation (0..3)"),
|
||||
drawtype = "mesh",
|
||||
@ -75,7 +75,7 @@ minetest.register_node("testnodes:mesh_4dir", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:mesh_color4dir", {
|
||||
core.register_node("testnodes:mesh_color4dir", {
|
||||
description = S("Color 4dir Mesh Test Node").."\n"..
|
||||
S("param2 = color + 4dir rotation (0..255)"),
|
||||
drawtype = "mesh",
|
||||
@ -90,7 +90,7 @@ minetest.register_node("testnodes:mesh_color4dir", {
|
||||
})
|
||||
|
||||
-- Wallmounted mesh: pyramid
|
||||
minetest.register_node("testnodes:mesh_wallmounted", {
|
||||
core.register_node("testnodes:mesh_wallmounted", {
|
||||
description = S("Wallmounted Mesh Test Node").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)"),
|
||||
drawtype = "mesh",
|
||||
@ -103,7 +103,7 @@ minetest.register_node("testnodes:mesh_wallmounted", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:mesh_colorwallmounted", {
|
||||
core.register_node("testnodes:mesh_colorwallmounted", {
|
||||
description = S("Color Wallmounted Mesh Test Node").."\n"..
|
||||
S("param2 = color + wallmounted rotation (0..7, 8..15, ...)"),
|
||||
drawtype = "mesh",
|
||||
@ -118,7 +118,7 @@ minetest.register_node("testnodes:mesh_colorwallmounted", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("testnodes:mesh_double", {
|
||||
core.register_node("testnodes:mesh_double", {
|
||||
description = S("Double-sized Mesh Test Node"),
|
||||
drawtype = "mesh",
|
||||
mesh = "testnodes_pyramid.obj",
|
||||
@ -129,7 +129,7 @@ minetest.register_node("testnodes:mesh_double", {
|
||||
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
minetest.register_node("testnodes:mesh_half", {
|
||||
core.register_node("testnodes:mesh_half", {
|
||||
description = S("Half-sized Mesh Test Node"),
|
||||
drawtype = "mesh",
|
||||
mesh = "testnodes_pyramid.obj",
|
||||
@ -141,7 +141,7 @@ minetest.register_node("testnodes:mesh_half", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:mesh_waving1", {
|
||||
core.register_node("testnodes:mesh_waving1", {
|
||||
description = S("Plantlike-waving Mesh Test Node").."\n"..
|
||||
S("Waves if waving plants are enabled by client"),
|
||||
drawtype = "mesh",
|
||||
@ -153,7 +153,7 @@ minetest.register_node("testnodes:mesh_waving1", {
|
||||
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
minetest.register_node("testnodes:mesh_waving2", {
|
||||
core.register_node("testnodes:mesh_waving2", {
|
||||
description = S("Leaflike-waving Mesh Test Node").."\n"..
|
||||
S("Waves if waving leaves are enabled by client"),
|
||||
drawtype = "mesh",
|
||||
@ -165,7 +165,7 @@ minetest.register_node("testnodes:mesh_waving2", {
|
||||
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
minetest.register_node("testnodes:mesh_waving3", {
|
||||
core.register_node("testnodes:mesh_waving3", {
|
||||
description = S("Liquidlike-waving Mesh Test Node").."\n"..
|
||||
S("Waves if waving liquids are enabled by client"),
|
||||
drawtype = "mesh",
|
||||
|
@ -1,9 +1,9 @@
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- Nodebox examples and tests.
|
||||
|
||||
-- An simple example nodebox with one centered box
|
||||
minetest.register_node("testnodes:nodebox_fixed", {
|
||||
core.register_node("testnodes:nodebox_fixed", {
|
||||
description = S("Fixed Nodebox Test Node").."\n"..
|
||||
S("Nodebox is always the same"),
|
||||
tiles = {"testnodes_nodebox.png"},
|
||||
@ -18,7 +18,7 @@ minetest.register_node("testnodes:nodebox_fixed", {
|
||||
})
|
||||
|
||||
-- 50% higher than a regular node
|
||||
minetest.register_node("testnodes:nodebox_overhigh", {
|
||||
core.register_node("testnodes:nodebox_overhigh", {
|
||||
description = S("+50% high Nodebox Test Node"),
|
||||
tiles = {"testnodes_nodebox.png"},
|
||||
drawtype = "nodebox",
|
||||
@ -32,7 +32,7 @@ minetest.register_node("testnodes:nodebox_overhigh", {
|
||||
})
|
||||
|
||||
-- 95% higher than a regular node
|
||||
minetest.register_node("testnodes:nodebox_overhigh2", {
|
||||
core.register_node("testnodes:nodebox_overhigh2", {
|
||||
description = S("+95% high Nodebox Test Node"),
|
||||
tiles = {"testnodes_nodebox.png"},
|
||||
drawtype = "nodebox",
|
||||
@ -47,7 +47,7 @@ minetest.register_node("testnodes:nodebox_overhigh2", {
|
||||
})
|
||||
|
||||
-- Height of nodebox changes with its param2 value
|
||||
minetest.register_node("testnodes:nodebox_leveled", {
|
||||
core.register_node("testnodes:nodebox_leveled", {
|
||||
description = S("Leveled Nodebox Test Node").."\n"..
|
||||
S("param2 = height (0..127)"),
|
||||
tiles = {"testnodes_nodebox.png^[colorize:#0F0:32"},
|
||||
@ -93,7 +93,7 @@ local nodebox_wall_thick = {
|
||||
}
|
||||
|
||||
-- Wall-like nodebox that connects to 4 neighbors
|
||||
minetest.register_node("testnodes:nodebox_connected", {
|
||||
core.register_node("testnodes:nodebox_connected", {
|
||||
description = S("Connected Nodebox Test Node (4 Side Wall)").."\n"..
|
||||
S("Connects to 4 neighbors sideways"),
|
||||
tiles = {"testnodes_nodebox.png^[colorize:#F00:32"},
|
||||
@ -106,7 +106,7 @@ minetest.register_node("testnodes:nodebox_connected", {
|
||||
})
|
||||
|
||||
-- Cable-like nodebox that connects to 6 neighbors
|
||||
minetest.register_node("testnodes:nodebox_connected_6side", {
|
||||
core.register_node("testnodes:nodebox_connected_6side", {
|
||||
description = S("Connected Nodebox Test Node (6 Side Cable)").."\n"..
|
||||
S("Connects to 6 neighbors"),
|
||||
tiles = {"testnodes_nodebox.png^[colorize:#F00:32"},
|
||||
@ -119,7 +119,7 @@ minetest.register_node("testnodes:nodebox_connected_6side", {
|
||||
})
|
||||
|
||||
-- More walls
|
||||
minetest.register_node("testnodes:nodebox_connected_facedir", {
|
||||
core.register_node("testnodes:nodebox_connected_facedir", {
|
||||
description = S("Facedir Connected Nodebox Test Node (4 Side Wall)").."\n"..
|
||||
S("Connects to neighbors").."\n"..
|
||||
S("param2 = facedir rotation of textures (not of the nodebox!)"),
|
||||
@ -140,7 +140,7 @@ minetest.register_node("testnodes:nodebox_connected_facedir", {
|
||||
node_box = nodebox_wall_thick,
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:nodebox_connected_4dir", {
|
||||
core.register_node("testnodes:nodebox_connected_4dir", {
|
||||
description = S("4Dir Connected Nodebox Test Node").."\n"..
|
||||
S("Connects to neighbors").."\n"..
|
||||
S("param2 = 4dir rotation of textures (not of the nodebox!)"),
|
||||
@ -162,7 +162,7 @@ minetest.register_node("testnodes:nodebox_connected_4dir", {
|
||||
})
|
||||
|
||||
-- Doesn't connect, but lets other nodes connect
|
||||
minetest.register_node("testnodes:facedir_to_connect_to", {
|
||||
core.register_node("testnodes:facedir_to_connect_to", {
|
||||
description = S("Facedir Node that connected Nodeboxes connect to").."\n"..
|
||||
S("Neighbors connect only to left (blue 4) and top (yellow 1) face").."\n"..
|
||||
S("(Currently broken for param2 >= 4, see FIXME in nodedef.cpp)").."\n"..
|
||||
@ -184,7 +184,7 @@ minetest.register_node("testnodes:facedir_to_connect_to", {
|
||||
-- 3D sign and button:
|
||||
-- These are example nodes for more realistic example uses
|
||||
-- of wallmounted_rotate_vertical
|
||||
minetest.register_node("testnodes:sign3d", {
|
||||
core.register_node("testnodes:sign3d", {
|
||||
description = S("Nodebox Sign, Nodebox Type \"fixed\""),
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -202,7 +202,7 @@ minetest.register_node("testnodes:sign3d", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:sign3d_wallmounted", {
|
||||
core.register_node("testnodes:sign3d_wallmounted", {
|
||||
description = S("Nodebox Sign, Nodebox Type \"wallmounted\""),
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
@ -222,7 +222,7 @@ minetest.register_node("testnodes:sign3d_wallmounted", {
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:button", {
|
||||
core.register_node("testnodes:button", {
|
||||
description = S("Button Nodebox Test Node"),
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
|
@ -1,13 +1,13 @@
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
minetest.register_node("testnodes:overlay", {
|
||||
core.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", {
|
||||
core.register_node("testnodes:overlay_color_all", {
|
||||
description = S("Texture Overlay Test Node, Colorized") .. "\n" ..
|
||||
S("param2 changes color"),
|
||||
tiles = {{name = "testnodes_overlayable.png"}},
|
||||
@ -18,7 +18,7 @@ minetest.register_node("testnodes:overlay_color_all", {
|
||||
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
minetest.register_node("testnodes:overlay_color_overlay", {
|
||||
core.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"}},
|
||||
@ -29,7 +29,7 @@ minetest.register_node("testnodes:overlay_color_overlay", {
|
||||
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
minetest.register_node("testnodes:overlay_color_overlayed", {
|
||||
core.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"}},
|
||||
@ -42,7 +42,7 @@ minetest.register_node("testnodes:overlay_color_overlayed", {
|
||||
})
|
||||
|
||||
local global_overlay_color = "#FF2000"
|
||||
minetest.register_node("testnodes:overlay_global", {
|
||||
core.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"}},
|
||||
@ -52,7 +52,7 @@ minetest.register_node("testnodes:overlay_global", {
|
||||
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
minetest.register_node("testnodes:overlay_global_color_all", {
|
||||
core.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"),
|
||||
@ -65,7 +65,7 @@ minetest.register_node("testnodes:overlay_global_color_all", {
|
||||
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
minetest.register_node("testnodes:overlay_global_color_overlay", {
|
||||
core.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"),
|
||||
@ -78,7 +78,7 @@ minetest.register_node("testnodes:overlay_global_color_overlay", {
|
||||
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
minetest.register_node("testnodes:overlay_global_color_overlayed", {
|
||||
core.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"),
|
||||
|
@ -1,8 +1,8 @@
|
||||
-- This file is for misc. param2 tests that aren't covered in drawtypes.lua already.
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
minetest.register_node("testnodes:facedir", {
|
||||
core.register_node("testnodes:facedir", {
|
||||
description = S("Facedir Test Node").."\n"..
|
||||
S("param2 = facedir rotation (0..23)"),
|
||||
paramtype2 = "facedir",
|
||||
@ -18,7 +18,7 @@ minetest.register_node("testnodes:facedir", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:4dir", {
|
||||
core.register_node("testnodes:4dir", {
|
||||
description = S("4dir Test Node").."\n"..
|
||||
S("param2 = 4dir rotation (0..3)"),
|
||||
paramtype2 = "4dir",
|
||||
@ -34,7 +34,7 @@ minetest.register_node("testnodes:4dir", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:facedir_nodebox", {
|
||||
core.register_node("testnodes:facedir_nodebox", {
|
||||
description = S("Facedir Nodebox Test Node").."\n"..
|
||||
S("param2 = facedir rotation (0..23)"),
|
||||
tiles = {
|
||||
@ -56,7 +56,7 @@ minetest.register_node("testnodes:facedir_nodebox", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:4dir_nodebox", {
|
||||
core.register_node("testnodes:4dir_nodebox", {
|
||||
description = S("4dir Nodebox Test Node").."\n"..
|
||||
S("param2 = 4dir rotation (0..3)"),
|
||||
tiles = {
|
||||
@ -78,7 +78,7 @@ minetest.register_node("testnodes:4dir_nodebox", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:4dir_nodebox_stair", {
|
||||
core.register_node("testnodes:4dir_nodebox_stair", {
|
||||
description = S("4dir Nodebox Stair Test Node").."\n"..
|
||||
S("param2 = 4dir rotation (0..3)"),
|
||||
tiles = {
|
||||
@ -104,7 +104,7 @@ minetest.register_node("testnodes:4dir_nodebox_stair", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("testnodes:wallmounted", {
|
||||
core.register_node("testnodes:wallmounted", {
|
||||
description = S("Wallmounted Test Node").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)"),
|
||||
paramtype2 = "wallmounted",
|
||||
@ -120,7 +120,7 @@ minetest.register_node("testnodes:wallmounted", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:wallmounted_rot", {
|
||||
core.register_node("testnodes:wallmounted_rot", {
|
||||
description = S("Wallmounted Rotatable Test Node"),
|
||||
paramtype2 = "wallmounted",
|
||||
wallmounted_rotate_vertical = true,
|
||||
@ -136,7 +136,7 @@ minetest.register_node("testnodes:wallmounted_rot", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:wallmounted_nodebox", {
|
||||
core.register_node("testnodes:wallmounted_nodebox", {
|
||||
description = S("Wallmounted Nodebox Test Node").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)"),
|
||||
paramtype2 = "wallmounted",
|
||||
@ -160,7 +160,7 @@ minetest.register_node("testnodes:wallmounted_nodebox", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:wallmounted_nodebox_rot", {
|
||||
core.register_node("testnodes:wallmounted_nodebox_rot", {
|
||||
description = S("Wallmounted Rotatable Nodebox Test Node"),
|
||||
paramtype2 = "wallmounted",
|
||||
wallmounted_rotate_vertical = true,
|
||||
@ -184,7 +184,7 @@ minetest.register_node("testnodes:wallmounted_nodebox_rot", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:color", {
|
||||
core.register_node("testnodes:color", {
|
||||
description = S("Color Test Node").."\n"..
|
||||
S("param2 = color (0..255)"),
|
||||
paramtype2 = "color",
|
||||
@ -196,7 +196,7 @@ minetest.register_node("testnodes:color", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:colorfacedir", {
|
||||
core.register_node("testnodes:colorfacedir", {
|
||||
description = S("Color Facedir Test Node").."\n"..
|
||||
S("param2 = color + facedir rotation (0..23, 32..55, ...)"),
|
||||
paramtype2 = "colorfacedir",
|
||||
@ -213,7 +213,7 @@ minetest.register_node("testnodes:colorfacedir", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:colorfacedir_nodebox", {
|
||||
core.register_node("testnodes:colorfacedir_nodebox", {
|
||||
description = S("Color Facedir Nodebox Test Node").."\n"..
|
||||
S("param2 = color + facedir rotation (0..23, 32..55, ...)"),
|
||||
tiles = {
|
||||
@ -236,7 +236,7 @@ minetest.register_node("testnodes:colorfacedir_nodebox", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:color4dir", {
|
||||
core.register_node("testnodes:color4dir", {
|
||||
description = S("Color 4dir Test Node").."\n"..
|
||||
S("param2 = color + 4dir rotation (0..255)"),
|
||||
paramtype2 = "color4dir",
|
||||
@ -253,7 +253,7 @@ minetest.register_node("testnodes:color4dir", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:color4dir_nodebox", {
|
||||
core.register_node("testnodes:color4dir_nodebox", {
|
||||
description = S("Color 4dir Nodebox Test Node").."\n"..
|
||||
S("param2 = color + 4dir rotation (0..255)"),
|
||||
tiles = {
|
||||
@ -276,7 +276,7 @@ minetest.register_node("testnodes:color4dir_nodebox", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:colorwallmounted", {
|
||||
core.register_node("testnodes:colorwallmounted", {
|
||||
description = S("Color Wallmounted Test Node").."\n"..
|
||||
S("param2 = color + wallmounted rotation (0..7, 8..15, ...)"),
|
||||
paramtype2 = "colorwallmounted",
|
||||
@ -294,7 +294,7 @@ minetest.register_node("testnodes:colorwallmounted", {
|
||||
groups = { dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:colorwallmounted_nodebox", {
|
||||
core.register_node("testnodes:colorwallmounted_nodebox", {
|
||||
description = S("Color Wallmounted Nodebox Test Node").."\n"..
|
||||
S("param2 = color + wallmounted rotation (0..7, 8..15, ...)"),
|
||||
paramtype2 = "colorwallmounted",
|
||||
|
@ -1,9 +1,9 @@
|
||||
-- Performance test mesh nodes
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- Complex mesh
|
||||
minetest.register_node("testnodes:performance_mesh_clip", {
|
||||
core.register_node("testnodes:performance_mesh_clip", {
|
||||
description = S("Performance Test Node") .. "\n" .. S("Marble with 'clip' transparency"),
|
||||
drawtype = "mesh",
|
||||
mesh = "testnodes_marble_glass.obj",
|
||||
@ -15,7 +15,7 @@ minetest.register_node("testnodes:performance_mesh_clip", {
|
||||
})
|
||||
|
||||
-- Complex mesh, alpha blending
|
||||
minetest.register_node("testnodes:performance_mesh_blend", {
|
||||
core.register_node("testnodes:performance_mesh_blend", {
|
||||
description = S("Performance Test Node") .. "\n" .. S("Marble with 'blend' transparency"),
|
||||
drawtype = "mesh",
|
||||
mesh = "testnodes_marble_glass.obj",
|
||||
@ -27,7 +27,7 @@ minetest.register_node("testnodes:performance_mesh_blend", {
|
||||
})
|
||||
|
||||
-- Overlay
|
||||
minetest.register_node("testnodes:performance_overlay_clip", {
|
||||
core.register_node("testnodes:performance_overlay_clip", {
|
||||
description = S("Performance Test Node") .. "\n" .. S("Marble with overlay with 'clip' transparency") .. "\n" .. S("Palette for demonstration"),
|
||||
drawtype = "mesh",
|
||||
mesh = "testnodes_marble_metal.obj",
|
||||
@ -43,7 +43,7 @@ minetest.register_node("testnodes:performance_overlay_clip", {
|
||||
})
|
||||
|
||||
-- Overlay
|
||||
minetest.register_node("testnodes:performance_overlay_blend", {
|
||||
core.register_node("testnodes:performance_overlay_blend", {
|
||||
description = S("Performance Test Node") .. "\n" .. S("Marble with overlay with 'blend' transparency") .. "\n" .. S("Palette for demonstration"),
|
||||
drawtype = "mesh",
|
||||
mesh = "testnodes_marble_metal.obj",
|
||||
|
@ -1,9 +1,9 @@
|
||||
-- Test Nodes: Node property tests
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
-- Is supposed to fall when it doesn't rest on solid ground
|
||||
minetest.register_node("testnodes:falling", {
|
||||
core.register_node("testnodes:falling", {
|
||||
description = S("Falling Node").."\n"..
|
||||
S("Falls down if no node below"),
|
||||
tiles = {
|
||||
@ -14,7 +14,7 @@ minetest.register_node("testnodes:falling", {
|
||||
groups = { falling_node = 1, dig_immediate = 3 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:falling_facedir", {
|
||||
core.register_node("testnodes:falling_facedir", {
|
||||
description = S("Falling Facedir Node").."\n"..
|
||||
S("Falls down if no node below").."\n"..
|
||||
S("param2 = facedir rotation"),
|
||||
@ -31,7 +31,7 @@ minetest.register_node("testnodes:falling_facedir", {
|
||||
})
|
||||
|
||||
-- Same as falling node, but will stop falling on top of liquids
|
||||
minetest.register_node("testnodes:falling_float", {
|
||||
core.register_node("testnodes:falling_float", {
|
||||
description = S("Falling+Floating Node").."\n"..
|
||||
S("Falls down if no node below, floats on liquids (liquidtype ~= \"none\")"),
|
||||
groups = { falling_node = 1, float = 1, dig_immediate = 3 },
|
||||
@ -47,7 +47,7 @@ minetest.register_node("testnodes:falling_float", {
|
||||
|
||||
-- This node attaches to the floor and drops as item
|
||||
-- when the floor is gone.
|
||||
minetest.register_node("testnodes:attached", {
|
||||
core.register_node("testnodes:attached", {
|
||||
description = S("Floor-Attached Node").."\n"..
|
||||
S("Drops as item if no solid node below"),
|
||||
tiles = {
|
||||
@ -59,7 +59,7 @@ minetest.register_node("testnodes:attached", {
|
||||
})
|
||||
-- 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", {
|
||||
core.register_node("testnodes:attached_wallmounted", {
|
||||
description = S("Wallmounted Attached Node").."\n"..
|
||||
S("Attaches to solid node it was placed on; drops as item if neighbor node is gone").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)"),
|
||||
@ -75,7 +75,7 @@ minetest.register_node("testnodes:attached_wallmounted", {
|
||||
-- This node attaches to the side of a node and drops as item
|
||||
-- when the node it attaches to is gone.
|
||||
-- Also adds vertical 90° rotation variants.
|
||||
minetest.register_node("testnodes:attached_wallmounted_rot", {
|
||||
core.register_node("testnodes:attached_wallmounted_rot", {
|
||||
description = S("Rotatable Wallmounted Attached Node").."\n"..
|
||||
S("Attaches to solid node it was placed on; drops as item if neighbor node is gone").."\n"..
|
||||
S("param2 = wallmounted rotation (0..7)").."\n"..
|
||||
@ -91,7 +91,7 @@ minetest.register_node("testnodes:attached_wallmounted_rot", {
|
||||
})
|
||||
|
||||
-- Wallmounted node that always attaches to the floor
|
||||
minetest.register_node("testnodes:attached_wallmounted_floor", {
|
||||
core.register_node("testnodes:attached_wallmounted_floor", {
|
||||
description = S("Floor-Attached Wallmounted Node").."\n"..
|
||||
S("Drops as item if no solid node below (regardless of rotation)").."\n"..
|
||||
S("param2 = wallmounted rotation (visual only) (0..7)"),
|
||||
@ -107,7 +107,7 @@ minetest.register_node("testnodes:attached_wallmounted_floor", {
|
||||
|
||||
-- Wallmounted node that always attaches to the floor.
|
||||
-- Also adds 90° rotation variants.
|
||||
minetest.register_node("testnodes:attached_wallmounted_floor_rot", {
|
||||
core.register_node("testnodes:attached_wallmounted_floor_rot", {
|
||||
description = S("Rotatable Floor-Attached Wallmounted Node").."\n"..
|
||||
S("Drops as item if no solid node below (regardless of rotation)").."\n"..
|
||||
S("param2 = wallmounted rotation (visual only) (0..7)").."\n"..
|
||||
@ -124,7 +124,7 @@ minetest.register_node("testnodes:attached_wallmounted_floor_rot", {
|
||||
|
||||
-- This node attaches to the ceiling and drops as item
|
||||
-- when the ceiling is gone.
|
||||
minetest.register_node("testnodes:attached_top", {
|
||||
core.register_node("testnodes:attached_top", {
|
||||
description = S("Ceiling-Attached Node").."\n"..
|
||||
S("Drops as item if no solid node above"),
|
||||
tiles = {
|
||||
@ -136,7 +136,7 @@ minetest.register_node("testnodes:attached_top", {
|
||||
})
|
||||
|
||||
-- Same as wallmounted attached, but for facedir
|
||||
minetest.register_node("testnodes:attached_facedir", {
|
||||
core.register_node("testnodes:attached_facedir", {
|
||||
description = S("Facedir Attached Node").."\n"..
|
||||
S("Attaches to a neighboring solid node; drops as item if that node is gone").."\n"..
|
||||
S("param2 = facedir rotation (0..23)"),
|
||||
@ -153,7 +153,7 @@ minetest.register_node("testnodes:attached_facedir", {
|
||||
})
|
||||
|
||||
-- Same as facedir attached, but for 4dir
|
||||
minetest.register_node("testnodes:attached_4dir", {
|
||||
core.register_node("testnodes:attached_4dir", {
|
||||
description = S("4dir Attached Node").."\n"..
|
||||
S("Attaches to the side of a solid node; drops as item if that node is gone").."\n"..
|
||||
S("param2 = 4dir rotation (0..3)"),
|
||||
@ -170,7 +170,7 @@ minetest.register_node("testnodes:attached_4dir", {
|
||||
})
|
||||
|
||||
-- Jump disabled
|
||||
minetest.register_node("testnodes:nojump", {
|
||||
core.register_node("testnodes:nojump", {
|
||||
description = S("Non-jumping Node").."\n"..
|
||||
S("You can't jump on it"),
|
||||
groups = {disable_jump=1, dig_immediate=3},
|
||||
@ -178,7 +178,7 @@ minetest.register_node("testnodes:nojump", {
|
||||
})
|
||||
|
||||
-- Jump disabled plant
|
||||
minetest.register_node("testnodes:nojump_walkable", {
|
||||
core.register_node("testnodes:nojump_walkable", {
|
||||
description = S("Non-jumping Plant Node").."\n"..
|
||||
S("You can't jump while your feet are in it"),
|
||||
drawtype = "plantlike",
|
||||
@ -192,7 +192,7 @@ local climbable_nodebox = {
|
||||
}
|
||||
|
||||
-- Climbable up and down with jump and sneak keys
|
||||
minetest.register_node("testnodes:climbable", {
|
||||
core.register_node("testnodes:climbable", {
|
||||
description = S("Climbable Node").."\n"..
|
||||
S("You can climb up and down"),
|
||||
climbable = true,
|
||||
@ -210,7 +210,7 @@ minetest.register_node("testnodes:climbable", {
|
||||
})
|
||||
|
||||
-- Climbable only downwards with sneak key
|
||||
minetest.register_node("testnodes:climbable_nojump", {
|
||||
core.register_node("testnodes:climbable_nojump", {
|
||||
description = S("Downwards-climbable Node").."\n"..
|
||||
S("You can climb only downwards"),
|
||||
climbable = true,
|
||||
@ -226,7 +226,7 @@ minetest.register_node("testnodes:climbable_nojump", {
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("testnodes:climbable_nodescend", {
|
||||
core.register_node("testnodes:climbable_nodescend", {
|
||||
description = S("Upwards-climbable Node"),
|
||||
climbable = true,
|
||||
walkable = false,
|
||||
@ -240,7 +240,7 @@ minetest.register_node("testnodes:climbable_nodescend", {
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:climbable_nodescend_nojump", {
|
||||
core.register_node("testnodes:climbable_nodescend_nojump", {
|
||||
description = S("Horizontal-only Climbable Node"),
|
||||
climbable = true,
|
||||
walkable = false,
|
||||
@ -255,7 +255,7 @@ minetest.register_node("testnodes:climbable_nodescend_nojump", {
|
||||
})
|
||||
|
||||
-- A liquid in which you can't rise
|
||||
minetest.register_node("testnodes:liquid_nojump", {
|
||||
core.register_node("testnodes:liquid_nojump", {
|
||||
description = S("Non-jumping Liquid Source Node").."\n"..
|
||||
S("Swimmable liquid, but you can't swim upwards"),
|
||||
liquidtype = "source",
|
||||
@ -282,7 +282,7 @@ minetest.register_node("testnodes:liquid_nojump", {
|
||||
})
|
||||
|
||||
-- A liquid in which you can't rise (flowing variant)
|
||||
minetest.register_node("testnodes:liquidflowing_nojump", {
|
||||
core.register_node("testnodes:liquidflowing_nojump", {
|
||||
description = S("Non-jumping Flowing Liquid Node").."\n"..
|
||||
S("Swimmable liquid, but you can't swim upwards"),
|
||||
liquidtype = "flowing",
|
||||
@ -311,7 +311,7 @@ minetest.register_node("testnodes:liquidflowing_nojump", {
|
||||
})
|
||||
|
||||
-- A liquid which doesn't have liquid movement physics (source variant)
|
||||
minetest.register_node("testnodes:liquid_noswim", {
|
||||
core.register_node("testnodes:liquid_noswim", {
|
||||
description = S("No-swim Liquid Source Node").."\n"..
|
||||
S("Liquid node, but swimming is disabled"),
|
||||
liquidtype = "source",
|
||||
@ -340,7 +340,7 @@ minetest.register_node("testnodes:liquid_noswim", {
|
||||
})
|
||||
|
||||
-- A liquid which doen't have liquid movement physics (flowing variant)
|
||||
minetest.register_node("testnodes:liquidflowing_noswim", {
|
||||
core.register_node("testnodes:liquidflowing_noswim", {
|
||||
description = S("No-swim Flowing Liquid Node").."\n"..
|
||||
S("Liquid node, but swimming is disabled"),
|
||||
liquidtype = "flowing",
|
||||
@ -372,7 +372,7 @@ minetest.register_node("testnodes:liquidflowing_noswim", {
|
||||
|
||||
-- A liquid in which you can't actively descend.
|
||||
-- Note: You'll still descend slowly by doing nothing.
|
||||
minetest.register_node("testnodes:liquid_nodescend", {
|
||||
core.register_node("testnodes:liquid_nodescend", {
|
||||
description = S("No-descending Liquid Source Node"),
|
||||
liquidtype = "source",
|
||||
liquid_range = 0,
|
||||
@ -398,7 +398,7 @@ minetest.register_node("testnodes:liquid_nodescend", {
|
||||
})
|
||||
|
||||
-- A liquid in which you can't actively descend (flowing variant)
|
||||
minetest.register_node("testnodes:liquidflowing_nodescend", {
|
||||
core.register_node("testnodes:liquidflowing_nodescend", {
|
||||
description = S("No-descending Flowing Liquid Node"),
|
||||
liquidtype = "flowing",
|
||||
liquid_range = 1,
|
||||
@ -452,7 +452,7 @@ for i=-100, 100, 25 do
|
||||
end
|
||||
desc = S("Fall Damage Node (-@1%)", math.abs(i))
|
||||
end
|
||||
minetest.register_node("testnodes:damage"..subname, {
|
||||
core.register_node("testnodes:damage"..subname, {
|
||||
description = desc,
|
||||
groups = {fall_damage_add_percent=i, dig_immediate=3},
|
||||
|
||||
@ -483,7 +483,7 @@ for i=-MAX_BOUNCE_NONJUMPY, MAX_BOUNCE_JUMPY, 20 do
|
||||
color = { r=val2, g=255, b=val2, a=255 }
|
||||
num = "NEG"..num
|
||||
end
|
||||
minetest.register_node("testnodes:bouncy"..num, {
|
||||
core.register_node("testnodes:bouncy"..num, {
|
||||
description = desc,
|
||||
groups = {bouncy=i, dig_immediate=3},
|
||||
|
||||
@ -497,7 +497,7 @@ end
|
||||
|
||||
-- Slippery nodes (various slippery levels)
|
||||
for i=1, 5 do
|
||||
minetest.register_node("testnodes:slippery"..i, {
|
||||
core.register_node("testnodes:slippery"..i, {
|
||||
description = S("Slippery Node (@1)", i),
|
||||
tiles ={"testnodes_slippery.png"},
|
||||
is_ground_content = false,
|
||||
@ -509,7 +509,7 @@ end
|
||||
-- Move resistance nodes (various resistance levels)
|
||||
for r=0, 7 do
|
||||
if r > 0 then
|
||||
minetest.register_node("testnodes:move_resistance"..r, {
|
||||
core.register_node("testnodes:move_resistance"..r, {
|
||||
description = S("Move-resistant Node (@1)", r).."\n"..
|
||||
S("Reduces movement speed"),
|
||||
walkable = false,
|
||||
@ -537,7 +537,7 @@ for r=0, 7 do
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("testnodes:move_resistance_liquidlike"..r, {
|
||||
core.register_node("testnodes:move_resistance_liquidlike"..r, {
|
||||
description = mdesc,
|
||||
walkable = false,
|
||||
move_resistance = r,
|
||||
@ -553,7 +553,7 @@ for r=0, 7 do
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("testnodes:climbable_move_resistance_4", {
|
||||
core.register_node("testnodes:climbable_move_resistance_4", {
|
||||
description = S("Climbable Move-resistant Node (4)").."\n"..
|
||||
S("You can climb up and down; reduced movement speed"),
|
||||
walkable = false,
|
||||
@ -570,7 +570,7 @@ minetest.register_node("testnodes:climbable_move_resistance_4", {
|
||||
})
|
||||
|
||||
-- By placing something on the node, the node itself will be replaced
|
||||
minetest.register_node("testnodes:buildable_to", {
|
||||
core.register_node("testnodes:buildable_to", {
|
||||
description = S("\"buildable_to\" Node").."\n"..
|
||||
S("Placing a node on it will replace it"),
|
||||
buildable_to = true,
|
||||
@ -598,7 +598,7 @@ for d=-3,3 do
|
||||
elseif math.abs(d) == 3 then
|
||||
tile = tile .. "^[colorize:#000000:140"
|
||||
end
|
||||
minetest.register_node("testnodes:damage_"..sub, {
|
||||
core.register_node("testnodes:damage_"..sub, {
|
||||
description = desc,
|
||||
damage_per_second = d,
|
||||
|
||||
@ -615,7 +615,7 @@ for d=-3,3 do
|
||||
end
|
||||
|
||||
-- Causes drowning damage
|
||||
minetest.register_node("testnodes:drowning_1", {
|
||||
core.register_node("testnodes:drowning_1", {
|
||||
description = S("Drowning Node (@1 damage)", 1).."\n"..
|
||||
S("You'll drown inside it"),
|
||||
drowning = 1,
|
||||
@ -632,7 +632,7 @@ minetest.register_node("testnodes:drowning_1", {
|
||||
|
||||
-- post_effect_color_shaded
|
||||
|
||||
minetest.register_node("testnodes:post_effect_color_shaded_false", {
|
||||
core.register_node("testnodes:post_effect_color_shaded_false", {
|
||||
description = S("\"post_effect_color_shaded = false\" Node"),
|
||||
|
||||
drawtype = "allfaces",
|
||||
@ -648,7 +648,7 @@ minetest.register_node("testnodes:post_effect_color_shaded_false", {
|
||||
groups = {dig_immediate=3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:post_effect_color_shaded_true", {
|
||||
core.register_node("testnodes:post_effect_color_shaded_true", {
|
||||
description = S("\"post_effect_color_shaded = true\" Node"),
|
||||
|
||||
drawtype = "allfaces",
|
||||
@ -669,7 +669,7 @@ minetest.register_node("testnodes:post_effect_color_shaded_true", {
|
||||
-- Register wrapper for compactness
|
||||
local function register_pointable_test_node(name, description, pointable)
|
||||
local texture = "testnodes_"..name..".png"
|
||||
minetest.register_node("testnodes:"..name, {
|
||||
core.register_node("testnodes:"..name, {
|
||||
description = S(description),
|
||||
tiles = {texture},
|
||||
drawtype = "glasslike_framed",
|
||||
|
@ -1,8 +1,8 @@
|
||||
-- Node texture tests
|
||||
|
||||
local S = minetest.get_translator("testnodes")
|
||||
local S = core.get_translator("testnodes")
|
||||
|
||||
minetest.register_node("testnodes:6sides", {
|
||||
core.register_node("testnodes:6sides", {
|
||||
description = S("Six Textures Test Node").."\n"..
|
||||
S("Has 1 texture per face"),
|
||||
tiles = {
|
||||
@ -17,7 +17,7 @@ minetest.register_node("testnodes:6sides", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:anim", {
|
||||
core.register_node("testnodes:anim", {
|
||||
description = S("Animated Test Node").."\n"..
|
||||
S("Tiles animate from A to D in 4s cycle"),
|
||||
tiles = {
|
||||
@ -33,7 +33,7 @@ minetest.register_node("testnodes:anim", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:fill_positioning", {
|
||||
core.register_node("testnodes:fill_positioning", {
|
||||
description = S("Fill Modifier Test Node") .. "\n" ..
|
||||
S("The node should have the same look as " ..
|
||||
"testnodes:fill_positioning_reference."),
|
||||
@ -44,7 +44,7 @@ minetest.register_node("testnodes:fill_positioning", {
|
||||
groups = {dig_immediate = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:fill_positioning_reference", {
|
||||
core.register_node("testnodes:fill_positioning_reference", {
|
||||
description = S("Fill Modifier Test Node Reference"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -52,7 +52,7 @@ minetest.register_node("testnodes:fill_positioning_reference", {
|
||||
groups = {dig_immediate = 3},
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:modifier_mask", {
|
||||
core.register_node("testnodes:modifier_mask", {
|
||||
description = S("[mask Modifier Test Node"),
|
||||
tiles = {"testnodes_128x128_rgb.png^[mask:testnodes_mask_WRGBKW.png"},
|
||||
groups = {dig_immediate = 3},
|
||||
@ -66,7 +66,7 @@ for a=1,#alphas do
|
||||
local alpha = alphas[a]
|
||||
|
||||
-- Transparency taken from texture
|
||||
minetest.register_node("testnodes:alpha_texture_"..alpha, {
|
||||
core.register_node("testnodes:alpha_texture_"..alpha, {
|
||||
description = S("Texture Alpha Test Node (@1)", alpha).."\n"..
|
||||
S("Semi-transparent"),
|
||||
drawtype = "glasslike",
|
||||
@ -80,7 +80,7 @@ for a=1,#alphas do
|
||||
})
|
||||
|
||||
-- Transparency set via texture modifier
|
||||
minetest.register_node("testnodes:alpha_"..alpha, {
|
||||
core.register_node("testnodes:alpha_"..alpha, {
|
||||
description = S("Alpha Test Node (@1)", alpha).."\n"..
|
||||
S("Semi-transparent"),
|
||||
drawtype = "glasslike",
|
||||
@ -94,7 +94,7 @@ for a=1,#alphas do
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node("testnodes:alpha_compositing", {
|
||||
core.register_node("testnodes:alpha_compositing", {
|
||||
description = S("Texture Overlay Test Node") .. "\n" ..
|
||||
S("A regular grid should be visible where each cell contains two " ..
|
||||
"texels with the same color.") .. "\n" ..
|
||||
@ -204,23 +204,23 @@ core.dynamic_add_media({
|
||||
filedata = png_ck,
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:generated_png_mb", {
|
||||
core.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", {
|
||||
core.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(
|
||||
local png_emb = "[png:" .. core.encode_base64(
|
||||
encode_and_check(64, 64, "rgba", data_emb))
|
||||
|
||||
minetest.register_node("testnodes:generated_png_emb", {
|
||||
core.register_node("testnodes:generated_png_emb", {
|
||||
description = S("Generated In-Band Mandelbrot PNG Test Node"),
|
||||
tiles = { png_emb },
|
||||
|
||||
@ -229,7 +229,7 @@ minetest.register_node("testnodes:generated_png_emb", {
|
||||
paramtype = "light",
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
minetest.register_node("testnodes:generated_png_src_emb", {
|
||||
core.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" },
|
||||
|
||||
@ -238,7 +238,7 @@ minetest.register_node("testnodes:generated_png_src_emb", {
|
||||
paramtype = "light",
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
minetest.register_node("testnodes:generated_png_dst_emb", {
|
||||
core.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 },
|
||||
|
||||
@ -270,7 +270,7 @@ then the string “TRUEVISION-XFILE.”, then another null byte.
|
||||
|
||||
]]--
|
||||
|
||||
minetest.register_node("testnodes:tga_type1_24bpp_bt", {
|
||||
core.register_node("testnodes:tga_type1_24bpp_bt", {
|
||||
description = S("TGA Type 1 (color-mapped RGB) 24bpp bottom-top Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -279,7 +279,7 @@ minetest.register_node("testnodes:tga_type1_24bpp_bt", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type1_24bpp_tb", {
|
||||
core.register_node("testnodes:tga_type1_24bpp_tb", {
|
||||
description = S("TGA Type 1 (color-mapped RGB) 24bpp top-bottom Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -288,7 +288,7 @@ minetest.register_node("testnodes:tga_type1_24bpp_tb", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type2_16bpp_bt", {
|
||||
core.register_node("testnodes:tga_type2_16bpp_bt", {
|
||||
description = S("TGA Type 2 (uncompressed RGB) 16bpp bottom-top Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -298,7 +298,7 @@ minetest.register_node("testnodes:tga_type2_16bpp_bt", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type2_16bpp_tb", {
|
||||
core.register_node("testnodes:tga_type2_16bpp_tb", {
|
||||
description = S("TGA Type 2 (uncompressed RGB) 16bpp top-bottom Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -308,7 +308,7 @@ minetest.register_node("testnodes:tga_type2_16bpp_tb", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type2_32bpp_bt", {
|
||||
core.register_node("testnodes:tga_type2_32bpp_bt", {
|
||||
description = S("TGA Type 2 (uncompressed RGB) 32bpp bottom-top Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -318,7 +318,7 @@ minetest.register_node("testnodes:tga_type2_32bpp_bt", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type2_32bpp_tb", {
|
||||
core.register_node("testnodes:tga_type2_32bpp_tb", {
|
||||
description = S("TGA Type 2 (uncompressed RGB) 32bpp top-bottom Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -328,7 +328,7 @@ minetest.register_node("testnodes:tga_type2_32bpp_tb", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type3_16bpp_bt", {
|
||||
core.register_node("testnodes:tga_type3_16bpp_bt", {
|
||||
description = S("TGA Type 3 (uncompressed grayscale) 16bpp bottom-top Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -338,7 +338,7 @@ minetest.register_node("testnodes:tga_type3_16bpp_bt", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type3_16bpp_tb", {
|
||||
core.register_node("testnodes:tga_type3_16bpp_tb", {
|
||||
description = S("TGA Type 3 (uncompressed grayscale) 16bpp top-bottom Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
@ -348,7 +348,7 @@ minetest.register_node("testnodes:tga_type3_16bpp_tb", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type10_32bpp_bt", {
|
||||
core.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",
|
||||
@ -358,7 +358,7 @@ minetest.register_node("testnodes:tga_type10_32bpp_bt", {
|
||||
groups = { dig_immediate = 2 },
|
||||
})
|
||||
|
||||
minetest.register_node("testnodes:tga_type10_32bpp_tb", {
|
||||
core.register_node("testnodes:tga_type10_32bpp_tb", {
|
||||
description = S("TGA Type 10 (RLE-compressed RGB) 32bpp top-bottom Test Node"),
|
||||
drawtype = "glasslike",
|
||||
paramtype = "light",
|
||||
|
@ -1,4 +1,4 @@
|
||||
local S = minetest.get_translator("testpathfinder")
|
||||
local S = core.get_translator("testpathfinder")
|
||||
|
||||
-- Config parameters
|
||||
|
||||
@ -37,26 +37,26 @@ local function find_path_for_player(player, itemstack)
|
||||
local pos1 = vector.round(player:get_pos())
|
||||
-- Don't bother calling pathfinder for high distance to avoid freezing
|
||||
if (not IGNORE_MAX_DISTANCE_SAFEGUARD) and (vector.distance(pos1, pos2) > MAX_DIRECT_DISTANCE) then
|
||||
minetest.chat_send_player(player:get_player_name(), S("Destination too far away! Set a destination (via placing) within a distance of @1 and try again!", MAX_DIRECT_DISTANCE))
|
||||
core.chat_send_player(player:get_player_name(), S("Destination too far away! Set a destination (via placing) within a distance of @1 and try again!", MAX_DIRECT_DISTANCE))
|
||||
return
|
||||
end
|
||||
local str = S("Path from @1 to @2:",
|
||||
minetest.pos_to_string(pos1),
|
||||
minetest.pos_to_string(pos2))
|
||||
core.pos_to_string(pos1),
|
||||
core.pos_to_string(pos2))
|
||||
|
||||
minetest.chat_send_player(player:get_player_name(), str)
|
||||
local time_start = minetest.get_us_time()
|
||||
local path = minetest.find_path(pos1, pos2, MAX_SEARCH_DISTANCE, MAX_JUMP, MAX_DROP, algo)
|
||||
local time_end = minetest.get_us_time()
|
||||
core.chat_send_player(player:get_player_name(), str)
|
||||
local time_start = core.get_us_time()
|
||||
local path = core.find_path(pos1, pos2, MAX_SEARCH_DISTANCE, MAX_JUMP, MAX_DROP, algo)
|
||||
local time_end = core.get_us_time()
|
||||
local time_diff = time_end - time_start
|
||||
str = ""
|
||||
if not path then
|
||||
minetest.chat_send_player(player:get_player_name(), S("No path!"))
|
||||
minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000))
|
||||
core.chat_send_player(player:get_player_name(), S("No path!"))
|
||||
core.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000))
|
||||
return
|
||||
end
|
||||
for s=1, #path do
|
||||
str = str .. minetest.pos_to_string(path[s]) .. "\n"
|
||||
str = str .. core.pos_to_string(path[s]) .. "\n"
|
||||
local t
|
||||
if s == #path then
|
||||
t = "testpathfinder_waypoint_end.png"
|
||||
@ -66,18 +66,18 @@ local function find_path_for_player(player, itemstack)
|
||||
local c = math.floor(((#path-s)/#path)*255)
|
||||
t = string.format("testpathfinder_waypoint.png^[multiply:#%02x%02x00", 0xFF-c, c)
|
||||
end
|
||||
minetest.add_particle({
|
||||
core.add_particle({
|
||||
pos = path[s],
|
||||
expirationtime = 5 + 0.2 * s,
|
||||
playername = player:get_player_name(),
|
||||
glow = minetest.LIGHT_MAX,
|
||||
glow = core.LIGHT_MAX,
|
||||
texture = t,
|
||||
size = 3,
|
||||
})
|
||||
end
|
||||
minetest.chat_send_player(player:get_player_name(), str)
|
||||
minetest.chat_send_player(player:get_player_name(), S("Path length: @1", #path))
|
||||
minetest.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000))
|
||||
core.chat_send_player(player:get_player_name(), str)
|
||||
core.chat_send_player(player:get_player_name(), S("Path length: @1", #path))
|
||||
core.chat_send_player(player:get_player_name(), S("Time: @1 ms", time_diff/1000))
|
||||
end
|
||||
end
|
||||
|
||||
@ -93,7 +93,7 @@ local function set_destination(itemstack, user, pointed_thing)
|
||||
meta:set_int("pos_x", pos.x)
|
||||
meta:set_int("pos_y", pos.y)
|
||||
meta:set_int("pos_z", pos.z)
|
||||
minetest.chat_send_player(user:get_player_name(), S("Destination set to @1", minetest.pos_to_string(pos)))
|
||||
core.chat_send_player(user:get_player_name(), S("Destination set to @1", core.pos_to_string(pos)))
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
@ -112,7 +112,7 @@ local function find_path_or_set_algorithm(itemstack, user, pointed_thing)
|
||||
local algo = meta:get_int("algorithm")
|
||||
algo = (algo + 1) % #algorithms
|
||||
meta:set_int("algorithm", algo)
|
||||
minetest.chat_send_player(user:get_player_name(), S("Algorithm: @1", algorithms[algo+1]))
|
||||
core.chat_send_player(user:get_player_name(), S("Algorithm: @1", algorithms[algo+1]))
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
@ -120,7 +120,7 @@ end
|
||||
-- Punch: Find path
|
||||
-- Sneak+punch: Select pathfinding algorithm
|
||||
-- Place: Select destination node
|
||||
minetest.register_tool("testpathfinder:testpathfinder", {
|
||||
core.register_tool("testpathfinder:testpathfinder", {
|
||||
description = S("Pathfinder Tester") .."\n"..
|
||||
S("Finds path between 2 points") .."\n"..
|
||||
S("Place on node: Select destination") .."\n"..
|
||||
|
@ -1,12 +1,12 @@
|
||||
local S = minetest.get_translator("testtools")
|
||||
local F = minetest.formspec_escape
|
||||
local S = core.get_translator("testtools")
|
||||
local F = core.formspec_escape
|
||||
|
||||
testtools = {}
|
||||
|
||||
dofile(minetest.get_modpath("testtools") .. "/light.lua")
|
||||
dofile(minetest.get_modpath("testtools") .. "/privatizer.lua")
|
||||
dofile(minetest.get_modpath("testtools") .. "/particles.lua")
|
||||
dofile(minetest.get_modpath("testtools") .. "/node_box_visualizer.lua")
|
||||
dofile(core.get_modpath("testtools") .. "/light.lua")
|
||||
dofile(core.get_modpath("testtools") .. "/privatizer.lua")
|
||||
dofile(core.get_modpath("testtools") .. "/particles.lua")
|
||||
dofile(core.get_modpath("testtools") .. "/node_box_visualizer.lua")
|
||||
|
||||
local pointabilities_nodes = {
|
||||
nodes = {
|
||||
@ -22,7 +22,7 @@ local pointabilities_objects = {
|
||||
},
|
||||
}
|
||||
|
||||
minetest.register_tool("testtools:param2tool", {
|
||||
core.register_tool("testtools:param2tool", {
|
||||
description = S("Param2 Tool") .."\n"..
|
||||
S("Modify param2 value of nodes") .."\n"..
|
||||
S("Punch: +1") .."\n"..
|
||||
@ -33,7 +33,7 @@ minetest.register_tool("testtools:param2tool", {
|
||||
groups = { testtool = 1, disable_repair = 1 },
|
||||
pointabilities = pointabilities_nodes,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing)
|
||||
if pointed_thing.type ~= "node" or (not pos) then
|
||||
return
|
||||
end
|
||||
@ -44,12 +44,12 @@ minetest.register_tool("testtools:param2tool", {
|
||||
add = 8
|
||||
end
|
||||
end
|
||||
local node = minetest.get_node(pos)
|
||||
local node = core.get_node(pos)
|
||||
node.param2 = node.param2 + add
|
||||
minetest.swap_node(pos, node)
|
||||
core.swap_node(pos, node)
|
||||
end,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing)
|
||||
if pointed_thing.type ~= "node" or (not pos) then
|
||||
return
|
||||
end
|
||||
@ -60,13 +60,13 @@ minetest.register_tool("testtools:param2tool", {
|
||||
add = -8
|
||||
end
|
||||
end
|
||||
local node = minetest.get_node(pos)
|
||||
local node = core.get_node(pos)
|
||||
node.param2 = node.param2 + add
|
||||
minetest.swap_node(pos, node)
|
||||
core.swap_node(pos, node)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("testtools:node_setter", {
|
||||
core.register_tool("testtools:node_setter", {
|
||||
description = S("Node Setter") .."\n"..
|
||||
S("Replace pointed node with something else") .."\n"..
|
||||
S("Punch: Select pointed node") .."\n"..
|
||||
@ -76,24 +76,24 @@ minetest.register_tool("testtools:node_setter", {
|
||||
groups = { testtool = 1, disable_repair = 1 },
|
||||
pointabilities = pointabilities_nodes,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing)
|
||||
if pointed_thing.type == "nothing" then
|
||||
local meta = itemstack:get_meta()
|
||||
meta:set_string("node", "air")
|
||||
meta:set_int("node_param2", 0)
|
||||
if user and user:is_player() then
|
||||
minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", "air", 0))
|
||||
core.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", "air", 0))
|
||||
end
|
||||
return itemstack
|
||||
elseif pointed_thing.type ~= "node" or (not pos) then
|
||||
return
|
||||
end
|
||||
local node = minetest.get_node(pos)
|
||||
local node = core.get_node(pos)
|
||||
local meta = itemstack:get_meta()
|
||||
meta:set_string("node", node.name)
|
||||
meta:set_int("node_param2", node.param2)
|
||||
if user and user:is_player() then
|
||||
minetest.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", node.name, node.param2))
|
||||
core.chat_send_player(user:get_player_name(), S("Now placing: @1 (param2=@2)", node.name, node.param2))
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
@ -102,7 +102,7 @@ minetest.register_tool("testtools:node_setter", {
|
||||
local nodename = meta:get_string("node") or ""
|
||||
local param2 = meta:get_int("node_param2") or 0
|
||||
|
||||
minetest.show_formspec(user:get_player_name(), "testtools:node_setter",
|
||||
core.show_formspec(user:get_player_name(), "testtools:node_setter",
|
||||
"size[4,4]"..
|
||||
"field[0.5,1;3,1;nodename;"..F(S("Node name (itemstring):"))..";"..F(nodename).."]"..
|
||||
"field[0.5,2;3,1;param2;"..F(S("param2:"))..";"..F(tostring(param2)).."]"..
|
||||
@ -110,11 +110,11 @@ minetest.register_tool("testtools:node_setter", {
|
||||
)
|
||||
end,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing)
|
||||
local meta = itemstack:get_meta()
|
||||
local nodename = meta:get_string("node")
|
||||
if nodename == "" and user and user:is_player() then
|
||||
minetest.chat_send_player(user:get_player_name(), S("Punch a node first!"))
|
||||
core.chat_send_player(user:get_player_name(), S("Punch a node first!"))
|
||||
return
|
||||
end
|
||||
local param2 = meta:get_int("node_param2")
|
||||
@ -122,15 +122,15 @@ minetest.register_tool("testtools:node_setter", {
|
||||
param2 = 0
|
||||
end
|
||||
local node = { name = nodename, param2 = param2 }
|
||||
if not minetest.registered_nodes[nodename] then
|
||||
minetest.chat_send_player(user:get_player_name(), S("Cannot set unknown node: @1", nodename))
|
||||
if not core.registered_nodes[nodename] then
|
||||
core.chat_send_player(user:get_player_name(), S("Cannot set unknown node: @1", nodename))
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, node)
|
||||
core.set_node(pos, node)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("testtools:remover", {
|
||||
core.register_tool("testtools:remover", {
|
||||
description = S("Remover") .."\n"..
|
||||
S("Punch: Remove pointed node or object"),
|
||||
inventory_image = "testtools_remover.png",
|
||||
@ -140,21 +140,21 @@ minetest.register_tool("testtools:remover", {
|
||||
objects = pointabilities_objects.objects,
|
||||
},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing)
|
||||
if pointed_thing.type == "node" and pos ~= nil then
|
||||
minetest.remove_node(pos)
|
||||
core.remove_node(pos)
|
||||
elseif pointed_thing.type == "object" then
|
||||
local obj = pointed_thing.ref
|
||||
if not obj:is_player() then
|
||||
obj:remove()
|
||||
else
|
||||
minetest.chat_send_player(user:get_player_name(), S("Can't remove players!"))
|
||||
core.chat_send_player(user:get_player_name(), S("Can't remove players!"))
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("testtools:falling_node_tool", {
|
||||
core.register_tool("testtools:falling_node_tool", {
|
||||
description = S("Falling Node Tool") .."\n"..
|
||||
S("Punch: Make pointed node fall") .."\n"..
|
||||
S("Place: Move pointed node 2 units upwards, then make it fall"),
|
||||
@ -163,7 +163,7 @@ minetest.register_tool("testtools:falling_node_tool", {
|
||||
pointabilities = pointabilities_nodes,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
-- Teleport node 1-2 units upwards (if possible) and make it fall
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing)
|
||||
if pointed_thing.type ~= "node" or (not pos) then
|
||||
return
|
||||
end
|
||||
@ -171,8 +171,8 @@ minetest.register_tool("testtools:falling_node_tool", {
|
||||
local highest
|
||||
for i=1,2 do
|
||||
local above = {x=pos.x,y=pos.y+i,z=pos.z}
|
||||
local n2 = minetest.get_node(above)
|
||||
local def2 = minetest.registered_nodes[n2.name]
|
||||
local n2 = core.get_node(above)
|
||||
local def2 = core.registered_nodes[n2.name]
|
||||
if def2 and (not def2.walkable) then
|
||||
highest = above
|
||||
else
|
||||
@ -180,33 +180,33 @@ minetest.register_tool("testtools:falling_node_tool", {
|
||||
end
|
||||
end
|
||||
if highest then
|
||||
local node = minetest.get_node(pos)
|
||||
local metatable = minetest.get_meta(pos):to_table()
|
||||
minetest.remove_node(pos)
|
||||
minetest.set_node(highest, node)
|
||||
local meta_highest = minetest.get_meta(highest)
|
||||
local node = core.get_node(pos)
|
||||
local metatable = core.get_meta(pos):to_table()
|
||||
core.remove_node(pos)
|
||||
core.set_node(highest, node)
|
||||
local meta_highest = core.get_meta(highest)
|
||||
meta_highest:from_table(metatable)
|
||||
ok = minetest.spawn_falling_node(highest)
|
||||
ok = core.spawn_falling_node(highest)
|
||||
else
|
||||
ok = minetest.spawn_falling_node(pos)
|
||||
ok = core.spawn_falling_node(pos)
|
||||
end
|
||||
if not ok and user and user:is_player() then
|
||||
minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!"))
|
||||
core.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!"))
|
||||
end
|
||||
end,
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing)
|
||||
if pointed_thing.type ~= "node" or (not pos) then
|
||||
return
|
||||
end
|
||||
local ok = minetest.spawn_falling_node(pos)
|
||||
local ok = core.spawn_falling_node(pos)
|
||||
if not ok and user and user:is_player() then
|
||||
minetest.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!"))
|
||||
core.chat_send_player(user:get_player_name(), S("Falling node could not be spawned!"))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_tool("testtools:rotator", {
|
||||
core.register_tool("testtools:rotator", {
|
||||
description = S("Entity Rotator") .. "\n" ..
|
||||
S("Rotate pointed entity") .."\n"..
|
||||
S("Punch: Yaw") .."\n"..
|
||||
@ -260,11 +260,11 @@ local mover_config = function(itemstack, user, pointed_thing)
|
||||
dist = dist + 1
|
||||
end
|
||||
meta:set_int("distance", dist)
|
||||
minetest.chat_send_player(user:get_player_name(), S("distance=@1/10", dist*2))
|
||||
core.chat_send_player(user:get_player_name(), S("distance=@1/10", dist*2))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:object_mover", {
|
||||
core.register_tool("testtools:object_mover", {
|
||||
description = S("Object Mover") .."\n"..
|
||||
S("Move pointed object towards or away from you") .."\n"..
|
||||
S("Punch: Move by distance").."\n"..
|
||||
@ -285,7 +285,7 @@ minetest.register_tool("testtools:object_mover", {
|
||||
return
|
||||
end
|
||||
local yaw = user:get_look_horizontal()
|
||||
local dir = minetest.yaw_to_dir(yaw)
|
||||
local dir = core.yaw_to_dir(yaw)
|
||||
local pos = obj:get_pos()
|
||||
local pitch = user:get_look_vertical()
|
||||
if pitch > 0.25 * math.pi then
|
||||
@ -313,7 +313,7 @@ minetest.register_tool("testtools:object_mover", {
|
||||
|
||||
|
||||
|
||||
minetest.register_tool("testtools:entity_scaler", {
|
||||
core.register_tool("testtools:entity_scaler", {
|
||||
description = S("Entity Visual Scaler") .."\n"..
|
||||
S("Scale visual size of entities") .."\n"..
|
||||
S("Punch: Increase size") .."\n"..
|
||||
@ -364,14 +364,14 @@ local next_brand_num = 1
|
||||
|
||||
function testtools.get_branded_object(name)
|
||||
if name:sub(1, 7) == "player:" then
|
||||
return minetest.get_player_by_name(name:sub(8))
|
||||
return core.get_player_by_name(name:sub(8))
|
||||
elseif name:sub(1, 4) == "obj:" then
|
||||
return branded_objects[tonumber(name:sub(5)) or 0]
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:branding_iron", {
|
||||
core.register_tool("testtools:branding_iron", {
|
||||
description = S("Branding Iron") .."\n"..
|
||||
S("Give an object a temporary name.") .."\n"..
|
||||
S("Punch object: Brand the object") .."\n"..
|
||||
@ -398,7 +398,7 @@ minetest.register_tool("testtools:branding_iron", {
|
||||
next_brand_num = next_brand_num + 1
|
||||
branded_objects[brand_num] = obj
|
||||
|
||||
minetest.chat_send_player(user:get_player_name(), S(msg, "obj:"..brand_num))
|
||||
core.chat_send_player(user:get_player_name(), S(msg, "obj:"..brand_num))
|
||||
end,
|
||||
})
|
||||
|
||||
@ -409,7 +409,7 @@ local function get_entity_list()
|
||||
if entity_list then
|
||||
return entity_list
|
||||
end
|
||||
local ents = minetest.registered_entities
|
||||
local ents = core.registered_entities
|
||||
local list = {}
|
||||
for k,_ in pairs(ents) do
|
||||
table.insert(list, k)
|
||||
@ -418,7 +418,7 @@ local function get_entity_list()
|
||||
entity_list = list
|
||||
return entity_list
|
||||
end
|
||||
minetest.register_tool("testtools:entity_spawner", {
|
||||
core.register_tool("testtools:entity_spawner", {
|
||||
description = S("Entity Spawner") .."\n"..
|
||||
S("Spawns entities") .."\n"..
|
||||
S("Punch: Select entity to spawn") .."\n"..
|
||||
@ -430,9 +430,9 @@ minetest.register_tool("testtools:entity_spawner", {
|
||||
if pointed_thing.type == "node" then
|
||||
if selections[name] then
|
||||
local pos = pointed_thing.above
|
||||
minetest.add_entity(pos, get_entity_list()[selections[name]])
|
||||
core.add_entity(pos, get_entity_list()[selections[name]])
|
||||
else
|
||||
minetest.chat_send_player(name, S("Select an entity first (with punch key)!"))
|
||||
core.chat_send_player(name, S("Select an entity first (with punch key)!"))
|
||||
end
|
||||
end
|
||||
end,
|
||||
@ -444,7 +444,7 @@ minetest.register_tool("testtools:entity_spawner", {
|
||||
local list = table.concat(get_entity_list(), ",")
|
||||
local name = user:get_player_name()
|
||||
local sel = selections[name] or ""
|
||||
minetest.show_formspec(name, "testtools:entity_list",
|
||||
core.show_formspec(name, "testtools:entity_list",
|
||||
"size[9,9]"..
|
||||
"textlist[0,0;9,8;entity_list;"..list..";"..sel..";false]"..
|
||||
"button[0,8;4,1;spawn;Spawn entity]"
|
||||
@ -508,7 +508,7 @@ local editor_formspec = function(playername, obj, value, sel)
|
||||
local ent = obj:get_luaentity()
|
||||
title = S("Object properties of @1", ent.name)
|
||||
end
|
||||
minetest.show_formspec(playername, "testtools:object_editor",
|
||||
core.show_formspec(playername, "testtools:object_editor",
|
||||
"size[9,9]"..
|
||||
"label[0,0;"..F(title).."]"..
|
||||
"textlist[0,0.5;9,7.5;object_props;"..list..";"..sel..";false]"..
|
||||
@ -518,7 +518,7 @@ local editor_formspec = function(playername, obj, value, sel)
|
||||
)
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:object_editor", {
|
||||
core.register_tool("testtools:object_editor", {
|
||||
description = S("Object Property Editor") .."\n"..
|
||||
S("Edit properties of objects") .."\n"..
|
||||
S("Punch object: Edit object") .."\n"..
|
||||
@ -582,7 +582,7 @@ local attacher_config = function(itemstack, user, pointed_thing)
|
||||
elseif rot_x < 0 then
|
||||
rot_x = math.pi * (15/8)
|
||||
end
|
||||
minetest.chat_send_player(name, S("rotation=@1", minetest.pos_to_string({x=rot_x,y=0,z=0})))
|
||||
core.chat_send_player(name, S("rotation=@1", core.pos_to_string({x=rot_x,y=0,z=0})))
|
||||
meta:set_float("rot_x", rot_x)
|
||||
else
|
||||
local pos_y
|
||||
@ -596,13 +596,13 @@ local attacher_config = function(itemstack, user, pointed_thing)
|
||||
else
|
||||
pos_y = pos_y + 1
|
||||
end
|
||||
minetest.chat_send_player(name, S("position=@1", minetest.pos_to_string({x=0,y=pos_y,z=0})))
|
||||
core.chat_send_player(name, S("position=@1", core.pos_to_string({x=0,y=pos_y,z=0})))
|
||||
meta:set_int("pos_y", pos_y)
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:object_attacher", {
|
||||
core.register_tool("testtools:object_attacher", {
|
||||
description = S("Object Attacher") .."\n"..
|
||||
S("Attach object to another") .."\n"..
|
||||
S("Punch objects to first select parent object, then the child object to attach") .."\n"..
|
||||
@ -631,9 +631,9 @@ minetest.register_tool("testtools:object_attacher", {
|
||||
if ctrl.sneak then
|
||||
if selected_object:get_attach() then
|
||||
selected_object:set_detach()
|
||||
minetest.chat_send_player(name, S("Object detached!"))
|
||||
core.chat_send_player(name, S("Object detached!"))
|
||||
else
|
||||
minetest.chat_send_player(name, S("Object is not attached!"))
|
||||
core.chat_send_player(name, S("Object is not attached!"))
|
||||
end
|
||||
return
|
||||
end
|
||||
@ -654,13 +654,13 @@ minetest.register_tool("testtools:object_attacher", {
|
||||
ename = selected_object:get_player_name()
|
||||
end
|
||||
if selected_object == parent then
|
||||
minetest.chat_send_player(name, S("Parent object selected: @1", ename))
|
||||
core.chat_send_player(name, S("Parent object selected: @1", ename))
|
||||
elseif selected_object == child then
|
||||
minetest.chat_send_player(name, S("Child object selected: @1", ename))
|
||||
core.chat_send_player(name, S("Child object selected: @1", ename))
|
||||
end
|
||||
if parent and child then
|
||||
if parent == child then
|
||||
minetest.chat_send_player(name, S("Can't attach an object to itself!"))
|
||||
core.chat_send_player(name, S("Can't attach an object to itself!"))
|
||||
ent_parent[name] = nil
|
||||
ent_child[name] = nil
|
||||
return
|
||||
@ -678,10 +678,10 @@ minetest.register_tool("testtools:object_attacher", {
|
||||
child:set_attach(parent, "", offset, angle)
|
||||
local check_parent = child:get_attach()
|
||||
if check_parent then
|
||||
minetest.chat_send_player(name, S("Object attached! position=@1, rotation=@2",
|
||||
minetest.pos_to_string(offset), minetest.pos_to_string(angle)))
|
||||
core.chat_send_player(name, S("Object attached! position=@1, rotation=@2",
|
||||
core.pos_to_string(offset), core.pos_to_string(angle)))
|
||||
else
|
||||
minetest.chat_send_player(name, S("Attachment failed!"))
|
||||
core.chat_send_player(name, S("Attachment failed!"))
|
||||
end
|
||||
ent_parent[name] = nil
|
||||
ent_child[name] = nil
|
||||
@ -700,7 +700,7 @@ local function print_object(obj)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:children_getter", {
|
||||
core.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"..
|
||||
@ -734,7 +734,7 @@ minetest.register_tool("testtools:children_getter", {
|
||||
else
|
||||
ret = S("Children of @1:", self_name) .. "\n" .. ret
|
||||
end
|
||||
minetest.chat_send_player(user:get_player_name(), ret)
|
||||
core.chat_send_player(user:get_player_name(), ret)
|
||||
end
|
||||
end,
|
||||
})
|
||||
@ -743,7 +743,7 @@ minetest.register_tool("testtools:children_getter", {
|
||||
local function use_loadstring(param, player)
|
||||
-- For security reasons, require 'server' priv, just in case
|
||||
-- someone is actually crazy enough to run this on a public server.
|
||||
local privs = minetest.get_player_privs(player:get_player_name())
|
||||
local privs = core.get_player_privs(player:get_player_name())
|
||||
if not privs.server then
|
||||
return false, "You need 'server' privilege to change object properties!"
|
||||
end
|
||||
@ -794,14 +794,14 @@ local function show_meta_formspec(user, metatype, pos_or_item, key, value, keyli
|
||||
local formname
|
||||
if metatype == "node" then
|
||||
formname = "testtools:node_meta_editor"
|
||||
extra_label = S("pos = @1", minetest.pos_to_string(pos_or_item))
|
||||
extra_label = S("pos = @1", core.pos_to_string(pos_or_item))
|
||||
else
|
||||
formname = "testtools:item_meta_editor"
|
||||
extra_label = S("item = @1", pos_or_item:get_name())
|
||||
end
|
||||
form = form .. "label[0,7.2;"..F(extra_label).."]"
|
||||
|
||||
minetest.show_formspec(user:get_player_name(), formname, form)
|
||||
core.show_formspec(user:get_player_name(), formname, form)
|
||||
end
|
||||
|
||||
local function get_meta_keylist(meta, playername, escaped)
|
||||
@ -822,7 +822,7 @@ local function get_meta_keylist(meta, playername, escaped)
|
||||
return table.concat(ekeys, ",")
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:node_meta_editor", {
|
||||
core.register_tool("testtools:node_meta_editor", {
|
||||
description = S("Node Meta Editor") .. "\n" ..
|
||||
S("Place: Edit node metadata"),
|
||||
inventory_image = "testtools_node_meta_editor.png",
|
||||
@ -836,7 +836,7 @@ minetest.register_tool("testtools:node_meta_editor", {
|
||||
end
|
||||
local pos = pointed_thing.under
|
||||
node_meta_posses[user:get_player_name()] = pos
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
show_meta_formspec(user, "node", pos, "", "", get_meta_keylist(meta, user:get_player_name(), true))
|
||||
return itemstack
|
||||
@ -861,7 +861,7 @@ local function use_item_meta_editor(itemstack, user, pointed_thing)
|
||||
end
|
||||
local item_to_edit = get_item_next_to_wielded_item(user)
|
||||
if item_to_edit:is_empty() then
|
||||
minetest.chat_send_player(user:get_player_name(), S("Place an item next to the Item Meta Editor in your inventory first!"))
|
||||
core.chat_send_player(user:get_player_name(), S("Place an item next to the Item Meta Editor in your inventory first!"))
|
||||
return itemstack
|
||||
end
|
||||
local meta = item_to_edit:get_meta()
|
||||
@ -869,7 +869,7 @@ local function use_item_meta_editor(itemstack, user, pointed_thing)
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:item_meta_editor", {
|
||||
core.register_tool("testtools:item_meta_editor", {
|
||||
description = S("Item Meta Editor") .. "\n" ..
|
||||
S("Punch/Place: Edit item metadata of item in the next inventory slot"),
|
||||
inventory_image = "testtools_item_meta_editor.png",
|
||||
@ -879,18 +879,18 @@ minetest.register_tool("testtools:item_meta_editor", {
|
||||
on_place = use_item_meta_editor,
|
||||
})
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
core.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if not (player and player:is_player()) then
|
||||
return
|
||||
end
|
||||
if formname == "testtools:entity_list" then
|
||||
local name = player:get_player_name()
|
||||
if fields.entity_list then
|
||||
local expl = minetest.explode_textlist_event(fields.entity_list)
|
||||
local expl = core.explode_textlist_event(fields.entity_list)
|
||||
if expl.type == "DCL" then
|
||||
local pos = vector.add(player:get_pos(), {x=0,y=1,z=0})
|
||||
selections[name] = expl.index
|
||||
minetest.add_entity(pos, get_entity_list()[expl.index])
|
||||
core.add_entity(pos, get_entity_list()[expl.index])
|
||||
return
|
||||
elseif expl.type == "CHG" then
|
||||
selections[name] = expl.index
|
||||
@ -898,13 +898,13 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
elseif fields.spawn and selections[name] then
|
||||
local pos = vector.add(player:get_pos(), {x=0,y=1,z=0})
|
||||
minetest.add_entity(pos, get_entity_list()[selections[name]])
|
||||
core.add_entity(pos, get_entity_list()[selections[name]])
|
||||
return
|
||||
end
|
||||
elseif formname == "testtools:object_editor" then
|
||||
local name = player:get_player_name()
|
||||
if fields.object_props then
|
||||
local expl = minetest.explode_textlist_event(fields.object_props)
|
||||
local expl = core.explode_textlist_event(fields.object_props)
|
||||
if expl.type == "DCL" or expl.type == "CHG" then
|
||||
property_formspec_index[name] = expl.index
|
||||
|
||||
@ -933,7 +933,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if success then
|
||||
props[key] = str
|
||||
else
|
||||
minetest.chat_send_player(name, str)
|
||||
core.chat_send_player(name, str)
|
||||
return
|
||||
end
|
||||
selected_objects[name]:set_properties(props)
|
||||
@ -968,7 +968,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
pos_or_item = get_item_next_to_wielded_item(player)
|
||||
end
|
||||
if fields.keylist then
|
||||
local evnt = minetest.explode_textlist_event(fields.keylist)
|
||||
local evnt = core.explode_textlist_event(fields.keylist)
|
||||
if evnt.type == "DCL" or evnt.type == "CHG" then
|
||||
local keylist_table = meta_latest_keylist[name]
|
||||
if metatype == "node" and not pos_or_item then
|
||||
@ -976,7 +976,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
local meta
|
||||
if metatype == "node" then
|
||||
meta = minetest.get_meta(pos_or_item)
|
||||
meta = core.get_meta(pos_or_item)
|
||||
else
|
||||
meta = pos_or_item:get_meta()
|
||||
end
|
||||
@ -1002,7 +1002,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
local meta
|
||||
if metatype == "node" then
|
||||
meta = minetest.get_meta(pos_or_item)
|
||||
meta = core.get_meta(pos_or_item)
|
||||
elseif metatype == "item" then
|
||||
if pos_or_item:is_empty() then
|
||||
return
|
||||
@ -1022,7 +1022,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_leaveplayer(function(player)
|
||||
core.register_on_leaveplayer(function(player)
|
||||
local name = player:get_player_name()
|
||||
meta_latest_keylist[name] = nil
|
||||
node_meta_posses[name] = nil
|
||||
@ -1030,7 +1030,7 @@ end)
|
||||
|
||||
-- Pointing Staffs
|
||||
|
||||
minetest.register_tool("testtools:blocked_pointing_staff", {
|
||||
core.register_tool("testtools:blocked_pointing_staff", {
|
||||
description = S("Blocked Pointing Staff").."\n"..
|
||||
S("Can point the Blocking Pointable Node/Object and "..
|
||||
"the Pointable Node/Object is point blocking."),
|
||||
@ -1047,7 +1047,7 @@ minetest.register_tool("testtools:blocked_pointing_staff", {
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_tool("testtools:ultimate_pointing_staff", {
|
||||
core.register_tool("testtools:ultimate_pointing_staff", {
|
||||
description = S("Ultimate Pointing Staff").."\n"..
|
||||
S("Can point all pointable test nodes, objects and liquids."),
|
||||
inventory_image = "testtools_ultimate_pointing_staff.png",
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
local S = minetest.get_translator("testtools")
|
||||
local S = core.get_translator("testtools")
|
||||
|
||||
local function get_func(is_place)
|
||||
return function(itemstack, user, pointed_thing)
|
||||
@ -13,19 +13,19 @@ local function get_func(is_place)
|
||||
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 node = core.get_node(pos)
|
||||
local pstr = core.pos_to_string(pos)
|
||||
local time = core.get_timeofday()
|
||||
local sunlight = core.get_natural_light(pos)
|
||||
local artificial = core.get_artificial_light(node.param1)
|
||||
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)
|
||||
core.chat_send_player(user:get_player_name(), message)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:lighttool", {
|
||||
core.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" ..
|
||||
|
@ -1,6 +1,6 @@
|
||||
local S = minetest.get_translator("testtools")
|
||||
local S = core.get_translator("testtools")
|
||||
|
||||
minetest.register_entity("testtools:visual_box", {
|
||||
core.register_entity("testtools:visual_box", {
|
||||
initial_properties = {
|
||||
visual = "cube",
|
||||
textures = {
|
||||
@ -14,11 +14,11 @@ minetest.register_entity("testtools:visual_box", {
|
||||
},
|
||||
|
||||
on_activate = function(self)
|
||||
self.timestamp = minetest.get_us_time() + 5000000
|
||||
self.timestamp = core.get_us_time() + 5000000
|
||||
end,
|
||||
|
||||
on_step = function(self)
|
||||
if minetest.get_us_time() >= self.timestamp then
|
||||
if core.get_us_time() >= self.timestamp then
|
||||
self.object:remove()
|
||||
end
|
||||
end,
|
||||
@ -35,14 +35,14 @@ local function visualizer_on_use(itemstack, user, pointed_thing)
|
||||
local meta = itemstack:get_meta()
|
||||
local box_type = meta:get("box_type") or DEFAULT_BOX_TYPE
|
||||
|
||||
local result = minetest.get_node_boxes(box_type, pointed_thing.under)
|
||||
local result = core.get_node_boxes(box_type, pointed_thing.under)
|
||||
local t = "testtools_visual_" .. box_type .. ".png"
|
||||
|
||||
for _, box in ipairs(result) do
|
||||
local box_min = pointed_thing.under + vector.new(box[1], box[2], box[3])
|
||||
local box_max = pointed_thing.under + vector.new(box[4], box[5], box[6])
|
||||
local box_center = (box_min + box_max) / 2
|
||||
local obj = minetest.add_entity(box_center, "testtools:visual_box")
|
||||
local obj = core.add_entity(box_center, "testtools:visual_box")
|
||||
if not obj then
|
||||
break
|
||||
end
|
||||
@ -62,12 +62,12 @@ local function visualizer_on_place(itemstack, placer, pointed_thing)
|
||||
|
||||
local new_value = BOX_TYPES[(prev_index % #BOX_TYPES) + 1]
|
||||
meta:set_string("box_type", new_value)
|
||||
minetest.chat_send_player(placer:get_player_name(), S("[Node Box Visualizer] box_type = @1", new_value))
|
||||
core.chat_send_player(placer:get_player_name(), S("[Node Box Visualizer] box_type = @1", new_value))
|
||||
|
||||
return itemstack
|
||||
end
|
||||
|
||||
minetest.register_tool("testtools:node_box_visualizer", {
|
||||
core.register_tool("testtools:node_box_visualizer", {
|
||||
description = S("Node Box Visualizer") .. "\n" ..
|
||||
S("Punch: Show node/collision/selection boxes of the pointed node") .. "\n" ..
|
||||
S("Place: Change selected box type (default: selection box)"),
|
||||
|
@ -1,10 +1,10 @@
|
||||
minetest.register_tool("testtools:particle_spawner", {
|
||||
core.register_tool("testtools:particle_spawner", {
|
||||
description = "Particle Spawner".."\n"..
|
||||
"Punch: Spawn random test particle",
|
||||
inventory_image = "testtools_particle_spawner.png",
|
||||
groups = { testtool = 1, disable_repair = 1 },
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local pos = minetest.get_pointed_thing_position(pointed_thing, true)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing, true)
|
||||
if pos == nil then
|
||||
if user then
|
||||
pos = user:get_pos()
|
||||
@ -20,7 +20,7 @@ minetest.register_tool("testtools:particle_spawner", {
|
||||
anim = {type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3}
|
||||
end
|
||||
|
||||
minetest.add_particle({
|
||||
core.add_particle({
|
||||
pos = pos,
|
||||
velocity = {x=0, y=0, z=0},
|
||||
acceleration = {x=0, y=0.04, z=0},
|
||||
|
@ -1,28 +1,28 @@
|
||||
minetest.register_tool("testtools:privatizer", {
|
||||
core.register_tool("testtools:privatizer", {
|
||||
description = "Node Meta Privatizer".."\n"..
|
||||
"Punch: Marks 'infotext' and 'formspec' meta fields of chest as private",
|
||||
inventory_image = "testtools_privatizer.png",
|
||||
groups = { testtool = 1, disable_repair = 1 },
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type == "node" then
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
if minetest.get_item_group(node.name, "meta_is_privatizable") == 1 then
|
||||
local node = core.get_node(pointed_thing.under)
|
||||
if core.get_item_group(node.name, "meta_is_privatizable") == 1 then
|
||||
local p = pointed_thing.under
|
||||
minetest.log("action", "[testtools] Privatizer used at "..minetest.pos_to_string(p))
|
||||
minetest.get_meta(p):mark_as_private({"infotext", "formspec"})
|
||||
core.log("action", "[testtools] Privatizer used at "..core.pos_to_string(p))
|
||||
core.get_meta(p):mark_as_private({"infotext", "formspec"})
|
||||
if user and user:is_player() then
|
||||
minetest.chat_send_player(user:get_player_name(), "Node metadata (infotext, formspec) set private!")
|
||||
core.chat_send_player(user:get_player_name(), "Node metadata (infotext, formspec) set private!")
|
||||
end
|
||||
return
|
||||
elseif node.name == "chest_of_everything:chest" then
|
||||
if user and user:is_player() then
|
||||
minetest.chat_send_player(user:get_player_name(), "Privatizer can't be used on the Chest of Everything. Use it on a normal chest.")
|
||||
core.chat_send_player(user:get_player_name(), "Privatizer can't be used on the Chest of Everything. Use it on a normal chest.")
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
if user and user:is_player() then
|
||||
minetest.chat_send_player(user:get_player_name(), "Privatizer can only be used on chest!")
|
||||
core.chat_send_player(user:get_player_name(), "Privatizer can only be used on chest!")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -1,11 +1,11 @@
|
||||
local S, NS = minetest.get_translator("testtranslations")
|
||||
local S, NS = core.get_translator("testtranslations")
|
||||
|
||||
local function send_compare(name, text)
|
||||
core.chat_send_player(name, ("%s | %s | %s"):format(
|
||||
core.get_translated_string("", text), text, core.get_translated_string("fr", text)))
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("testtranslations", {
|
||||
core.register_chatcommand("testtranslations", {
|
||||
params = "",
|
||||
description = "Test translations",
|
||||
privs = {},
|
||||
|
@ -1,7 +1,7 @@
|
||||
local align_help = "Texture spans over a space of 8×8 nodes"
|
||||
local align_help_n = "Tiles looks the same for every node"
|
||||
|
||||
minetest.register_node("tiled:tiled", {
|
||||
core.register_node("tiled:tiled", {
|
||||
description = "Tiled Node (world-aligned)".."\n"..align_help,
|
||||
tiles = {{
|
||||
name = "tiled_tiled.png",
|
||||
@ -11,7 +11,7 @@ minetest.register_node("tiled:tiled", {
|
||||
groups = {cracky=3},
|
||||
})
|
||||
|
||||
minetest.register_node("tiled:tiled_rooted", {
|
||||
core.register_node("tiled:tiled_rooted", {
|
||||
description = "Tiled 'plantlike_rooted' Node (world-aligned)".."\n"..
|
||||
"Base node texture spans over a space of 8×8 nodes".."\n"..
|
||||
"A plantlike thing grows on top",
|
||||
@ -26,7 +26,7 @@ minetest.register_node("tiled:tiled_rooted", {
|
||||
groups = {cracky=3},
|
||||
})
|
||||
|
||||
minetest.register_node("tiled:tiled_n", {
|
||||
core.register_node("tiled:tiled_n", {
|
||||
description = "Tiled Node (node-aligned)".."\n"..align_help_n,
|
||||
tiles = {{
|
||||
name = "tiled_tiled_node.png",
|
||||
|
@ -1,31 +1,31 @@
|
||||
dofile(core.get_modpath(core.get_current_modname()) .. "/crafting_prepare.lua")
|
||||
|
||||
-- Test minetest.clear_craft function
|
||||
-- Test core.clear_craft function
|
||||
local function test_clear_craft()
|
||||
-- Clearing by output
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
output = "foo",
|
||||
recipe = {{"bar"}}
|
||||
})
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
output = "foo 4",
|
||||
recipe = {{"foo", "bar"}}
|
||||
})
|
||||
assert(#minetest.get_all_craft_recipes("foo") == 2)
|
||||
minetest.clear_craft({output="foo"})
|
||||
assert(minetest.get_all_craft_recipes("foo") == nil)
|
||||
assert(#core.get_all_craft_recipes("foo") == 2)
|
||||
core.clear_craft({output="foo"})
|
||||
assert(core.get_all_craft_recipes("foo") == nil)
|
||||
-- Clearing by input
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
output = "foo 4",
|
||||
recipe = {{"foo", "bar"}}
|
||||
})
|
||||
assert(#minetest.get_all_craft_recipes("foo") == 1)
|
||||
minetest.clear_craft({recipe={{"foo", "bar"}}})
|
||||
assert(minetest.get_all_craft_recipes("foo") == nil)
|
||||
assert(#core.get_all_craft_recipes("foo") == 1)
|
||||
core.clear_craft({recipe={{"foo", "bar"}}})
|
||||
assert(core.get_all_craft_recipes("foo") == nil)
|
||||
end
|
||||
unittests.register("test_clear_craft", test_clear_craft)
|
||||
|
||||
-- Test minetest.get_craft_result function
|
||||
-- Test core.get_craft_result function
|
||||
local function test_get_craft_result()
|
||||
-- normal
|
||||
local input = {
|
||||
@ -33,12 +33,12 @@ local function test_get_craft_result()
|
||||
width = 2,
|
||||
items = {"", "unittests:coal_lump", "", "unittests:stick"}
|
||||
}
|
||||
minetest.log("info", "[unittests] torch crafting input: "..dump(input))
|
||||
local output, decremented_input = minetest.get_craft_result(input)
|
||||
minetest.log("info", "[unittests] torch crafting output: "..dump(output))
|
||||
minetest.log("info", "[unittests] torch crafting decremented input: "..dump(decremented_input))
|
||||
core.log("info", "[unittests] torch crafting input: "..dump(input))
|
||||
local output, decremented_input = core.get_craft_result(input)
|
||||
core.log("info", "[unittests] torch crafting output: "..dump(output))
|
||||
core.log("info", "[unittests] torch crafting decremented input: "..dump(decremented_input))
|
||||
assert(output.item)
|
||||
minetest.log("info", "[unittests] torch crafting output.item:to_table(): "..dump(output.item:to_table()))
|
||||
core.log("info", "[unittests] torch crafting output.item:to_table(): "..dump(output.item:to_table()))
|
||||
assert(output.item:get_name() == "unittests:torch")
|
||||
assert(output.item:get_count() == 4)
|
||||
|
||||
@ -48,10 +48,10 @@ local function test_get_craft_result()
|
||||
width = 1,
|
||||
items = {"unittests:coal_lump"}
|
||||
}
|
||||
minetest.log("info", "[unittests] coal fuel input: "..dump(input))
|
||||
output, decremented_input = minetest.get_craft_result(input)
|
||||
minetest.log("info", "[unittests] coal fuel output: "..dump(output))
|
||||
minetest.log("info", "[unittests] coal fuel decremented input: "..dump(decremented_input))
|
||||
core.log("info", "[unittests] coal fuel input: "..dump(input))
|
||||
output, decremented_input = core.get_craft_result(input)
|
||||
core.log("info", "[unittests] coal fuel output: "..dump(output))
|
||||
core.log("info", "[unittests] coal fuel decremented input: "..dump(decremented_input))
|
||||
assert(output.time)
|
||||
assert(output.time > 0)
|
||||
|
||||
@ -61,14 +61,14 @@ local function test_get_craft_result()
|
||||
width = 1,
|
||||
items = {"unittests:iron_lump"}
|
||||
}
|
||||
minetest.log("info", "[unittests] iron lump cooking input: "..dump(output))
|
||||
output, decremented_input = minetest.get_craft_result(input)
|
||||
minetest.log("info", "[unittests] iron lump cooking output: "..dump(output))
|
||||
minetest.log("info", "[unittests] iron lump cooking decremented input: "..dump(decremented_input))
|
||||
core.log("info", "[unittests] iron lump cooking input: "..dump(output))
|
||||
output, decremented_input = core.get_craft_result(input)
|
||||
core.log("info", "[unittests] iron lump cooking output: "..dump(output))
|
||||
core.log("info", "[unittests] iron lump cooking decremented input: "..dump(decremented_input))
|
||||
assert(output.time)
|
||||
assert(output.time > 0)
|
||||
assert(output.item)
|
||||
minetest.log("info", "[unittests] iron lump cooking output.item:to_table(): "..dump(output.item:to_table()))
|
||||
core.log("info", "[unittests] iron lump cooking output.item:to_table(): "..dump(output.item:to_table()))
|
||||
assert(output.item:get_name() == "unittests:steel_ingot")
|
||||
assert(output.item:get_count() == 1)
|
||||
|
||||
@ -79,12 +79,12 @@ local function test_get_craft_result()
|
||||
-- Using a wear of 60000
|
||||
items = {"unittests:repairable_tool 1 60000", "unittests:repairable_tool 1 60000"}
|
||||
}
|
||||
minetest.log("info", "[unittests] repairable tool crafting input: "..dump(input))
|
||||
output, decremented_input = minetest.get_craft_result(input)
|
||||
minetest.log("info", "[unittests] repairable tool crafting output: "..dump(output))
|
||||
minetest.log("info", "[unittests] repairable tool crafting decremented input: "..dump(decremented_input))
|
||||
core.log("info", "[unittests] repairable tool crafting input: "..dump(input))
|
||||
output, decremented_input = core.get_craft_result(input)
|
||||
core.log("info", "[unittests] repairable tool crafting output: "..dump(output))
|
||||
core.log("info", "[unittests] repairable tool crafting decremented input: "..dump(decremented_input))
|
||||
assert(output.item)
|
||||
minetest.log("info", "[unittests] repairable tool crafting output.item:to_table(): "..dump(output.item:to_table()))
|
||||
core.log("info", "[unittests] repairable tool crafting output.item:to_table(): "..dump(output.item:to_table()))
|
||||
assert(output.item:get_name() == "unittests:repairable_tool")
|
||||
-- Test the wear value.
|
||||
-- See src/craftdef.cpp in Luanti source code for the formula. The formula to calculate
|
||||
@ -100,12 +100,12 @@ local function test_get_craft_result()
|
||||
width = 2,
|
||||
items = {"unittests:unrepairable_tool 1 60000", "unittests:unrepairable_tool 1 60000"}
|
||||
}
|
||||
minetest.log("info", "[unittests] unrepairable tool crafting input: "..dump(input))
|
||||
output, decremented_input = minetest.get_craft_result(input)
|
||||
minetest.log("info", "[unittests] unrepairable tool crafting output: "..dump(output))
|
||||
minetest.log("info", "[unittests] unrepairable tool crafting decremented input: "..dump(decremented_input))
|
||||
core.log("info", "[unittests] unrepairable tool crafting input: "..dump(input))
|
||||
output, decremented_input = core.get_craft_result(input)
|
||||
core.log("info", "[unittests] unrepairable tool crafting output: "..dump(output))
|
||||
core.log("info", "[unittests] unrepairable tool crafting decremented input: "..dump(decremented_input))
|
||||
assert(output.item)
|
||||
minetest.log("info", "[unittests] unrepairable tool crafting output.item:to_table(): "..dump(output.item:to_table()))
|
||||
core.log("info", "[unittests] unrepairable tool crafting output.item:to_table(): "..dump(output.item:to_table()))
|
||||
-- unrepairable tool must not yield any output
|
||||
assert(output.item:is_empty())
|
||||
end
|
||||
|
@ -1,30 +1,30 @@
|
||||
-- Registering some dummy items and recipes for the crafting tests
|
||||
|
||||
minetest.register_craftitem("unittests:torch", {
|
||||
core.register_craftitem("unittests:torch", {
|
||||
description = "Crafting Test Item: Torch",
|
||||
inventory_image = "unittests_torch.png",
|
||||
|
||||
groups = { dummy = 1 },
|
||||
})
|
||||
minetest.register_craftitem("unittests:coal_lump", {
|
||||
core.register_craftitem("unittests:coal_lump", {
|
||||
description = "Crafting Test Item: Coal Lump",
|
||||
inventory_image = "unittests_coal_lump.png",
|
||||
|
||||
groups = { dummy = 1 },
|
||||
})
|
||||
minetest.register_craftitem("unittests:stick", {
|
||||
core.register_craftitem("unittests:stick", {
|
||||
description = "Crafting Test Item: Stick",
|
||||
inventory_image = "unittests_stick.png",
|
||||
|
||||
groups = { dummy = 1 },
|
||||
})
|
||||
minetest.register_craftitem("unittests:iron_lump", {
|
||||
core.register_craftitem("unittests:iron_lump", {
|
||||
description = "Crafting Test Item: Iron Lump",
|
||||
inventory_image = "unittests_iron_lump.png",
|
||||
|
||||
groups = { dummy = 1 },
|
||||
})
|
||||
minetest.register_craftitem("unittests:steel_ingot", {
|
||||
core.register_craftitem("unittests:steel_ingot", {
|
||||
description = "Crafting Test Item: Steel Ingot",
|
||||
inventory_image = "unittests_steel_ingot.png",
|
||||
|
||||
@ -33,13 +33,13 @@ minetest.register_craftitem("unittests:steel_ingot", {
|
||||
|
||||
-- Use aliases in recipes for more complete testing
|
||||
|
||||
minetest.register_alias("unittests:steel_ingot_alias", "unittests:steel_ingot")
|
||||
minetest.register_alias("unittests:coal_lump_alias", "unittests:coal_lump")
|
||||
minetest.register_alias("unittests:iron_lump_alias", "unittests:iron_lump")
|
||||
core.register_alias("unittests:steel_ingot_alias", "unittests:steel_ingot")
|
||||
core.register_alias("unittests:coal_lump_alias", "unittests:coal_lump")
|
||||
core.register_alias("unittests:iron_lump_alias", "unittests:iron_lump")
|
||||
|
||||
-- Recipes for tests: Normal crafting, cooking and fuel
|
||||
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
output = 'unittests:torch 4',
|
||||
recipe = {
|
||||
{'unittests:coal_lump_alias'},
|
||||
@ -47,26 +47,26 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
type = "cooking",
|
||||
output = "unittests:steel_ingot_alias",
|
||||
recipe = "unittests:iron_lump_alias",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "unittests:coal_lump_alias",
|
||||
burntime = 40,
|
||||
})
|
||||
|
||||
-- Test tool repair
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
type = "toolrepair",
|
||||
additional_wear = -0.05,
|
||||
})
|
||||
|
||||
-- Test the disable_repair=1 group
|
||||
minetest.register_tool("unittests:unrepairable_tool", {
|
||||
core.register_tool("unittests:unrepairable_tool", {
|
||||
description = "Crafting Test Item: Unrepairable Tool",
|
||||
inventory_image = "unittests_unrepairable_tool.png",
|
||||
tool_capabilities = {
|
||||
@ -79,7 +79,7 @@ minetest.register_tool("unittests:unrepairable_tool", {
|
||||
groups = { disable_repair = 1, dummy = 1 }
|
||||
})
|
||||
|
||||
minetest.register_tool("unittests:repairable_tool", {
|
||||
core.register_tool("unittests:repairable_tool", {
|
||||
description = "Crafting Test Item: Repairable Tool",
|
||||
inventory_image = "unittests_repairable_tool.png",
|
||||
tool_capabilities = {
|
||||
|
@ -193,7 +193,7 @@ dofile(modpath .. "/color.lua")
|
||||
|
||||
local function send_results(name, ok)
|
||||
core.chat_send_player(name,
|
||||
minetest.colorize(ok and "green" or "red",
|
||||
core.colorize(ok and "green" or "red",
|
||||
(ok and "All devtest unit tests passed." or
|
||||
"There were devtest unit test failures.") ..
|
||||
" Check the console for detailed output."))
|
||||
@ -206,7 +206,7 @@ if core.settings:get_bool("devtest_unittests_autostart", false) then
|
||||
-- to write status information to the filesystem
|
||||
local old_on_finished = unittests.on_finished
|
||||
unittests.on_finished = function(ok)
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
for _, player in ipairs(core.get_connected_players()) do
|
||||
send_results(player:get_player_name(), ok)
|
||||
end
|
||||
test_results = ok
|
||||
@ -214,7 +214,7 @@ if core.settings:get_bool("devtest_unittests_autostart", false) then
|
||||
end
|
||||
coroutine.wrap(unittests.run_all)()
|
||||
end)
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
core.register_on_joinplayer(function(player)
|
||||
if test_results == nil then
|
||||
return -- tests haven't completed yet
|
||||
end
|
||||
|
@ -20,7 +20,7 @@ local function compare_lists(a, b)
|
||||
end
|
||||
|
||||
local function test_inventory()
|
||||
local inv = minetest.create_detached_inventory("test")
|
||||
local inv = core.create_detached_inventory("test")
|
||||
|
||||
inv:set_lists({test = {""}})
|
||||
assert(inv:get_list("test"))
|
||||
@ -66,8 +66,8 @@ local function test_inventory()
|
||||
assert(compare_lists(before, after))
|
||||
|
||||
local location = inv:get_location()
|
||||
assert(minetest.remove_detached_inventory("test"))
|
||||
assert(not minetest.get_inventory(location))
|
||||
assert(core.remove_detached_inventory("test"))
|
||||
assert(not core.get_inventory(location))
|
||||
end
|
||||
|
||||
unittests.register("test_inventory", test_inventory)
|
||||
|
@ -1,15 +1,15 @@
|
||||
local full_description = "Description Test Item\nFor testing item decription"
|
||||
minetest.register_tool("unittests:description_test", {
|
||||
core.register_tool("unittests:description_test", {
|
||||
description = full_description,
|
||||
inventory_image = "unittests_description_test.png",
|
||||
groups = { dummy = 1 },
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("item_description", {
|
||||
core.register_chatcommand("item_description", {
|
||||
param = "",
|
||||
description = "Show the short and full description of the wielded item.",
|
||||
func = function(name)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
local item = player:get_wielded_item()
|
||||
return true, string.format("short_description: %s\ndescription: %s",
|
||||
item:get_short_description(), item:get_description())
|
||||
@ -24,9 +24,9 @@ local function test_short_desc()
|
||||
local stack = ItemStack("unittests:description_test")
|
||||
assert(stack:get_short_description() == "Description Test Item")
|
||||
assert(get_short_description("unittests:description_test") == "Description Test Item")
|
||||
assert(minetest.registered_items["unittests:description_test"].short_description == nil)
|
||||
assert(core.registered_items["unittests:description_test"].short_description == nil)
|
||||
assert(stack:get_description() == full_description)
|
||||
assert(stack:get_description() == minetest.registered_items["unittests:description_test"].description)
|
||||
assert(stack:get_description() == core.registered_items["unittests:description_test"].description)
|
||||
|
||||
stack:get_meta():set_string("description", "Hello World")
|
||||
assert(stack:get_short_description() == "Hello World")
|
||||
|
@ -1,13 +1,13 @@
|
||||
-- Test item (un)registration and overriding
|
||||
do
|
||||
local itemname = "unittests:test_override_item"
|
||||
minetest.register_craftitem(":" .. itemname, {description = "foo"})
|
||||
assert(assert(minetest.registered_items[itemname]).description == "foo")
|
||||
minetest.override_item(itemname, {description = "bar"})
|
||||
assert(assert(minetest.registered_items[itemname]).description == "bar")
|
||||
minetest.override_item(itemname, {}, {"description"})
|
||||
core.register_craftitem(":" .. itemname, {description = "foo"})
|
||||
assert(assert(core.registered_items[itemname]).description == "foo")
|
||||
core.override_item(itemname, {description = "bar"})
|
||||
assert(assert(core.registered_items[itemname]).description == "bar")
|
||||
core.override_item(itemname, {}, {"description"})
|
||||
-- description has the empty string as a default
|
||||
assert(assert(minetest.registered_items[itemname]).description == "")
|
||||
minetest.unregister_item("unittests:test_override_item")
|
||||
assert(minetest.registered_items["unittests:test_override_item"] == nil)
|
||||
assert(assert(core.registered_items[itemname]).description == "")
|
||||
core.unregister_item("unittests:test_override_item")
|
||||
assert(core.registered_items["unittests:test_override_item"] == nil)
|
||||
end
|
||||
|
@ -116,6 +116,6 @@ end
|
||||
unittests.register("test_item_metadata", test_item_metadata)
|
||||
|
||||
local function test_node_metadata(player, pos)
|
||||
test_metadata(minetest.get_meta(pos))
|
||||
test_metadata(core.get_meta(pos))
|
||||
end
|
||||
unittests.register("test_node_metadata", test_node_metadata, {map=true})
|
||||
|
@ -73,8 +73,8 @@ end
|
||||
unittests.register("test_v3f_metatable", test_v3f_metatable, {player=true})
|
||||
|
||||
local function test_v3s16_metatable(player, pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local found_pos = minetest.find_node_near(pos, 0, node.name, true)
|
||||
local node = core.get_node(pos)
|
||||
local found_pos = core.find_node_near(pos, 0, node.name, true)
|
||||
assert(vector.check(found_pos))
|
||||
end
|
||||
unittests.register("test_v3s16_metatable", test_v3s16_metatable, {map=true})
|
||||
@ -181,7 +181,7 @@ local function test_write_json()
|
||||
for i = 1, 1000 do
|
||||
data = {data}
|
||||
end
|
||||
local roundtripped = minetest.parse_json(minetest.write_json(data))
|
||||
local roundtripped = core.parse_json(core.write_json(data))
|
||||
for i = 1, 1000 do
|
||||
roundtripped = roundtripped[1]
|
||||
end
|
||||
@ -190,7 +190,7 @@ end
|
||||
unittests.register("test_write_json", test_write_json)
|
||||
|
||||
local function test_game_info()
|
||||
local info = minetest.get_game_info()
|
||||
local info = core.get_game_info()
|
||||
local game_conf = Settings(info.path .. "/game.conf")
|
||||
assert(info.id == "devtest")
|
||||
assert(info.title == game_conf:get("title"))
|
||||
@ -199,27 +199,27 @@ unittests.register("test_game_info", test_game_info)
|
||||
|
||||
local function test_mapgen_edges(cb)
|
||||
-- Test that the map can extend to the expected edges and no further.
|
||||
local min_edge, max_edge = minetest.get_mapgen_edges()
|
||||
local min_edge, max_edge = core.get_mapgen_edges()
|
||||
local min_finished = {}
|
||||
local max_finished = {}
|
||||
local function finish()
|
||||
if #min_finished ~= 1 then
|
||||
return cb("Expected 1 block to emerge around mapgen minimum edge")
|
||||
end
|
||||
if min_finished[1] ~= (min_edge / minetest.MAP_BLOCKSIZE):floor() then
|
||||
if min_finished[1] ~= (min_edge / core.MAP_BLOCKSIZE):floor() then
|
||||
return cb("Expected block within minimum edge to emerge")
|
||||
end
|
||||
if #max_finished ~= 1 then
|
||||
return cb("Expected 1 block to emerge around mapgen maximum edge")
|
||||
end
|
||||
if max_finished[1] ~= (max_edge / minetest.MAP_BLOCKSIZE):floor() then
|
||||
if max_finished[1] ~= (max_edge / core.MAP_BLOCKSIZE):floor() then
|
||||
return cb("Expected block within maximum edge to emerge")
|
||||
end
|
||||
return cb()
|
||||
end
|
||||
local emerges_left = 2
|
||||
local function emerge_block(blockpos, action, blocks_left, finished)
|
||||
if action ~= minetest.EMERGE_CANCELLED then
|
||||
if action ~= core.EMERGE_CANCELLED then
|
||||
table.insert(finished, blockpos)
|
||||
end
|
||||
if blocks_left == 0 then
|
||||
@ -229,34 +229,34 @@ local function test_mapgen_edges(cb)
|
||||
end
|
||||
end
|
||||
end
|
||||
minetest.emerge_area(min_edge:subtract(1), min_edge, emerge_block, min_finished)
|
||||
minetest.emerge_area(max_edge, max_edge:add(1), emerge_block, max_finished)
|
||||
core.emerge_area(min_edge:subtract(1), min_edge, emerge_block, min_finished)
|
||||
core.emerge_area(max_edge, max_edge:add(1), emerge_block, max_finished)
|
||||
end
|
||||
unittests.register("test_mapgen_edges", test_mapgen_edges, {map=true, async=true})
|
||||
|
||||
local finish_test_on_mapblocks_changed
|
||||
minetest.register_on_mapblocks_changed(function(modified_blocks, modified_block_count)
|
||||
core.register_on_mapblocks_changed(function(modified_blocks, modified_block_count)
|
||||
if finish_test_on_mapblocks_changed then
|
||||
finish_test_on_mapblocks_changed(modified_blocks, modified_block_count)
|
||||
finish_test_on_mapblocks_changed = nil
|
||||
end
|
||||
end)
|
||||
local function test_on_mapblocks_changed(cb, player, pos)
|
||||
local bp1 = (pos / minetest.MAP_BLOCKSIZE):floor()
|
||||
local bp1 = (pos / core.MAP_BLOCKSIZE):floor()
|
||||
local bp2 = bp1:add(1)
|
||||
for _, bp in ipairs({bp1, bp2}) do
|
||||
-- Make a modification in the block.
|
||||
local p = bp * minetest.MAP_BLOCKSIZE
|
||||
minetest.load_area(p)
|
||||
local meta = minetest.get_meta(p)
|
||||
local p = bp * core.MAP_BLOCKSIZE
|
||||
core.load_area(p)
|
||||
local meta = core.get_meta(p)
|
||||
meta:set_int("test_on_mapblocks_changed", meta:get_int("test_on_mapblocks_changed") + 1)
|
||||
end
|
||||
finish_test_on_mapblocks_changed = function(modified_blocks, modified_block_count)
|
||||
if modified_block_count < 2 then
|
||||
return cb("Expected at least two mapblocks to be recorded as modified")
|
||||
end
|
||||
if not modified_blocks[minetest.hash_node_position(bp1)] or
|
||||
not modified_blocks[minetest.hash_node_position(bp2)] then
|
||||
if not modified_blocks[core.hash_node_position(bp1)] or
|
||||
not modified_blocks[core.hash_node_position(bp2)] then
|
||||
return cb("The expected mapblocks were not recorded as modified")
|
||||
end
|
||||
cb()
|
||||
|
@ -1,8 +1,8 @@
|
||||
minetest.register_chatcommand("hotbar", {
|
||||
core.register_chatcommand("hotbar", {
|
||||
params = "<size>",
|
||||
description = "Set hotbar size",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
@ -19,16 +19,16 @@ minetest.register_chatcommand("hotbar", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("hp", {
|
||||
core.register_chatcommand("hp", {
|
||||
params = "<hp>",
|
||||
description = "Set your health",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
local hp = tonumber(param)
|
||||
if not hp or minetest.is_nan(hp) or hp < 0 or hp > 65535 then
|
||||
if not hp or core.is_nan(hp) or hp < 0 or hp > 65535 then
|
||||
return false, "Missing or incorrect hp parameter!"
|
||||
end
|
||||
player:set_hp(hp)
|
||||
@ -36,32 +36,32 @@ minetest.register_chatcommand("hp", {
|
||||
end,
|
||||
})
|
||||
|
||||
local s_infplace = minetest.settings:get("devtest_infplace")
|
||||
local s_infplace = core.settings:get("devtest_infplace")
|
||||
if s_infplace == "true" then
|
||||
infplace = true
|
||||
elseif s_infplace == "false" then
|
||||
infplace = false
|
||||
else
|
||||
infplace = minetest.is_creative_enabled("")
|
||||
infplace = core.is_creative_enabled("")
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("infplace", {
|
||||
core.register_chatcommand("infplace", {
|
||||
params = "",
|
||||
description = "Toggle infinite node placement",
|
||||
func = function(name, param)
|
||||
infplace = not infplace
|
||||
if infplace then
|
||||
minetest.chat_send_all("Infinite node placement enabled!")
|
||||
minetest.log("action", "Infinite node placement enabled")
|
||||
core.chat_send_all("Infinite node placement enabled!")
|
||||
core.log("action", "Infinite node placement enabled")
|
||||
else
|
||||
minetest.chat_send_all("Infinite node placement disabled!")
|
||||
minetest.log("action", "Infinite node placement disabled")
|
||||
core.chat_send_all("Infinite node placement disabled!")
|
||||
core.log("action", "Infinite node placement disabled")
|
||||
end
|
||||
return true
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("detach", {
|
||||
core.register_chatcommand("detach", {
|
||||
params = "[<radius>]",
|
||||
description = "Detach all objects nearby",
|
||||
func = function(name, param)
|
||||
@ -72,11 +72,11 @@ minetest.register_chatcommand("detach", {
|
||||
if radius < 1 then
|
||||
radius = 1
|
||||
end
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
local objs = minetest.get_objects_inside_radius(player:get_pos(), radius)
|
||||
local objs = core.get_objects_inside_radius(player:get_pos(), radius)
|
||||
local num = 0
|
||||
for o=1, #objs do
|
||||
if objs[o]:get_attach() then
|
||||
@ -88,11 +88,11 @@ minetest.register_chatcommand("detach", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("use_tool", {
|
||||
core.register_chatcommand("use_tool", {
|
||||
params = "(dig <group> <leveldiff>) | (hit <damage_group> <time_from_last_punch>) [<uses>]",
|
||||
description = "Apply tool wear a number of times, as if it were used for digging",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
if not player then
|
||||
return false, "No player."
|
||||
end
|
||||
@ -117,9 +117,9 @@ minetest.register_chatcommand("use_tool", {
|
||||
local wear = tool:get_wear()
|
||||
local dp
|
||||
if mode == "dig" then
|
||||
dp = minetest.get_dig_params({[group]=3, level=level}, caps, wear)
|
||||
dp = core.get_dig_params({[group]=3, level=level}, caps, wear)
|
||||
else
|
||||
dp = minetest.get_hit_params({[group]=100}, caps, level, wear)
|
||||
dp = core.get_hit_params({[group]=100}, caps, level, wear)
|
||||
end
|
||||
tool:add_wear(dp.wear)
|
||||
actual_uses = actual_uses + 1
|
||||
@ -141,15 +141,15 @@ minetest.register_chatcommand("use_tool", {
|
||||
|
||||
|
||||
-- Unlimited node placement
|
||||
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
core.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
|
||||
if placer and placer:is_player() then
|
||||
return infplace
|
||||
end
|
||||
end)
|
||||
|
||||
-- Don't pick up if the item is already in the inventory
|
||||
local old_handle_node_drops = minetest.handle_node_drops
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
local old_handle_node_drops = core.handle_node_drops
|
||||
function core.handle_node_drops(pos, drops, digger)
|
||||
if not digger or not digger:is_player() or not infplace then
|
||||
return old_handle_node_drops(pos, drops, digger)
|
||||
end
|
||||
@ -163,11 +163,11 @@ function minetest.handle_node_drops(pos, drops, digger)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("set_displayed_itemcount", {
|
||||
core.register_chatcommand("set_displayed_itemcount", {
|
||||
params = "(-s \"<string>\" [-c <color>]) | -a <alignment_num>",
|
||||
description = "Set the displayed itemcount of the wielded item",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
local item = player:get_wielded_item()
|
||||
local meta = item:get_meta()
|
||||
local flag1 = param:sub(1, 2)
|
||||
@ -181,7 +181,7 @@ minetest.register_chatcommand("set_displayed_itemcount", {
|
||||
end
|
||||
local s = param:sub(5, se - 1)
|
||||
if param:sub(se + 1, se + 4) == " -c " then
|
||||
s = minetest.colorize(param:sub(se + 5), s)
|
||||
s = core.colorize(param:sub(se + 5), s)
|
||||
end
|
||||
meta:set_string("count_meta", s)
|
||||
elseif flag1 == "-a" then
|
||||
@ -198,11 +198,11 @@ minetest.register_chatcommand("set_displayed_itemcount", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("dump_item", {
|
||||
core.register_chatcommand("dump_item", {
|
||||
params = "",
|
||||
description = "Prints a dump of the wielded item in table form",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
local item = player:get_wielded_item()
|
||||
local str = dump(item:to_table())
|
||||
print(str)
|
||||
@ -210,22 +210,22 @@ minetest.register_chatcommand("dump_item", {
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("dump_itemdef", {
|
||||
core.register_chatcommand("dump_itemdef", {
|
||||
params = "",
|
||||
description = "Prints a dump of the wielded item's definition in table form",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
local str = dump(player:get_wielded_item():get_definition())
|
||||
print(str)
|
||||
return true, str
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("dump_wear_bar", {
|
||||
core.register_chatcommand("dump_wear_bar", {
|
||||
params = "",
|
||||
description = "Prints a dump of the wielded item's wear bar parameters in table form",
|
||||
func = function(name, param)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local player = core.get_player_by_name(name)
|
||||
local item = player:get_wielded_item()
|
||||
local str = dump(item:get_wear_bar_params())
|
||||
print(str)
|
||||
@ -238,6 +238,6 @@ core.register_chatcommand("set_saturation", {
|
||||
description = "Set the saturation for current player.",
|
||||
func = function(player_name, param)
|
||||
local saturation = tonumber(param)
|
||||
minetest.get_player_by_name(player_name):set_lighting({saturation = saturation })
|
||||
core.get_player_by_name(player_name):set_lighting({saturation = saturation })
|
||||
end
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user