toolranks : added reduced version that used sounds from default
* add also support for hoes into farming mod (cos we used older non redo) * autodetection if extra toolranks mod its already doing that
This commit is contained in:
parent
ba5db28e64
commit
16557e744b
@ -36,6 +36,7 @@ To download you can play this game with the following minetest engines:
|
|||||||
|
|
||||||
* minetest default and xtras
|
* minetest default and xtras
|
||||||
* integrated the killme/game_commands were simplified into default mod, and provide CC-BY-SA-NC license
|
* integrated the killme/game_commands were simplified into default mod, and provide CC-BY-SA-NC license
|
||||||
|
* farming is default older but has build-in toolrank detection support
|
||||||
* xdecor as `xdecor` [mods/xdecor](mods/xdecor) a super reduced version of homedecor pack, for performance
|
* xdecor as `xdecor` [mods/xdecor](mods/xdecor) a super reduced version of homedecor pack, for performance
|
||||||
* sorceredkid auth mod
|
* sorceredkid auth mod
|
||||||
* minetest Auth Redux as `auth_rx` [mods/auth_rx](mods/auth_rx) from https://codeberg.org/minenux/minetest-mod-auth_rx
|
* minetest Auth Redux as `auth_rx` [mods/auth_rx](mods/auth_rx) from https://codeberg.org/minenux/minetest-mod-auth_rx
|
||||||
@ -48,7 +49,7 @@ To download you can play this game with the following minetest engines:
|
|||||||
* simple_skins as `skins` [mods/skins](mods/skins) from https://codeberg.org/minenux/minetest-mod-simple_skins
|
* simple_skins as `skins` [mods/skins](mods/skins) from https://codeberg.org/minenux/minetest-mod-simple_skins
|
||||||
* regrow as `regrow` [mods/regrow](mods/regrow) from https://codeberg.org/minenux/minetest-mod-regrow
|
* regrow as `regrow` [mods/regrow](mods/regrow) from https://codeberg.org/minenux/minetest-mod-regrow
|
||||||
* ethereal as `ethereal` [mods/ethereal](mods/ethereal) from https://codeberg.org/minenux/minetest-mod-ethereal
|
* ethereal as `ethereal` [mods/ethereal](mods/ethereal) from https://codeberg.org/minenux/minetest-mod-ethereal
|
||||||
* toolranks as `toolranks` [mods/toolranks](mods/toolranks) from https://codeberg.org/minenux/minetest-mod-toolranks
|
* toolranks as `toolranks` [mods/toolranks](mods/toolranks) (reduced) from https://codeberg.org/minenux/minetest-mod-toolranks
|
||||||
* armors and stuff mods
|
* armors and stuff mods
|
||||||
* 3d_armor and shields [mods/3d_armor](mods/3d_armor) https://codeberg.org/minenux/minetest-mod-3d_armor
|
* 3d_armor and shields [mods/3d_armor](mods/3d_armor) https://codeberg.org/minenux/minetest-mod-3d_armor
|
||||||
* player stuffs:
|
* player stuffs:
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
local use_toolranks = minetest.get_modpath("toolranks") or false
|
||||||
|
local use_extratoolranks = minetest.get_modpath("toolranks_extra") or false
|
||||||
|
|
||||||
|
local use_tr = (use_toolranks and (not use_extratoolranks)) or false
|
||||||
|
|
||||||
farming.register_hoe(":farming:hoe_wood", {
|
farming.register_hoe(":farming:hoe_wood", {
|
||||||
description = "Wooden Hoe",
|
description = "Wooden Hoe",
|
||||||
inventory_image = "farming_tool_woodhoe.png",
|
inventory_image = "farming_tool_woodhoe.png",
|
||||||
@ -5,6 +10,7 @@ farming.register_hoe(":farming:hoe_wood", {
|
|||||||
material = "group:wood",
|
material = "group:wood",
|
||||||
groups = {flammable = 2},
|
groups = {flammable = 2},
|
||||||
})
|
})
|
||||||
|
if use_tr then farming.add_hoe("farming:hoe_wood") end
|
||||||
|
|
||||||
farming.register_hoe(":farming:hoe_stone", {
|
farming.register_hoe(":farming:hoe_stone", {
|
||||||
description = "Stone Hoe",
|
description = "Stone Hoe",
|
||||||
@ -12,6 +18,7 @@ farming.register_hoe(":farming:hoe_stone", {
|
|||||||
max_uses = 90,
|
max_uses = 90,
|
||||||
material = "group:stone"
|
material = "group:stone"
|
||||||
})
|
})
|
||||||
|
if use_tr then farming.add_hoe("farming:hoe_stone") end
|
||||||
|
|
||||||
farming.register_hoe(":farming:hoe_steel", {
|
farming.register_hoe(":farming:hoe_steel", {
|
||||||
description = "Steel Hoe",
|
description = "Steel Hoe",
|
||||||
@ -19,6 +26,7 @@ farming.register_hoe(":farming:hoe_steel", {
|
|||||||
max_uses = 200,
|
max_uses = 200,
|
||||||
material = "default:steel_ingot"
|
material = "default:steel_ingot"
|
||||||
})
|
})
|
||||||
|
if use_tr then farming.add_hoe("farming:hoe_steel") end
|
||||||
|
|
||||||
farming.register_hoe(":farming:hoe_bronze", {
|
farming.register_hoe(":farming:hoe_bronze", {
|
||||||
description = "Bronze Hoe",
|
description = "Bronze Hoe",
|
||||||
@ -26,6 +34,7 @@ farming.register_hoe(":farming:hoe_bronze", {
|
|||||||
max_uses = 220,
|
max_uses = 220,
|
||||||
material = "default:bronze_ingot"
|
material = "default:bronze_ingot"
|
||||||
})
|
})
|
||||||
|
if use_tr then farming.add_hoe("farming:hoe_bronze") end
|
||||||
|
|
||||||
farming.register_hoe(":farming:hoe_mese", {
|
farming.register_hoe(":farming:hoe_mese", {
|
||||||
description = "Mese Hoe",
|
description = "Mese Hoe",
|
||||||
@ -33,6 +42,7 @@ farming.register_hoe(":farming:hoe_mese", {
|
|||||||
max_uses = 350,
|
max_uses = 350,
|
||||||
material = "default:mese_crystal"
|
material = "default:mese_crystal"
|
||||||
})
|
})
|
||||||
|
if use_tr then farming.add_hoe("farming:hoe_mese") end
|
||||||
|
|
||||||
farming.register_hoe(":farming:hoe_diamond", {
|
farming.register_hoe(":farming:hoe_diamond", {
|
||||||
description = "Diamond Hoe",
|
description = "Diamond Hoe",
|
||||||
@ -40,3 +50,4 @@ farming.register_hoe(":farming:hoe_diamond", {
|
|||||||
max_uses = 500,
|
max_uses = 500,
|
||||||
material = "default:diamond"
|
material = "default:diamond"
|
||||||
})
|
})
|
||||||
|
if use_tr then farming.add_hoe("farming:hoe_diamond") end
|
||||||
|
@ -4,13 +4,53 @@ farming = {}
|
|||||||
farming.path = minetest.get_modpath("farming")
|
farming.path = minetest.get_modpath("farming")
|
||||||
|
|
||||||
|
|
||||||
|
-- toolranks support
|
||||||
|
if minetest.get_modpath("toolranks") then
|
||||||
|
function farming.add_hoe(material)
|
||||||
|
-- registering as tool
|
||||||
|
local name = material
|
||||||
|
toolranks.add_tool(material)
|
||||||
|
|
||||||
|
-- getting after_use
|
||||||
|
local def = minetest.registered_items[name]
|
||||||
|
local hoe_on_use = def.on_use
|
||||||
|
local hoe_after_use = def.after_use
|
||||||
|
|
||||||
|
if (hoe_on_use == nil) or (hoe_after_use == nil) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.override_item(name, {
|
||||||
|
-- we also want hoes to increase dugnodes when farming soil
|
||||||
|
on_use = function(itemstack, user, pointed_thing, uses)
|
||||||
|
-- if no node is pointed, the hoe cannot be used
|
||||||
|
if pointed_thing.under == nil then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local under = minetest.get_node(pointed_thing.under)
|
||||||
|
-- get origin wear
|
||||||
|
local wear = itemstack:get_wear()
|
||||||
|
-- apply previous on_use
|
||||||
|
local ret_itemstack = hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||||
|
if ret_itemstack == nil then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
-- compute wear diff
|
||||||
|
local hoe_uses = ret_itemstack:get_wear() - wear
|
||||||
|
-- set wear back because it is up to hoe_after_use to add wear
|
||||||
|
ret_itemstack:set_wear(wear)
|
||||||
|
-- apply afteruse
|
||||||
|
return hoe_after_use(ret_itemstack, user, under, {wear = hoe_uses})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Load files
|
-- Load files
|
||||||
|
|
||||||
dofile(farming.path .. "/api.lua")
|
dofile(farming.path .. "/api.lua")
|
||||||
dofile(farming.path .. "/nodes.lua")
|
dofile(farming.path .. "/nodes.lua")
|
||||||
dofile(farming.path .. "/hoes.lua")
|
dofile(farming.path .. "/hoes.lua")
|
||||||
|
|
||||||
|
|
||||||
-- WHEAT
|
-- WHEAT
|
||||||
|
|
||||||
farming.register_plant("farming:wheat", {
|
farming.register_plant("farming:wheat", {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name = toolranks
|
name = toolranks
|
||||||
depends =
|
depends =
|
||||||
optional_depens = default
|
optional_depends = default
|
||||||
description = TOOL gains levels for digging nodes. Higher level take longer to wear out
|
description = TOOL gains levels for digging nodes. Higher level take longer to wear out
|
||||||
|
Loading…
x
Reference in New Issue
Block a user