Add Carrots and Farming!

This commit is contained in:
IamPyu 2024-10-14 12:16:08 -06:00
parent 247d6b3c5d
commit 323e2039ea
25 changed files with 187 additions and 60 deletions

View File

@ -1,9 +1,13 @@
# Changelog
## [Oct 12th - **STILL UNDER DEVELOPMENT** 2024] Update: Building Update
## [Oct 12th - **STILL UNDER DEVELOPMENT** 2024] Update: Building and Farming Update
- Added Stained Glass
- Start working on a new entity API to replace mobs_redo
- Added Farming Mechanics
- Added Hoes
- Added Wheat Crops
- Added Carrots and Carrot Crops
## [Oct 6th - Oct 12th 2024] Update: Texture Update

View File

@ -1,5 +1,7 @@
PyuTest = {}
Translate = minetest.get_translator("pyutest")
Translate = function (s)
return minetest.get_translator(minetest.get_current_modname())(s)
end
PyuTest.BLOCK_FAST = 3
PyuTest.BLOCK_NORMAL = 2

View File

@ -5,7 +5,7 @@ PyuTest.create_boss_egg = function(mob_id, desc, texture, addegg, no_creative, c
output = mob_id,
recipe = {
{"", craft, ""},
{craft, "pyutest_core:emerald_shard", craft},
{craft, "pyutest_ores:emerald_shard", craft},
{"", craft, ""}
}
})

View File

@ -84,4 +84,4 @@ mobs:register_mob("pyutest_mobs:necromancer", {
})
PyuTest.create_boss_egg("pyutest_mobs:necromancer", "Necromancer Spawn Egg",
"pyutest-egg.png^[multiply:dimgray", 0, nil,
"pyutest_core:bone")
"pyutest_tools:bone")

View File

@ -74,4 +74,4 @@ mobs:register_mob("pyutest_mobs:snowman", {
})
PyuTest.create_boss_egg("pyutest_mobs:snowman", "Snowman Spawn Egg",
"pyutest-egg.png^[multiply:skyblue", 0, nil,
"pyutest_core:snow_block")
"pyutest_blocks:snow_block")

View File

@ -78,4 +78,4 @@ mobs:register_mob("pyutest_mobs:wind_warrior", {
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")
"pyutest_ores:iron_ingot")

View File

@ -1,11 +1,13 @@
PyuTest.make_building_blocks("pyutest_blocks:dirt", "Dirt", { "pyutest-dirt.png" }, nil, {
ground = 1,
dirt = 1,
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
})
PyuTest.make_building_blocks("pyutest_blocks:podzol", "Podzol", { "pyutest-dirt.png" }, nil, {
ground = 1,
dirt = 1,
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
}, {
@ -30,6 +32,7 @@ PyuTest.make_building_blocks("pyutest_blocks:mycelium", "Mycelium", {
{name = "pyutest-grass-top.png", color = "#5c455e"}, "pyutest-dirt.png"
}, nil, {
ground = 1,
dirt = 1,
crumbly = PyuTest.BLOCK_FAST,
}, {
overlay_tiles = {"", "", {name = "pyutest-grass-side.png", color = "#5c455e"}}

View File

@ -148,9 +148,10 @@ PyuTest.make_node("pyutest_blocks:workbench", "Workbench", {
}, {
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;]"
"size[8,7.5]",
"list[current_player;craft;2.5,0;3,3;]",
"list[current_player;craftpreview;6.5,1;1,1;]",
"list[current_player;main;0,3.5;8,4;]"
}))
end
})

View File

@ -141,6 +141,14 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = "pyutest_blocks:workbench",
recipe = {
{"group:wooden_planks", "group:wooden_planks"},
{"group:wooden_planks", "group:wooden_planks"},
}
})
minetest.register_craft({
output = "pyutest_blocks:slime_block",
type = "shapeless",

View File

@ -0,0 +1,87 @@
PyuTest.make_node("pyutest_farming:farmland", "Farmland", {
ground = 1,
acid_vulnerable = 1,
crumbly = PyuTest.BLOCK_FAST
}, {"pyutest-farmland.png", "pyutest-dirt.png"}, {
drop = "pyutest_blocks:dirt_block"
})
PyuTest.make_item("pyutest_farming:hoe", "Hoe", {}, "pyutest-hoe.png", {
stack_max = 1,
on_place = function (itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if minetest.get_item_group(node.name, "dirt") ~= 0 then
minetest.set_node(pos, {name = "pyutest_farming:farmland"})
end
end
end
})
PyuTest.make_crop = function (name, desc, output, growtime, textures)
local t = textures or {}
PyuTest.make_node(name.."_crop", desc .. "Crop", {
flammable = 1,
dig_immediate = 3,
attached_node = 3,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
not_in_creative_inventory = 1
}, {t["crop"] or "pyutest-crop.png"}, {
drawtype = "plantlike",
color = t["crop_color"],
drop = name.."_seeds",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
floodable = true,
on_construct = function (pos)
local timer = minetest.get_node_timer(pos)
timer:start(growtime or 90)
end,
on_timer = function (pos)
minetest.set_node(pos, {name = name.."_grown"})
end
})
PyuTest.make_node(name.."_grown", desc .. " Crop", {
flammable = 1,
dig_immediate = 3,
attached_node = 3,
oddly_breakable_by_hand = PyuTest.BLOCK_FAST,
not_in_creative_inventory = 1
}, {t["grown"] or "pyutest-crop-grown.png"}, {
drawtype = "plantlike",
color = t["grown_color"],
paramtype = "light",
sunlight_propagates = true,
walkable = false,
floodable = true,
drop = {
max_items = 1,
items = {
{
items = {ItemStack(name.."_seeds 3"), ItemStack(output)}
}
}
},
})
PyuTest.make_item(name.."_seeds", desc.." Seeds", {seeds = 1}, t["seed"] or "pyutest-seeds.png", {
color = t["seed_color"],
on_place = function (itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
local pos = pointed_thing.under
local node = minetest.get_node(pos)
if node.name == "pyutest_farming:farmland" then
minetest.place_node(pointed_thing.above, {name = name.."_crop"}, user)
itemstack:set_count(itemstack:get_count() - 1)
return itemstack
end
end
end
})
end

View File

@ -0,0 +1,15 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath .. "/api.lua")
PyuTest.make_crop("pyutest_farming:wheat", "Wheat", "pyutest_tools:wheat 2", 65, {
crop_color = "#eed89a",
grown_color = "#eed89a",
seed_color = "#eed89a"
})
PyuTest.make_crop("pyutest_farming:carrot", "Carrot", "pyutest_tools:carrot 3", 90, {
crop_color = "#d19d79",
grown_color = "#d19d79",
seed_color = "#d19d79"
})

View File

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

View File

@ -6,6 +6,7 @@ PyuTest.make_grass = function (name, desc, groups, color, ttex, stex, dtex)
PyuTest.make_building_blocks(name, desc, _dtex, nil, PyuTest.util.tableconcat(groups or {}, {
ground = 1,
grass = 1,
dirt = 1,
}), {
overlay_tiles = {"", "", _stex}
})

View File

@ -1,5 +1,6 @@
PyuTest.registered_lootboxes = {}
PyuTest.make_lootbox = function (name, dname, items)
PyuTest.spawning_lootboxes = {}
PyuTest.make_lootbox = function (name, dname, items, spawn)
local id = name.."_lootbox"
minetest.register_node(id, {
description = Translate(dname .. " Lootbox"),
@ -26,13 +27,17 @@ PyuTest.make_lootbox = function (name, dname, items)
id = id,
items = items
}
if spawn == true then
PyuTest.spawning_lootboxes[#PyuTest.spawning_lootboxes+1] = name
end
end
PyuTest.make_lootbox("pyutest_lootboxes:trash", "Trash", {
ItemStack("pyutest_flowers:deadbush 6"),
ItemStack("pyutest_tools:bone 3"),
ItemStack("pyutest_tools:ash 2")
})
}, true)
PyuTest.make_lootbox("pyutest_lootboxes:resource", "Resource", {
ItemStack("pyutest_tools:gunpowder 3"),
@ -40,17 +45,17 @@ PyuTest.make_lootbox("pyutest_lootboxes:resource", "Resource", {
ItemStack("pyutest_tools:sugar 2"),
ItemStack("pyutest_tools:apple 3"),
ItemStack("pyutest_tools:string 5")
})
}, true)
PyuTest.make_lootbox("pyutest_lootboxes:griefer", "Griefer's Dream", {
ItemStack("pyutest_blocks:tnt 3"),
ItemStack("pyutest_tools:bomb 2")
})
}, true)
PyuTest.make_lootbox("pyutest_lootboxes:lighting", "Lighting", {
ItemStack("pyutest_blocks:light 2"),
ItemStack("pyutest_blocks:torch 5")
})
}, true)
PyuTest.make_lootbox("pyutest_lootboxes:color", "Color", {
ItemStack("pyutest_wool:green_dye 2"),
@ -59,3 +64,8 @@ PyuTest.make_lootbox("pyutest_lootboxes:color", "Color", {
ItemStack("pyutest_wool:black_dye 3"),
ItemStack("pyutest_wool:brown_dye 2")
})
PyuTest.make_lootbox("pyutest_lootboxes:farming", "Farmer's", {
ItemStack("pyutest_farming:wheat_seeds 5"),
ItemStack("pyutest_farming:carrot_seeds 3")
}, true)

View File

@ -1 +1 @@
depends = pyutest_blocks,pyutest_tools
depends = pyutest_blocks,pyutest_tools,pyutest_farming,pyutest_wool

View File

@ -32,11 +32,11 @@ PyuTest.make_spellbook = function (nsname, desc, color, craftitem, action)
}
end
PyuTest.make_spellbook("pyutest_magic:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_magic:bomb", function (itemstack, user)
PyuTest.make_spellbook("pyutest_magic:explosions_spellbook", "Spellbook of Explosions", "gray", "pyutest_tools: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)
PyuTest.make_spellbook("pyutest_magic:fire_spellbook", "Spellbook of Fire", "crimson", "pyutest_blocks:magma", function (itemstack, user)
local range = 2
local function replace(pos)
@ -48,7 +48,7 @@ PyuTest.make_spellbook("pyutest_magic:fire_spellbook", "Spellbook of Fire", "cri
if node == nil then return end
if node.name ~= "air" then return end
minetest.set_node(pos, {name = "pyutest_magic:fire"})
minetest.set_node(pos, {name = "pyutest_blocks:fire"})
end
for dx = -range, range do
@ -67,9 +67,9 @@ PyuTest.make_item("pyutest_magic:enchanted_shard", "Enchanted Shard", {}, "pyute
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_magic:magic_shards", "pyutest_ores:diamond_shard", "pyutest_magic:magic_shards"},
{"pyutest_ores:diamond_shard", "pyutest_magic:magic_shards", "pyutest_ores:diamond_shard"},
{"pyutest_magic:magic_shards", "pyutest_ores:diamond_shard", "pyutest_magic:magic_shards"}
}
})
@ -94,8 +94,8 @@ 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_tools:stick", ""},
{"", "pyutest_tools:stick", ""}
}
})
@ -107,7 +107,7 @@ minetest.register_craft({
recipe = {
{"pyutest_magic:enchanted_shard"},
{"pyutest_magic:enchanted_shard"},
{"pyutest_magic:stick"}
{"pyutest_tools:stick"}
}
})

View File

@ -1,3 +1,4 @@
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:carrot", "Carrot", "pyutest-carrot.png", 7)
PyuTest.make_food("pyutest_tools:water_bottle", "Water Bottle", "pyutest-water-bottle.png", 0)

View File

@ -1 +1 @@
depends = pyutest_blocks,pyutest_flowers,pyutest_worlds
depends = pyutest_blocks,pyutest_flowers,pyutest_worlds,pyutest_lootboxes

View File

@ -1,51 +1,45 @@
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",
}
deco_type = "simple",
sidelen = 16,
fill_ratio = 0.0003,
place_on = {"group:ground"},
decoration = PyuTest.spawning_lootboxes
})
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
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"
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",
},
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.OVERWORLD_DEEP_OCEAN_MAX + 4,
y_min = PyuTest.DEAP_OCEAN_MIN,
spawn_by = {"pyutest_blocks:water_source"},
num_spawn_by = 2
fill_ratio = 0.0002,
place_on = {"pyutest_blocks:gravel_block"},
biomes = PyuTest.get_biomes_from_type(PyuTest.BIOME_TYPES.OCEAN),
y_max = PyuTest.OVERWORLD_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", {

BIN
textures/pyutest-carrot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

BIN
textures/pyutest-crop.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

BIN
textures/pyutest-hoe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 B

BIN
textures/pyutest-seeds.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B