Skip to content

Commit

Permalink
Merge pull request #94 from olliy1or/make-level4-completable
Browse files Browse the repository at this point in the history
Make level 4 completable
  • Loading branch information
cornernote authored Jun 9, 2024
2 parents 5f5bd8b + db48329 commit 650730d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
26 changes: 25 additions & 1 deletion skyblock_levels/skyblock.feats.lua
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ function skyblock.feats.on_placenode(pos, newnode, placer, oldnode)
end
minetest.register_on_placenode(skyblock.feats.on_placenode)

--track hoe use
function skyblock.feats.hoe_on_use(itemstack, user, pointed_thing)
local player_name = user:get_player_name()
local level = skyblock.feats.get_level(player_name)
if skyblock.levels[level].hoe_on_use then
skyblock.levels[level].hoe_on_use(player_name, pointed_thing, itemstack:get_name())
end
end

-- track on_place of items with their own on_place
local function on_place(v, is_craftitem)
local entity = minetest.registered_items[v]
Expand Down Expand Up @@ -428,8 +437,23 @@ for _, material in pairs({"wood", "stone", "steel", "bronze", "mese", "diamond"}
on_use = function(itemstack, user, pointed_thing)
if not minetest.is_protected(pointed_thing.above, user:get_player_name()) then
old_use(itemstack, user, pointed_thing)
skyblock.feats.hoe_on_use(itemstack, user, pointed_thing)
end
end
end,
groups = {not_in_creative_inventory = 0}
})
end

--make uncraftable hoes craftable
local uncraftable_hoes = {bronze="bronze_ingot", mese="mese_crystal", diamond="diamond"}
for hoe, material in pairs(uncraftable_hoes) do
minetest.register_craft({
output = "farming:hoe_" .. hoe,
recipe = {
{"default:" .. material, "default:" .. material,},
{"", "default:stick"},
{"", "default:stick"}
}
})
end

Expand Down
5 changes: 3 additions & 2 deletions skyblock_levels/skyblock.levels.4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ License: GPLv3
Level 4 mostly revolving around farming and dying
level 4 feats and rewards:
* craft_diamondhoe farming:seed_wheat
* craft_mesehoe farming:seed_wheat
* use_hoe x40 farming:melon_slice
* plant_wheatseed default:cactus
* craft_flour farming:seed_cotton x10
Expand Down Expand Up @@ -50,7 +50,8 @@ skyblock.levels[level].feats = {
feat = "use_hoe",
count = 40,
reward = "farming:melon_slice",
hoeuse = {}
hoeuse = {},
use_item = "farming:hoe_mese"
},
{
name = "Plant 10 wheat seeds",
Expand Down
14 changes: 13 additions & 1 deletion skyblock_levels/skyblock.levels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,16 @@ function skyblock.levels.bucket_lava_on_use(level,player_name,pointed_thing)
end
end
end
end
end

-- track hoe feats
function skyblock.levels.hoe_on_use(level, player_name, pointed_thing, itemname)
for _,v in ipairs(skyblock.levels[level].feats) do
if v.hoeuse then
if itemname == v.use_item then
skyblock.feats.add(level, player_name, v.feat)
return
end
end
end
end

0 comments on commit 650730d

Please sign in to comment.