diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d9a4cf..853ba83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/mods/CORE/modpack.conf b/mods/CORE/modpack.conf new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest/init.lua b/mods/CORE/pyutest/init.lua similarity index 77% rename from mods/pyutest/pyutest/init.lua rename to mods/CORE/pyutest/init.lua index 15a597c..a5fe093 100644 --- a/mods/pyutest/pyutest/init.lua +++ b/mods/CORE/pyutest/init.lua @@ -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") diff --git a/mods/pyutest/pyutest_core/models/chair.mtl b/mods/CORE/pyutest/models/chair.mtl similarity index 100% rename from mods/pyutest/pyutest_core/models/chair.mtl rename to mods/CORE/pyutest/models/chair.mtl diff --git a/mods/pyutest/pyutest_core/models/chair.obj b/mods/CORE/pyutest/models/chair.obj similarity index 100% rename from mods/pyutest/pyutest_core/models/chair.obj rename to mods/CORE/pyutest/models/chair.obj diff --git a/mods/pyutest/pyutest_core/models/mtable.mtl b/mods/CORE/pyutest/models/mtable.mtl similarity index 100% rename from mods/pyutest/pyutest_core/models/mtable.mtl rename to mods/CORE/pyutest/models/mtable.mtl diff --git a/mods/pyutest/pyutest_core/models/mtable.obj b/mods/CORE/pyutest/models/mtable.obj similarity index 100% rename from mods/pyutest/pyutest_core/models/mtable.obj rename to mods/CORE/pyutest/models/mtable.obj diff --git a/mods/CORE/pyutest/schematics/AspenTree1.mts b/mods/CORE/pyutest/schematics/AspenTree1.mts new file mode 100644 index 0000000..0c96b7b Binary files /dev/null and b/mods/CORE/pyutest/schematics/AspenTree1.mts differ diff --git a/mods/CORE/pyutest/schematics/AspenTree2.mts b/mods/CORE/pyutest/schematics/AspenTree2.mts new file mode 100644 index 0000000..a89d425 Binary files /dev/null and b/mods/CORE/pyutest/schematics/AspenTree2.mts differ diff --git a/mods/CORE/pyutest/schematics/BirchTree.mts b/mods/CORE/pyutest/schematics/BirchTree.mts new file mode 100644 index 0000000..f522259 Binary files /dev/null and b/mods/CORE/pyutest/schematics/BirchTree.mts differ diff --git a/mods/CORE/pyutest/schematics/CherryTree.mts b/mods/CORE/pyutest/schematics/CherryTree.mts new file mode 100644 index 0000000..7cbaa9a Binary files /dev/null and b/mods/CORE/pyutest/schematics/CherryTree.mts differ diff --git a/mods/CORE/pyutest/schematics/DesertWell.mts b/mods/CORE/pyutest/schematics/DesertWell.mts new file mode 100644 index 0000000..e615b2a Binary files /dev/null and b/mods/CORE/pyutest/schematics/DesertWell.mts differ diff --git a/mods/CORE/pyutest/schematics/FallenMushroom.mts b/mods/CORE/pyutest/schematics/FallenMushroom.mts new file mode 100644 index 0000000..cf12ff1 Binary files /dev/null and b/mods/CORE/pyutest/schematics/FallenMushroom.mts differ diff --git a/mods/CORE/pyutest/schematics/Fossil.mts b/mods/CORE/pyutest/schematics/Fossil.mts new file mode 100644 index 0000000..ac3771d Binary files /dev/null and b/mods/CORE/pyutest/schematics/Fossil.mts differ diff --git a/mods/CORE/pyutest/schematics/IceSpike.mts b/mods/CORE/pyutest/schematics/IceSpike.mts new file mode 100644 index 0000000..6a201bc Binary files /dev/null and b/mods/CORE/pyutest/schematics/IceSpike.mts differ diff --git a/mods/CORE/pyutest/schematics/Igloo.mts b/mods/CORE/pyutest/schematics/Igloo.mts new file mode 100644 index 0000000..1871e49 Binary files /dev/null and b/mods/CORE/pyutest/schematics/Igloo.mts differ diff --git a/mods/CORE/pyutest/schematics/Mushroom.mts b/mods/CORE/pyutest/schematics/Mushroom.mts new file mode 100644 index 0000000..0e7f94f Binary files /dev/null and b/mods/CORE/pyutest/schematics/Mushroom.mts differ diff --git a/mods/CORE/pyutest/schematics/OceanRuins.mts b/mods/CORE/pyutest/schematics/OceanRuins.mts new file mode 100644 index 0000000..e7420ec Binary files /dev/null and b/mods/CORE/pyutest/schematics/OceanRuins.mts differ diff --git a/mods/CORE/pyutest/schematics/RedwoodTree.mts b/mods/CORE/pyutest/schematics/RedwoodTree.mts new file mode 100644 index 0000000..42e1074 Binary files /dev/null and b/mods/CORE/pyutest/schematics/RedwoodTree.mts differ diff --git a/mods/CORE/pyutest/schematics/SavannaTree.mts b/mods/CORE/pyutest/schematics/SavannaTree.mts new file mode 100644 index 0000000..c965ddc Binary files /dev/null and b/mods/CORE/pyutest/schematics/SavannaTree.mts differ diff --git a/mods/CORE/pyutest/schematics/SmallMushroom.mts b/mods/CORE/pyutest/schematics/SmallMushroom.mts new file mode 100644 index 0000000..0fede91 Binary files /dev/null and b/mods/CORE/pyutest/schematics/SmallMushroom.mts differ diff --git a/mods/CORE/pyutest/schematics/SnowyTree1.mts b/mods/CORE/pyutest/schematics/SnowyTree1.mts new file mode 100644 index 0000000..ad0b058 Binary files /dev/null and b/mods/CORE/pyutest/schematics/SnowyTree1.mts differ diff --git a/mods/CORE/pyutest/schematics/SnowyTree2.mts b/mods/CORE/pyutest/schematics/SnowyTree2.mts new file mode 100644 index 0000000..1dc75bd Binary files /dev/null and b/mods/CORE/pyutest/schematics/SnowyTree2.mts differ diff --git a/mods/CORE/pyutest/schematics/SwampTree.mts b/mods/CORE/pyutest/schematics/SwampTree.mts new file mode 100644 index 0000000..6d93537 Binary files /dev/null and b/mods/CORE/pyutest/schematics/SwampTree.mts differ diff --git a/mods/CORE/pyutest/schematics/TaigaTree.mts b/mods/CORE/pyutest/schematics/TaigaTree.mts new file mode 100644 index 0000000..9ccb8ee Binary files /dev/null and b/mods/CORE/pyutest/schematics/TaigaTree.mts differ diff --git a/mods/CORE/pyutest/schematics/TallBirchTree.mts b/mods/CORE/pyutest/schematics/TallBirchTree.mts new file mode 100644 index 0000000..09e6880 Binary files /dev/null and b/mods/CORE/pyutest/schematics/TallBirchTree.mts differ diff --git a/mods/CORE/pyutest/schematics/TallMushroom.mts b/mods/CORE/pyutest/schematics/TallMushroom.mts new file mode 100644 index 0000000..06f4171 Binary files /dev/null and b/mods/CORE/pyutest/schematics/TallMushroom.mts differ diff --git a/mods/CORE/pyutest/schematics/Tree.mts b/mods/CORE/pyutest/schematics/Tree.mts new file mode 100644 index 0000000..092f4c5 Binary files /dev/null and b/mods/CORE/pyutest/schematics/Tree.mts differ diff --git a/mods/CORE/pyutest/schematics/VeryTallBirchTree.mts b/mods/CORE/pyutest/schematics/VeryTallBirchTree.mts new file mode 100644 index 0000000..0c060b1 Binary files /dev/null and b/mods/CORE/pyutest/schematics/VeryTallBirchTree.mts differ diff --git a/mods/pyutest/pyutest_core/sounds/block_break.ogg b/mods/CORE/pyutest/sounds/block_break.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/block_break.ogg rename to mods/CORE/pyutest/sounds/block_break.ogg diff --git a/mods/pyutest/pyutest_core/sounds/block_dig.ogg b/mods/CORE/pyutest/sounds/block_dig.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/block_dig.ogg rename to mods/CORE/pyutest/sounds/block_dig.ogg diff --git a/mods/pyutest/pyutest_core/sounds/block_place.ogg b/mods/CORE/pyutest/sounds/block_place.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/block_place.ogg rename to mods/CORE/pyutest/sounds/block_place.ogg diff --git a/mods/pyutest/pyutest_core/sounds/block_walk.ogg b/mods/CORE/pyutest/sounds/block_walk.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/block_walk.ogg rename to mods/CORE/pyutest/sounds/block_walk.ogg diff --git a/mods/pyutest/pyutest_core/sounds/button.ogg b/mods/CORE/pyutest/sounds/button.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/button.ogg rename to mods/CORE/pyutest/sounds/button.ogg diff --git a/mods/pyutest/pyutest_core/sounds/coin.ogg b/mods/CORE/pyutest/sounds/coin.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/coin.ogg rename to mods/CORE/pyutest/sounds/coin.ogg diff --git a/mods/pyutest/pyutest_core/sounds/crate_open.ogg b/mods/CORE/pyutest/sounds/crate_open.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/crate_open.ogg rename to mods/CORE/pyutest/sounds/crate_open.ogg diff --git a/mods/pyutest/pyutest_core/sounds/eat.ogg b/mods/CORE/pyutest/sounds/eat.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/eat.ogg rename to mods/CORE/pyutest/sounds/eat.ogg diff --git a/mods/pyutest/pyutest_core/sounds/lootbox_unlock.ogg b/mods/CORE/pyutest/sounds/lootbox_unlock.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/lootbox_unlock.ogg rename to mods/CORE/pyutest/sounds/lootbox_unlock.ogg diff --git a/mods/pyutest/pyutest_core/sounds/spellbook_action.ogg b/mods/CORE/pyutest/sounds/spellbook_action.ogg similarity index 100% rename from mods/pyutest/pyutest_core/sounds/spellbook_action.ogg rename to mods/CORE/pyutest/sounds/spellbook_action.ogg diff --git a/mods/pyutest/pyutest_core/utils.lua b/mods/CORE/pyutest/util.lua similarity index 56% rename from mods/pyutest/pyutest_core/utils.lua rename to mods/CORE/pyutest/util.lua index cda2334..36c210a 100644 --- a/mods/pyutest/pyutest_core/utils.lua +++ b/mods/CORE/pyutest/util.lua @@ -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 } diff --git a/mods/ENTITIES/modpack.conf b/mods/ENTITIES/modpack.conf new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_mobs/README.md b/mods/ENTITIES/pyutest_mobs/README.md similarity index 100% rename from mods/pyutest/pyutest_mobs/README.md rename to mods/ENTITIES/pyutest_mobs/README.md diff --git a/mods/ENTITIES/pyutest_mobs/api.lua b/mods/ENTITIES/pyutest_mobs/api.lua new file mode 100644 index 0000000..17d57ff --- /dev/null +++ b/mods/ENTITIES/pyutest_mobs/api.lua @@ -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 diff --git a/mods/ENTITIES/pyutest_mobs/basic.lua b/mods/ENTITIES/pyutest_mobs/basic.lua new file mode 100644 index 0000000..6d77ccc --- /dev/null +++ b/mods/ENTITIES/pyutest_mobs/basic.lua @@ -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) diff --git a/mods/ENTITIES/pyutest_mobs/init.lua b/mods/ENTITIES/pyutest_mobs/init.lua new file mode 100644 index 0000000..5b86df3 --- /dev/null +++ b/mods/ENTITIES/pyutest_mobs/init.lua @@ -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 diff --git a/mods/ENTITIES/pyutest_mobs/mod.conf b/mods/ENTITIES/pyutest_mobs/mod.conf new file mode 100644 index 0000000..cf5e4da --- /dev/null +++ b/mods/ENTITIES/pyutest_mobs/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks,mobs,pyutest_mapgen diff --git a/mods/ENTITIES/pyutest_mobs/necromancer.lua b/mods/ENTITIES/pyutest_mobs/necromancer.lua new file mode 100644 index 0000000..da6571c --- /dev/null +++ b/mods/ENTITIES/pyutest_mobs/necromancer.lua @@ -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") diff --git a/mods/ENTITIES/pyutest_mobs/snowman.lua b/mods/ENTITIES/pyutest_mobs/snowman.lua new file mode 100644 index 0000000..1842348 --- /dev/null +++ b/mods/ENTITIES/pyutest_mobs/snowman.lua @@ -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") diff --git a/mods/ENTITIES/pyutest_mobs/wind_warrior.lua b/mods/ENTITIES/pyutest_mobs/wind_warrior.lua new file mode 100644 index 0000000..a808c53 --- /dev/null +++ b/mods/ENTITIES/pyutest_mobs/wind_warrior.lua @@ -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") diff --git a/mods/ITEMS/modpack.conf b/mods/ITEMS/modpack.conf new file mode 100644 index 0000000..e69de29 diff --git a/mods/ITEMS/pyutest_blocks/api.lua b/mods/ITEMS/pyutest_blocks/api.lua new file mode 100644 index 0000000..f5ec25b --- /dev/null +++ b/mods/ITEMS/pyutest_blocks/api.lua @@ -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 diff --git a/mods/ITEMS/pyutest_blocks/basic.lua b/mods/ITEMS/pyutest_blocks/basic.lua new file mode 100644 index 0000000..f886619 --- /dev/null +++ b/mods/ITEMS/pyutest_blocks/basic.lua @@ -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 +}) diff --git a/mods/ITEMS/pyutest_blocks/init.lua b/mods/ITEMS/pyutest_blocks/init.lua new file mode 100644 index 0000000..4690447 --- /dev/null +++ b/mods/ITEMS/pyutest_blocks/init.lua @@ -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") diff --git a/mods/ITEMS/pyutest_blocks/liquid.lua b/mods/ITEMS/pyutest_blocks/liquid.lua new file mode 100644 index 0000000..113852c --- /dev/null +++ b/mods/ITEMS/pyutest_blocks/liquid.lua @@ -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 +}) diff --git a/mods/ITEMS/pyutest_blocks/mod.conf b/mods/ITEMS/pyutest_blocks/mod.conf new file mode 100644 index 0000000..e69de29 diff --git a/mods/ITEMS/pyutest_blocks/special.lua b/mods/ITEMS/pyutest_blocks/special.lua new file mode 100644 index 0000000..198ead6 --- /dev/null +++ b/mods/ITEMS/pyutest_blocks/special.lua @@ -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 +}) diff --git a/mods/ITEMS/pyutest_crafts/init.lua b/mods/ITEMS/pyutest_crafts/init.lua new file mode 100644 index 0000000..259bfe8 --- /dev/null +++ b/mods/ITEMS/pyutest_crafts/init.lua @@ -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", +}) diff --git a/mods/ITEMS/pyutest_crafts/mod.conf b/mods/ITEMS/pyutest_crafts/mod.conf new file mode 100644 index 0000000..864c53b --- /dev/null +++ b/mods/ITEMS/pyutest_crafts/mod.conf @@ -0,0 +1 @@ +depends = pyutest_tools,pyutest_blocks diff --git a/mods/pyutest/pyutest_core/electricity.lua b/mods/ITEMS/pyutest_electricity/init.lua similarity index 55% rename from mods/pyutest/pyutest_core/electricity.lua rename to mods/ITEMS/pyutest_electricity/init.lua index fb95c8d..3d475d5 100644 --- a/mods/pyutest/pyutest_core/electricity.lua +++ b/mods/ITEMS/pyutest_electricity/init.lua @@ -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" } }, }) diff --git a/mods/ITEMS/pyutest_electricity/mod.conf b/mods/ITEMS/pyutest_electricity/mod.conf new file mode 100644 index 0000000..c43aded --- /dev/null +++ b/mods/ITEMS/pyutest_electricity/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks \ No newline at end of file diff --git a/mods/ITEMS/pyutest_flowers/init.lua b/mods/ITEMS/pyutest_flowers/init.lua new file mode 100644 index 0000000..bd46f0d --- /dev/null +++ b/mods/ITEMS/pyutest_flowers/init.lua @@ -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" +}) diff --git a/mods/ITEMS/pyutest_flowers/mod.conf b/mods/ITEMS/pyutest_flowers/mod.conf new file mode 100644 index 0000000..c43aded --- /dev/null +++ b/mods/ITEMS/pyutest_flowers/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks \ No newline at end of file diff --git a/mods/ITEMS/pyutest_furnace/init.lua b/mods/ITEMS/pyutest_furnace/init.lua new file mode 100644 index 0000000..fb4e5d1 --- /dev/null +++ b/mods/ITEMS/pyutest_furnace/init.lua @@ -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, +}) diff --git a/mods/ITEMS/pyutest_furnace/mod.conf b/mods/ITEMS/pyutest_furnace/mod.conf new file mode 100644 index 0000000..2c919f7 --- /dev/null +++ b/mods/ITEMS/pyutest_furnace/mod.conf @@ -0,0 +1,2 @@ +name = pyutest_furnace +depends = pyutest_blocks diff --git a/mods/ITEMS/pyutest_furniture/init.lua b/mods/ITEMS/pyutest_furniture/init.lua new file mode 100644 index 0000000..6b9f8a4 --- /dev/null +++ b/mods/ITEMS/pyutest_furniture/init.lua @@ -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 diff --git a/mods/ITEMS/pyutest_furniture/mod.conf b/mods/ITEMS/pyutest_furniture/mod.conf new file mode 100644 index 0000000..c43aded --- /dev/null +++ b/mods/ITEMS/pyutest_furniture/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks \ No newline at end of file diff --git a/mods/ITEMS/pyutest_leaves/init.lua b/mods/ITEMS/pyutest_leaves/init.lua new file mode 100644 index 0000000..159ea8a --- /dev/null +++ b/mods/ITEMS/pyutest_leaves/init.lua @@ -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" }) diff --git a/mods/ITEMS/pyutest_leaves/mod.conf b/mods/ITEMS/pyutest_leaves/mod.conf new file mode 100644 index 0000000..c43aded --- /dev/null +++ b/mods/ITEMS/pyutest_leaves/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks \ No newline at end of file diff --git a/mods/ITEMS/pyutest_lootboxes/init.lua b/mods/ITEMS/pyutest_lootboxes/init.lua new file mode 100644 index 0000000..a8cc952 --- /dev/null +++ b/mods/ITEMS/pyutest_lootboxes/init.lua @@ -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") +}) diff --git a/mods/ITEMS/pyutest_lootboxes/mod.conf b/mods/ITEMS/pyutest_lootboxes/mod.conf new file mode 100644 index 0000000..f136755 --- /dev/null +++ b/mods/ITEMS/pyutest_lootboxes/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks,pyutest_tools diff --git a/mods/ITEMS/pyutest_magic/init.lua b/mods/ITEMS/pyutest_magic/init.lua new file mode 100644 index 0000000..738d8cf --- /dev/null +++ b/mods/ITEMS/pyutest_magic/init.lua @@ -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 +}) diff --git a/mods/ITEMS/pyutest_magic/mod.conf b/mods/ITEMS/pyutest_magic/mod.conf new file mode 100644 index 0000000..864c53b --- /dev/null +++ b/mods/ITEMS/pyutest_magic/mod.conf @@ -0,0 +1 @@ +depends = pyutest_tools,pyutest_blocks diff --git a/mods/ITEMS/pyutest_overrides/init.lua b/mods/ITEMS/pyutest_overrides/init.lua new file mode 100644 index 0000000..03f5b3e --- /dev/null +++ b/mods/ITEMS/pyutest_overrides/init.lua @@ -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 +}) diff --git a/mods/ITEMS/pyutest_overrides/mod.conf b/mods/ITEMS/pyutest_overrides/mod.conf new file mode 100644 index 0000000..d3c5936 --- /dev/null +++ b/mods/ITEMS/pyutest_overrides/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks diff --git a/mods/ITEMS/pyutest_tools/api.lua b/mods/ITEMS/pyutest_tools/api.lua new file mode 100644 index 0000000..f1a9bdd --- /dev/null +++ b/mods/ITEMS/pyutest_tools/api.lua @@ -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 diff --git a/mods/ITEMS/pyutest_tools/combat.lua b/mods/ITEMS/pyutest_tools/combat.lua new file mode 100644 index 0000000..a1faaed --- /dev/null +++ b/mods/ITEMS/pyutest_tools/combat.lua @@ -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) diff --git a/mods/ITEMS/pyutest_tools/food.lua b/mods/ITEMS/pyutest_tools/food.lua new file mode 100644 index 0000000..48e0582 --- /dev/null +++ b/mods/ITEMS/pyutest_tools/food.lua @@ -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) diff --git a/mods/ITEMS/pyutest_tools/init.lua b/mods/ITEMS/pyutest_tools/init.lua new file mode 100644 index 0000000..9bccd36 --- /dev/null +++ b/mods/ITEMS/pyutest_tools/init.lua @@ -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") diff --git a/mods/ITEMS/pyutest_tools/items.lua b/mods/ITEMS/pyutest_tools/items.lua new file mode 100644 index 0000000..578a2e8 --- /dev/null +++ b/mods/ITEMS/pyutest_tools/items.lua @@ -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") diff --git a/mods/ITEMS/pyutest_tools/mod.conf b/mods/ITEMS/pyutest_tools/mod.conf new file mode 100644 index 0000000..093b2b9 --- /dev/null +++ b/mods/ITEMS/pyutest_tools/mod.conf @@ -0,0 +1 @@ +name = pyutest_tools diff --git a/mods/ITEMS/pyutest_tools/tools.lua b/mods/ITEMS/pyutest_tools/tools.lua new file mode 100644 index 0000000..43a75cd --- /dev/null +++ b/mods/ITEMS/pyutest_tools/tools.lua @@ -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 +}) diff --git a/mods/ITEMS/pyutest_wood/init.lua b/mods/ITEMS/pyutest_wood/init.lua new file mode 100644 index 0000000..8c04ba0 --- /dev/null +++ b/mods/ITEMS/pyutest_wood/init.lua @@ -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" +}) diff --git a/mods/ITEMS/pyutest_wood/mod.conf b/mods/ITEMS/pyutest_wood/mod.conf new file mode 100644 index 0000000..c43aded --- /dev/null +++ b/mods/ITEMS/pyutest_wood/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks \ No newline at end of file diff --git a/mods/ITEMS/pyutest_wool/init.lua b/mods/ITEMS/pyutest_wool/init.lua new file mode 100644 index 0000000..8a66939 --- /dev/null +++ b/mods/ITEMS/pyutest_wool/init.lua @@ -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") diff --git a/mods/ITEMS/pyutest_wool/mod.conf b/mods/ITEMS/pyutest_wool/mod.conf new file mode 100644 index 0000000..d3c5936 --- /dev/null +++ b/mods/ITEMS/pyutest_wool/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks diff --git a/mods/MAPGEN/modpack.conf b/mods/MAPGEN/modpack.conf new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_mapgen/api.lua b/mods/MAPGEN/pyutest_mapgen/api.lua similarity index 100% rename from mods/pyutest/pyutest_mapgen/api.lua rename to mods/MAPGEN/pyutest_mapgen/api.lua diff --git a/mods/MAPGEN/pyutest_mapgen/init.lua b/mods/MAPGEN/pyutest_mapgen/init.lua new file mode 100644 index 0000000..926d8ac --- /dev/null +++ b/mods/MAPGEN/pyutest_mapgen/init.lua @@ -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 diff --git a/mods/MAPGEN/pyutest_mapgen/mapgen.lua b/mods/MAPGEN/pyutest_mapgen/mapgen.lua new file mode 100644 index 0000000..6a2a754 --- /dev/null +++ b/mods/MAPGEN/pyutest_mapgen/mapgen.lua @@ -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 +}) diff --git a/mods/MAPGEN/pyutest_mapgen/mod.conf b/mods/MAPGEN/pyutest_mapgen/mod.conf new file mode 100644 index 0000000..8b40125 --- /dev/null +++ b/mods/MAPGEN/pyutest_mapgen/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks,pyutest_flowers diff --git a/mods/MAPGEN/pyutest_mapgen/structures.lua b/mods/MAPGEN/pyutest_mapgen/structures.lua new file mode 100644 index 0000000..263ad70 --- /dev/null +++ b/mods/MAPGEN/pyutest_mapgen/structures.lua @@ -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 +}) diff --git a/mods/MAPGEN/pyutest_mapgen/trees.lua b/mods/MAPGEN/pyutest_mapgen/trees.lua new file mode 100644 index 0000000..82fc98a --- /dev/null +++ b/mods/MAPGEN/pyutest_mapgen/trees.lua @@ -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 +}) diff --git a/mods/MAPGEN/pyutest_mapgen/worlds.lua b/mods/MAPGEN/pyutest_mapgen/worlds.lua new file mode 100644 index 0000000..8aab6a2 --- /dev/null +++ b/mods/MAPGEN/pyutest_mapgen/worlds.lua @@ -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" +}) diff --git a/mods/MAPGEN/pyutest_ores/init.lua b/mods/MAPGEN/pyutest_ores/init.lua new file mode 100644 index 0000000..2090ef5 --- /dev/null +++ b/mods/MAPGEN/pyutest_ores/init.lua @@ -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" +}) diff --git a/mods/MAPGEN/pyutest_ores/mod.conf b/mods/MAPGEN/pyutest_ores/mod.conf new file mode 100644 index 0000000..d3c5936 --- /dev/null +++ b/mods/MAPGEN/pyutest_ores/mod.conf @@ -0,0 +1 @@ +depends = pyutest_blocks diff --git a/mods/PLAYER/modpack.conf b/mods/PLAYER/modpack.conf new file mode 100644 index 0000000..e69de29 diff --git a/mods/PLAYER/pyutest_cmds/fun.lua b/mods/PLAYER/pyutest_cmds/fun.lua new file mode 100644 index 0000000..3189556 --- /dev/null +++ b/mods/PLAYER/pyutest_cmds/fun.lua @@ -0,0 +1,36 @@ +minetest.register_privilege("fun", { + description = "Access to \"powerful\" fun commands", + give_to_singeplayer = true +}) + +minetest.register_chatcommand("explode", { + params = "", + 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 +}) diff --git a/mods/PLAYER/pyutest_cmds/gameplay.lua b/mods/PLAYER/pyutest_cmds/gameplay.lua new file mode 100644 index 0000000..a39c49d --- /dev/null +++ b/mods/PLAYER/pyutest_cmds/gameplay.lua @@ -0,0 +1,73 @@ +--[[ +Format: + +user = { + name = { + pos = {x = 128, y = 50, z = 256}, + idx = 439 + } +} + +]] +local waypoints = {} + +minetest.register_chatcommand("waypoint", { + params = "", + description = [[Creates a waypoint at your position called + 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 = "", + 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 +}) diff --git a/mods/PLAYER/pyutest_cmds/init.lua b/mods/PLAYER/pyutest_cmds/init.lua new file mode 100644 index 0000000..b85acf2 --- /dev/null +++ b/mods/PLAYER/pyutest_cmds/init.lua @@ -0,0 +1,4 @@ +local modpath = minetest.get_modpath("pyutest_cmds") +dofile(modpath.."/worldedit.lua") +dofile(modpath.."/gameplay.lua") +dofile(modpath.."/fun.lua") diff --git a/mods/PLAYER/pyutest_cmds/mod.conf b/mods/PLAYER/pyutest_cmds/mod.conf new file mode 100644 index 0000000..e69de29 diff --git a/mods/PLAYER/pyutest_cmds/worldedit.lua b/mods/PLAYER/pyutest_cmds/worldedit.lua new file mode 100644 index 0000000..28ade16 --- /dev/null +++ b/mods/PLAYER/pyutest_cmds/worldedit.lua @@ -0,0 +1,63 @@ +minetest.register_privilege("builder", { + description = "Builder/World Edit Privilege", + give_to_singeplayer = true +}) + +minetest.register_chatcommand("replacenear", { + params = " ", + description = [[Replace blocks around RANGE from FROM to TO. + FROM can be comma seperated, or it can be `any` which replaces any node. + Or it can be `anyblock` which replaces any node other than air and ignore. + ]], + privs = { + builder = true + }, + func = function (name, param) + local parts = param:split(" ") + if #parts == 3 then + local player = minetest.get_player_by_name(name) + local pos = player:get_pos() + local range = tonumber(parts[1]) or 5 + local from = parts[2]:split(",") + local to = parts[3] + local replaced = 0 + + local function replace(p) + for _, v in pairs(from) do + local name = minetest.get_node(p).name + local anyblock_match = (v == "anyblock" or v == "anynode" and name ~= "air" and name ~= "ignore") + + if name == v or v == "any" or anyblock_match then + minetest.set_node(p, {name = to}) + replaced = replaced + 1 + end + end + end + + PyuTest.dorange(pos, range, function(p) + replace(p) + end) + + return true, string.format("Replaced %d blocks", replaced) + end + return false, "Requires 3 arguments" + end +}) + +minetest.register_chatcommand("place", { + params = "", + description = "Place SCHEMATIC at player position", + privs = { + builder = true + }, + func = function(name, param) + local player = minetest.get_player_by_name(name) + minetest.place_schematic(player:get_pos(), + PyuTest.get_schem_path(param), + "random", + nil, + false, + "place_center_x, place_center_z" + ) + end +}) diff --git a/mods/PLAYER/pyutest_inventory/init.lua b/mods/PLAYER/pyutest_inventory/init.lua new file mode 100644 index 0000000..ed4e6f4 --- /dev/null +++ b/mods/PLAYER/pyutest_inventory/init.lua @@ -0,0 +1,78 @@ +local function get_items_from_group(name) + local list = {} + for k, v in pairs(minetest.registered_items) do + if minetest.get_item_group(k, name) ~= 0 then + table.insert(list, k) + end + end + return list +end + +-- Remove built-in Unified Inventory categories +for k, v in pairs(unified_inventory.registered_categories) do + unified_inventory.remove_category(k) +end + +unified_inventory.register_category("pyutest_inventory:blocks", { + symbol = "pyutest_blocks:stone_block", + label = "Blocks", + index = 3, + items = get_items_from_group("block") +}) + +unified_inventory.register_category("pyutest_inventory:tools", { + symbol = "pyutest_tools:iron_pickaxe", + label = "Tools", + index = 4, + items = get_items_from_group("tool") +}) + +unified_inventory.register_category("pyutest_inventory:furniture", { + symbol = "pyutest_furniture:oak_wood_chair", + label = "Furniture", + index = 5, + items = get_items_from_group("furniture") +}) + +unified_inventory.register_category("pyutest_inventory:minerals", { + symbol = "pyutest_ores:diamond_ore", + label = "Minerals", + index = 6, + items = get_items_from_group("mineral") +}) + +unified_inventory.register_category("pyutest_inventory:colored", { + symbol = "pyutest_wool:yellow_wool_block", + label = "Colored Blocks", + index = 7, + items = get_items_from_group("colored") +}) + +unified_inventory.register_category("pyutest_inventory:flowers", { + symbol = "pyutest_flowers:rose", + label = "Flora", + index = 8, + items = get_items_from_group("flower") +}) + +unified_inventory.register_category("pyutest_inventory:fuel", { + symbol = "pyutest_ores:coal_lump", + label = "Fuel", + index = 9, + items = get_items_from_group("fuel") +}) + + +unified_inventory.register_category("pyutest_inventory:solid_nodes", { + symbol = "pyutest_blocks:stone_block", + label = "Solid Nodes", + index = 10, + items = get_items_from_group("solid") +}) + +unified_inventory.register_category("pyutest_inventory:electricity", { + symbol = "pyutest_electricity:button", + label = "Electricity", + index = 11, + items = get_items_from_group("electric") +}) diff --git a/mods/PLAYER/pyutest_inventory/mod.conf b/mods/PLAYER/pyutest_inventory/mod.conf new file mode 100644 index 0000000..bd4f3a4 --- /dev/null +++ b/mods/PLAYER/pyutest_inventory/mod.conf @@ -0,0 +1 @@ +depends = unified_inventory,pyutest_blocks,pyutest_furniture,pyutest_ores,pyutest_wool,pyutest_wood,pyutest_flowers,pyutest_electricity diff --git a/mods/PLAYER/pyutest_player/init.lua b/mods/PLAYER/pyutest_player/init.lua new file mode 100644 index 0000000..a86534b --- /dev/null +++ b/mods/PLAYER/pyutest_player/init.lua @@ -0,0 +1,158 @@ +-- player setup +minetest.register_on_joinplayer(function (player) + if player == nil then return end + local name = player:get_player_name() + player:set_properties({ + hp_max = 25 + }) + + player:get_inventory():set_width("main", 8) + player:get_inventory():set_size("main", 8 * 4) + player:hud_set_hotbar_itemcount(8) + + -- creative mode privs + if minetest.is_creative_enabled(name) then + minetest.set_player_privs(name, PyuTest.util.tableconcat({ + fly = true, + fast = true, + noclip = true, + builder = true, + settime = true, + creative = true, + peaceful_player = true, -- from mobs_redo + teleport = true, + }, minetest.get_player_privs(name))) + else + minetest.set_player_privs(name, PyuTest.util.tableconcat({ + fly = false, + fast = false, + noclip = false, + builder = false, + settime = false, + teleport = false, + creative = false, + peaceful_player = false, + }, minetest.get_player_privs(name))) + end +end) + +-- player physics +local function set_player_speed(player, speed) + player:set_physics_override({ + speed = speed, + }) +end + +minetest.register_globalstep(function(dtime) + local players = minetest.get_connected_players() + for p=1, #players do + local ctrl = players[p]:get_player_control() + if ctrl.aux1 then + set_player_speed(players[p], 1.60) + else + set_player_speed(players[p], 1) + end + end +end) + +-- player hand +minetest.register_item(":", { + type = "none", + wield_image = "pyutest-hand.png" +}) + +if minetest.is_creative_enabled("") then + minetest.override_item("", { + range = 9, + tool_capabilities = PyuTest.tool_caps({ + uses = 0, + time = 0.35, + + groupcaps = { + crumbly = {}, + choppy = {}, + cracky = {}, + snappy = {}, + explody = {}, + oddly_breakable_by_hand = {} + }, + + attack_uses = 0, + damage_groups = {fleshy = 10000} + }) + }) +else + minetest.override_item("", { + range = 5, + tool_capabilities = PyuTest.tool_caps({ + uses = 0, + attck_uses = 0, + damage_groups = {fleshy = 2}, + + groupcaps = { + oddly_breakable_by_hand = { + times = { + [PyuTest.BLOCK_FAST] = 0.35, + [PyuTest.BLOCK_NORMAL] = 0.50, + [PyuTest.BLOCK_SLOW] = 0.65, + } + }, + snappy = { + times = { + [PyuTest.BLOCK_FAST] = 0.55, + [PyuTest.BLOCK_NORMAL] = 0.70, + [PyuTest.BLOCK_SLOW] = 0.70 + } + }, + crumbly = { + times = { + [PyuTest.BLOCK_FAST] = 0.75, + [PyuTest.BLOCK_NORMAL] = 0.80, + [PyuTest.BLOCK_SLOW] = 0.90 + } + }, + choppy = { + times = { + [PyuTest.BLOCK_FAST] = 1.2, + [PyuTest.BLOCK_NORMAL] = 2.3, + [PyuTest.BLOCK_SLOW] = 2.9, + } + }, + cracky = { + times = { + [PyuTest.BLOCK_FAST] = 6, + [PyuTest.BLOCK_NORMAL] = 10, + [PyuTest.BLOCK_SLOW] = 45, + } + } + } + }) + }) +end + +-- unlimited blocks in creative mode +minetest.register_on_placenode(function(_, _, placer) + if placer and placer:is_player() then + return minetest.is_creative_enabled(placer:get_player_name()) + end +end) + +-- player death message +minetest.register_on_dieplayer(function(player, reason) + local playername = player:get_player_name() + + if reason.object ~= nil then + local le = reason.object:get_luaentity() + + if le == nil then + minetest.chat_send_all(string.format("%s was slain by %s", + playername, reason.object:get_player_name())) + else + local split = string.split(le.name, ":") + local name = split[#split] + name = name:gsub("_", " ") + name = string.upper(name:sub(1, 1))..name:sub(2, name:len()) + minetest.chat_send_all(string.format("%s was slain by %s", playername, name)) + end + end +end) diff --git a/mods/pyutest/pyutest_cmds/README.md b/mods/pyutest/pyutest_cmds/README.md deleted file mode 100644 index 68dcdc7..0000000 --- a/mods/pyutest/pyutest_cmds/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# pyutest_cmds - -Chat Commands for Nodelands diff --git a/mods/pyutest/pyutest_cmds/fun.lua b/mods/pyutest/pyutest_cmds/fun.lua deleted file mode 100644 index 2d39f7b..0000000 --- a/mods/pyutest/pyutest_cmds/fun.lua +++ /dev/null @@ -1,36 +0,0 @@ -minetest.register_privilege("fun", { - description = "Access to \"powerful\" fun commands", - give_to_singeplayer = true -}) - -minetest.register_chatcommand("explode", { - params = "", - 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 -}) diff --git a/mods/pyutest/pyutest_cmds/gameplay.lua b/mods/pyutest/pyutest_cmds/gameplay.lua deleted file mode 100644 index ef5f897..0000000 --- a/mods/pyutest/pyutest_cmds/gameplay.lua +++ /dev/null @@ -1,73 +0,0 @@ ---[[ - Format: - - user = { - name = { - pos = {x = 128, y = 50, z = 256}, - idx = 439 - } - } - -]] -local waypoints = {} - -minetest.register_chatcommand("waypoint", { - params = "", - description = [[Creates a waypoint at your position called -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 = "", - 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 -}) diff --git a/mods/pyutest/pyutest_cmds/init.lua b/mods/pyutest/pyutest_cmds/init.lua deleted file mode 100644 index 88f9a3a..0000000 --- a/mods/pyutest/pyutest_cmds/init.lua +++ /dev/null @@ -1,4 +0,0 @@ -PyuTestCmds_Path = minetest.get_modpath("pyutest_cmds") -dofile(PyuTestCmds_Path.."/worldedit.lua") -dofile(PyuTestCmds_Path.."/gameplay.lua") -dofile(PyuTestCmds_Path.."/fun.lua") diff --git a/mods/pyutest/pyutest_cmds/mod.conf b/mods/pyutest/pyutest_cmds/mod.conf deleted file mode 100644 index b1e9bb5..0000000 --- a/mods/pyutest/pyutest_cmds/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = pyutest_cmds -depends = pyutest_core diff --git a/mods/pyutest/pyutest_cmds/worldedit.lua b/mods/pyutest/pyutest_cmds/worldedit.lua deleted file mode 100644 index fac3a6d..0000000 --- a/mods/pyutest/pyutest_cmds/worldedit.lua +++ /dev/null @@ -1,63 +0,0 @@ -minetest.register_privilege("builder", { - description = "Builder/World Edit Privilege", - give_to_singeplayer = true -}) - -minetest.register_chatcommand("replacenear", { - params = " ", - description = [[Replace blocks around RANGE from FROM to TO. -FROM can be comma seperated, or it can be `any` which replaces any node. -Or it can be `anyblock` which replaces any node other than air and ignore. -]], -privs = { - builder = true -}, -func = function (name, param) - local parts = param:split(" ") - if #parts == 3 then - local player = minetest.get_player_by_name(name) - local pos = player:get_pos() - local range = tonumber(parts[1]) or 5 - local from = parts[2]:split(",") - local to = parts[3] - local replaced = 0 - - local function replace(p) - for _, v in pairs(from) do - local name = minetest.get_node(p).name - local anyblock_match = (v == "anyblock" or v == "anynode" and name ~= "air" and name ~= "ignore") - - if name == v or v == "any" or anyblock_match then - minetest.set_node(p, {name = to}) - replaced = replaced + 1 - end - end - end - - PyuTest.dorange(pos, range, function(p) - replace(p) - end) - - return true, string.format("Replaced %d blocks", replaced) - end - return false, "Requires 3 arguments" -end -}) - -minetest.register_chatcommand("place", { - params = "", - description = "Place SCHEMATIC at player position", - privs = { - builder = true - }, - func = function(name, param) - local player = minetest.get_player_by_name(name) - minetest.place_schematic(player:get_pos(), - PyuTest.get_schem_path(param), - "random", - nil, - false, - "place_center_x, place_center_z" - ) - end -}) diff --git a/mods/pyutest/pyutest_core/abms.lua b/mods/pyutest/pyutest_core/abms.lua deleted file mode 100644 index 4875b66..0000000 --- a/mods/pyutest/pyutest_core/abms.lua +++ /dev/null @@ -1,51 +0,0 @@ -minetest.register_abm({ - label = "Sponge Loop", - nodenames = {"pyutest_core: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_core:contagious_acid"}, - interval = 3.4, - chance = 3.7, - catchup = true, - action = function (pos) - minetest.set_node(pos, { - name = "pyutest_core:contagious_acid" - }) - end -}) - -minetest.register_abm({ - label = "Fire Spread", - nodenames = {"group:flammable"}, - neighbors = {"pyutest_core:fire"}, - interval = 1, - chance = 4, - action = function (pos) - minetest.set_node(pos, { - name = "pyutest_core:fire" - }) - end -}) diff --git a/mods/pyutest/pyutest_core/crafts.lua b/mods/pyutest/pyutest_core/crafts.lua deleted file mode 100644 index b7955b4..0000000 --- a/mods/pyutest/pyutest_core/crafts.lua +++ /dev/null @@ -1,262 +0,0 @@ -minetest.register_craft({ - output = "pyutest_core:wooden_pickaxe 1", - recipe = { - {"group:wooden_planks", "group:wooden_planks", "group:wooden_planks"}, - {"", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:wooden_axe 1", - recipe = { - {"group:wooden_planks", "group:wooden_planks", ""}, - {"group:wooden_planks", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:wooden_sword 1", - recipe = { - {"", "group:wooden_planks", ""}, - {"", "group:wooden_planks", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:stone_pickaxe", - recipe = { - {"group:stone", "group:stone", "group:stone"}, - {"", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:stone_axe", - recipe = { - {"group:stone", "group:stone", ""}, - {"group:stone", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:stone_sword", - recipe = { - {"", "group:stone", ""}, - {"", "group:stone", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:iron_pickaxe", - recipe = { - {"pyutest_core:iron_ingot", "pyutest_core:iron_ingot", "pyutest_core:iron_ingot"}, - {"", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:iron_axe", - recipe = { - {"pyutest_core:iron_ingot", "pyutest_core:iron_ingot", ""}, - {"pyutest_core:iron_ingot", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:iron_sword", - recipe = { - {"pyutest_core:iron_ingot"}, - {"pyutest_core:iron_ingot"}, - {"pyutest_core:stick"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:diamond_pickaxe", - recipe = { - {"pyutest_core:diamond_shard", "pyutest_core:diamond_shard", "pyutest_core:diamond_shard"}, - {"", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:diamond_axe", - recipe = { - {"pyutest_core:diamond_shard", "pyutest_core:diamond_shard", ""}, - {"pyutest_core:diamond_shard", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -minetest.register_craft({ - output = "pyutest_core:diamond_sword", - recipe = { - {"pyutest_core:diamond_shard"}, - {"pyutest_core:diamond_shard"}, - {"pyutest_core:stick"} - } -}) - --- not tools -minetest.register_craft({ - output = "pyutest_core: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_core:brick_block 4", - recipe = { - {"pyutest_core:brick", "pyutest_core:brick"}, - {"pyutest_core:brick", "pyutest_core:brick"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:furnace", - recipe = { - {"group:stone", "group:stone", "group:stone"}, - {"group:stone", "", "group:stone"}, - {"group:stone", "group:stone", "group:stone"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:slime_block", - type = "shapeless", - recipe = { - "pyutest_core:clay_block", - "pyutest_core:swampy_grass_block" - } -}) - -minetest.register_craft({ - output = "pyutest_core:sugar 3", - type = "shapeless", - recipe = { - "pyutest_core:sugarcane" - } -}) - -minetest.register_craft({ - output = "pyutest_core:clay_block 4", - recipe = { - {"pyutest_core:clay", "pyutest_core:clay"}, - {"pyutest_core:clay", "pyutest_core:clay"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:bone_block 4", - recipe = { - {"pyutest_core:bone", "pyutest_core:bone"}, - {"pyutest_core:bone", "pyutest_core:bone"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:stick 4", - recipe = { - {"group:wooden_planks"}, - {"group:wooden_planks"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:coin", - recipe = { - {"pyutest_core:gold_ingot", "pyutest_core:gold_ingot", "pyutest_core:gold_ingot"}, - {"pyutest_core:gold_ingot", "pyutest_core:gold_ingot", "pyutest_core:gold_ingot"}, - {"pyutest_core:gold_ingot", "pyutest_core:gold_ingot", "pyutest_core:gold_ingot"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:gold_ingot 9", - recipe = { - {"pyutest_core:coin"} - } -}) - --- this recipe makes no sense, but who cares? -minetest.register_craft({ - output = "pyutest_core:contagious_acid 3", - recipe = { - "pyutest_core:mushroom_block", - "pyutest_core:mushroom_stem_block", - "pyutest_core:dirt_block", - "pyutest_core:swampy_grass_block" - }, - type = "shapeless" -}) - -minetest.register_craft({ - output = "pyutest_core:light 4", - recipe = { - {"pyutest_core:torch", "pyutest_core:torch"}, - {"pyutest_core:torch", "pyutest_core:torch"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:tnt 3", - recipe = { - {"pyutest_core:sand_block", "pyutest_core:gunpowder"}, - {"pyutest_core:gunpowder", "pyutest_core:sand_block"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:torch 4", - recipe = { - {"pyutest_core:coal_lump"}, - {"pyutest_core:stick"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:wheat 4", - recipe = { - "pyutest_core:haybale_block" - }, - type = "shapeless" -}) - -minetest.register_craft({ - output = "pyutest_core:haybale_block", - recipe = { - {"pyutest_core:wheat", "pyutest_core:wheat"}, - {"pyutest_core:wheat", "pyutest_core:wheat"} - } -}) - -minetest.register_craft({ - output = "pyutest_core:bread 3", - recipe = { - {"pyutest_core:wheat", "pyutest_core:wheat", "pyutest_core:wheat"} - } -}) - -minetest.register_craft({ - type = "cooking", - output = "pyutest_core:glass", - recipe = "pyutest_core:sand_block" -}) - -minetest.register_craft({ - type = "cooking", - output = "pyutest_core:brick", - recipe = "pyutest_core:clay", -}) diff --git a/mods/pyutest/pyutest_core/furnace.lua b/mods/pyutest/pyutest_core/furnace.lua deleted file mode 100644 index 0e9350f..0000000 --- a/mods/pyutest/pyutest_core/furnace.lua +++ /dev/null @@ -1,85 +0,0 @@ -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_core: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, -}) diff --git a/mods/pyutest/pyutest_core/furniture.lua b/mods/pyutest/pyutest_core/furniture.lua deleted file mode 100644 index 048ad74..0000000 --- a/mods/pyutest/pyutest_core/furniture.lua +++ /dev/null @@ -1,121 +0,0 @@ -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(v.name, v.desc, v.name.."_block", v.tiles, v.groups, v.econf) -end diff --git a/mods/pyutest/pyutest_core/leaves.lua b/mods/pyutest/pyutest_core/leaves.lua deleted file mode 100644 index 64439bf..0000000 --- a/mods/pyutest/pyutest_core/leaves.lua +++ /dev/null @@ -1,42 +0,0 @@ -PyuTest.registered_leaves = {} -PyuTest.make_leaves = function (id, desc, tiles) - local _id = id ~= nil and id.."_leaves" or "pyutest_core:leaves" -- backwards compatability with original leaves - local _desc = desc ~= nil and desc .. " Leaves" or "Leaves" - - PyuTest.make_building_blocks(_id, _desc, tiles, nil, { - acid_vulnerable = 1, - flammable = 1, - snappy = PyuTest.BLOCK_FAST - }, { - is_ground_content = false - }) - - local leaves_id = _id.."_block" - minetest.override_item(leaves_id, { - drop = { - max_items = 1, - items = { - { - rarity = 3.5, - items = {"pyutest_core:apple 1"} - }, - - { - items = {leaves_id} - } - } - } - }) - - PyuTest.registered_leaves[_id] = { - tiles = tiles - } -end - -PyuTest.make_leaves(nil, nil, {"pyutest-leaves.png"}) -PyuTest.make_leaves("pyutest_core:snowy", "Snowy", {"pyutest-snowy-leaves.png"}) -PyuTest.make_leaves("pyutest_core:cherry", "Cherry", {"pyutest-cherry-leaves.png"}) -PyuTest.make_leaves("pyutest_core:dark", "Dark", {"pyutest-dark-leaves.png"}) -PyuTest.make_leaves("pyutest_core:aspen", "Aspen", {"pyutest-aspen-leaves.png"}) -PyuTest.make_leaves("pyutest_core:red_aspen", "Red Aspen", {"pyutest-red-aspen-leaves.png"}) -PyuTest.make_leaves("pyutest_core:vyn", "Vyn", {"pyutest-vyn-leaves.png"}) diff --git a/mods/pyutest/pyutest_core/liquid.lua b/mods/pyutest/pyutest_core/liquid.lua deleted file mode 100644 index f04be3f..0000000 --- a/mods/pyutest/pyutest_core/liquid.lua +++ /dev/null @@ -1,76 +0,0 @@ -PyuTest.registered_liquids = {} -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")) - - PyuTest.registered_liquids[name] = { - source = name.."_source", - flowing = name.."_flowing", - texture = texture, - groups = g - } -end - -PyuTest.make_liquid("pyutest_core: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_core:lava", "Lava", { - lava = 1, - coolable = 1 -}, "pyutest-lava.png", 5, { - damage_per_second = 4, - light_source = 8 -}) -PyuTest.make_liquid("pyutest_core:oil", "Oil", {}, "pyutest-oil.png", 3) -PyuTest.make_liquid("pyutest_core:liquid_acid", "Acid", {}, "pyutest-acid.png", 7, { - damage_per_second = 4 -}) diff --git a/mods/pyutest/pyutest_core/lootboxes.lua b/mods/pyutest/pyutest_core/lootboxes.lua deleted file mode 100644 index d18482f..0000000 --- a/mods/pyutest/pyutest_core/lootboxes.lua +++ /dev/null @@ -1,62 +0,0 @@ -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_core:trash", "Trash", { - ItemStack("pyutest_core:deadbush 6"), - ItemStack("pyutest_core:bone 3"), - ItemStack("pyutest_core:ash 2") -}) - -PyuTest.make_lootbox("pyutest_core:resource", "Resource", { - ItemStack("pyutest_core:gunpowder 3"), - ItemStack("pyutest_core:stick 4"), - ItemStack("pyutest_core:sugar 2"), - ItemStack("pyutest_core:tree_sapling 3"), - ItemStack("pyutest_core:apple 3"), - ItemStack("pyutest_core:string 5") -}) - -PyuTest.make_lootbox("pyutest_core:griefer", "Griefer's Dream", { - ItemStack("pyutest_core:tnt 3"), - ItemStack("pyutest_core:bomb 2") -}) - -PyuTest.make_lootbox("pyutest_core:lighting", "Lighting", { - ItemStack("pyutest_core:light 2"), - ItemStack("pyutest_core:torch 5") -}) - -PyuTest.make_lootbox("pyutest_core:color", "Color", { - ItemStack("pyutest_core:green_dye 2"), - ItemStack("pyutest_core:pink_dye 3"), - ItemStack("pyutest_core:white_dye 1"), - ItemStack("pyutest_core:black_dye 3"), - ItemStack("pyutest_core:brown_dye 2") -}) diff --git a/mods/pyutest/pyutest_core/magic.lua b/mods/pyutest/pyutest_core/magic.lua deleted file mode 100644 index 9b7d582..0000000 --- a/mods/pyutest/pyutest_core/magic.lua +++ /dev/null @@ -1,155 +0,0 @@ -PyuTest.make_item("pyutest_core:magic_shards", "Magic Shards", {}, "pyutest-magic-shards.png") -minetest.override_item("pyutest_core:enchanted_obsidian_block", { - drop = { - max_items = 1, - items = { - { - rarity = 3.2, - items = {"pyutest_core: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_core:magic_shards", ""}, - {"pyutest_core:magic_shards", craftitem, "pyutest_core:magic_shards"}, - {"", "pyutest_core:magic_shards", ""} - } - }) - - PyuTest.registered_spellbooks[nsname] = { - color = color, - craftitem = craftitem, - action = action - } -end - -PyuTest.make_spellbook("pyutest_core:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_core:bomb", function (itemstack, user) - PyuTest.create_explosion(user:get_pos(), 3, false, 7, user) -end) - -PyuTest.make_spellbook("pyutest_core:fire_spellbook", "Spellbook of Fire", "crimson", "pyutest_core: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_core: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_core:enchanted_shard", "Enchanted Shard", {}, "pyutest-shard.png", { - color = "indigo", -}) - -minetest.register_craft({ - output = "pyutest_core:enchanted_shard 2", - recipe = { - {"pyutest_core:magic_shards", "pyutest_core:diamond_shard", "pyutest_core:magic_shards"}, - {"pyutest_core:emerald_shard", "pyutest_core:magic_shards", "pyutest_core:emerald_shard"}, - {"pyutest_core:magic_shards", "pyutest_core:diamond_shard", "pyutest_core:magic_shards"} - } -}) - -PyuTest.make_tool("pyutest_core: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_core:enchanted_pickaxe", - recipe = { - {"pyutest_core:enchanted_shard", "pyutest_core:enchanted_shard", "pyutest_core:enchanted_shard"}, - {"", "pyutest_core:stick", ""}, - {"", "pyutest_core:stick", ""} - } -}) - -PyuTest.make_sword("pyutest_core:enchanted_sword", "Enchanted Sword", "pyutest-enchanted-sword.png", 9, 3600, 0.7) - - -minetest.register_craft({ - output = "pyutest_core:enchanted_sword", - recipe = { - {"pyutest_core:enchanted_shard"}, - {"pyutest_core:enchanted_shard"}, - {"pyutest_core:stick"} - } -}) - - -PyuTest.make_item("pyutest_core: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}) - math.randomseed(os.time()) - - 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 -}) diff --git a/mods/pyutest/pyutest_core/ores.lua b/mods/pyutest/pyutest_core/ores.lua deleted file mode 100644 index 565c933..0000000 --- a/mods/pyutest/pyutest_core/ores.lua +++ /dev/null @@ -1,371 +0,0 @@ -PyuTest.make_building_blocks("pyutest_core:granite", "Granite", {"pyutest-granite.png"}, nil, { - ground = 1, - stone = 1, - cracky = PyuTest.BLOCK_NORMAL, - level = 1 -}) - -PyuTest.make_building_blocks("pyutest_core:andesite", "Andesite", {"pyutest-andesite.png"}, nil, { - ground = 1, - stone = 1, - cracky = PyuTest.BLOCK_NORMAL, - level = 1 -}) - -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_core:granite_block", - wherein = "pyutest_core: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_core:andesite_block", - wherein = "pyutest_core: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_core:clay_block", - wherein = "pyutest_core: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_core:stone_block", - "pyutest_core:granite_block", - "pyutest_core:andesite_block", -} - --- TODO: The code here is very messy, and this function takes to much arguments. Squash the arguments into a table and clean the code. -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_core: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} - }, - - block_tiles = {"pyutest-metal.png"}, - block_color = {r = 32, g = 32, b = 32} -}) - -PyuTest.make_ore("pyutest_core: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_core: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_core: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_core: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_core: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_core: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_core: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" -}) diff --git a/mods/pyutest/pyutest_core/player.lua b/mods/pyutest/pyutest_core/player.lua deleted file mode 100644 index f6d6fe6..0000000 --- a/mods/pyutest/pyutest_core/player.lua +++ /dev/null @@ -1,149 +0,0 @@ --- player setup -minetest.register_on_joinplayer(function (player) - if player == nil then return end - local name = player:get_player_name() - player:set_properties({ - hp_max = 25 - }) - - player:get_inventory():set_width("main", 8) - player:get_inventory():set_size("main", 8 * 4) - player:hud_set_hotbar_itemcount(8) - - -- creative mode privs - if minetest.is_creative_enabled(name) then - minetest.set_player_privs(name, PyuTest.util.tableconcat({ - fly = true, - fast = true, - noclip = true, - builder = true, - settime = true, - creative = true, - peaceful_player = true, -- from mobs_redo - teleport = true, - }, minetest.get_player_privs(name))) - end -end) - --- player physics -local function set_player_speed(player, speed) - player:set_physics_override({ - speed = speed, - }) -end - -minetest.register_globalstep(function(dtime) - local players = minetest.get_connected_players() - for p=1, #players do - local ctrl = players[p]:get_player_control() - if ctrl.aux1 then - set_player_speed(players[p], 1.60) - else - set_player_speed(players[p], 1) - end - end -end) - --- player hand -minetest.register_item(":", { - type = "none", - wield_image = "pyutest-hand.png" -}) - -if minetest.is_creative_enabled("") then - local break_speed = 0.2 - - minetest.override_item("", { - range = 9, - tool_capabilities = PyuTest.tool_caps({ - uses = 0, - time = 0.35, - - groupcaps = { - crumbly = {}, - choppy = {}, - cracky = {}, - snappy = {}, - explody = {}, - oddly_breakable_by_hand = {} - }, - - attack_uses = 0, - damage_groups = {fleshy = 10000} - }) - }) -else - minetest.override_item("", { - range = 5, - tool_capabilities = PyuTest.tool_caps({ - uses = 0, - attck_uses = 0, - damage_groups = {fleshy = 2}, - - groupcaps = { - oddly_breakable_by_hand = { - times = { - [PyuTest.BLOCK_FAST] = 0.35, - [PyuTest.BLOCK_NORMAL] = 0.50, - [PyuTest.BLOCK_SLOW] = 0.65, - } - }, - snappy = { - times = { - [PyuTest.BLOCK_FAST] = 0.55, - [PyuTest.BLOCK_NORMAL] = 0.70, - [PyuTest.BLOCK_SLOW] = 0.70 - } - }, - crumbly = { - times = { - [PyuTest.BLOCK_FAST] = 0.75, - [PyuTest.BLOCK_NORMAL] = 0.80, - [PyuTest.BLOCK_SLOW] = 0.90 - } - }, - choppy = { - times = { - [PyuTest.BLOCK_FAST] = 1.2, - [PyuTest.BLOCK_NORMAL] = 2.3, - [PyuTest.BLOCK_SLOW] = 2.9, - } - }, - cracky = { - times = { - [PyuTest.BLOCK_FAST] = 6, - [PyuTest.BLOCK_NORMAL] = 10, - [PyuTest.BLOCK_SLOW] = 45, - } - } - } - }) - }) -end - --- unlimited blocks in creative mode -minetest.register_on_placenode(function(_, _, placer) - if placer and placer:is_player() then - return minetest.is_creative_enabled(placer:get_player_name()) - end -end) - --- player death message -minetest.register_on_dieplayer(function(player, reason) - local playername = player:get_player_name() - - if reason.object ~= nil then - local le = reason.object:get_luaentity() - - if le == nil then - minetest.chat_send_all(string.format("%s was slain by %s", - playername, reason.object:get_player_name())) - else - local split = string.split(le.name, ":") - local name = split[#split] - name = name:gsub("_", " ") - name = string.upper(name:sub(1, 1))..name:sub(2, name:len()) - minetest.chat_send_all(string.format("%s was slain by %s", playername, name)) - end - end -end) diff --git a/mods/pyutest/pyutest_core/tools.lua b/mods/pyutest/pyutest_core/tools.lua deleted file mode 100644 index 3f494b8..0000000 --- a/mods/pyutest/pyutest_core/tools.lua +++ /dev/null @@ -1,170 +0,0 @@ -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_tool("pyutest_core: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_core: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_core: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_core: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_core: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_core: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_core: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_core: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_core: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 -}) diff --git a/mods/pyutest/pyutest_core/wood.lua b/mods/pyutest/pyutest_core/wood.lua deleted file mode 100644 index 46c4dc4..0000000 --- a/mods/pyutest/pyutest_core/wood.lua +++ /dev/null @@ -1,104 +0,0 @@ -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_core:wooden", "Oak", { - "pyutest-log-top-bottom.png", - "pyutest-log-top-bottom.png", - "pyutest-log.png" -}, { - "pyutest-wood.png" -}) - -PyuTest.make_wood("pyutest_core: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_core: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_core: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_core: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_core:jungle", "Jungle", { - "pyutest-jungle-log-top-bottom.png", - "pyutest-jungle-log-top-bottom.png", - "pyutest-jungle-log.png" -}, { - "pyutest-jungle-wood.png" -}) - -PyuTest.make_wood("pyutest_core:vyn", "Vyn", { - "pyutest-vyn-log-top-bottom.png", - "pyutest-vyn-log-top-bottom.png", - "pyutest-vyn-log.png" -}, { - "pyutest-vyn-wood.png" -}) diff --git a/mods/pyutest/pyutest_core/wool.lua b/mods/pyutest/pyutest_core/wool.lua deleted file mode 100644 index 2d0e124..0000000 --- a/mods/pyutest/pyutest_core/wool.lua +++ /dev/null @@ -1,94 +0,0 @@ -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_core:white_wool_block", - name.."_dye" - } - }) - - minetest.register_craft({ - output = name.."_terracotta_block", - type = "shapeless", - recipe = { - "pyutest_core: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_core:white", "White", "white") -minetest.register_craft({ - output = "pyutest_core:white_wool_block 4", - recipe = { - {"pyutest_core:string", "pyutest_core:string"}, - {"pyutest_core:string", "pyutest_core:string"} - } -}) - -minetest.register_craft({ - type = "cooking", - output = "pyutest_core:white_terracotta_block", - recipe = "pyutest_core: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_core:"..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_core:red_dye", "pyutest_core:blue_dye", "pyutest_core:purple_dye") -PyuTest.make_dye_mixing_recipe("pyutest_core:red_dye", "pyutest_core:yellow_dye", "pyutest_core:orange_dye") -PyuTest.make_dye_mixing_recipe("pyutest_core:yellow_dye", "pyutest_core:blue_dye", "pyutest_core:green_dye") -PyuTest.make_dye_mixing_recipe("pyutest_core:red_dye", "pyutest_core:white_dye", "pyutest_core:pink_dye") -PyuTest.make_dye_mixing_recipe("pyutest_core:red_dye", "pyutest_core:green_dye", "pyutest_core:brown_dye") diff --git a/mods/pyutest/pyutest_core/README.md b/mods/pyutest/pyutest_core2/README.md similarity index 100% rename from mods/pyutest/pyutest_core/README.md rename to mods/pyutest/pyutest_core2/README.md diff --git a/mods/pyutest/pyutest_core2/abms.lua b/mods/pyutest/pyutest_core2/abms.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_core/blocks.lua b/mods/pyutest/pyutest_core2/blocks.lua similarity index 99% rename from mods/pyutest/pyutest_core/blocks.lua rename to mods/pyutest/pyutest_core2/blocks.lua index da804c3..db6ea08 100644 --- a/mods/pyutest/pyutest_core/blocks.lua +++ b/mods/pyutest/pyutest_core2/blocks.lua @@ -1,3 +1,7 @@ +if true then + return +end + PyuTest.make_node_sounds = function(tbl) local t = tbl or {} t.footstep = t.footstep or {name = "block_walk", gain = 1} @@ -438,7 +442,7 @@ PyuTest.make_node("pyutest_core:torch", "Torch", { }) PyuTest.make_node("pyutest_core:glass", "Glass", { - block = PyuTest.BLOCK_BREAKABLE_INSTANT + cracky = PyuTest.BLOCK_NORMAL }, {"pyutest-glass.png"}, { drawtype = "glasslike_framed", paramtype = "light", diff --git a/mods/pyutest/pyutest_core/combat.lua b/mods/pyutest/pyutest_core2/combat.lua similarity index 100% rename from mods/pyutest/pyutest_core/combat.lua rename to mods/pyutest/pyutest_core2/combat.lua diff --git a/mods/pyutest/pyutest_core2/crafts.lua b/mods/pyutest/pyutest_core2/crafts.lua new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/mods/pyutest/pyutest_core2/crafts.lua @@ -0,0 +1 @@ + diff --git a/mods/pyutest/pyutest_core2/electricity.lua b/mods/pyutest/pyutest_core2/electricity.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_core/flowers.lua b/mods/pyutest/pyutest_core2/flowers.lua similarity index 62% rename from mods/pyutest/pyutest_core/flowers.lua rename to mods/pyutest/pyutest_core2/flowers.lua index 5cb84ad..275cea9 100644 --- a/mods/pyutest/pyutest_core/flowers.lua +++ b/mods/pyutest/pyutest_core2/flowers.lua @@ -1,27 +1,27 @@ 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 + 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 + 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" + output = dye .. " 2", + recipe = {name}, + type = "shapeless" }) end @@ -47,17 +47,17 @@ PyuTest.make_flower("pyutest_core:grass_plant", "Grass", "pyutest-grass-plant.pn PyuTest.make_flower("pyutest_core:sugarcane", "Sugarcane", "pyutest-sugarcane.png", "pyutest_core:green_dye", false, nil) PyuTest.make_node("pyutest_core:lilypad", "Lily Pad", { - block = PyuTest.BLOCK_BREAKABLE_INSTANT + 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} - }, + 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} + }, }) -- Plants after the floral update @@ -66,53 +66,53 @@ PyuTest.make_flower("pyutest_core:orange_tulip", "Orange Tulip", "pyutest-orange PyuTest.make_flower("pyutest_core:black_rose", "Black Rose", "pyutest-black-rose.png", "pyutest_core:black_dye", false) PyuTest.make_node("pyutest_core:vines", "Vines", { - block = PyuTest.BLOCK_BREAKABLE_INSTANT, - attached_node = 1, - flammable = 1 + block = PyuTest.BLOCK_BREAKABLE_INSTANT, + attached_node = 1, + 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" + 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_core:kelp", "Kelp", "pyutest-kelp.png", "pyutest_core: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" + 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 + walkable = true }) PyuTest.make_flower("pyutest_core:small_mushroom", - "Small Mushroom", - "pyutest-mushroom-small.png", - "pyutest_core:red_dye", - false, nil, { - groups = { - block = PyuTest.BLOCK_BREAKABLE_INSTANT, - flammable = 1, - flower = 1, - dig_immediate = 1, - attached_node = 1 - }, +"Small Mushroom", +"pyutest-mushroom-small.png", +"pyutest_core:red_dye", +false, nil, { + groups = { + block = PyuTest.BLOCK_BREAKABLE_INSTANT, + flammable = 1, + flower = 1, + dig_immediate = 1, + attached_node = 1 + }, - paramtype2 = "wallmounted" + paramtype2 = "wallmounted" }) diff --git a/mods/pyutest/pyutest_core/food.lua b/mods/pyutest/pyutest_core2/food.lua similarity index 62% rename from mods/pyutest/pyutest_core/food.lua rename to mods/pyutest/pyutest_core2/food.lua index a517b84..8107abc 100644 --- a/mods/pyutest/pyutest_core/food.lua +++ b/mods/pyutest/pyutest_core2/food.lua @@ -2,12 +2,12 @@ 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 + 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 diff --git a/mods/pyutest/pyutest_core2/furnace.lua b/mods/pyutest/pyutest_core2/furnace.lua new file mode 100644 index 0000000..ee92f5c --- /dev/null +++ b/mods/pyutest/pyutest_core2/furnace.lua @@ -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_core: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, +}) diff --git a/mods/pyutest/pyutest_core2/furniture.lua b/mods/pyutest/pyutest_core2/furniture.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_core/init.lua b/mods/pyutest/pyutest_core2/init.lua similarity index 97% rename from mods/pyutest/pyutest_core/init.lua rename to mods/pyutest/pyutest_core2/init.lua index 13c9705..46f9e26 100644 --- a/mods/pyutest/pyutest_core/init.lua +++ b/mods/pyutest/pyutest_core2/init.lua @@ -1,3 +1,6 @@ +if true then + return +end PyuTestCore_Path = minetest.get_modpath("pyutest_core") dofile(PyuTestCore_Path.."/utils.lua") -- Utilities diff --git a/mods/pyutest/pyutest_core/items.lua b/mods/pyutest/pyutest_core2/items.lua similarity index 84% rename from mods/pyutest/pyutest_core/items.lua rename to mods/pyutest/pyutest_core2/items.lua index 3fd2859..fdbfb00 100644 --- a/mods/pyutest/pyutest_core/items.lua +++ b/mods/pyutest/pyutest_core2/items.lua @@ -20,33 +20,33 @@ PyuTest.make_item("pyutest_core:stick", "Stick", {}, "pyutest-stick.png") PyuTest.make_item("pyutest_core:bone", "Bone", {}, "pyutest-bone.png", {}) PyuTest.make_item("pyutest_core:gunpowder", "Gunpowder", {}, "pyutest-powder.png", { - color = "dimgray", + color = "dimgray", }) PyuTest.make_item("pyutest_core:ash", "Ash", {}, "pyutest-powder.png", { - color = "gray", + color = "gray", }) PyuTest.make_item("pyutest_core:sugar", "Sugar", {}, "pyutest-powder.png") PyuTest.make_item("pyutest_core: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 + 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_core:wheat", "Wheat", {}, "pyutest-wheat.png") PyuTest.make_item("pyutest_core:string", "String", {}, "pyutest-string.png") PyuTest.make_item("pyutest_core:egg", "Egg", {}, "pyutest-egg.png", { - color = "peachpuff" + color = "peachpuff" }) PyuTest.make_item("pyutest_core:clay", "Clay Ball", {}, "pyutest-clay.png") PyuTest.make_item("pyutest_core:glass_bottle", "Glass Bottle", {}, "pyutest-glass-bottle.png", { - stack_max = 16 + stack_max = 16 }) PyuTest.make_item("pyutest_core:brick", "Brick", {}, "pyutest-brick.png") PyuTest.make_item("pyutest_core:snowball", "Snowball", {}, "pyutest-snowball.png") diff --git a/mods/pyutest/pyutest_core2/leaves.lua b/mods/pyutest/pyutest_core2/leaves.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_core2/liquid.lua b/mods/pyutest/pyutest_core2/liquid.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_core2/lootboxes.lua b/mods/pyutest/pyutest_core2/lootboxes.lua new file mode 100644 index 0000000..2f30587 --- /dev/null +++ b/mods/pyutest/pyutest_core2/lootboxes.lua @@ -0,0 +1,62 @@ +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_core:trash", "Trash", { + ItemStack("pyutest_core:deadbush 6"), + ItemStack("pyutest_core:bone 3"), + ItemStack("pyutest_core:ash 2") +}) + +PyuTest.make_lootbox("pyutest_core:resource", "Resource", { + ItemStack("pyutest_core:gunpowder 3"), + ItemStack("pyutest_core:stick 4"), + ItemStack("pyutest_core:sugar 2"), + ItemStack("pyutest_core:tree_sapling 3"), + ItemStack("pyutest_core:apple 3"), + ItemStack("pyutest_core:string 5") +}) + +PyuTest.make_lootbox("pyutest_core:griefer", "Griefer's Dream", { + ItemStack("pyutest_core:tnt 3"), + ItemStack("pyutest_core:bomb 2") +}) + +PyuTest.make_lootbox("pyutest_core:lighting", "Lighting", { + ItemStack("pyutest_core:light 2"), + ItemStack("pyutest_core:torch 5") +}) + +PyuTest.make_lootbox("pyutest_core:color", "Color", { + ItemStack("pyutest_core:green_dye 2"), + ItemStack("pyutest_core:pink_dye 3"), + ItemStack("pyutest_core:white_dye 1"), + ItemStack("pyutest_core:black_dye 3"), + ItemStack("pyutest_core:brown_dye 2") +}) diff --git a/mods/pyutest/pyutest_core2/magic.lua b/mods/pyutest/pyutest_core2/magic.lua new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/mods/pyutest/pyutest_core2/magic.lua @@ -0,0 +1 @@ + diff --git a/mods/pyutest/pyutest_core/mod.conf b/mods/pyutest/pyutest_core2/mod.conf similarity index 100% rename from mods/pyutest/pyutest_core/mod.conf rename to mods/pyutest/pyutest_core2/mod.conf diff --git a/mods/pyutest/pyutest_core2/ores.lua b/mods/pyutest/pyutest_core2/ores.lua new file mode 100644 index 0000000..f8c694b --- /dev/null +++ b/mods/pyutest/pyutest_core2/ores.lua @@ -0,0 +1,371 @@ +PyuTest.make_building_blocks("pyutest_core:granite", "Granite", {"pyutest-granite.png"}, nil, { + ground = 1, + stone = 1, + cracky = PyuTest.BLOCK_NORMAL, + level = 1 +}) + +PyuTest.make_building_blocks("pyutest_core:andesite", "Andesite", {"pyutest-andesite.png"}, nil, { + ground = 1, + stone = 1, + cracky = PyuTest.BLOCK_NORMAL, + level = 1 +}) + +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_core:granite_block", + wherein = "pyutest_core: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_core:andesite_block", + wherein = "pyutest_core: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_core:clay_block", + wherein = "pyutest_core: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_core:stone_block", + "pyutest_core:granite_block", + "pyutest_core:andesite_block", +} + +-- TODO: The code here is very messy, and this function takes to much arguments. Squash the arguments into a table and clean the code. +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_core: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} + }, + + block_tiles = {"pyutest-metal.png"}, + block_color = {r = 32, g = 32, b = 32} +}) + +PyuTest.make_ore("pyutest_core: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_core: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_core: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_core: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_core: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_core: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_core: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" +}) diff --git a/mods/pyutest/pyutest_core/overrides.lua b/mods/pyutest/pyutest_core2/overrides.lua similarity index 55% rename from mods/pyutest/pyutest_core/overrides.lua rename to mods/pyutest/pyutest_core2/overrides.lua index 7b458e9..43a13f9 100644 --- a/mods/pyutest/pyutest_core/overrides.lua +++ b/mods/pyutest/pyutest_core2/overrides.lua @@ -1,14 +1,14 @@ minetest.override_item("pyutest_core:clay_block", { - drop = "pyutest_core:clay 3" + drop = "pyutest_core:clay 3" }) minetest.override_item("pyutest_core:coal_lump", { - groups = { - fuel = 1 - } + groups = { + fuel = 1 + } }) minetest.override_item("pyutest_core:bone_block", { - paramtype2 = "facedir", - on_place = minetest.rotate_node + paramtype2 = "facedir", + on_place = minetest.rotate_node }) diff --git a/mods/pyutest/pyutest_core2/player.lua b/mods/pyutest/pyutest_core2/player.lua new file mode 100644 index 0000000..1185195 --- /dev/null +++ b/mods/pyutest/pyutest_core2/player.lua @@ -0,0 +1,149 @@ +-- player setup +minetest.register_on_joinplayer(function (player) + if player == nil then return end + local name = player:get_player_name() + player:set_properties({ + hp_max = 25 + }) + + player:get_inventory():set_width("main", 8) + player:get_inventory():set_size("main", 8 * 4) + player:hud_set_hotbar_itemcount(8) + + -- creative mode privs + if minetest.is_creative_enabled(name) then + minetest.set_player_privs(name, PyuTest.util.tableconcat({ + fly = true, + fast = true, + noclip = true, + builder = true, + settime = true, + creative = true, + peaceful_player = true, -- from mobs_redo + teleport = true, + }, minetest.get_player_privs(name))) + end +end) + +-- player physics +local function set_player_speed(player, speed) + player:set_physics_override({ + speed = speed, + }) +end + +minetest.register_globalstep(function(dtime) + local players = minetest.get_connected_players() + for p=1, #players do + local ctrl = players[p]:get_player_control() + if ctrl.aux1 then + set_player_speed(players[p], 1.60) + else + set_player_speed(players[p], 1) + end + end +end) + +-- player hand +minetest.register_item(":", { + type = "none", + wield_image = "pyutest-hand.png" +}) + +if minetest.is_creative_enabled("") then + local break_speed = 0.2 + + minetest.override_item("", { + range = 9, + tool_capabilities = PyuTest.tool_caps({ + uses = 0, + time = 0.35, + + groupcaps = { + crumbly = {}, + choppy = {}, + cracky = {}, + snappy = {}, + explody = {}, + oddly_breakable_by_hand = {} + }, + + attack_uses = 0, + damage_groups = {fleshy = 10000} + }) + }) +else + minetest.override_item("", { + range = 5, + tool_capabilities = PyuTest.tool_caps({ + uses = 0, + attck_uses = 0, + damage_groups = {fleshy = 2}, + + groupcaps = { + oddly_breakable_by_hand = { + times = { + [PyuTest.BLOCK_FAST] = 0.35, + [PyuTest.BLOCK_NORMAL] = 0.50, + [PyuTest.BLOCK_SLOW] = 0.65, + } + }, + snappy = { + times = { + [PyuTest.BLOCK_FAST] = 0.55, + [PyuTest.BLOCK_NORMAL] = 0.70, + [PyuTest.BLOCK_SLOW] = 0.70 + } + }, + crumbly = { + times = { + [PyuTest.BLOCK_FAST] = 0.75, + [PyuTest.BLOCK_NORMAL] = 0.80, + [PyuTest.BLOCK_SLOW] = 0.90 + } + }, + choppy = { + times = { + [PyuTest.BLOCK_FAST] = 1.2, + [PyuTest.BLOCK_NORMAL] = 2.3, + [PyuTest.BLOCK_SLOW] = 2.9, + } + }, + cracky = { + times = { + [PyuTest.BLOCK_FAST] = 6, + [PyuTest.BLOCK_NORMAL] = 10, + [PyuTest.BLOCK_SLOW] = 45, + } + } + } + }) + }) +end + +-- unlimited blocks in creative mode +minetest.register_on_placenode(function(_, _, placer) + if placer and placer:is_player() then + return minetest.is_creative_enabled(placer:get_player_name()) + end +end) + +-- player death message +minetest.register_on_dieplayer(function(player, reason) + local playername = player:get_player_name() + + if reason.object ~= nil then + local le = reason.object:get_luaentity() + + if le == nil then + minetest.chat_send_all(string.format("%s was slain by %s", + playername, reason.object:get_player_name())) + else + local split = string.split(le.name, ":") + local name = split[#split] + name = name:gsub("_", " ") + name = string.upper(name:sub(1, 1))..name:sub(2, name:len()) + minetest.chat_send_all(string.format("%s was slain by %s", playername, name)) + end + end +end) diff --git a/mods/pyutest/pyutest_core2/tools.lua b/mods/pyutest/pyutest_core2/tools.lua new file mode 100644 index 0000000..1eb006c --- /dev/null +++ b/mods/pyutest/pyutest_core2/tools.lua @@ -0,0 +1,170 @@ +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_tool("pyutest_core: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_core: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_core: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_core: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_core: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_core: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_core: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_core: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_core: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 +}) diff --git a/mods/pyutest/pyutest_core2/utils.lua b/mods/pyutest/pyutest_core2/utils.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_core2/wood.lua b/mods/pyutest/pyutest_core2/wood.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_core2/wool.lua b/mods/pyutest/pyutest_core2/wool.lua new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_inventory/README.md b/mods/pyutest/pyutest_inventory/README.md deleted file mode 100644 index adfb5f8..0000000 --- a/mods/pyutest/pyutest_inventory/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# pyutest_inventory - -Nodelands support for unified_inventory diff --git a/mods/pyutest/pyutest_inventory/init.lua b/mods/pyutest/pyutest_inventory/init.lua deleted file mode 100644 index 5dba37d..0000000 --- a/mods/pyutest/pyutest_inventory/init.lua +++ /dev/null @@ -1,78 +0,0 @@ -local function get_items_from_group(name) - local list = {} - for k, v in pairs(minetest.registered_items) do - if minetest.get_item_group(k, name) ~= 0 then - table.insert(list, k) - end - end - return list -end - --- Remove built-in Unified Inventory categories -for k, v in pairs(unified_inventory.registered_categories) do - unified_inventory.remove_category(k) -end - -unified_inventory.register_category("pyutest_inventory:blocks", { - symbol = "pyutest_core:stone_block", - label = "Blocks", - index = 3, - items = get_items_from_group("block") -}) - -unified_inventory.register_category("pyutest_inventory:tools", { - symbol = "pyutest_core:iron_pickaxe", - label = "Tools", - index = 4, - items = get_items_from_group("tool") -}) - -unified_inventory.register_category("pyutest_inventory:furniture", { - symbol = "pyutest_core:wooden_wood_chair", - label = "Furniture", - index = 5, - items = get_items_from_group("furniture") -}) - -unified_inventory.register_category("pyutest_inventory:minerals", { - symbol = "pyutest_core:diamond_ore", - label = "Minerals", - index = 6, - items = get_items_from_group("mineral") -}) - -unified_inventory.register_category("pyutest_inventory:colored", { - symbol = "pyutest_core:yellow_wool_block", - label = "Colored Blocks", - index = 7, - items = get_items_from_group("colored") -}) - -unified_inventory.register_category("pyutest_inventory:flowers", { - symbol = "pyutest_core:rose", - label = "Flora", - index = 8, - items = get_items_from_group("flower") -}) - -unified_inventory.register_category("pyutest_inventory:fuel", { - symbol = "pyutest_core:coal_lump", - label = "Fuel", - index = 9, - items = get_items_from_group("fuel") -}) - - -unified_inventory.register_category("pyutest_inventory:solid_nodes", { - symbol = "pyutest_core:stone_block", - label = "Solid Nodes", - index = 10, - items = get_items_from_group("solid") -}) - -unified_inventory.register_category("pyutest_inventory:electricity", { - symbol = "pyutest_core:button", - label = "Electricity", - index = 11, - items = get_items_from_group("electric") -}) diff --git a/mods/pyutest/pyutest_inventory/mod.conf b/mods/pyutest/pyutest_inventory/mod.conf deleted file mode 100644 index 5406959..0000000 --- a/mods/pyutest/pyutest_inventory/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = pyutest_inventory -depends = unified_inventory,pyutest_core diff --git a/mods/pyutest/pyutest_mapgen/mod.conf b/mods/pyutest/pyutest_mapgen/mod.conf deleted file mode 100644 index 80794d8..0000000 --- a/mods/pyutest/pyutest_mapgen/mod.conf +++ /dev/null @@ -1,2 +0,0 @@ -name = pyutest_mapgen -depends = pyutest_core diff --git a/mods/pyutest/pyutest_mapgen/README.md b/mods/pyutest/pyutest_mapgen2/README.md similarity index 100% rename from mods/pyutest/pyutest_mapgen/README.md rename to mods/pyutest/pyutest_mapgen2/README.md diff --git a/mods/pyutest/pyutest_mapgen2/api.lua b/mods/pyutest/pyutest_mapgen2/api.lua new file mode 100644 index 0000000..088f96b --- /dev/null +++ b/mods/pyutest/pyutest_mapgen2/api.lua @@ -0,0 +1,49 @@ +-- This function is used for structures because it will update the lighting when placed. +PyuTest.register_structure = function (name, schematic, def) + local id = "pyutest_mapgen:structure_block_"..name + minetest.register_node(id, { + description = string.format("Structure Block (%s)", name), + groups = { + not_in_creative_inventory = 1 + }, + drawtype = "airlike", + walkable = false, + pointable = false, + }) + + minetest.register_decoration({ + sidelen = 80, + decoration = id, + deco_type = "simple", + place_on = def.place_on, + spawn_by = def.spawn_by, + num_spawn_by = def.num_spawn_by, + fill_ratio = def.fill_ratio, + noise_params = def.noise_params, + flags = def.flags or "place_center_x, place_center_y, force_placement", + biomes = def.biomes, + y_max = def.y_max, + y_min = def.y_min + }) + + minetest.register_lbm({ + name = "pyutest_mapgen:spawn_"..name, + run_at_every_load = true, + nodenames = {id}, + action = function (pos, node) + minetest.remove_node(pos) + minetest.place_schematic( + pos, + PyuTest.get_schem_path(schematic), + def.rotation or "random", + def.replacements or {}, + def.force_placement or true, + def.flags or "place_center_x, place_center_z" + ) + end + }) +end + +PyuTest.is_flat = function() + return minetest.get_mapgen_setting("mg_name") == "flat" +end diff --git a/mods/pyutest/pyutest_mapgen/init.lua b/mods/pyutest/pyutest_mapgen2/init.lua similarity index 92% rename from mods/pyutest/pyutest_mapgen/init.lua rename to mods/pyutest/pyutest_mapgen2/init.lua index 999fa12..6857d29 100644 --- a/mods/pyutest/pyutest_mapgen/init.lua +++ b/mods/pyutest/pyutest_mapgen2/init.lua @@ -1,3 +1,6 @@ +if true then + return +end PyuTestMapgen_Path = minetest.get_modpath("pyutest_mapgen") dofile(PyuTestMapgen_Path.."/api.lua") diff --git a/mods/pyutest/pyutest_mapgen/mapgen.lua b/mods/pyutest/pyutest_mapgen2/mapgen.lua similarity index 100% rename from mods/pyutest/pyutest_mapgen/mapgen.lua rename to mods/pyutest/pyutest_mapgen2/mapgen.lua diff --git a/mods/pyutest/pyutest_mapgen2/mod.conf b/mods/pyutest/pyutest_mapgen2/mod.conf new file mode 100644 index 0000000..e69de29 diff --git a/mods/pyutest/pyutest_mapgen/schematics/AspenTree1.mts b/mods/pyutest/pyutest_mapgen2/schematics/AspenTree1.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/AspenTree1.mts rename to mods/pyutest/pyutest_mapgen2/schematics/AspenTree1.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/AspenTree2.mts b/mods/pyutest/pyutest_mapgen2/schematics/AspenTree2.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/AspenTree2.mts rename to mods/pyutest/pyutest_mapgen2/schematics/AspenTree2.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/BirchTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/BirchTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/BirchTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/BirchTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/CherryTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/CherryTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/CherryTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/CherryTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/DesertWell.mts b/mods/pyutest/pyutest_mapgen2/schematics/DesertWell.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/DesertWell.mts rename to mods/pyutest/pyutest_mapgen2/schematics/DesertWell.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/FallenMushroom.mts b/mods/pyutest/pyutest_mapgen2/schematics/FallenMushroom.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/FallenMushroom.mts rename to mods/pyutest/pyutest_mapgen2/schematics/FallenMushroom.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/IceSpike.mts b/mods/pyutest/pyutest_mapgen2/schematics/IceSpike.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/IceSpike.mts rename to mods/pyutest/pyutest_mapgen2/schematics/IceSpike.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/Igloo.mts b/mods/pyutest/pyutest_mapgen2/schematics/Igloo.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/Igloo.mts rename to mods/pyutest/pyutest_mapgen2/schematics/Igloo.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/JungleBush.mts b/mods/pyutest/pyutest_mapgen2/schematics/JungleBush.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/JungleBush.mts rename to mods/pyutest/pyutest_mapgen2/schematics/JungleBush.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/JungleTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/JungleTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/JungleTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/JungleTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/LargeJungleTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/LargeJungleTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/LargeJungleTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/LargeJungleTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/Mushroom.mts b/mods/pyutest/pyutest_mapgen2/schematics/Mushroom.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/Mushroom.mts rename to mods/pyutest/pyutest_mapgen2/schematics/Mushroom.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/ObsidianMound.mts b/mods/pyutest/pyutest_mapgen2/schematics/ObsidianMound.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/ObsidianMound.mts rename to mods/pyutest/pyutest_mapgen2/schematics/ObsidianMound.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/OceanRuins.mts b/mods/pyutest/pyutest_mapgen2/schematics/OceanRuins.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/OceanRuins.mts rename to mods/pyutest/pyutest_mapgen2/schematics/OceanRuins.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/OldGrowthTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/OldGrowthTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/OldGrowthTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/OldGrowthTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/RedwoodTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/RedwoodTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/RedwoodTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/RedwoodTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/SavannaTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/SavannaTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/SavannaTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/SavannaTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/SmallJungleTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/SmallJungleTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/SmallJungleTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/SmallJungleTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/SmallMushroom.mts b/mods/pyutest/pyutest_mapgen2/schematics/SmallMushroom.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/SmallMushroom.mts rename to mods/pyutest/pyutest_mapgen2/schematics/SmallMushroom.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/SnowmanTower.mts b/mods/pyutest/pyutest_mapgen2/schematics/SnowmanTower.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/SnowmanTower.mts rename to mods/pyutest/pyutest_mapgen2/schematics/SnowmanTower.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/SnowyTree1.mts b/mods/pyutest/pyutest_mapgen2/schematics/SnowyTree1.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/SnowyTree1.mts rename to mods/pyutest/pyutest_mapgen2/schematics/SnowyTree1.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/SnowyTree2.mts b/mods/pyutest/pyutest_mapgen2/schematics/SnowyTree2.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/SnowyTree2.mts rename to mods/pyutest/pyutest_mapgen2/schematics/SnowyTree2.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/SwampTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/SwampTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/SwampTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/SwampTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/TaigaTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/TaigaTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/TaigaTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/TaigaTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/TallBirchTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/TallBirchTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/TallBirchTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/TallBirchTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/TallMushroom.mts b/mods/pyutest/pyutest_mapgen2/schematics/TallMushroom.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/TallMushroom.mts rename to mods/pyutest/pyutest_mapgen2/schematics/TallMushroom.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/Tree.mts b/mods/pyutest/pyutest_mapgen2/schematics/Tree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/Tree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/Tree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/Tree2.mts b/mods/pyutest/pyutest_mapgen2/schematics/Tree2.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/Tree2.mts rename to mods/pyutest/pyutest_mapgen2/schematics/Tree2.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/VeryTallBirchTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/VeryTallBirchTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/VeryTallBirchTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/VeryTallBirchTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/VynTree.mts b/mods/pyutest/pyutest_mapgen2/schematics/VynTree.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/VynTree.mts rename to mods/pyutest/pyutest_mapgen2/schematics/VynTree.mts diff --git a/mods/pyutest/pyutest_mapgen/schematics/hut.mts b/mods/pyutest/pyutest_mapgen2/schematics/hut.mts similarity index 100% rename from mods/pyutest/pyutest_mapgen/schematics/hut.mts rename to mods/pyutest/pyutest_mapgen2/schematics/hut.mts diff --git a/mods/pyutest/pyutest_mapgen/structures.lua b/mods/pyutest/pyutest_mapgen2/structures.lua similarity index 100% rename from mods/pyutest/pyutest_mapgen/structures.lua rename to mods/pyutest/pyutest_mapgen2/structures.lua diff --git a/mods/pyutest/pyutest_mapgen/trees.lua b/mods/pyutest/pyutest_mapgen2/trees.lua similarity index 100% rename from mods/pyutest/pyutest_mapgen/trees.lua rename to mods/pyutest/pyutest_mapgen2/trees.lua diff --git a/mods/pyutest/pyutest_mapgen/worlds.lua b/mods/pyutest/pyutest_mapgen2/worlds.lua similarity index 90% rename from mods/pyutest/pyutest_mapgen/worlds.lua rename to mods/pyutest/pyutest_mapgen2/worlds.lua index 8e87004..486e2d3 100644 --- a/mods/pyutest/pyutest_mapgen/worlds.lua +++ b/mods/pyutest/pyutest_mapgen2/worlds.lua @@ -59,20 +59,20 @@ PyuTest.register_world = function (options) } end -IceWorld = PyuTest.register_world({ +PyuTest.IceWorld = PyuTest.register_world({ name = "ice_world", y_max = -400, y_min = -800 }) -local icy_cavern = IceWorld.register_biome({ +local icy_cavern = PyuTest.IceWorld.register_biome({ name = "icy_cave", node_stone = "pyutest_core:ice_block", heat_point = 14, humidity_point = 0 }) -IceWorld.register_ore({ +PyuTest.IceWorld.register_ore({ ore_type = "blob", ore = "pyutest_core:snow_block", wherein = "pyutest_core:ice_block", @@ -83,7 +83,7 @@ IceWorld.register_ore({ noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS }) -IceWorld.register_ore({ +PyuTest.IceWorld.register_ore({ ore_type = "blob", ore = "pyutest_core:crystal_lantern_block", wherein = "pyutest_core:ice_block", @@ -118,20 +118,20 @@ SlimeWorld.register_ore({ noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS }) -LavaWorld = PyuTest.register_world({ +PyuTest.LavaWorld = PyuTest.register_world({ name = "lava_world", y_max = -2000, y_min = -2400 }) -local lava_cavern = LavaWorld.register_biome({ +local lava_cavern = PyuTest.LavaWorld.register_biome({ name = "lava_cavern", node_stone = "pyutest_core:molten_rock_block", heat_point = 100, humidity_point = 0, }) -LavaWorld.register_ore({ +PyuTest.LavaWorld.register_ore({ ore_type = "blob", ore = "pyutest_core:magma", wherein = "pyutest_core:molten_rock_block", @@ -142,7 +142,7 @@ LavaWorld.register_ore({ noise_params = PyuTest.SPECIALSTONE_NOISE_PARAMS }) -LavaWorld.register_decoration({ +PyuTest.LavaWorld.register_decoration({ deco_type = "simple", sidelen = 16, fill_ratio = 0.00063, diff --git a/mods/pyutest/pyutest_mobs2/README.md b/mods/pyutest/pyutest_mobs2/README.md new file mode 100644 index 0000000..e80dad1 --- /dev/null +++ b/mods/pyutest/pyutest_mobs2/README.md @@ -0,0 +1,3 @@ +# pyutest_mobs + +Mobs and entities diff --git a/mods/pyutest/pyutest_mobs/api.lua b/mods/pyutest/pyutest_mobs2/api.lua similarity index 100% rename from mods/pyutest/pyutest_mobs/api.lua rename to mods/pyutest/pyutest_mobs2/api.lua diff --git a/mods/pyutest/pyutest_mobs/basic.lua b/mods/pyutest/pyutest_mobs2/basic.lua similarity index 100% rename from mods/pyutest/pyutest_mobs/basic.lua rename to mods/pyutest/pyutest_mobs2/basic.lua diff --git a/mods/pyutest/pyutest_mobs/init.lua b/mods/pyutest/pyutest_mobs2/init.lua similarity index 82% rename from mods/pyutest/pyutest_mobs/init.lua rename to mods/pyutest/pyutest_mobs2/init.lua index ba5118e..435192f 100644 --- a/mods/pyutest/pyutest_mobs/init.lua +++ b/mods/pyutest/pyutest_mobs2/init.lua @@ -1,14 +1,18 @@ -PyuTestMobs_Path = minetest.get_modpath("pyutest_mobs") +if true then + mobs.fallback_node = "pyutest_blocks:dirt_block" + return +end + +modpath = minetest.get_modpath("pyutest_mobs") -mobs.fallback_node = "pyutest_core:dirt_block" -dofile(PyuTestMobs_Path.."/api.lua") +dofile(modpath.."/api.lua") -dofile(PyuTestMobs_Path.."/basic.lua") -dofile(PyuTestMobs_Path.."/snowman.lua") -dofile(PyuTestMobs_Path.."/wind_warrior.lua") -dofile(PyuTestMobs_Path.."/necromancer.lua") +dofile(modpath.."/basic.lua") +dofile(modpath.."/snowman.lua") +dofile(modpath.."/wind_warrior.lua") +dofile(modpath.."/necromancer.lua") local mapgen = minetest.get_mapgen_params().mgname or "???" if mapgen ~= "flat" and mapgen ~= "singlenode" then diff --git a/mods/pyutest/pyutest_mobs/mod.conf b/mods/pyutest/pyutest_mobs2/mod.conf similarity index 68% rename from mods/pyutest/pyutest_mobs/mod.conf rename to mods/pyutest/pyutest_mobs2/mod.conf index 9d9b28f..3e63ce0 100644 --- a/mods/pyutest/pyutest_mobs/mod.conf +++ b/mods/pyutest/pyutest_mobs2/mod.conf @@ -1,2 +1 @@ -name = pyutest_mobs depends = pyutest_core,mobs,pyutest_mapgen diff --git a/mods/pyutest/pyutest_mobs/necromancer.lua b/mods/pyutest/pyutest_mobs2/necromancer.lua similarity index 100% rename from mods/pyutest/pyutest_mobs/necromancer.lua rename to mods/pyutest/pyutest_mobs2/necromancer.lua diff --git a/mods/pyutest/pyutest_mobs/snowman.lua b/mods/pyutest/pyutest_mobs2/snowman.lua similarity index 100% rename from mods/pyutest/pyutest_mobs/snowman.lua rename to mods/pyutest/pyutest_mobs2/snowman.lua diff --git a/mods/pyutest/pyutest_mobs/wind_warrior.lua b/mods/pyutest/pyutest_mobs2/wind_warrior.lua similarity index 100% rename from mods/pyutest/pyutest_mobs/wind_warrior.lua rename to mods/pyutest/pyutest_mobs2/wind_warrior.lua diff --git a/textures/pyutest-lamp.png b/textures/pyutest-lamp.png new file mode 100644 index 0000000..b99e09f Binary files /dev/null and b/textures/pyutest-lamp.png differ diff --git a/textures/pyutest-world-token.png b/textures/pyutest-world-token.png new file mode 100644 index 0000000..aa8697e Binary files /dev/null and b/textures/pyutest-world-token.png differ