I cant... to much stuff changed. I lost track. Everything is in chaos.

Schematics broke... please, help me.
This commit is contained in:
IamPyu 2024-09-30 20:51:08 -06:00
parent 8bcdcf1d49
commit b37c71c2f2
200 changed files with 5408 additions and 2214 deletions

View File

@ -2,7 +2,10 @@
# [Sep 29th - **STILL UNDER DEVELOPMENT** 2024] World Update
This update completely breaks the API lol.
This update completely breaks the API and game lol.
The entire codebase was also refactored, which ended up breaking all the schematics.
So I had to go through the tedious process and fix them all.
- Added "Worlds" which are like Minecraft's own Dimensions
- Added Ice World
@ -12,6 +15,9 @@ This update completely breaks the API lol.
- Added Glowslime
- Added Magma
- Give the Heater Device and Freezer Device more abilities with new `heatable` and `coolable` groups
- Added World Tokens which let you travel between worlds
- Added Fossils
- Removed Vyn Forest, Old Growth Forest and Jungle
# [Sep 29th 2024] Unnamed Minor Update

0
mods/CORE/modpack.conf Normal file
View File

View File

@ -16,5 +16,8 @@ PyuTest.DEEP_OCEAN_MAX = PyuTest.OCEAN_MIN - 1
PyuTest.DEEP_OCEAN_MIN = -31
PyuTest.get_schem_path = function (name)
return minetest.get_modpath("pyutest_mapgen") .. "/schematics/"..name..".mts"
return minetest.get_modpath("pyutest") .. "/schematics/"..name..".mts"
end
local modpath = minetest.get_modpath("pyutest")
dofile(modpath.."/util.lua")

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -41,27 +41,27 @@ PyuTest.create_explosion = function (pos, range, rm_pos, dmg, creator, dmg_creat
end
PyuTest.dorange(pos, range, function(p)
if minetest.get_node(p).name == "pyutest_core:tnt" then
minetest.after(0.8, function()
minetest.remove_node(p)
PyuTest.create_explosion(p, range, rm_pos, dmg, creator, dmg_creator)
end)
else
minetest.dig_node(p)
end
if minetest.get_node(p).name == "pyutest_blocks:tnt" then
minetest.after(0.8, function()
minetest.remove_node(p)
PyuTest.create_explosion(p, range, rm_pos, dmg, creator, dmg_creator)
end)
else
minetest.dig_node(p)
end
end)
for _, v in pairs(minetest.get_objects_inside_radius(pos, range)) do
if creator ~= nil then
if v ~= creator then
v:punch(creator, nil, {
damage_groups = {fleshy = dmg}
damage_groups = {fleshy = dmg}
}, nil)
end
if dmg_creator and v == creator then
v:punch(creator, nil, {
damage_groups = {fleshy = dmg}
damage_groups = {fleshy = dmg}
}, nil)
end
end
@ -72,65 +72,65 @@ PyuTest.create_explosion = function (pos, range, rm_pos, dmg, creator, dmg_creat
local maxpos = {x = pos.x + r, y = pos.y + r, z = pos.z + r}
minetest.add_particlespawner({
amount = range * 8,
time = 0.4,
minexptime = 0.4,
maxexptime = 1.4,
minsize = 16,
maxsize = 32,
vertical = false,
glow = 8,
amount = range * 8,
time = 0.4,
minexptime = 0.4,
maxexptime = 1.4,
minsize = 16,
maxsize = 32,
vertical = false,
glow = 8,
collisiondetection = false,
texture = "pyutest-blast.png",
collisiondetection = false,
texture = "pyutest-blast.png",
minpos = minpos,
maxpos = maxpos,
minvel = vector.new(-1, -1, 1),
maxvel = vector.new(1, 1, 1),
minpos = minpos,
maxpos = maxpos,
minvel = vector.new(-1, -1, 1),
maxvel = vector.new(1, 1, 1),
})
minetest.add_particlespawner({
amount = range * 18,
time = 0.4,
minexptime = 0.4,
maxexptime = 1.4,
minsize = 1,
maxsize = 2,
vertical = false,
glow = 4,
amount = range * 18,
time = 0.4,
minexptime = 0.4,
maxexptime = 1.4,
minsize = 1,
maxsize = 2,
vertical = false,
glow = 4,
collisiondetection = false,
texture = "pyutest-blast2.png",
collisiondetection = false,
texture = "pyutest-blast2.png",
minpos = minpos,
maxpos = maxpos,
minvel = vector.new(-6, -6, -6),
maxvel = vector.new( 6, 6, 6),
minpos = minpos,
maxpos = maxpos,
minvel = vector.new(-6, -6, -6),
maxvel = vector.new( 6, 6, 6),
})
minetest.add_particlespawner({
amount = range * 18,
time = 0.4,
minexptime = 0.4,
maxexptime = 1.4,
minsize = 1,
maxsize = 2,
vertical = false,
glow = 4,
amount = range * 18,
time = 0.4,
minexptime = 0.4,
maxexptime = 1.4,
minsize = 1,
maxsize = 2,
vertical = false,
glow = 4,
collisiondetection = false,
texture = "pyutest-blast3.png",
collisiondetection = false,
texture = "pyutest-blast3.png",
minpos = minpos,
maxpos = maxpos,
minvel = vector.new(-6, -6, -6),
maxvel = vector.new( 6, 6, 6),
minpos = minpos,
maxpos = maxpos,
minvel = vector.new(-6, -6, -6),
maxvel = vector.new( 6, 6, 6),
})
minetest.sound_play("block_break", {
pos = pos,
gain = 2.5
pos = pos,
gain = 2.5
})
end
@ -142,9 +142,9 @@ PyuTest.tool_caps = function(options)
groupcaps[k] = {
maxlevel = v.maxlevel or options.maxlevel,
times = v.times or {
[PyuTest.BLOCK_FAST] = options.time or 3,
[PyuTest.BLOCK_NORMAL] = options.time or 3,
[PyuTest.BLOCK_SLOW] = options.time or 3
[PyuTest.BLOCK_FAST] = options.time or 3,
[PyuTest.BLOCK_NORMAL] = options.time or 3,
[PyuTest.BLOCK_SLOW] = options.time or 3
},
uses = v.uses or options.uses or default_uses
}

View File

View File

@ -0,0 +1,33 @@
PyuTest.ENTITY_BLOOD_AMOUNT = 6
PyuTest.HUMAN_LIKE_CBOX = {-0.25, -1, -0.25, 0.25, 1, 0.25}
PyuTest.create_boss_egg = function(mob_id, desc, texture, addegg, no_creative, craft)
mobs:register_egg(mob_id, desc, texture, addegg, no_creative)
minetest.register_craft({
output = mob_id,
recipe = {
{"", craft, ""},
{craft, "pyutest_core:emerald_shard", craft},
{"", craft, ""}
}
})
local t = mob_id:split(":")
local mob_name = t[#t]
local cage_id = "pyutest_mobs:"..mob_name.."_spawn_cage"
PyuTest.make_node(cage_id, desc:gsub("Spawn Egg", "") .. "Boss Spawner Cage", {
block = PyuTest.BLOCK_BREAKABLE_LONG
}, {"pyutest-cage.png"}, {
drawtype = "glasslike",
on_rightclick = function(pos)
mobs:add_mob(vector.add(pos, vector.new(0, 1, 0)), {
name = mob_id,
child = false,
ignore_count = true
})
minetest.remove_node(pos)
end
})
end

View File

@ -0,0 +1,135 @@
mobs:register_mob("pyutest_mobs:monster", {
type = "monster",
hp_max = 20,
hp_min = 20,
walk_velocity = 1,
run_velocity = 3,
armor = 100,
passive = false,
walk_chance = 0,
stand_chance = 25,
damage = 2.7,
attack_chance = 1,
attack_type = "dogfight",
pathfinding = 1,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
physical = true,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
view_range = 30,
reach = 2,
jump = 1,
group_attack = true,
makes_footstep_sound = true,
textures = {
"pyutest-monster.png", "pyutest-monster_back.png"
},
drops = {
{
name = "pyutest_core:bone",
min = 2,
max = 3,
chance = 1
}
}
})
mobs:register_egg("pyutest_mobs:monster", "Monster Spawn Egg", "pyutest-egg.png^[multiply:darkgreen", 0)
mobs:register_mob("pyutest_mobs:human", {
type = "npc",
hp_max = 20,
hp_min = 20,
walk_velocity = 1,
run_velocity = 5,
armor = 100,
passive = true,
walk_chance = 50,
stand_chance = 50,
damage = 3,
attack_type = "dogfight",
pathfinding = 1,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
textures = {"player.png", "player_back.png"},
follow = {"pyutest_mobs:coin"},
runaway = true,
view_range = 15,
reach = 2,
fear_height = 7,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
makes_footstep_sound = true,
drops = {
{
name = "pyutest_core:bone",
min = 2,
max = 3,
chance = 1
},
{
name = "pyutest_core:apple",
min = 1,
max = 4,
chance = 2.5
}
}
})
mobs:register_egg("pyutest_mobs:human", "Human Spawn Egg", "pyutest-egg.png^[multiply:peachpuff", 0)
mobs:register_mob("pyutest_mobs:mimic", {
type = "monster",
hp_max = 15,
hp_min = 15,
walk_velocity = 1,
run_velocity = 3,
armor = 100,
passive = false,
stand_chance = 1,
walk_chance = 0,
damage = 4,
attack_type = "dogfight",
pathfinding = 1,
visual = "cube",
visual_size = {x = 1, y = 1, z = 1},
collisionbox = {
-0.25, -0.5, -0.25, 0.25, 0.5, 0.25
},
textures = {
"pyutest-crate.png",
"pyutest-crate.png",
"pyutest-crate.png",
"pyutest-crate.png",
"pyutest-crate.png",
"pyutest-crate.png"
},
view_range = 12,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
reach = 2,
})
mobs:register_egg("pyutest_mobs:mimic", "Mimic Spawn Egg", "pyutest-egg.png^[multiply:brown", 0)
mobs:register_mob("pyutest_mobs:firefly", {
type = "animal",
hp_max = 3,
hp_min = 3,
walk_velocity = 1,
run_velocity = 3,
armor = 100,
passive = true,
stand_chance = 0,
walk_chance = 100,
fly = true,
keep_flying = true,
visual = "sprite",
visual_size = {x = 0.05, y = 0.05},
collisionbox = {
-0.0, -0.0, -0.0, 0.0, 0.0, 0.0
},
textures = {"pyutest-firefly.png"},
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
glow = 7,
})
mobs:register_egg("pyutest_mobs:firefly", "Firefly Spawn Egg", "pyutest-egg.png^[multiply:yellow", 0)

View File

@ -0,0 +1,73 @@
local modpath = minetest.get_modpath("pyutest_mobs")
mobs.fallback_node = "pyutest_blocks:dirt_block"
dofile(modpath.."/api.lua")
dofile(modpath.."/basic.lua")
dofile(modpath.."/snowman.lua")
dofile(modpath.."/wind_warrior.lua")
dofile(modpath.."/necromancer.lua")
local mapgen = minetest.get_mapgen_setting("mg_name")
if mapgen ~= "flat" and mapgen ~= "singlenode" then
mobs:spawn({
name = "pyutest_mobs:monster",
nodes = {"group:ground"},
interval = 4,
chance = 1,
active_object_count = 3,
min_light = 0,
max_light = 8,
max_height = PyuTest.OVERWORLD_TOP,
min_height = PyuTest.SURFACE_BOTTOM,
day_toggle = false
})
mobs:spawn({
name = "pyutest_mobs:monster",
nodes = {"group:ground"},
interval = 2,
chance = 2,
active_object_count = 6,
min_light = 0,
max_light = 8,
min_height = PyuTest.SURFACE_BOTTOM - 1,
max_height= PyuTest.OVERWORLD_BOTTOM
})
mobs:spawn({
name = "pyutest_mobs:human",
nodes = {"group:ground"},
interval = 3,
chance = 4,
active_object_count = 3,
min_light = 9,
max_light = 15,
min_height = PyuTest.SURFACE_BOTTOM,
day_toggle = true,
})
mobs:spawn({
name = "pyutest_mobs:mimic",
nodes = {"group:ground"},
interval = 3,
chance = 18,
active_object_count = 2,
min_light = 0,
max_light = 15,
day_toggle = true,
})
mobs:spawn({
name = "pyutest_mobs:firefly",
nodes = {"group:ground", "air"},
interval = 3,
chance = 3,
active_object_count = 4,
min_light = 0,
max_light = 9,
day_toggle = false,
min_height = PyuTest.SURFACE_BOTTOM
})
end

View File

@ -0,0 +1 @@
depends = pyutest_blocks,mobs,pyutest_mapgen

View File

@ -0,0 +1,87 @@
local necroball_hit_player = function (self, player)
player:punch(self.object, nil, {
damage_groups = {fleshy = 3}
}, nil)
end
mobs:register_arrow("pyutest_mobs:arrow_necroball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"pyutest-necroball.png"},
hit_player = necroball_hit_player,
hit_mob = necroball_hit_player,
hit_node = function(self, pos)
math.randomseed(os.time())
local num_minions = math.random(2, 3)
local minions = {
"pyutest_mobs:monster",
"pyutest_mobs:mimic"
}
local m = minions[math.random(#minions)]
for i = 1, num_minions do
mobs:add_mob(vector.add(pos, vector.new(0, 3, 0)), {
name = m,
child = false,
nametag = "Necromancer Minion",
ignore_count = true
})
end
self.object:remove()
end,
velocity = 18,
collisionbox = {
-1.5, -1.5, -1.5, 1.5, 1.5, 1.5
}
})
mobs:register_mob("pyutest_mobs:necromancer", {
type = "monster",
hp_max = 125,
hp_min = 125,
walk_velocity = 2,
run_velocity = 4,
armor = 100,
passive = false,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
physical = true,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
view_range = 25,
reach = 2,
jump = 1,
group_attack = true,
group_helper = {
"pyutest_mobs:monster",
"pyutest_mobs:mimic"
},
makes_footstep_sound = true,
textures = {
"pyutest-necromancer.png", "pyutest-necromancer_back.png"
},
drops = {
{
name = "pyutest_core:magic_shards",
min = 4,
max = 8,
chance = 1
},
},
damage = 4,
attack_chance = 1,
attack_type = "dogshoot",
arrow = "pyutest_mobs:arrow_necroball",
shoot_interval = 1.2,
shoot_offset = 0,
pathfinding = 1,
dogshoot_switch = 1,
dogshoot_count_max = 5,
dogshoot_count2_max = 6,
})
PyuTest.create_boss_egg("pyutest_mobs:necromancer", "Necromancer Spawn Egg",
"pyutest-egg.png^[multiply:dimgray", 0, nil,
"pyutest_core:bone")

View File

@ -0,0 +1,77 @@
local snowball_hit_player = function (self, player)
player:punch(self.object, nil, {
damage_groups = {fleshy = 5}
}, nil)
end
mobs:register_arrow("pyutest_mobs:arrow_snowball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"pyutest-snowball.png"},
hit_node = function (self, pos)
PyuTest.create_explosion(pos, 1, false, 9, self.object, false)
end,
hit_player = snowball_hit_player,
hit_mob = snowball_hit_player,
velocity = 9,
collisionbox = {
-1.5, -1.5, -1.5, 1.5, 1.5, 1.5
}
})
mobs:register_mob("pyutest_mobs:snowman", {
type = "monster",
hp_max = 150,
hp_min = 150,
walk_velocity = 1,
run_velocity = 4,
armor = 100,
passive = false,
walk_chance = 1,
stand_chance = 2,
damage = 9,
attack_chance = 1,
attack_type = "dogshoot",
arrow = "pyutest_mobs:arrow_snowball",
shoot_interval = 0.75,
shoot_offset = 2,
homing = true,
pathfinding = 1,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
physical = true,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
view_range = 35,
reach = 2,
jump = 1,
group_attack = false,
makes_footstep_sound = true,
dogshoot_switch = 2,
dogshoot_count_max = 3,
dogshoot_count2_max = 6,
textures = {
"pyutest-snowman.png", "pyutest-snowman_back.png"
},
drops = {
{
name = "pyutest_core:magic_shards",
min = 2,
max = 5,
chance = 1
},
{
name = "pyutest_core:snowball",
min = 4,
max = 9,
chance = 1
}
}
})
PyuTest.create_boss_egg("pyutest_mobs:snowman", "Snowman Spawn Egg",
"pyutest-egg.png^[multiply:skyblue", 0, nil,
"pyutest_core:snow_block")

View File

@ -0,0 +1,81 @@
local windball_hit_player = function (self, player)
player:punch(self.object, nil, {
damage_groups = {fleshy = 3}
}, nil)
math.randomseed(os.time())
player:add_velocity({
x = 0,
z = 0,
y = math.random(18, 25)
})
end
mobs:register_arrow("pyutest_mobs:arrow_windball", {
visual = "sprite",
visual_size = {x = 1, y = 1},
textures = {"pyutest-windball.png"},
hit_player = windball_hit_player,
hit_mob = windball_hit_player,
velocity = 9,
collisionbox = {
-1.5, -1.5, -1.5, 1.5, 1.5, 1.5
}
})
mobs:register_mob("pyutest_mobs:wind_warrior", {
type = "monster",
hp_max = 120,
hp_min = 120,
walk_velocity = 1,
run_velocity = 4,
armor = 100,
passive = false,
walk_chance = 1,
stand_chance = 2,
damage = 9,
attack_chance = 1,
attack_type = "dogshoot",
arrow = "pyutest_mobs:arrow_windball",
shoot_interval = 0.75,
shoot_offset = 2,
homing = true,
pathfinding = 1,
visual = "upright_sprite",
visual_size = {x = 1, y = 2},
collisionbox = PyuTest.HUMAN_LIKE_CBOX,
physical = true,
blood_amount = PyuTest.ENTITY_BLOOD_AMOUNT,
view_range = 35,
reach = 2,
jump = 1,
group_attack = false,
makes_footstep_sound = true,
dogshoot_switch = 1,
dogshoot_count_max = 3,
dogshoot_count2_max = 6,
textures = {
"pyutest-wind-warrior.png", "pyutest-wind-warrior_back.png"
},
drops = {
{
name = "pyutest_core:magic_shards",
min = 4,
max = 7,
chance = 1
},
{
name = "pyutest_core:windball",
min = 2,
max = 4,
chance = 1
}
}
})
PyuTest.create_boss_egg("pyutest_mobs:wind_warrior", "Wind Warrior Spawn Egg",
"pyutest-egg.png^[multiply:white", 0, nil,
-- just a place holder until more wind-related items come.
"pyutest_core:iron_ingot")

0
mods/ITEMS/modpack.conf Normal file
View File

View File

@ -0,0 +1,184 @@
PyuTest.make_node_sounds = function(tbl)
local t = tbl or {}
t.footstep = t.footstep or { name = "block_walk", gain = 1 }
t.dig = t.dig or { name = "block_dig", gain = 0.50 }
t.dug = t.dug or { name = "block_break", gain = 0.50 }
t.place = t.place or { name = "block_place", gain = 0.50 }
return t
end
PyuTest.make_node = function(name, desc, groups, tiles, extra_conf)
local conf = {
description = Translate(desc),
tiles = tiles,
groups = PyuTest.util.tableconcat(groups, {
block = 1
}),
}
if extra_conf ~= nil then
for k, v in pairs(extra_conf) do
conf[k] = v
end
conf["sounds"] = PyuTest.make_node_sounds(extra_conf.sounds)
end
minetest.register_node(name, conf)
end
PyuTest.node_boxes = {
CARPET = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.45, 0.5 }
},
SLAB = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 }
},
PILLAR = {
type = "fixed",
fixed = { -0.15, -0.5, -0.15, 0.15, 0.5, 0.15 }
},
STAIRS = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
{ -0.5, 0, 0, 0.5, 0.5, 0.5 },
},
},
}
PyuTest.building_blocks = {}
PyuTest.make_building_blocks = function(name, desc, tex, colortint, cgroups, extra_conf)
local groups = PyuTest.util.tablecopy(cgroups) or {}
groups["block"] = 1
local econf = extra_conf or {}
econf["is_ground_content"] = econf["is_ground_content"] or true
econf["color"] = colortint
local id_block = name .. "_block"
local id_carpet = name .. "_carpet"
local id_slab = name .. "_slab"
local id_pillar = name .. "_pillar"
local id_stairs = name .. "_stairs"
local id_fence = name .. "_fence"
table.insert(PyuTest.building_blocks, {
ns = name:split(":")[1],
name = name:split(":")[2],
desc = desc,
tiles = tex,
groups = groups,
econf = econf
})
minetest.register_node(id_block, PyuTest.util.tableconcat({
description = Translate(desc .. " Block"),
tiles = tex,
groups = PyuTest.util.tableconcat(groups, {
solid = 1
}),
sounds = PyuTest.make_node_sounds(),
}, econf))
minetest.register_node(id_carpet, PyuTest.util.tableconcat({
description = Translate(desc .. " Carpet"),
tiles = tex,
groups = PyuTest.util.tableconcat(PyuTest.util.tablecopy(groups), {
attached_node = 1
}),
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = PyuTest.node_boxes.CARPET,
sounds = PyuTest.make_node_sounds(),
buildable_to = true
}, econf))
minetest.register_node(id_slab, PyuTest.util.tableconcat({
description = Translate(desc .. " Slab"),
tiles = tex,
groups = groups,
drawtype = "nodebox",
paramtype = "light",
node_box = PyuTest.node_boxes.SLAB,
sounds = PyuTest.make_node_sounds(),
}, econf))
minetest.register_node(id_pillar, PyuTest.util.tableconcat({
description = Translate(desc .. " Pillar"),
tiles = tex,
groups = groups,
drawtype = "nodebox",
paramtype = "light",
node_box = PyuTest.node_boxes.PILLAR,
sounds = PyuTest.make_node_sounds(),
}, econf))
minetest.register_node(id_stairs, PyuTest.util.tableconcat({
description = Translate(desc .. " Stairs"),
tiles = tex,
groups = groups,
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
node_box = PyuTest.node_boxes.STAIRS,
sounds = PyuTest.make_node_sounds(),
}, econf))
minetest.register_node(id_fence, PyuTest.util.tableconcat({
description = Translate(desc .. " Fence"),
tiles = tex,
groups = groups,
drawtype = "fencelike",
paramtype = "light",
collision_box = {
type = "fixed",
fixed = { -0.25, -0.5, -0.25, 0.25, 0.5, 0.25 }
},
sounds = PyuTest.make_node_sounds(),
}, econf))
minetest.register_craft({
output = id_carpet .. " 2",
recipe = {
{ id_block, id_block }
}
})
minetest.register_craft({
output = id_slab .. " 3",
recipe = {
{ id_block, id_block, id_block }
}
})
minetest.register_craft({
output = id_pillar .. " 3",
recipe = {
{ id_block },
{ id_block },
{ id_block }
}
})
minetest.register_craft({
output = id_stairs .. " 4",
recipe = {
{ id_block, "", "" },
{ id_block, id_block, "" },
{ id_block, id_block, id_block }
}
})
minetest.register_craft({
output = id_fence .. " 4",
recipe = {
{ id_block, "pyutest_tools:stick", id_block },
{ id_block, "pyutest_tools:stick", id_block }
}
})
end

View File

@ -0,0 +1,231 @@
PyuTest.make_building_blocks("pyutest_blocks:grass", "Grass", {
"pyutest-grass.png"
}, nil, {
ground = 1,
acid_vulnerable = 1,
grass = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:dark_grass", "Dark Grass", {
"pyutest-dark-grass.png"
}, nil, {
ground = 1,
acid_vulnerable = 1,
grass = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:swampy_grass", "Swampy Grass", {
"pyutest-swampy-grass.png"
}, nil, {
ground = 1,
acid_vulnerable = 1,
sugarcane_spawn_on = 1,
grass = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:savanna_grass", "Savanna Grass", {
"pyutest-savanna-grass.png"
}, nil, {
ground = 1,
acid_vulnerable = 1,
sugarcane_spawn_on = 1,
grass = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:aspen_grass", "Aspen Grass", {
"pyutest-aspen-grass.png"
}, nil, {
ground = 1,
acid_vulnerable = 1,
grass = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:jungle_grass", "Jungle Grass", {
"pyutest-jungle-grass.png"
}, nil, {
ground = 1,
acid_vulnerable = 1,
grass = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:dirt", "Dirt", { "pyutest-dirt.png" }, nil, {
ground = 1,
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:podzol", "Podzol", { "pyutest-podzol.png" }, nil, {
ground = 1,
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:snow", "Snow", { "pyutest-snow.png" }, nil, {
ground = 1,
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:sand", "Sand", { "pyutest-sand.png" }, nil, {
ground = 1,
acid_vulnerable = 1,
falling_node = 1,
sugarcane_spawn_on = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:mycelium", "Mycelium", {
"pyutest-mycelium.png"
}, nil, {
ground = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:clay", "Clay", { "pyutest-clay-block.png" }, nil, {
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:gravel", "Gravel", { "pyutest-gravel.png" }, nil, {
falling_node = 1,
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
})
-- Cracky
PyuTest.make_building_blocks("pyutest_blocks:stone", "Stone", { "pyutest-stone.png" }, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
level = 1
}, { is_ground_content = true })
PyuTest.make_building_blocks("pyutest_blocks:darkstone", "Darkstone", { "pyutest-darkstone.png" }, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
level = 1
}, { is_ground_content = true })
PyuTest.make_building_blocks("pyutest_blocks:granite", "Granite", {"pyutest-granite.png"}, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
level = 1
})
PyuTest.make_building_blocks("pyutest_blocks:andesite", "Andesite", {"pyutest-andesite.png"}, nil, {
ground = 1,
stone = 1,
cracky = PyuTest.BLOCK_NORMAL,
level = 1
})
PyuTest.make_building_blocks("pyutest_blocks:sandstone", "Sandstone", { "pyutest-sandstone.png" }, nil, {
ground = 1,
acid_vulnerable = 1,
cracky = PyuTest.BLOCK_FAST,
}, { is_ground_content = false })
PyuTest.make_building_blocks("pyutest_blocks:ice", "Ice", { "pyutest-ice.png" }, nil, {
ground = 1,
acid_vulnerable = 1,
slippery = 4,
cracky = PyuTest.BLOCK_FAST,
thawable = 1
})
PyuTest.make_building_blocks("pyutest_blocks:molten_rock", "Molten Rock", { "pyutest-molten-rock.png" }, nil, {
ground = 1,
cracky = PyuTest.BLOCK_FAST,
}, { is_ground_content = false })
PyuTest.make_building_blocks("pyutest_blocks:basalt", "Basalt", { "pyutest-basalt.png" }, nil, {
ground = 1,
cracky = PyuTest.BLOCK_FAST,
}, { is_ground_content = false })
PyuTest.make_building_blocks("pyutest_blocks:obsidian", "Obsidian", { "pyutest-obsidian.png" }, nil, {
cracky = PyuTest.BLOCK_SLOW,
}, { is_ground_content = false })
PyuTest.make_building_blocks("pyutest_blocks:crystal_lantern", "Crystal Lantern", { "pyutest-crystal-lantern.png" }, nil, {
cracky = PyuTest.BLOCK_FAST
}, {
light_source = minetest.LIGHT_MAX,
paramtype = "light"
})
PyuTest.make_building_blocks("pyutest_blocks:bone", "Bone", {
"pyutest-bone-block-top-bottom.png",
"pyutest-bone-block-top-bottom.png",
"pyutest-bone-block.png"
}, nil, {
cracky = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:enchanted_obsidian", "Enchanted Obsidian", {
"pyutest-enchanted-obsidian.png"
}, nil, {
cracky = PyuTest.BLOCK_SLOW
}, {
is_ground_content = false
})
PyuTest.make_building_blocks("pyutest_blocks:brick", "Brick", { "pyutest-bricks.png" }, nil, {
cracky = PyuTest.BLOCK_NORMAL
}, {
is_ground_content = false
})
PyuTest.make_building_blocks("pyutest_blocks:stone_bricks", "Stone Bricks", { "pyutest-stone-bricks.png" }, nil, {
cracky = PyuTest.BLOCK_SLOW
}, {
is_ground_content = false
})
-- Choppy
PyuTest.make_building_blocks("pyutest_blocks:mushroom", "Mushroom", { "pyutest-mushroom.png" }, nil, {
flammable = 1,
choppy = PyuTest.BLOCK_FAST
}, { is_ground_content = false })
PyuTest.make_building_blocks("pyutest_blocks:mushroom_stem", "Mushroom Stem", { "pyutest-mushroom-stem.png" }, nil, {
flammable = 1,
choppy = PyuTest.BLOCK_FAST
}, { is_ground_content = false })
PyuTest.make_building_blocks("pyutest_blocks:purple_mushroom", "Purple Mushroom", {
"pyutest-purple-mushroom.png"
}, nil, {
flammable = 1,
choppy = PyuTest.BLOCK_FAST
}, { is_ground_content = false })
-- Breakable by hand
PyuTest.make_building_blocks("pyutest_blocks:haybale", "Haybale", {
"pyutest-haybale-top-bottom.png",
"pyutest-haybale-top-bottom.png",
"pyutest-haybale.png"
}, nil, {
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:slime", "Slime", { "pyutest-slime.png" }, nil, {
bouncy = 85,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:glowslime", "Glowslime", { "pyutest-glowslime.png" }, nil, {
bouncy = 85,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
}, {
paramtype = "light",
light_source = minetest.LIGHT_MAX
})

View File

@ -0,0 +1,6 @@
local modpath = minetest.get_modpath("pyutest_blocks")
dofile(modpath .. "/api.lua")
dofile(modpath .. "/basic.lua")
dofile(modpath .. "/liquid.lua")
dofile(modpath .. "/special.lua")

View File

@ -0,0 +1,68 @@
PyuTest.make_liquid = function(name, desc, groups, texture, speed, extra_conf)
local function make_liquid_flags(liquidtype)
local drawtype = ""
if liquidtype == "source" then
drawtype = "liquid"
elseif liquidtype == "flowing" then
drawtype = "flowingliquid"
end
local t = PyuTest.util.tableconcat({
drawtype = drawtype,
waving = 3,
walkable = false,
pointable = false,
buildable_to = true,
is_ground_content = false,
use_texture_alpha = "blend",
paramtype = "light",
drop = "",
drowning = 3,
liquidtype = liquidtype,
liquid_renewable = true,
liquid_viscosity = speed or 1,
liquid_alternative_flowing = name .. "_flowing",
liquid_alternative_source = name .. "_source",
paramtype2 = liquidtype == "flowing" and "flowingliquid" or nil,
special_tiles = liquidtype == "flowing" and {
{
name = texture,
backface_culling = false
},
{
name = texture,
backface_culling = true
}
} or nil
}, extra_conf or {})
return t
end
local g = groups or {}
g["liquid"] = 1
PyuTest.make_node(name .. "_source", desc .. " Source", g, { texture }, make_liquid_flags("source"))
PyuTest.make_node(name .. "_flowing", "Flowing " .. desc, g, { texture }, make_liquid_flags("flowing"))
end
PyuTest.make_liquid("pyutest_blocks:water", "Water", {
water = 1,
freezable = 1,
heatable = 1
}, "pyutest-water.png", 1, {
post_effect_color = { a = 60, r = 24.7, g = 46.3, b = 89.4 },
paramtype2 = "color",
})
PyuTest.make_liquid("pyutest_blocks:lava", "Lava", {
lava = 1,
coolable = 1
}, "pyutest-lava.png", 5, {
damage_per_second = 4,
light_source = 8
})
PyuTest.make_liquid("pyutest_blocks:oil", "Oil", {}, "pyutest-oil.png", 3)
PyuTest.make_liquid("pyutest_blocks:liquid_acid", "Acid", {}, "pyutest-acid.png", 7, {
damage_per_second = 4
})

View File

View File

@ -0,0 +1,231 @@
PyuTest.make_node("pyutest_blocks:sponge", "Sponge", {
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
}, { "pyutest-sponge.png" })
PyuTest.make_node("pyutest_blocks:light", "Light", {
light = 1,
dig_immediate = 1,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
}, {
"pyutest-light.png"
}, {
drawtype = "torchlike",
walkable = false,
paramtype = "light",
sunlight_propagates = true,
light_source = minetest.LIGHT_MAX,
floodable = true
})
PyuTest.make_node("pyutest_blocks:torch", "Torch", {
dig_immediate = 1,
light = 1,
attached_node = 1,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
}, {
"pyutest-torch.png",
"pyutest-torch.png^[transform6",
"pyutest-torch.png^[transform1"
}, {
light_source = minetest.LIGHT_MAX,
walkable = false,
drawtype = "torchlike",
paramtype = "light",
inventory_image = "pyutest-torch.png",
paramtype2 = "wallmounted",
floodable = true
})
PyuTest.make_node("pyutest_blocks:glass", "Glass", {
cracky = PyuTest.BLOCK_NORMAL
}, { "pyutest-glass.png" }, {
drawtype = "glasslike_framed",
paramtype = "light",
sunlight_propagates = true
})
-- FIXME: This has been in the game for a month, implement it already!
PyuTest.make_node("pyutest_blocks:trapdoor", "Trapdoor", {
choppy = PyuTest.BLOCK_NORMAL,
flammable = 1
}, { "pyutest-trapdoor.png" }, {
drawtype = "nodebox",
paramtype = "light",
sunlight_propagates = true,
node_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, -0.15, 0.5 }
}
})
PyuTest.make_node("pyutest_blocks:contagious_acid", "Contagious Acid", {
crumbly = PyuTest.BLOCK_NORMAL,
solid_node = 1
}, { "pyutest-acid.png" }, {})
PyuTest.make_node("pyutest_blocks:fire", "Fire", {
dig_immediate = 1
}, { "pyutest-fire.png" }, {
drawtype = "firelike",
walkable = false,
buildable_to = true,
paramtype = "light",
sunlight_propagates = true,
damage_per_second = 2,
light_source = 8,
drop = "pyutest_blocks:ash 4"
})
PyuTest.make_node("pyutest_blocks:tnt", "TNT", {
dig_immediate = 1,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
}, {
"pyutest-tnt-top-bottom.png",
"pyutest-tnt-top-bottom.png",
"pyutest-tnt-side.png" -- Affects all other sides
}, {
on_rightclick = function(pos, node, clicker)
minetest.after(3, function()
if minetest.get_node(pos).name ~= "pyutest_blocks:tnt" then
return
end
PyuTest.create_explosion(pos, 3, true, 7, clicker, true)
end)
end,
__on_electricity_activated = function(pos, node, clicker, sender_pos)
minetest.after(3, function()
if minetest.get_node(pos).name ~= "pyutest_blocks:tnt" then
return
end
PyuTest.create_explosion(pos, 3, true, 7, clicker, true)
end)
end,
})
PyuTest.make_node("pyutest_blocks:crate", "Crate", {
choppy = PyuTest.BLOCK_NORMAL
}, { "pyutest-crate.png" }, {
on_construct = function(pos)
local meta = minetest.get_meta(pos)
local inventory = meta:get_inventory()
inventory:set_size("main", 8 * 4)
end,
can_dig = function(pos, player)
local meta = minetest.get_meta(pos)
local inventory = meta:get_inventory()
local empty = inventory:is_empty("main")
if not empty then
minetest.chat_send_player(player:get_player_name(), "Cannot destroy crate, it's not empty!")
end
return empty
end,
on_rightclick = function(pos, node, clicker)
local spos = string.format("%d,%d,%d", pos.x, pos.y, pos.z)
local formspec =
"size[8,9]" ..
"list[nodemeta:" .. spos .. ";main;0,0;8,4;]" ..
"list[current_player;main;0,5;8,4;]" ..
"listring[nodemeta:" .. spos .. ";main]" ..
"listring[current_player;main]"
minetest.show_formspec(clicker:get_player_name(), string.format("pyutest_blocks:crate_%d_%d_%d", pos.x, pos.y, pos.z),
formspec)
minetest.sound_play({ name = "crate_open", gain = 1 }, { pos = pos })
end
})
PyuTest.make_node("pyutest_blocks:workbench", "Workbench", {
choppy = PyuTest.BLOCK_NORMAL
}, {
"pyutest-workbench-top.png",
"pyutest-workbench-bottom.png",
"pyutest-workbench-sides.png"
}, {
on_rightclick = function(pos, node, clicker)
minetest.show_formspec(clicker:get_player_name(), "pyutest_blocks:workbench", table.concat({
"size[8,9]",
"list[current_player;craft;2.5,1;3,3;]",
"list[current_player;main;0,5;8,4;]"
}))
end
})
PyuTest.make_node("pyutest_blocks:ladder", "Ladder", {
dig_immediate = 1
}, { "pyutest-ladder.png" }, {
drawtype = "signlike",
paramtype = "light",
walkable = false,
climbable = true,
buildable_to = true,
sunlight_propagates = true,
paramtype2 = "wallmounted",
selection_box = {
type = "wallmounted"
},
inventory_image = "pyutest-ladder.png"
})
PyuTest.make_node("pyutest_blocks:magma", "Magma", {
cracky = PyuTest.BLOCK_NORMAL
}, { "pyutest-magma.png" }, {
paramtype = "light",
light_source = 11,
damage_per_second = 3
})
minetest.register_abm({
label = "Sponge Loop",
nodenames = { "pyutest_blocks:sponge" },
neighbors = { "group:liquid" },
interval = 0,
chance = 1,
action = function(pos)
local range = 4
local function replace(npos)
local node = minetest.get_node(npos)
if node.name == "air" then return end
local def = minetest.registered_nodes[node.name]
if def.groups["liquid"] == 1 then
minetest.remove_node(npos)
end
end
PyuTest.dorange(pos, range, function(p)
replace(p)
end)
end
})
minetest.register_abm({
label = "Contagious Acid Spread",
nodenames = { "group:acid_vulnerable" },
neighbors = { "pyutest_blocks:contagious_acid" },
interval = 2.4,
chance = 2.2,
catchup = true,
action = function(pos)
minetest.set_node(pos, {
name = "pyutest_blocks:contagious_acid"
})
end
})
minetest.register_abm({
label = "Fire Spread",
nodenames = { "group:flammable" },
neighbors = { "pyutest_blocks:fire" },
interval = 1,
chance = 4,
action = function(pos)
minetest.set_node(pos, {
name = "pyutest_blocks:fire"
})
end
})

View File

@ -0,0 +1,262 @@
minetest.register_craft({
output = "pyutest_tools:wooden_pickaxe 1",
recipe = {
{"group:wooden_planks", "group:wooden_planks", "group:wooden_planks"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:wooden_axe 1",
recipe = {
{"group:wooden_planks", "group:wooden_planks", ""},
{"group:wooden_planks", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:wooden_sword 1",
recipe = {
{"", "group:wooden_planks", ""},
{"", "group:wooden_planks", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:stone_pickaxe",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:stone_axe",
recipe = {
{"group:stone", "group:stone", ""},
{"group:stone", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:stone_sword",
recipe = {
{"", "group:stone", ""},
{"", "group:stone", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:iron_pickaxe",
recipe = {
{"pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:iron_axe",
recipe = {
{"pyutest_ores:iron_ingot", "pyutest_ores:iron_ingot", ""},
{"pyutest_ores:iron_ingot", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:iron_sword",
recipe = {
{"pyutest_ores:iron_ingot"},
{"pyutest_ores:iron_ingot"},
{"pyutest_tools:stick"}
}
})
minetest.register_craft({
output = "pyutest_tools:diamond_pickaxe",
recipe = {
{"pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard"},
{"", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:diamond_axe",
recipe = {
{"pyutest_ores:diamond_shard", "pyutest_ores:diamond_shard", ""},
{"pyutest_ores:diamond_shard", "pyutest_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
minetest.register_craft({
output = "pyutest_tools:diamond_sword",
recipe = {
{"pyutest_ores:diamond_shard"},
{"pyutest_ores:diamond_shard"},
{"pyutest_tools:stick"}
}
})
-- not tools
minetest.register_craft({
output = "pyutest_blocks:crate",
recipe = {
{"group:wooden_planks", "group:wooden_planks", "group:wooden_planks"},
{"group:wooden_planks", "", "group:wooden_planks"},
{"group:wooden_planks", "group:wooden_planks", "group:wooden_planks"}
}
})
minetest.register_craft({
output = "pyutest_blocks:brick_block 4",
recipe = {
{"pyutest_tools:brick", "pyutest_tools:brick"},
{"pyutest_tools:brick", "pyutest_tools:brick"}
}
})
minetest.register_craft({
output = "pyutest_furnace:furnace",
recipe = {
{"group:stone", "group:stone", "group:stone"},
{"group:stone", "", "group:stone"},
{"group:stone", "group:stone", "group:stone"}
}
})
minetest.register_craft({
output = "pyutest_blocks:slime_block",
type = "shapeless",
recipe = {
"pyutest_blocks:clay_block",
"pyutest_blocks:swampy_grass_block"
}
})
minetest.register_craft({
output = "pyutest_tools:sugar 3",
type = "shapeless",
recipe = {
"pyutest_flowers:sugarcane"
}
})
minetest.register_craft({
output = "pyutest_blocks:clay_block 4",
recipe = {
{"pyutest_tools:clay", "pyutest_tools:clay"},
{"pyutest_tools:clay", "pyutest_tools:clay"}
}
})
minetest.register_craft({
output = "pyutest_blocks:bone_block 4",
recipe = {
{"pyutest_tools:bone", "pyutest_tools:bone"},
{"pyutest_tools:bone", "pyutest_tools:bone"}
}
})
minetest.register_craft({
output = "pyutest_tools:stick 4",
recipe = {
{"group:wooden_planks"},
{"group:wooden_planks"}
}
})
minetest.register_craft({
output = "pyutest_tools:coin",
recipe = {
{"pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot"},
{"pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot"},
{"pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot", "pyutest_ores:gold_ingot"}
}
})
minetest.register_craft({
output = "pyutest_ores:gold_ingot 9",
recipe = {
{"pyutest_tools:coin"}
}
})
-- this recipe makes no sense, but who cares?
minetest.register_craft({
output = "pyutest_blocks:contagious_acid 3",
recipe = {
"pyutest_blocks:mushroom_block",
"pyutest_blocks:mushroom_stem_block",
"pyutest_blocks:dirt_block",
"pyutest_blocks:swampy_grass_block"
},
type = "shapeless"
})
minetest.register_craft({
output = "pyutest_blocks:light 4",
recipe = {
{"pyutest_blocks:torch", "pyutest_blocks:torch"},
{"pyutest_blocks:torch", "pyutest_blocks:torch"}
}
})
minetest.register_craft({
output = "pyutest_blocks:tnt 4",
recipe = {
{"pyutest_blocks:sand_block", "pyutest_blocks:gunpowder"},
{"pyutest_blocks:gunpowder", "pyutest_blocks:sand_block"}
}
})
minetest.register_craft({
output = "pyutest_blocks:torch 4",
recipe = {
{"pyutest_ores:coal_lump"},
{"pyutest_tools:stick"}
}
})
minetest.register_craft({
output = "pyutest_tools:wheat 4",
recipe = {
"pyutest_blocks:haybale_block"
},
type = "shapeless"
})
minetest.register_craft({
output = "pyutest_blocks:haybale_block",
recipe = {
{"pyutest_tools:wheat", "pyutest_tools:wheat"},
{"pyutest_tools:wheat", "pyutest_tools:wheat"}
}
})
minetest.register_craft({
output = "pyutest_tools:bread 3",
recipe = {
{"pyutest_tools:wheat", "pyutest_tools:wheat", "pyutest_tools:wheat"}
}
})
minetest.register_craft({
type = "cooking",
output = "pyutest_blocks:glass",
recipe = "pyutest_blocks:sand_block"
})
minetest.register_craft({
type = "cooking",
output = "pyutest_blocks:brick",
recipe = "pyutest_tools:clay",
})

View File

@ -0,0 +1 @@
depends = pyutest_tools,pyutest_blocks

View File

@ -1,4 +1,4 @@
local ELECTRICITY_TICK = 0.02 -- Maybe this will prevent stack overflows?
PyuTest.ELECTRICITY_TICK = 0.02 -- Maybe this will prevent stack overflows?
local function get_neighbours(pos)
return {
vector.new(pos.x + 1, pos.y, pos.z),
@ -20,12 +20,12 @@ local function get_neighbours(pos)
}
end
PyuTest.make_button = function (id, desc, groups, tiles)
PyuTest.make_button = function(id, desc, groups, tiles)
PyuTest.make_node(id, desc, PyuTest.util.tableconcat(groups, {
electric = 1
}), tiles, {
is_ground_content = false,
on_rightclick = function (pos, node, clicker)
on_rightclick = function(pos, node, clicker)
minetest.sound_play("button", {
pos = pos,
gain = 1
@ -34,7 +34,7 @@ PyuTest.make_button = function (id, desc, groups, tiles)
for _, v in pairs(get_neighbours(pos)) do
local n = minetest.get_node(v)
local def = minetest.registered_nodes[n.name]
minetest.after(ELECTRICITY_TICK, function ()
minetest.after(PyuTest.ELECTRICITY_TICK, function()
if def.__on_electricity_activated then
def.__on_electricity_activated(v, n, clicker, pos)
end
@ -44,25 +44,27 @@ PyuTest.make_button = function (id, desc, groups, tiles)
})
end
PyuTest.make_wire = function (id, desc, groups, color, efn)
local fn = efn or function (def, pos, node, clicker, sender_pos)
PyuTest.make_wire = function(id, desc, groups, color, efn)
local fn = efn or function(def, pos, node, clicker, sender_pos)
def.__on_electricity_activated(pos, node, clicker, sender_pos)
end
PyuTest.make_node(id, desc, PyuTest.util.tableconcat(groups, {
electric = 1
}), {"pyutest-wire.png", "pyutest-wire.png", "pyutest-wire.png", "pyutest-wire.png"}, {
}), {
"pyutest-wire.png",
"pyutest-wire.png",
"pyutest-wire.png",
"pyutest-wire.png"
}, {
drawtype = "raillike",
color = color,
paramtype = "light",
sunlight_propagates = true,
-- selection_box = {
-- type = "wallmounted"
-- },
walkable = false,
inventory_image = "pyutest-wire.png",
__on_electricity_activated = function (pos, node, clicker, sender_pos)
__on_electricity_activated = function(pos, node, clicker, sender_pos)
for _, v in pairs(get_neighbours(pos)) do
local n = minetest.get_node(v)
local def = minetest.registered_nodes[n.name]
@ -72,7 +74,7 @@ PyuTest.make_wire = function (id, desc, groups, color, efn)
goto continue
end
minetest.after(ELECTRICITY_TICK, function ()
minetest.after(PyuTest.ELECTRICITY_TICK, function()
if def.__on_electricity_activated then
fn(def, v, n, clicker, pos)
end
@ -84,92 +86,92 @@ PyuTest.make_wire = function (id, desc, groups, color, efn)
})
end
PyuTest.make_button("pyutest_core:button", "Button", {
PyuTest.make_button("pyutest_electricity:button", "Button", {
cracky = PyuTest.BLOCK_NORMAL,
}, {"pyutest-button.png"})
}, { "pyutest-button.png" })
PyuTest.make_wire("pyutest_core:copper_wire", "Copper Wire", {
PyuTest.make_wire("pyutest_electricity:copper_wire", "Copper Wire", {
snappy = PyuTest.BLOCK_NORMAL
}, "darkgoldenrod")
PyuTest.make_wire("pyutest_core:zinc_wire", "Zinc Wire", {
PyuTest.make_wire("pyutest_electricity:zinc_wire", "Zinc Wire", {
snappy = PyuTest.BLOCK_NORMAL
}, "#bed3d4", function (def, pos, node, clicker, sender_pos)
minetest.after(0.2, function ()
}, "#bed3d4", function(def, pos, node, clicker, sender_pos)
minetest.after(0.2, function()
def.__on_electricity_activated(pos, node, clicker, sender_pos)
end)
end)
PyuTest.make_node("pyutest_core:freezer_device", "Freezer Device", {
PyuTest.make_node("pyutest_electricity:freezer_device", "Freezer Device", {
cracky = PyuTest.BLOCK_FAST,
electric = 1
}, {"pyutest-freezer.png"}, {
}, { "pyutest-freezer.png" }, {
__on_electricity_activated = function(pos, node, clicker)
PyuTest.dorange(pos, 2, function (p)
PyuTest.dorange(pos, 2, function(p)
local n = minetest.get_node(p)
if minetest.get_item_group(n.name, "freezable") ~= 0 then
minetest.set_node(p, {name = "pyutest_core:ice_block"})
minetest.set_node(p, { name = "pyutest_blocks:ice_block" })
elseif minetest.get_item_group(n.name, "coolable") ~= 0 then
local def = minetest.registered_nodes[n.name]
local cool_into = def.__cool_into or "pyutest_core:water_source"
minetest.set_node(p, {name = cool_into})
local cool_into = def.__cool_into or "pyutest_blocks:water_source"
minetest.set_node(p, { name = cool_into })
end
end)
end
})
PyuTest.make_node("pyutest_core:heater_device", "Heater Device", {
PyuTest.make_node("pyutest_electricity:heater_device", "Heater Device", {
cracky = PyuTest.BLOCK_FAST,
electric = 1
}, {"pyutest-heater.png"}, {
}, { "pyutest-heater.png" }, {
__on_electricity_activated = function(pos, node, clicker)
PyuTest.dorange(pos, 2, function (p)
PyuTest.dorange(pos, 2, function(p)
local n = minetest.get_node(p)
if minetest.get_item_group(n.name, "thawable") ~= 0 then
local def = minetest.registered_nodes[n.name]
local thaw_into = def.__thaw_into or "pyutest_core:water_source"
minetest.set_node(p, {name = thaw_into})
local thaw_into = def.__thaw_into or "pyutest_blocks:water_source"
minetest.set_node(p, { name = thaw_into })
elseif minetest.get_item_group(n.name, "heatable") ~= 0 then
local def = minetest.registered_nodes[n.name]
local heat_into = def.__heat_into or "pyutest_core:lava_source"
minetest.set_node(p, {name = heat_into})
local heat_into = def.__heat_into or "pyutest_blocks:lava_source"
minetest.set_node(p, { name = heat_into })
end
end)
end
})
minetest.register_craft({
output = "pyutest_core:copper_wire 4",
output = "pyutest_electricity:copper_wire 4",
recipe = {
"pyutest_core:copper_ingot"
"pyutest_ores:copper_ingot"
},
type = "shapeless"
})
minetest.register_craft({
output = "pyutest_core:zinc_wire 4",
output = "pyutest_electricity:zinc_wire 4",
recipe = {
"pyutest_core:zinc_ingot"
"pyutest_ores:zinc_ingot"
},
type = "shapeless"
})
minetest.register_craft({
output = "pyutest_core:button",
output = "pyutest_electricity:button",
recipe = {
{"pyutest_core:stone_block", "pyutest_core:stone_block", "pyutest_core:stone_block"},
{"pyutest_core:stone_block", "pyutest_core:copper_ingot", "pyutest_core:stone_block"},
{"pyutest_core:stone_block", "pyutest_core:stone_block", "pyutest_core:stone_block"}
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_ores:copper_ingot", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" }
},
})
minetest.register_craft({
output = "pyutest_core:freezer_device",
output = "pyutest_electricity:freezer_device",
recipe = {
{"pyutest_core:stone_block", "pyutest_core:stone_block", "pyutest_core:stone_block"},
{"pyutest_core:stone_block", "pyutest_core:ice_block", "pyutest_core:stone_block"},
{"pyutest_core:stone_block", "pyutest_core:stone_block", "pyutest_core:stone_block"}
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_blocks:ice_block", "pyutest_blocks:stone_block" },
{ "pyutest_blocks:stone_block", "pyutest_blocks:stone_block", "pyutest_blocks:stone_block" }
},
})

View File

@ -0,0 +1 @@
depends = pyutest_blocks

View File

@ -0,0 +1,106 @@
PyuTest.registered_flowers = {}
PyuTest.make_flower = function (name, desc, texture, dye, add_to_registry, drawtype, econf)
PyuTest.make_node(name, desc, {
flammable = 1,
flower = 1,
attached_node = 3,
dig_immediate = 1,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST
}, {texture}, PyuTest.util.tableconcat({
drawtype = drawtype or "plantlike",
walkable = false,
waving = 1,
buildable_to = true,
paramtype = "light",
sunlight_propagates = true,
inventory_image = texture,
floodable = true
}, econf or {}))
if dye ~= nil then
minetest.register_craft({
output = dye .. " 2",
recipe = {name},
type = "shapeless"
})
end
-- This is for plants like deadbushes which I do not want spawning in for say, Forests.
if add_to_registry then
table.insert(PyuTest.registered_flowers, name)
end
end
PyuTest.make_flower("pyutest_flowers:rose", "Rose", "pyutest-flower.png", "pyutest_flowers:red_dye", true)
PyuTest.make_flower("pyutest_flowers:dandelion", "Dandelion", "pyutest-flower2.png", "pyutest_flowers:yellow_dye", true)
PyuTest.make_flower("pyutest_flowers:blue_daisy", "Blue Daisy", "pyutest-flower3.png", "pyutest_flowers:blue_dye", true)
PyuTest.make_flower("pyutest_flowers:lavender", "Lavender", "pyutest-flower4.png", "pyutest_flowers:purple_dye", true)
PyuTest.make_flower("pyutest_flowers:deadbush", "Deadbush", "pyutest-deadbush.png", "pyutest_flowers:brown_dye")
PyuTest.make_flower("pyutest_flowers:grass_plant", "Grass", "pyutest-grass-plant.png", "pyutest_flowers:green_dye")
PyuTest.make_flower("pyutest_flowers:sugarcane", "Sugarcane", "pyutest-sugarcane.png", "pyutest_flowers:green_dye", false, nil)
PyuTest.make_node("pyutest_flowers:lilypad", "Lily Pad", {
block = PyuTest.BLOCK_BREAKABLE_INSTANT
}, {"pyutest-lilypad.png"}, {
drawtype = "signlike",
paramtype = "light",
paramtype2 = "facedir",
buildable_to = true,
sunlight_propagates = true,
selection_box = {
type = "fixed",
fixed = {-0.5, -31/64, -0.5, 0.5, -15/32, 0.5}
},
})
PyuTest.make_flower("pyutest_flowers:maybell", "Maybell", "pyutest-maybell.png", "pyutest_flowers:white_dye", true)
PyuTest.make_flower("pyutest_flowers:orange_tulip", "Orange Tulip", "pyutest-orange-tulip.png", "pyutest_flowers:orange_dye", true)
PyuTest.make_flower("pyutest_flowers:black_rose", "Black Rose", "pyutest-black-rose.png", "pyutest_flowers:black_dye", false)
PyuTest.make_node("pyutest_flowers:vines", "Vines", {
snappy = PyuTest.BLOCK_FAST,
flammable = 1
}, {"pyutest-vines.png"}, {
drawtype = "signlike",
paramtype = "light",
walkable = false,
climbable = true,
buildable_to = true,
sunlight_propagates = true,
paramtype2 = "wallmounted",
selection_box = {
type = "wallmounted"
},
inventory_image = "pyutest-vines.png"
})
PyuTest.make_flower("pyutest_flowers:kelp", "Kelp", "pyutest-kelp.png", "pyutest_flowers:green_dye", false, "plantlike_rooted", {
paramtype2 = "leveled",
place_param2 = 128,
wield_image = "pyutest-kelp.png",
special_tiles = {
{
image = "pyutest-kelp.png",
tileable_vertical = true
},
},
tiles = {
"pyutest-gravel.png"
},
walkable = true
})
PyuTest.make_flower("pyutest_flowers:small_mushroom", "Small Mushroom", "pyutest-mushroom-small.png", "pyutest_flowers:red_dye", false, nil, {
groups = {
block = PyuTest.BLOCK_BREAKABLE_INSTANT,
flammable = 1,
flower = 1,
dig_immediate = 1,
attached_node = 1
},
paramtype2 = "wallmounted"
})

View File

@ -0,0 +1 @@
depends = pyutest_blocks

View File

@ -0,0 +1,85 @@
local function furnace_formspec(pos)
local spos = string.format("%d,%d,%d", pos.x, pos.y, pos.z)
local formspec = {
"size[8,9]",
"list[nodemeta:", spos, ";main;0,0;8,4;]",
"list[context;src;1,1;1,1;]",
"list[context;fuel;1,2.5;1,1;]",
"list[context;dst;5,1.25;2,2;]",
"button[0,3.5;4,2;smelt;Smelt]",
"button[4,3.5;4,2;smelt3;Smelt 3]",
"list[current_player;main;0,5;8,4;]"
}
return table.concat(formspec)
end
PyuTest.make_node("pyutest_furnace:furnace", "Furnace", {
cracky = PyuTest.BLOCK_NORMAL,
level = 1
}, {
"pyutest-furnace-top-bottom.png",
"pyutest-furnace-top-bottom.png",
"pyutest-furnace-sides.png",
"pyutest-furnace-sides.png",
"pyutest-furnace-sides.png",
"pyutest-furnace-front.png",
}, {
is_ground_content = false,
paramtype2 = "facedir",
on_construct = function(pos, placer)
local meta = minetest.get_meta(pos)
local inventory = meta:get_inventory()
inventory:set_size("src", 1)
inventory:set_size("fuel", 1)
inventory:set_size("dst", 4)
meta:set_string("formspec", furnace_formspec(pos))
end,
on_receive_fields = function(pos, formname, fields, player)
if fields.quit then
return
end
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
local function smelt()
local src = inv:get_stack("src", 1)
local fuel = inv:get_stack("fuel", 1)
if minetest.get_item_group(fuel:get_name(), "fuel") == 0 then
return
end
local output, decremented_input = minetest.get_craft_result({
method = "cooking",
width = 1,
items = {
src
}
})
if output.item:is_empty() then
return
end
inv:add_item("dst", output.item)
src:set_count(src:get_count() - output.item:get_count())
fuel:set_count(fuel:get_count() - 1)
inv:set_stack("src", 1, src)
inv:set_stack("fuel", 1, fuel)
end
if fields.smelt then
smelt()
end
if fields.smelt3 then
for i = 1, 3 do
smelt()
end
end
end,
})

View File

@ -0,0 +1,2 @@
name = pyutest_furnace
depends = pyutest_blocks

View File

@ -0,0 +1,121 @@
PyuTest.FURNITURE_NODEBOXES = {
TABLE = {
type = "connected",
fixed = {
{ -0.5, 0.5, -0.5, 0.5, 0.45, 0.5 },
{ -0.15, -0.5, -0.15, 0.15, 0.45, 0.15 },
},
}
}
PyuTest.registered_furniture = {}
PyuTest.make_furniture = function(name, desc, craft, tiles, cgroups, extra_conf)
local econf = extra_conf or {}
local groups = PyuTest.util.tablecopy(cgroups) or {
block = PyuTest.BLOCK_BREAKABLE_NORMAL
}
groups["block"] = groups["block"] or PyuTest.BLOCK_BREAKABLE_NORMAL
groups["furniture"] = 1
local id_table = name .. "_table"
local id_chair = name .. "_chair"
local id_mtable = name .. "_mtable"
minetest.register_node(id_table, PyuTest.util.tableconcat({
description = Translate(desc .. " Table"),
tiles = tiles,
groups = PyuTest.util.tableconcat(groups, {
table = 1
}),
sounds = PyuTest.make_node_sounds(),
drawtype = "nodebox",
paramtype = "light",
node_box = PyuTest.FURNITURE_NODEBOXES.TABLE,
connects_to = { "group:table" }
}, econf))
minetest.register_node(id_chair, PyuTest.util.tableconcat({
description = Translate(desc .. " Chair"),
tiles = tiles,
groups = PyuTest.util.tableconcat(groups, {
chair = 1,
attached_node = 3,
}),
sounds = PyuTest.make_node_sounds(),
paramtype = "light",
paramtype2 = "4dir",
drawtype = "mesh",
mesh = "chair.obj",
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 1.1, 0.5 }
},
collision_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.10, 0.5 }
}
}
}, econf))
minetest.register_node(id_mtable, PyuTest.util.tableconcat({
description = Translate(desc .. " Mini Table"),
tiles = tiles,
groups = PyuTest.util.tableconcat(groups, {
mtable = 1,
attached_node = 3,
}),
sounds = PyuTest.make_node_sounds(),
paramtype = "light",
paramtype2 = "4dir",
drawtype = "mesh",
mesh = "mtable.obj",
selection_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.25, 0.5 }
},
collision_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.25, 0.5 }
}
}
}, econf))
minetest.register_craft({
output = id_table .. " 4",
recipe = {
{ craft, craft, craft },
{ "", craft, "" },
{ "", craft, "" }
}
})
minetest.register_craft({
output = id_chair .. " 4",
recipe = {
{ craft, "", "" },
{ craft, craft, craft },
{ craft, "", craft }
}
})
minetest.register_craft({
output = id_mtable .. " 4",
recipe = {
{ craft, craft, craft },
{ craft, craft, craft }
}
})
PyuTest.registered_furniture[name] = {
craft = craft,
groups = groups,
tiles = tiles,
econf = econf
}
end
for _, v in pairs(PyuTest.building_blocks) do
PyuTest.make_furniture("pyutest_furniture:"..v.name, v.desc, v.ns..":"..v.name .. "_block", v.tiles, v.groups, v.econf)
end

View File

@ -0,0 +1 @@
depends = pyutest_blocks

View File

@ -0,0 +1,33 @@
PyuTest.make_leaves = function(id, desc, tiles)
PyuTest.make_building_blocks(id.."_leaves", desc .. " Leaves", tiles, nil, {
acid_vulnerable = 1,
flammable = 1,
snappy = PyuTest.BLOCK_FAST
}, {
is_ground_content = false
})
local leaves_id = id .. "_leaves_block"
minetest.override_item(leaves_id, {
drop = {
max_items = 1,
items = {
{
rarity = 2.5,
items = { "pyutest_tools:apple 1" }
},
{
items = { leaves_id }
}
}
}
})
end
PyuTest.make_leaves("pyutest_leaves:oak", "Oak", { "pyutest-leaves.png" })
PyuTest.make_leaves("pyutest_leaves:snowy", "Snowy", { "pyutest-snowy-leaves.png" })
PyuTest.make_leaves("pyutest_leaves:cherry", "Cherry", { "pyutest-cherry-leaves.png" })
PyuTest.make_leaves("pyutest_leaves:dark", "Dark", { "pyutest-dark-leaves.png" })
PyuTest.make_leaves("pyutest_leaves:aspen", "Aspen", { "pyutest-aspen-leaves.png" })
PyuTest.make_leaves("pyutest_leaves:red_aspen", "Red Aspen", { "pyutest-red-aspen-leaves.png" })

View File

@ -0,0 +1 @@
depends = pyutest_blocks

View File

@ -0,0 +1,61 @@
PyuTest.registered_lootboxes = {}
PyuTest.make_lootbox = function (name, dname, items)
local id = name.."_lootbox"
minetest.register_node(id, {
description = Translate(dname .. " Lootbox"),
groups = {
choppy = PyuTest.BLOCK_NORMAL,
not_in_creative_inventory = 1
},
tiles = {"pyutest-crate.png"},
sounds = PyuTest.make_node_sounds(),
drop = "",
after_destruct = function (pos)
for _, v in pairs(items) do
minetest.add_item(pos, v)
end
minetest.sound_play("lootbox_unlock", {
pos = pos,
gain = 1
})
minetest.remove_node(pos)
end
})
PyuTest.registered_lootboxes[name] = {
id = id,
items = items
}
end
PyuTest.make_lootbox("pyutest_lootboxes:trash", "Trash", {
ItemStack("pyutest_flowers:deadbush 6"),
ItemStack("pyutest_tools:bone 3"),
ItemStack("pyutest_tools:ash 2")
})
PyuTest.make_lootbox("pyutest_lootboxes:resource", "Resource", {
ItemStack("pyutest_tools:gunpowder 3"),
ItemStack("pyutest_tools:stick 4"),
ItemStack("pyutest_tools:sugar 2"),
ItemStack("pyutest_tools:apple 3"),
ItemStack("pyutest_tools:string 5")
})
PyuTest.make_lootbox("pyutest_lootboxes:griefer", "Griefer's Dream", {
ItemStack("pyutest_blocks:tnt 3"),
ItemStack("pyutest_tools:bomb 2")
})
PyuTest.make_lootbox("pyutest_lootboxes:lighting", "Lighting", {
ItemStack("pyutest_blocks:light 2"),
ItemStack("pyutest_blocks:torch 5")
})
PyuTest.make_lootbox("pyutest_lootboxes:color", "Color", {
ItemStack("pyutest_wool:green_dye 2"),
ItemStack("pyutest_wool:pink_dye 3"),
ItemStack("pyutest_wool:white_dye 1"),
ItemStack("pyutest_wool:black_dye 3"),
ItemStack("pyutest_wool:brown_dye 2")
})

View File

@ -0,0 +1 @@
depends = pyutest_blocks,pyutest_tools

View File

@ -0,0 +1,154 @@
PyuTest.make_item("pyutest_magic:magic_shards", "Magic Shards", {}, "pyutest-magic-shards.png")
minetest.override_item("pyutest_blocks:enchanted_obsidian_block", {
drop = {
max_items = 1,
items = {
{
rarity = 3.2,
items = {"pyutest_magic:magic_shards 3"}
},
{
items = {"enchanted_obsidian_block_obsidian_block"}
}
}
}
})
PyuTest.registered_spellbooks = {}
PyuTest.make_spellbook = function (nsname, desc, color, craftitem, action)
if action == nil then
action = function(_, _, _)end
end
PyuTest.make_item(nsname, desc, {}, "pyutest-spellbook.png", {
stack_max = 1,
color = color,
on_use = function (itemstack, user, pointed_thing)
local pos = user:get_pos()
minetest.sound_play({name = "spellbook_action", gain = 0.75}, {pos = pos})
action(itemstack, user, pointed_thing)
end
})
minetest.register_craft({
output = nsname,
recipe = {
{"", "pyutest_magic:magic_shards", ""},
{"pyutest_magic:magic_shards", craftitem, "pyutest_magic:magic_shards"},
{"", "pyutest_magic:magic_shards", ""}
}
})
PyuTest.registered_spellbooks[nsname] = {
color = color,
craftitem = craftitem,
action = action
}
end
PyuTest.make_spellbook("pyutest_magic:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_magic:bomb", function (itemstack, user)
PyuTest.create_explosion(user:get_pos(), 3, false, 7, user)
end)
PyuTest.make_spellbook("pyutest_magic:fire_spellbook", "Spellbook of Fire", "crimson", "pyutest_magic:hellstone_block", function (itemstack, user)
local range = 2
local function replace(pos)
local node = minetest.get_node_or_nil(pos)
if node == nil then return end
if node.name ~= "air" then return end
local pos2 = vector.new(pos.x, pos.y - 1, pos.z)
node = minetest.get_node_or_nil(pos)
if node == nil then return end
if node.name ~= "air" then return end
minetest.set_node(pos, {name = "pyutest_magic:fire"})
end
for dx = -range, range do
for dz = -range, range do
local pos = user:get_pos()
replace({x = pos.x + dx, y = pos.y, z = pos.z + dz})
end
end
end)
PyuTest.make_item("pyutest_magic:enchanted_shard", "Enchanted Shard", {}, "pyutest-shard.png", {
color = "indigo",
})
minetest.register_craft({
output = "pyutest_magic:enchanted_shard 2",
recipe = {
{"pyutest_magic:magic_shards", "pyutest_magic:diamond_shard", "pyutest_magic:magic_shards"},
{"pyutest_magic:emerald_shard", "pyutest_magic:magic_shards", "pyutest_magic:emerald_shard"},
{"pyutest_magic:magic_shards", "pyutest_magic:diamond_shard", "pyutest_magic:magic_shards"}
}
})
PyuTest.make_tool("pyutest_magic:enchanted_pickaxe", "Enchanted Pickaxe", {}, "pyutest-enchanted-pickaxe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 2768,
attack_uses = 2768 / 2,
maxlevel = 4,
groupcaps = {
cracky = {
times = {
[PyuTest.BLOCK_FAST] = 0.25,
[PyuTest.BLOCK_NORMAL] = 0.6,
[PyuTest.BLOCK_SLOW] = 7
}
}
}
}),
})
minetest.register_craft({
output = "pyutest_magic:enchanted_pickaxe",
recipe = {
{"pyutest_magic:enchanted_shard", "pyutest_magic:enchanted_shard", "pyutest_magic:enchanted_shard"},
{"", "pyutest_magic:stick", ""},
{"", "pyutest_magic:stick", ""}
}
})
PyuTest.make_sword("pyutest_magic:enchanted_sword", "Enchanted Sword", "pyutest-enchanted-sword.png", 9, 3600, 0.7)
minetest.register_craft({
output = "pyutest_magic:enchanted_sword",
recipe = {
{"pyutest_magic:enchanted_shard"},
{"pyutest_magic:enchanted_shard"},
{"pyutest_magic:stick"}
}
})
PyuTest.make_item("pyutest_magic:windball", "Windball", {}, "pyutest-windball.png", {
stack_max = 16,
on_use = function (_, user)
if user == nil then
return
end
local pos = user:get_pos()
minetest.sound_play({name = "spellbook_action", gain = 0.75}, {pos = pos})
local vel = user:get_velocity()
user:add_velocity({
x = vel.x * 2.5,
z = vel.z * 2.5,
y = math.random(11, 14)
})
local stack = user:get_wielded_item()
stack:set_count(stack:get_count() - 1)
user:set_wielded_item(stack)
end
})

View File

@ -0,0 +1 @@
depends = pyutest_tools,pyutest_blocks

View File

@ -0,0 +1,8 @@
minetest.override_item("pyutest_blocks:clay_block", {
drop = "pyutest_core:clay 3"
})
minetest.override_item("pyutest_blocks:bone_block", {
paramtype2 = "facedir",
on_place = minetest.rotate_node
})

View File

@ -0,0 +1 @@
depends = pyutest_blocks

View File

@ -0,0 +1,62 @@
PyuTest.make_item = function (nsname, desc, groups, wield_image, extra_conf)
local conf = {
description = Translate(desc),
wield_image = wield_image,
inventory_image = wield_image,
groups = groups
}
if extra_conf ~= nil then
for k, v in pairs(extra_conf) do
conf[k] = v
end
end
minetest.register_craftitem(nsname, conf)
end
PyuTest.make_tool = function (nsname, desc, groups, wield_image, extra_conf)
local conf = {
description = Translate(desc),
wield_image = wield_image,
inventory_image = wield_image,
groups = PyuTest.util.tableconcat(groups, {
tool = 1
})
}
if extra_conf ~= nil then
for k, v in pairs(extra_conf) do
conf[k] = v
end
end
minetest.register_tool(nsname, conf)
end
PyuTest.make_sword = function (nsname, desc, texture, damage, durability, atkspeed)
PyuTest.make_tool(nsname, desc, {
weapon = 1
}, texture, {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = durability / 2,
attack_uses = durability,
damage_groups = {fleshy = damage or 3},
full_punch_interval = atkspeed or 1
})
})
end
PyuTest.make_food = function (nsname, desc, wield_image, health_fill, extra_code)
local code = extra_code or function()end
PyuTest.make_item(nsname, desc, {}, wield_image, {
on_use = function (itemstack, user, pt)
if user == nil then return end
minetest.sound_play({name = "eat", gain = 1}, {pos = user:get_pos(), start_time = 1.2})
minetest.do_item_eat(health_fill, "", itemstack, user, pt)
code()
end
})
end

View File

@ -0,0 +1,4 @@
PyuTest.make_sword("pyutest_tools:wooden_sword", "Wooden Sword", "pyutest-wooden-sword.png", 4, 69, 1.1)
PyuTest.make_sword("pyutest_tools:stone_sword", "Stone Sword", "pyutest-stone-sword.png", 5, 274, 1.05)
PyuTest.make_sword("pyutest_tools:iron_sword", "Iron Sword", "pyutest-iron-sword.png", 6, 689, 0.8)
PyuTest.make_sword("pyutest_tools:diamond_sword", "Diamond Sword", "pyutest-diamond-sword.png", 7, 1345, 0.7)

View File

@ -0,0 +1,3 @@
PyuTest.make_food("pyutest_tools:apple", "Apple", "pyutest-apple.png", 6)
PyuTest.make_food("pyutest_tools:bread", "Bread", "pyutest-bread.png", 4)
PyuTest.make_food("pyutest_tools:water_bottle", "Water Bottle", "pyutest-water-bottle.png", 0)

View File

@ -0,0 +1,7 @@
local modpath = minetest.get_modpath("pyutest_tools")
dofile(modpath.."/api.lua")
dofile(modpath.."/tools.lua")
dofile(modpath.."/items.lua")
dofile(modpath.."/combat.lua")
dofile(modpath.."/food.lua")

View File

@ -0,0 +1,34 @@
PyuTest.make_item("pyutest_tools:stick", "Stick", {}, "pyutest-stick.png")
PyuTest.make_item("pyutest_tools:bone", "Bone", {}, "pyutest-bone.png", {})
PyuTest.make_item("pyutest_tools:gunpowder", "Gunpowder", {}, "pyutest-powder.png", {
color = "dimgray",
})
PyuTest.make_item("pyutest_tools:ash", "Ash", {}, "pyutest-powder.png", {
color = "gray",
})
PyuTest.make_item("pyutest_tools:sugar", "Sugar", {}, "pyutest-powder.png")
PyuTest.make_item("pyutest_tools:coin", "Coin", {}, "pyutest-coin.png", {
on_secondary_use = function (_, user)
local pos = user:get_pos()
minetest.sound_play({name = "coin", gain = 1}, {
pos = pos
})
return nil
end
})
PyuTest.make_item("pyutest_tools:wheat", "Wheat", {}, "pyutest-wheat.png")
PyuTest.make_item("pyutest_tools:string", "String", {}, "pyutest-string.png")
PyuTest.make_item("pyutest_tools:egg", "Egg", {}, "pyutest-egg.png", {
color = "peachpuff"
})
PyuTest.make_item("pyutest_tools:clay", "Clay Ball", {}, "pyutest-clay.png")
PyuTest.make_item("pyutest_tools:glass_bottle", "Glass Bottle", {}, "pyutest-glass-bottle.png", {
stack_max = 16
})
PyuTest.make_item("pyutest_tools:brick", "Brick", {}, "pyutest-brick.png")
PyuTest.make_item("pyutest_tools:snowball", "Snowball", {}, "pyutest-snowball.png")
PyuTest.make_item("pyutest_tools:bone", "Bone", {}, "pyutest-bone.png")

View File

@ -0,0 +1 @@
name = pyutest_tools

View File

@ -0,0 +1,151 @@
PyuTest.make_tool("pyutest_tools:wooden_pickaxe", "Wooden Pickaxe", {}, "pyutest-wooden-pickaxe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 69,
attack_uses = 69 / 2,
maxlevel = 1,
groupcaps = {
cracky = {
times = {
[PyuTest.BLOCK_FAST] = 2,
[PyuTest.BLOCK_NORMAL] = 3
}
}
}
})
})
PyuTest.make_tool("pyutest_tools:stone_pickaxe", "Stone Pickaxe", {}, "pyutest-stone-pickaxe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 274,
attack_uses = 274 / 2,
maxlevel = 2,
groupcaps = {
cracky = {
times = {
[PyuTest.BLOCK_FAST] = 1.8,
[PyuTest.BLOCK_NORMAL] = 2.4
}
}
}
})
})
PyuTest.make_tool("pyutest_tools:iron_pickaxe", "Iron Pickaxe", {}, "pyutest-iron-pickaxe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 689,
attack_uses = 689 / 2,
maxlevel = 3,
groupcaps = {
cracky = {
times = {
[PyuTest.BLOCK_FAST] = 0.7,
[PyuTest.BLOCK_NORMAL] = 1.5
}
}
}
})
})
PyuTest.make_tool("pyutest_tools:diamond_pickaxe", "Diamond Pickaxe", {}, "pyutest-diamond-pickaxe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 1345,
attack_uses = 1345 / 2,
maxlevel = 3,
groupcaps = {
cracky = {
times = {
[PyuTest.BLOCK_FAST] = 0.3,
[PyuTest.BLOCK_NORMAL] = 0.8,
[PyuTest.BLOCK_SLOW] = 8
}
}
}
})
})
PyuTest.make_tool("pyutest_tools:wooden_axe", "Wooden Axe", {}, "pyutest-wooden-axe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 69,
attack_uses = 69 / 2,
groupcaps = {
choppy = {
times = {
[PyuTest.BLOCK_FAST] = 1.1,
[PyuTest.BLOCK_NORMAL] = 1.6,
[PyuTest.BLOCK_SLOW] = 2.2
}
}
}
})
})
PyuTest.make_tool("pyutest_tools:stone_axe", "Stone Axe", {}, "pyutest-stone-axe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 274,
attack_uses = 274 / 2,
groupcaps = {
choppy = {
times = {
[PyuTest.BLOCK_FAST] = 0.98,
[PyuTest.BLOCK_NORMAL] = 1.23,
[PyuTest.BLOCK_SLOW] = 2
}
}
}
})
})
PyuTest.make_tool("pyutest_tools:iron_axe", "Iron Axe", {}, "pyutest-iron-axe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 689,
attack_uses = 689 / 2,
groupcaps = {
choppy = {
times = {
[PyuTest.BLOCK_FAST] = 0.4,
[PyuTest.BLOCK_NORMAL] = 0.6,
[PyuTest.BLOCK_SLOW] = 1.8
}
}
}
})
})
PyuTest.make_tool("pyutest_tools:diamond_axe", "Diamond Axe", {}, "pyutest-diamond-axe.png", {
stack_max = 1,
tool_capabilities = PyuTest.tool_caps({
uses = 1345,
attack_uses = 1345 / 2,
groupcaps = {
choppy = {
times = {
[PyuTest.BLOCK_FAST] = 0.3,
[PyuTest.BLOCK_NORMAL] = 0.4,
[PyuTest.BLOCK_SLOW] = 1.4
}
}
}
})
})
PyuTest.make_item("pyutest_tools:bomb", "Bomb", {}, "pyutest-bomb.png", {
stack_max = 16,
on_use = function (_, user)
if user == nil then
return
end
local pos = user:get_pos()
PyuTest.create_explosion(pos, 2, false, 6, user)
local stack = user:get_wielded_item()
stack:set_count(stack:get_count() - 1)
user:set_wielded_item(stack)
end
})

View File

@ -0,0 +1,96 @@
PyuTest.registered_wood = {}
PyuTest.make_wood = function(id, desc, ltiles, btiles)
PyuTest.make_building_blocks(id .. "_log", desc .. " Log", ltiles, nil, {
choppy = PyuTest.BLOCK_NORMAL,
acid_vulnerable = 1,
flammable = 1,
}, {
is_ground_content = false
})
PyuTest.make_building_blocks(id .. "_wood", desc .. " Wood", btiles, nil, {
choppy = PyuTest.BLOCK_NORMAL,
acid_vulnerable = 1,
flammable = 1,
}, {
is_ground_content = false
})
local log_id = id .. "_log_block"
local wood_id = id .. "_wood_block"
minetest.override_item(log_id, {
groups = PyuTest.util.tableconcat(minetest.registered_nodes[log_id].groups, {
wooden_log = 1,
fuel = 1
}),
paramtype2 = "facedir",
on_place = minetest.rotate_node
})
minetest.override_item(wood_id, {
groups = PyuTest.util.tableconcat(minetest.registered_nodes[wood_id].groups, {
wooden_planks = 1,
fuel = 1
})
})
minetest.register_craft({
output = id .. "_wood_block 4",
recipe = { id .. "_log_block" },
type = "shapeless"
})
PyuTest.registered_wood[id] = {
log = log_id,
wood = wood_id
}
end
PyuTest.make_wood("pyutest_wood:oak", "Oak", {
"pyutest-log-top-bottom.png",
"pyutest-log-top-bottom.png",
"pyutest-log.png"
}, {
"pyutest-wood.png"
})
PyuTest.make_wood("pyutest_wood:savanna", "Savanna", {
"pyutest-savanna-log-top-bottom.png",
"pyutest-savanna-log-top-bottom.png",
"pyutest-savanna-log.png"
}, {
"pyutest-savanna-wood.png"
})
PyuTest.make_wood("pyutest_wood:birch", "Birch", {
"pyutest-birch-log-top-bottom.png",
"pyutest-birch-log-top-bottom.png",
"pyutest-birch-log.png"
}, {
"pyutest-birch-wood.png"
})
PyuTest.make_wood("pyutest_wood:cherry", "Cherry", {
"pyutest-cherry-log-top-bottom.png",
"pyutest-cherry-log-top-bottom.png",
"pyutest-cherry-log.png"
}, {
"pyutest-cherry-wood.png"
})
PyuTest.make_wood("pyutest_wood:redwood", "Redwood", {
"pyutest-redwood-log-top-bottom.png",
"pyutest-redwood-log-top-bottom.png",
"pyutest-redwood-log.png"
}, {
"pyutest-redwood.png"
})
PyuTest.make_wood("pyutest_wood:jungle", "Jungle", {
"pyutest-jungle-log-top-bottom.png",
"pyutest-jungle-log-top-bottom.png",
"pyutest-jungle-log.png"
}, {
"pyutest-jungle-wood.png"
})

View File

@ -0,0 +1 @@
depends = pyutest_blocks

View File

@ -0,0 +1,94 @@
PyuTest.registered_colored_blocks = {}
PyuTest.make_colored_blocks = function(name, desc, color)
PyuTest.make_building_blocks(name.."_wool", desc.." Wool", {
"pyutest-wool.png"
}, color or "white", {
oddly_breakable_by_hand = PyuTest.BLOCK_NORMAL,
colored = 1
})
PyuTest.make_building_blocks(name.."_terracotta", desc .. " Terracotta", {
"pyutest-terracotta.png"
}, color or "white", {
cracky = PyuTest.BLOCK_FAST,
colored = 1
})
PyuTest.make_item(name.."_dye", desc.." Dye", {}, "pyutest-dye.png", {
color = color or "white"
})
minetest.register_craft({
output = name.."_wool_block",
type = "shapeless",
recipe = {
"pyutest_wool:white_wool_block",
name.."_dye"
}
})
minetest.register_craft({
output = name.."_terracotta_block",
type = "shapeless",
recipe = {
"pyutest_wool:white_terracotta_block",
name.."_dye"
}
})
PyuTest.registered_colored_blocks[name] = {
wool = name.."_wool",
terracotta = name.."_terracotta",
dye = name.."_dye"
}
end
PyuTest.make_colored_blocks("pyutest_wool:white", "White", "white")
minetest.register_craft({
output = "pyutest_wool:white_wool_block 4",
recipe = {
{"pyutest_tools:string", "pyutest_tools:string"},
{"pyutest_tools:string", "pyutest_tools:string"}
}
})
minetest.register_craft({
type = "cooking",
output = "pyutest_wool:white_terracotta_block",
recipe = "pyutest_blocks:clay_block"
})
PyuTest.COLORS = {
white = {"White", nil},
black = {"Black", {r = 32, g = 32, b = 32}},
brown = {"Brown", "saddlebrown"},
red = {"Red", "indianred"},
orange = {"Orange", "coral"},
yellow = {"Yellow", "khaki"},
green = {"Green", "olivedrab"},
blue = {"Blue", "cornflowerblue"},
purple = {"Purple", "plum"},
pink = {"Pink", "pink"},
lime = {"Lime", "#64C044"}
}
for k, v in pairs(PyuTest.COLORS) do
PyuTest.make_colored_blocks("pyutest_wool:"..k, v[1], v[2])
end
PyuTest.make_dye_mixing_recipe = function(c1, c2, out)
minetest.register_craft({
type = "shapeless",
output = out .. " 2",
recipe = {
c1, c2
}
})
end
PyuTest.make_dye_mixing_recipe("pyutest_wool:red_dye", "pyutest_wool:blue_dye", "pyutest_wool:purple_dye")
PyuTest.make_dye_mixing_recipe("pyutest_wool:red_dye", "pyutest_wool:yellow_dye", "pyutest_wool:orange_dye")
PyuTest.make_dye_mixing_recipe("pyutest_wool:yellow_dye", "pyutest_wool:blue_dye", "pyutest_wool:green_dye")
PyuTest.make_dye_mixing_recipe("pyutest_wool:red_dye", "pyutest_wool:white_dye", "pyutest_wool:pink_dye")
PyuTest.make_dye_mixing_recipe("pyutest_wool:red_dye", "pyutest_wool:green_dye", "pyutest_wool:brown_dye")

View File

@ -0,0 +1 @@
depends = pyutest_blocks

0
mods/MAPGEN/modpack.conf Normal file
View File

View File

@ -0,0 +1,10 @@
local modpath = minetest.get_modpath("pyutest_mapgen")
dofile(modpath.."/api.lua")
dofile(modpath.."/mapgen.lua")
dofile(modpath.."/worlds.lua")
if not PyuTest.is_flat() then
dofile(modpath.."/structures.lua")
dofile(modpath.."/trees.lua")
end

View File

@ -0,0 +1,446 @@
minetest.register_alias("mapgen_stone", "pyutest_blocks:stone_block")
minetest.register_alias("mapgen_water_source", "pyutest_blocks:water_source")
minetest.register_alias("mapgen_river_water_source", "pyutest_blocks:water_source")
minetest.register_alias("mapgen_lava_source", "pyutest_blocks:lava_source")
minetest.register_alias("mapgen_singlenode", "air")
local mg_flags = minetest.settings:get_flags("mg_flags")
local mg_name = minetest.get_mapgen_setting("mg_name")
minetest.set_mapgen_setting(string.format("mg%s_cavern_threshold", mg_name), "0.20", true)
mg_flags.caverns = true
mg_flags.dungeons = false
-- https://git.minetest.land/VoxeLibre/VoxeLibre/src/branch/master/mods/MAPGEN/mcl_mapgen_core/init.lua#L127
local mg_flags_str = ""
for k,v in pairs(mg_flags) do
if v == false then
k = "no" .. k
end
mg_flags_str = mg_flags_str .. k .. ","
end
if string.len(mg_flags_str) > 0 then
mg_flags_str = string.sub(mg_flags_str, 1, string.len(mg_flags_str)-1)
end
minetest.set_mapgen_setting("mg_flags", mg_flags_str, true)
-- Biomes
PyuTest.BIOME_TOPS = {
grassland = 30,
forest = 35,
desert = 70,
frozen_plains = 30,
mountains = 300,
mushroom_fields = 30,
ice_spikes = 250,
swamp = 10
}
-- Overworld biome types
PyuTest.BIOME_TYPES = {
-- Normal biomes (Forests for example)
NORMAL = 1,
-- Chilly biomes, but not snowy (Taigas for example)
CHILLY = 2,
-- Snowy biomes (Frozen Plains for example)
COLD = 3,
-- Warm biomes (Savannas for example)
WARM = 4,
-- Hot biomes (Deserts for example)
DESERT = 5,
-- Wasteland biomes (Wastelands and Volcano for example)
WASTELAND = 6,
-- Wetland biomes (Swamps for example)
WETLAND = 7,
-- Ocean biomes (What example do you want?)
OCEAN = 8,
-- Cave biomes (What example do you want?)
CAVE = 9
}
PyuTest.get_biomes_from_type = function(type)
local biomes = {}
for k, v in pairs(minetest.registered_biomes) do
if v._pyutest_biome_type == type then
biomes[k] = v
end
end
return biomes
end
PyuTest.get_flowering_biomes = function ()
local biomes = {}
for k, v in pairs(minetest.registered_biomes) do
if v._pyutest_biome_flowering == true and v._pyutest_biome_flowering_extra == false then
table.insert(biomes, k)
end
end
return biomes
end
PyuTest.get_extra_flowering_biomes = function ()
local biomes = {}
for k, v in pairs(minetest.registered_biomes) do
if v._pyutest_biome_flowering == true and v._pyutest_biome_flowering_extra == true then
table.insert(biomes, k)
end
end
return biomes
end
-- wrapper around minetest.register_biome but with defaults and caves
PyuTest.register_overworld_biome = function(name, type, opts)
local nopts = PyuTest.util.tablecopy(opts) or {}
nopts["name"] = name
nopts["depth_top"] = nopts["depth_top"] or 1
nopts["depth_filler"] = nopts["depth_filler"] or 3
nopts["depth_riverbed"] = nopts["depth_riverbed"] or 2
nopts["depth_water_top"] = nopts["depth_water_top"] or nil -- cant think of a sane default..
nopts["node_water"] = nopts["node_water"] or "pyutest_blocks:water_source"
nopts["node_river_water"] = nopts["node_river_water"] or "pyutest_blocks:water_source"
nopts["node_riverbed"] = nopts["node_riverbed"] or "pyutest_blocks:gravel_block"
minetest.register_biome(PyuTest.util.tableconcat(nopts, {
_pyutest_biome_type = type,
}))
minetest.register_biome(PyuTest.util.tableconcat({
name = name.."_ocean",
node_top = nopts["node_riverbed"],
depth_top = 2,
node_filler = nopts["node_riverbed"],
depth_filler = 3,
depth_riverbed = 2,
node_water = nopts["node_water"],
node_river_water = nopts["node_river_water"],
heat_point = nopts["heat_point"],
humidity_point = nopts["humidity_point"],
y_max = 0,
y_min = PyuTest.OCEAN_MIN
}, {
_pyutest_biome_type = PyuTest.BIOME_TYPES.OCEAN,
_pyutest_ocean_type = type
}))
minetest.register_biome(PyuTest.util.tableconcat({
name = name.."_deep_ocean",
node_top = nopts["node_riverbed"],
depth_top = 2,
node_filler = nopts["node_riverbed"],
depth_filler = 3,
depth_riverbed = 2,
node_water = nopts["node_water"],
node_river_water = nopts["node_river_water"],
heat_point = nopts["heat_point"],
humidity_point = nopts["humidity_point"],
y_max = PyuTest.DEEP_OCEAN_MAX,
y_min = PyuTest.DEEP_OCEAN_MIN,
vertical_blend = 5
}, {
_pyutest_biome_type = PyuTest.BIOME_TYPES.OCEAN,
_pyutest_ocean_type = type
}))
minetest.register_biome(PyuTest.util.tableconcat({
name = name.."_cave",
heat_point = nopts["heat_point"],
humidity_point = nopts["humidity_point"],
y_max = PyuTest.DEEP_OCEAN_MIN - 1,
y_min = PyuTest.OVERWORLD_BOTTOM,
}, {
_pyutest_biome_type = PyuTest.BIOME_TYPES.CAVE,
_pyutest_cave_type = type
}))
end
if PyuTest.is_flat() then
PyuTest.register_overworld_biome("flat", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:dark_grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.grassland,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 50,
humidity_point = 50,
})
return
end
PyuTest.register_overworld_biome("grassland", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.grassland,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 53,
humidity_point = 57,
_pyutest_biome_flowering = true
})
PyuTest.register_overworld_biome("forest", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:dark_grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.forest,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 50,
humidity_point = 65,
_pyutest_biome_flowering = true
})
PyuTest.register_overworld_biome("stony_mountains", PyuTest.BIOME_TYPES.WARM, {
node_top = "pyutest_blocks:stone_block",
node_filler = "pyutest_blocks:stone_block",
y_max = PyuTest.BIOME_TOPS.mountains,
y_min = PyuTest.BIOME_TOPS.grassland,
heat_point = 65,
humidity_point = 8
})
PyuTest.register_overworld_biome("desert", PyuTest.BIOME_TYPES.DESERT, {
node_top = "pyutest_blocks:sand_block",
node_filler = "pyutest_blocks:sandstone_block",
node_riverbed = "pyutest_blocks:sand_block",
y_max = PyuTest.BIOME_TOPS.desert,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 84,
humidity_point = 4
})
PyuTest.register_overworld_biome("desert_mountains", PyuTest.BIOME_TYPES.DESERT, {
node_top = "pyutest_blocks:sand_block",
node_filler = "pyutest_blocks:sandstone_block",
y_max = PyuTest.BIOME_TOPS.mountains,
y_min = PyuTest.BIOME_TOPS.desert,
heat_point = 83,
humidity_point = 6
})
PyuTest.register_overworld_biome("snowy_mountains", PyuTest.BIOME_TYPES.COLD, {
node_dust = "pyutest_blocks:snow_carpet",
node_top = "pyutest_blocks:snow_block",
node_filler = "pyutest_blocks:snow_block",
y_max = PyuTest.BIOME_TOPS.mountains,
y_min = PyuTest.BIOME_TOPS.frozen_plains,
heat_point = 6,
humidity_point = 72
})
PyuTest.register_overworld_biome("frozen_plains", PyuTest.BIOME_TYPES.COLD, {
node_dust = "pyutest_blocks:snow_carpet",
node_top = "pyutest_blocks:snow_block",
node_filler = "pyutest_blocks:snow_block",
y_max = PyuTest.BIOME_TOPS.frozen_plains,
y_min = PyuTest.SURFACE_BOTTOM,
node_water_top = "pyutest_blocks:ice_block",
depth_water_top = 5,
heat_point = 9,
humidity_point = 67
})
PyuTest.register_overworld_biome("mushroom_fields", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:mycelium_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.mushroom_fields,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 53,
humidity_point = 94
})
PyuTest.register_overworld_biome("ice_spikes", PyuTest.BIOME_TYPES.COLD, {
node_top = "pyutest_blocks:ice_block",
node_filler = "pyutest_blocks:ice_block",
y_max = PyuTest.BIOME_TOPS.ice_spikes,
y_min = PyuTest.SURFACE_BOTTOM,
node_water_top = "pyutest_blocks:ice_block",
depth_water_top = 5,
heat_point = 9,
humidity_point = 70
})
PyuTest.register_overworld_biome("meadow", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:dark_grass_block",
node_filler = "pyutest_blocks:dirt_block",
depth_filler = 4,
y_max = PyuTest.BIOME_TOPS.mountains,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 52,
humidity_point = 83,
_pyutest_biome_flowering = true,
_pyutest_biome_flowering_extra = true
})
PyuTest.register_overworld_biome("snowy_forest", PyuTest.BIOME_TYPES.COLD, {
node_dust = "pyutest_blocks:snow_carpet",
node_top = "pyutest_blocks:snow_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.forest,
y_min = PyuTest.SURFACE_BOTTOM,
node_water_top = "pyutest_blocks:ice_block",
depth_water_top = 5,
heat_point = 8,
humidity_point = 69
})
PyuTest.register_overworld_biome("savanna", PyuTest.BIOME_TYPES.WARM, {
node_top = "pyutest_blocks:savanna_grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.grassland,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 72,
humidity_point = 9
})
PyuTest.register_overworld_biome("taiga", PyuTest.BIOME_TYPES.CHILLY, {
node_top = "pyutest_blocks:dark_grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.forest,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 28,
humidity_point = 72,
_pyutest_biome_flowering = true
})
PyuTest.register_overworld_biome("birch_forest", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.forest,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 48,
humidity_point = 85,
_pyutest_biome_flowering = true
})
PyuTest.register_overworld_biome("cherry_grove", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.forest,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 52,
humidity_point = 78,
_pyutest_biome_flowering = true,
_pyutest_biome_flowering_extra = true
})
PyuTest.register_overworld_biome("swamp", PyuTest.BIOME_TYPES.WETLAND, {
node_top = "pyutest_blocks:swampy_grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.swamp,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 52,
humidity_point = 88,
})
PyuTest.register_overworld_biome("old_growth_birch_forest", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.forest,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 47,
humidity_point = 73,
_pyutest_biome_flowering = true,
_pyutest_biome_flowering_extra = true
})
PyuTest.register_overworld_biome("aspen_forest", PyuTest.BIOME_TYPES.CHILLY, {
node_top = "pyutest_blocks:aspen_grass_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.forest,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 25,
humidity_point = 63,
_pyutest_biome_flowering = true
})
PyuTest.register_overworld_biome("redwood_forest", PyuTest.BIOME_TYPES.CHILLY, {
node_top = "pyutest_blocks:podzol_block",
node_filler = "pyutest_blocks:podzol_block",
y_max = PyuTest.BIOME_TOPS.forest,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 21,
humidity_point = 65,
_pyutest_biome_flowering = true
})
PyuTest.register_overworld_biome("large_mushroom_forest", PyuTest.BIOME_TYPES.NORMAL, {
node_top = "pyutest_blocks:mycelium_block",
node_filler = "pyutest_blocks:dirt_block",
y_max = PyuTest.BIOME_TOPS.mushroom_fields,
y_min = PyuTest.SURFACE_BOTTOM,
heat_point = 53,
humidity_point = 98
})

View File

@ -0,0 +1 @@
depends = pyutest_blocks,pyutest_flowers

View File

@ -0,0 +1,58 @@
minetest.register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.0003,
place_on = {"group:ground"},
decoration = {
"pyutest_lootboxes:trash_lootbox",
"pyutest_lootboxes:resource_lootbox",
"pyutest_lootboxes:griefer_lootbox",
"pyutest_lootboxes:liquid_sources_lootbox",
"pyutest_lootboxes:lighting_lootbox",
}
})
PyuTest.register_structure("igloo", "Igloo", {
place_on = {"pyutest_blocks:snow_block"},
fill_ratio = 0.00004,
biomes = {"frozen_plains"},
rotation = "random",
flags = "place_center_x, place_center_z",
place_offset_y = 1
})
PyuTest.register_structure("desert_well", "DesertWell", {
place_on = {"pyutest_blocks:sand_block"},
fill_ratio = 0.00006,
biomes = {"desert"},
rotation = "random"
})
PyuTest.register_structure("ice_spike", "IceSpike", {
fill_ratio = 0.0008,
place_on = {
"pyutest_blocks:ice_block",
},
biomes = {
"ice_spikes",
},
})
PyuTest.register_structure("ocean_ruins", "OceanRuins", {
fill_ratio = 0.0002,
place_on = {"pyutest_blocks:gravel_block"},
biomes = PyuTest.get_biomes_from_type(PyuTest.BIOME_TYPES.OCEAN),
y_max = PyuTest.DEEP_OCEAN_MAX + 4,
y_min = PyuTest.DEAP_OCEAN_MIN,
spawn_by = {"pyutest_blocks:water_source"},
num_spawn_by = 2
})
PyuTest.register_structure("fossil", "Fossil", {
fill_ratio = 9 / 10000, -- 9 out of every 10000 blocks should spawn fossils
place_on = {
"pyutest_blocks:molten_rock_block",
"pyutest_blocks:magma"
},
biomes = PyuTest.LavaWorld.biome_names
})

View File

@ -0,0 +1,295 @@
-- plants and other small decorations
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.009,
biomes = PyuTest.get_flowering_biomes(),
decoration = PyuTest.registered_flowers
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.032,
biomes = PyuTest.get_extra_flowering_biomes(),
decoration = PyuTest.registered_flowers
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.048,
biomes = {"grassland"},
decoration = "pyutest_flowers:grass_plant"
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.0018,
biomes = {"grassland"},
decoration = "pyutest_blocks:haybale_block"
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"pyutest_blocks:dirt_block", "pyutest_blocks:sand_block"},
sidelen = 16,
fill_ratio = 0.019,
biomes = {"desert"},
decoration = "pyutest_flowers:deadbush"
})
minetest.register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.03,
place_on = {"pyutest_blocks:water_source"},
biomes = {"swamp", "swamp_ocean"},
y_max = PyuTest.OVERWORLD_TOP,
y_min = 0,
decoration = "pyutest_flowers:lilypad",
flags = "liquid_surface"
})
minetest.register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.04,
place_on = {"group:sugarcane_spawn_on"},
decoration = "pyutest_blocks:sugarcane",
y_max = PyuTest.SURFACE_BOTTOM,
y_min = 0,
spawn_by = {"pyutest_blocks:water_source"},
num_spawn_by = 1,
height = 1,
height_max = 4
})
-- trees
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.004,
biomes = {"forest"},
schematic = PyuTest.get_schem_path("Tree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.00045,
biomes = {"grassland"},
schematic = PyuTest.get_schem_path("Tree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.00085,
biomes = {"savanna"},
schematic = PyuTest.get_schem_path("SavannaTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true,
place_offset_y = 1
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:mycelium_block"},
sidelen = 16,
fill_ratio = 0.003,
biomes = {"mushroom_fields", "large_mushroom_forest"},
schematic = PyuTest.get_schem_path("Mushroom"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true,
place_offset_y = 1
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.005,
biomes = {"taiga"},
schematic = PyuTest.get_schem_path("TaigaTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true,
place_offset_y = 1
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:grass_block"},
sidelen = 16,
fill_ratio = 0.005,
biomes = {"birch_forest"},
schematic = PyuTest.get_schem_path("BirchTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:grass_block"},
sidelen = 16,
fill_ratio = 0.005,
biomes = {"birch_forest", "old_growth_birch_forest"},
schematic = PyuTest.get_schem_path("TallBirchTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:grass_block"},
sidelen = 16,
fill_ratio = 0.005,
biomes = {"cherry_grove"},
schematic = PyuTest.get_schem_path("CherryTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true,
place_offset_y = 1
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:snow_block"},
sidelen = 16,
fill_ratio = 0.004,
biomes = {"snowy_forest"},
schematic = PyuTest.get_schem_path("SnowyTree1"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:snow_block"},
sidelen = 16,
fill_ratio = 0.004,
biomes = {"snowy_forest"},
schematic = PyuTest.get_schem_path("SnowyTree2"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true,
place_offset_y = 1
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.004,
biomes = {"swamp"},
schematic = PyuTest.get_schem_path("SwampTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:grass_block"},
sidelen = 16,
fill_ratio = 0.004,
biomes = {"old_growth_birch_forest"},
schematic = PyuTest.get_schem_path("VeryTallBirchTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.016,
biomes = {"aspen_forest"},
schematic = PyuTest.get_schem_path("AspenTree1"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"group:grass"},
sidelen = 16,
fill_ratio = 0.008,
biomes = {"aspen_forest"},
schematic = PyuTest.get_schem_path("AspenTree2"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:podzol_block"},
sidelen = 16,
fill_ratio = 0.019,
biomes = {"redwood_forest"},
schematic = PyuTest.get_schem_path("RedwoodTree"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:mycelium_block"},
sidelen = 16,
fill_ratio = 0.006,
biomes = {"large_mushroom_forest"},
schematic = PyuTest.get_schem_path("TallMushroom"),
rotation = "random",
flags = "place_center_x, place_center_z",
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:mycelium_block"},
sidelen = 16,
fill_ratio = 0.002,
biomes = {"large_mushroom_forest"},
schematic = PyuTest.get_schem_path("SmallMushroom"),
rotation = "random",
flags = "place_center_x, place_center_z",
place_offset_y = 1,
force_placement = true
})
minetest.register_decoration({
deco_type = "schematic",
place_on = {"pyutest_blocks:mycelium_block"},
sidelen = 16,
fill_ratio = 0.007,
biomes = {"large_mushroom_forest"},
schematic = PyuTest.get_schem_path("FallenMushroom"),
rotation = "random",
flags = "place_center_x, place_center_z",
place_offset_y = 1,
force_placement = true
})

View File

@ -0,0 +1,203 @@
PyuTest.register_world = function (options)
local default_options = {}
local conf = {}
for k, v in pairs(options) do
conf[k] = v
end
for k, v in pairs(default_options) do
if conf[k] == nil then
conf[k] = v
end
end
if conf.y_max == nil or conf.y_min == nil then
error("Please supply 'y_max' and 'y_min' to the options table!")
end
if conf.name == nil then
error("Please supply 'name' in the options table!")
end
local World = {
name = conf.name,
y_max = conf.y_max,
y_min = conf.y_min,
biome_names = {}
}
function World:register_biome(o)
local name = conf.name .. "-" .. o.name
local cfg = PyuTest.util.tablecopy(o)
cfg.node_stone = cfg.node_stone or conf.node_stone -- Defaults to nil
cfg.node_water = cfg.node_water or "air"
minetest.register_biome(PyuTest.util.tableconcat(cfg, {
name = name,
depth_top = 0,
depth_filler = 0,
y_max = conf.y_max,
y_min = conf.y_min,
node_river_water = cfg.node_water,
node_cave_liquid = cfg.node_water,
}))
self.biome_names[#self.biome_names+1] = name
return name
end
function World:register_ore(o)
minetest.register_ore(PyuTest.util.tableconcat(o, {
y_max = conf.y_max,
y_min = conf.y_min,
}))
end
function World:register_decoration(o)
minetest.register_decoration(PyuTest.util.tableconcat(o, {
y_max = conf.y_max,
y_min = conf.y_min
}))
end
function World:create_token(name, world, color)
local average = (conf.y_max + conf.y_min) / 2
PyuTest.make_item(name, world .. " Token", {
world_token = 1
}, "pyutest-world-token.png", {
color = color,
stack_max = 16,
on_use = function (itemstack, user, pointed_thing)
local pos = user:get_pos()
local npos = vector.new(pos.x, average, pos.y)
minetest.do_item_eat(0, "", itemstack, user, pointed_thing)
local range = 1
user:set_pos(npos)
minetest.sound_play({name = "spellbook_action", gain = 1}, {pos = npos})
-- Spent hours trying to get this to work using mapblocks, just resorted to waiting a second.
minetest.after(1.2, function ()
local upos = user:get_pos()
PyuTest.dorange(upos, range, function (p)
minetest.remove_node(p)
end)
for dx = -range, range do
for dz = -range, range do
minetest.set_node(upos + vector.new(dx, -2, dz), {
name = "pyutest_blocks:obsidian_block"
})
end
end
minetest.set_node(upos + vector.new(0, -1, 0), {
name = "pyutest_blocks:light"
})
end)
end
})
end
return World
end
PyuTest.IceWorld = PyuTest.register_world({
name = "ice_world",
y_max = -1000,
y_min = -2000
})
PyuTest.IceWorld:create_token("pyutest_mapgen:ice_world_token", "Ice World", "#cbdbfc")
local icy_cavern = PyuTest.IceWorld:register_biome({
name = "icy_cavern",
node_stone = "pyutest_blocks:ice_block",
heat_point = 14,
humidity_point = 0
})
PyuTest.IceWorld:register_ore({
ore_type = "blob",
ore = "pyutest_blocks:snow_block",
wherein = "pyutest_blocks:ice_block",
clust_scarcity = 3 * 3 * 3,
clust_num_ores = 35,
clust_size = 5,
biomes = {icy_cavern},
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
PyuTest.IceWorld:register_ore({
ore_type = "blob",
ore = "pyutest_blocks:crystal_lantern_block",
wherein = "pyutest_blocks:ice_block",
clust_scarcity = 4.5 * 4.5 * 4.5,
clust_num_ores = 6,
clust_size = 5,
biomes = {icy_cavern},
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
PyuTest.SlimeWorld = PyuTest.register_world({
name = "slime_world",
y_max = -2001,
y_min = -3001
})
PyuTest.SlimeWorld:create_token("pyutest_mapgen:slime_world_token", "Slime World", "#7dbd3f")
local slimey_cavern = PyuTest.SlimeWorld:register_biome({
name = "slimey_cavern",
node_stone = "pyutest_blocks:slime_block",
heat_point = 45,
humidity_point = 0
})
PyuTest.SlimeWorld:register_ore({
ore_type = "blob",
ore = "pyutest_blocks:glowslime_block",
wherein = "pyutest_blocks:slime_block",
clust_scarcity = 4.5 * 4.5 * 4.5,
clust_num_ores = 6,
clust_size = 5,
biomes = {slimey_cavern},
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
PyuTest.LavaWorld = PyuTest.register_world({
name = "lava_world",
y_max = -3002,
y_min = -4002
})
PyuTest.LavaWorld:create_token("pyutest_mapgen:lava_world_token", "Lava World", "#511e1e")
local lava_cavern = PyuTest.LavaWorld:register_biome({
name = "lava_cavern",
node_stone = "pyutest_blocks:molten_rock_block",
heat_point = 100,
humidity_point = 0,
})
PyuTest.LavaWorld:register_ore({
ore_type = "blob",
ore = "pyutest_blocks:magma",
wherein = "pyutest_blocks:molten_rock_block",
clust_scarcity = 4.5 * 4.5 * 4.5,
clust_num_ores = 6,
clust_size = 5,
biomes = {lava_cavern},
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
PyuTest.LavaWorld:register_decoration({
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.00063,
decoration = {"pyutest_blocks:lava_source"},
place_on = {"pyutest_blocks:molten_rock_block", "pyutest_blocks:magma"},
biomes = {lava_cavern},
flags = "all_ceilings"
})

View File

@ -0,0 +1,359 @@
PyuTest.SPECIALSTONE_NOISE_PARAMS = {
offset = 0,
scale = 1,
spread = {x = 250, y = 250, z = 250},
seed = 1536,
octaves = 3,
persist = 0.4,
lacunarity = 2,
flags = "defaults"
}
minetest.register_ore({
ore_type = "blob",
ore = "pyutest_blocks:granite_block",
wherein = "pyutest_blocks:stone_block",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 35,
clust_size = 5,
y_max = PyuTest.SURFACE_BOTTOM - 1,
y_min = PyuTest.OVERWORLD_BOTTOM,
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
minetest.register_ore({
ore_type = "blob",
ore = "pyutest_blocks:andesite_block",
wherein = "pyutest_blocks:stone_block",
clust_scarcity = 9 * 9 * 9,
clust_num_ores = 35,
clust_size = 5,
y_max = PyuTest.SURFACE_BOTTOM - 1,
y_min = PyuTest.OVERWORLD_BOTTOM,
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
minetest.register_ore({
ore_type = "blob",
ore = "pyutest_blocks:clay_block",
wherein = "pyutest_blocks:gravel_block",
clust_scarcity = 7 * 7 * 7,
clust_num_ores = 35,
clust_size = 5,
y_max = PyuTest.SURFACE_BOTTOM - 1,
y_min = PyuTest.DEAP_OCEAN_MIN,
noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS
})
PyuTest.ORE_STONES = {
"pyutest_blocks:stone_block",
"pyutest_blocks:granite_block",
"pyutest_blocks:andesite_block",
}
PyuTest.registered_ores = {}
PyuTest.make_ore = function(id, desc, item_id_suffix, item_description_suffix, options)
local default_options = {
scarcity = 5 * 5 * 5,
y_max = 31000,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_conf = {},
ore_groups = {},
ore_drop = nil,
ore_drop_count = 1,
ore_sounds = nil,
ore_tiles = {},
ore_level = 1,
item_conf = {},
item_groups = {},
item_texture = nil,
make_raw = false,
raw_conf = {},
raw_groups = {},
raw_texture = {},
block_conf = {},
block_color = nil,
block_tiles = {},
block_groups = {}
}
local conf = {}
for k, v in pairs(options) do
conf[k] = v
end
for k, v in pairs(default_options) do
if conf[k] == nil then
conf[k] = v
end
end
local oid = id.."_ore"
local iid = id.."_"..item_id_suffix
local rid = conf.make_raw and id.."_raw" or nil
minetest.register_node(oid, PyuTest.util.tableconcat({
description = Translate(desc .. " Ore"),
groups = PyuTest.util.tableconcat({
cracky = conf.ore_strength,
mineral = 1,
level = conf.ore_level
}, conf.ore_groups),
light_source = 2.2,
drop = conf.ore_drop or (conf.make_raw and rid or iid) .. " " .. tostring(conf.ore_drop_count or 1),
sounds = PyuTest.make_node_sounds(conf.ore_sounds),
tiles = conf.ore_tiles
}, conf.ore_conf))
minetest.register_craftitem(iid, PyuTest.util.tableconcat({
description = Translate(desc .. " " .. item_description_suffix),
groups = PyuTest.util.tableconcat({
mineral = 1
}, conf.item_groups),
wield_image = conf.item_texture,
inventory_image = conf.item_texture
}, conf.item_conf))
if conf.make_raw then
minetest.register_craftitem(rid, PyuTest.util.tableconcat({
description = Translate("Raw " .. desc),
groups = PyuTest.util.tableconcat({
mineral = 1,
raw_mineral = 1
}, conf.raw_groups),
wield_image = conf.raw_texture,
inventory_image = conf.raw_texture
}, conf.raw_conf))
minetest.register_craft({
type = "cooking",
output = iid,
recipe = rid
})
end
minetest.register_ore({
ore_type = "scatter",
ore = oid,
wherein = PyuTest.ORE_STONES,
clust_scarcity = conf.scarcity,
clust_num_ores = 4,
clust_size = 3,
y_max = conf.y_max,
y_min = PyuTest.OVERWORLD_BOTTOM,
})
minetest.register_ore({
ore_type = "scatter",
ore = oid,
wherein = PyuTest.ORE_STONES,
clust_scarcity = conf.scarcity * 2.2,
clust_num_ores = 9,
clust_size = 3,
y_max = conf.y_max,
y_min = PyuTest.OVERWORLD_BOTTOM,
})
minetest.register_ore({
ore_type = "scatter",
ore = oid,
wherein = PyuTest.ORE_STONES,
clust_scarcity = conf.scarcity * 3,
clust_num_ores = 18,
clust_size = 6,
y_max = conf.y_max,
y_min = PyuTest.OVERWORLD_BOTTOM,
})
PyuTest.make_building_blocks(id, desc, conf.block_tiles, conf.block_color, PyuTest.util.tableconcat({
cracky = conf.ore_strength
}, conf.block_groups), conf.block_conf)
local bid = id.."_block"
minetest.register_craft({
output = bid,
recipe = {
{iid, iid},
{iid, iid}
}
})
minetest.register_craft({
output = iid .. " 4",
recipe = {
bid
},
type = "shapeless"
})
end
-- "Primary" Ores
PyuTest.make_ore("pyutest_ores:coal", "Coal", "lump", "Lump", {
scarcity = 8 * 8 * 8,
y_max = 48,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_drop_count = 2,
ore_tiles = {"pyutest-ore-coal.png"},
item_texture = "pyutest-lump.png",
item_conf = {
color = {r = 32, g = 32, b = 32}
},
item_groups = {
fuel = 1
},
block_tiles = {"pyutest-metal.png"},
block_color = {r = 32, g = 32, b = 32}
})
PyuTest.make_ore("pyutest_ores:iron", "Iron", "ingot", "Ingot", {
scarcity = 11 * 11 * 11,
y_max = 18,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_tiles = {"pyutest-ore-iron.png"},
ore_level = 2,
item_texture = "pyutest-ingot.png",
make_raw = true,
raw_texture = "pyutest-lump.png",
block_tiles = {"pyutest-metal.png"}
})
PyuTest.make_ore("pyutest_ores:copper", "Copper", "ingot", "Ingot", {
scarcity = 11 * 11 * 11,
y_max = 18,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_tiles = {"pyutest-ore-copper.png"},
ore_level = 2,
item_texture = "pyutest-ingot.png",
item_conf = {
color = "darkgoldenrod",
},
make_raw = true,
raw_texture = "pyutest-lump.png",
raw_conf = {
color = "darkgoldenrod"
},
block_tiles = {"pyutest-metal.png"},
block_color = "darkgoldenrod"
})
PyuTest.make_ore("pyutest_ores:gold", "Gold", "ingot", "Ingot", {
scarcity = 15.5 * 15.5 * 15.5,
y_max = -35,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_tiles = {"pyutest-ore-gold.png"},
ore_level = 3,
item_texture = "pyutest-ingot.png",
item_conf = {
color = "gold"
},
make_raw = true,
raw_texture = "pyutest-lump.png",
raw_conf = {
color = "gold"
},
block_tiles = {"pyutest-metal.png"},
block_color = "gold"
})
PyuTest.make_ore("pyutest_ores:diamond", "Diamond", "shard", "Shard", {
scarcity = 16.7 * 16.7 * 16.7,
y_max = -50,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_tiles = {"pyutest-ore-diamond.png"},
ore_level = 3,
item_texture = "pyutest-shard.png",
item_conf = {
color = "cyan"
},
block_tiles = {"pyutest-metal.png"},
block_color = "cyan"
})
PyuTest.make_ore("pyutest_ores:emerald", "Emerald", "shard", "Shard", {
scarcity = 18.3 * 18.3 * 18.3,
y_max = -50,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_tiles = {"pyutest-ore-emerald.png"},
ore_level = 3,
item_texture = "pyutest-shard.png",
item_conf = {
color = "seagreen"
},
block_tiles = {"pyutest-metal.png"},
block_color = "seagreen"
})
PyuTest.make_ore("pyutest_ores:zinc", "Zinc", "ingot", "Ingot", {
scarcity = 11 * 11 * 11,
y_max = 18,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_tiles = {"pyutest-ore-zinc.png"},
ore_level = 2,
item_texture = "pyutest-ingot.png",
item_conf = {
color = "#bed3d4"
},
make_raw = true,
raw_texture = "pyutest-lump.png",
raw_conf = {
color = "#bed3d4"
},
block_tiles = {"pyutest-metal.png"},
block_color = "#bed3d4"
})
-- "Secondary" Ores
PyuTest.make_ore("pyutest_ores:tin", "Tin", "ingot", "Ingot", {
scarcity = 11 * 11 * 11,
y_max = 18,
ore_strength = PyuTest.BLOCK_NORMAL,
ore_tiles = {"pyutest-ore-tin.png"},
ore_levle = 2,
item_texture = "pyutest-ingot.png",
item_conf = {
color = "#8e8591"
},
make_raw = true,
raw_texture = "pyutest-lump.png",
raw_conf = {
color = "#8e8591"
},
block_tiles = {"pyutest-metal.png"},
block_color = "#8e8591"
})

View File

@ -0,0 +1 @@
depends = pyutest_blocks

0
mods/PLAYER/modpack.conf Normal file
View File

View File

@ -0,0 +1,36 @@
minetest.register_privilege("fun", {
description = "Access to \"powerful\" fun commands",
give_to_singeplayer = true
})
minetest.register_chatcommand("explode", {
params = "<range>",
description = "Create an explosion of size RANGE.",
privs = {
fun = true
},
func = function(name, param)
local player = minetest.get_player_by_name(name)
local range = tonumber(param)
if range == nil then
return false, "Please use a number for the range."
end
PyuTest.create_explosion(player:get_pos(), range, false, range, player, true)
end
})
minetest.register_chatcommand("rtp", {
description = [[Teleport to a random location in the world.
This command may or may not kill you.]],
func = function(name)
local player = minetest.get_player_by_name(name)
local player_pos = player:get_pos()
math.randomseed(os.time())
local pos = vector.new(math.random(-31000, 31000), player_pos.y, math.random(-31000, 31000))
player:set_pos(pos)
end
})

View File

@ -0,0 +1,73 @@
--[[
Format:
user = {
name = {
pos = {x = 128, y = 50, z = 256},
idx = 439
}
}
]]
local waypoints = {}
minetest.register_chatcommand("waypoint", {
params = "<name>",
description = [[Creates a waypoint at your position called <NAME>
If the waypoint is already set, move the waypoint.]],
func = function (name, param)
if waypoints[name] == nil then
waypoints[name] = {}
end
local player = minetest.get_player_by_name(name)
if player == nil then return end
if waypoints[name][param] ~= nil then
player:hud_remove(waypoints[name][param].idx)
end
local pos = player:get_pos()
waypoints[name][param] = {}
waypoints[name][param].pos = pos
local idx = player:hud_add({
hud_elem_type = "waypoint",
name = param,
text = "m",
world_pos = pos,
number = 0xFFFFFFFF,
})
waypoints[name][param].idx = idx
end
})
minetest.register_chatcommand("teleportwaypoint", {
params = "<name>",
description = "Teleport to waypoint NAME",
func = function (name, param)
if waypoints[name] == nil then
waypoints[name] = {}
end
if waypoints[name][param] == nil then return end
local player = minetest.get_player_by_name(name)
if player == nil then return end
player:set_pos(waypoints[name][param].pos)
end
})
minetest.register_chatcommand("biome", {
description = "Return the current biome name",
func = function (name)
local player = minetest.get_player_by_name(name)
if player == nil then return end
local pos = player:get_pos()
local name = minetest.get_biome_name(minetest.get_biome_data(pos).biome)
return true, string.format("Current biome name: %s", name)
end
})

View File

@ -0,0 +1,4 @@
local modpath = minetest.get_modpath("pyutest_cmds")
dofile(modpath.."/worldedit.lua")
dofile(modpath.."/gameplay.lua")
dofile(modpath.."/fun.lua")

View File

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