forked from mtcontrib/farming
added toolranks support
This commit is contained in:
parent
268f66bd6d
commit
29d47ff0ec
@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
|
||||
|
||||
Changelog:
|
||||
|
||||
1.26 - Added support for [toolranks] mod when using hoe's
|
||||
1.25 - Added check for farming.conf setting file to disable specific crops globally (inside mod folder) or world specific (inside world folder)
|
||||
1.24 - Added Hemp which can be crafted into fibre, paper, string, rope and oil.
|
||||
1.23 - Huge code tweak and tidy done and added barley seeds to be found in dry grass, barley can make flour for bread also.
|
||||
|
@ -1,3 +1,4 @@
|
||||
default
|
||||
intllib?
|
||||
lucky_block?
|
||||
lucky_block?
|
||||
toolranks?
|
||||
|
45
hoes.lua
45
hoes.lua
@ -1,5 +1,6 @@
|
||||
|
||||
local S = farming.intllib
|
||||
local tr = minetest.get_modpath("toolranks")
|
||||
|
||||
-- Hoe registration function
|
||||
|
||||
@ -101,8 +102,20 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
|
||||
|
||||
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5})
|
||||
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
local wear = 65535 / (uses -1)
|
||||
|
||||
if minetest.setting_getbool("creative_mode") then
|
||||
if tr then
|
||||
wear = 1
|
||||
else
|
||||
wear = 0
|
||||
end
|
||||
end
|
||||
|
||||
if tr then
|
||||
itemstack = toolranks.new_afteruse(itemstack, user, under, {wear = wear})
|
||||
else
|
||||
itemstack:add_wear(wear)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
@ -151,3 +164,31 @@ farming.register_hoe(":farming:hoe_diamond", {
|
||||
max_uses = 500,
|
||||
material = "default:diamond"
|
||||
})
|
||||
|
||||
-- Toolranks support
|
||||
if tr then
|
||||
|
||||
minetest.override_item("farming:hoe_wood", {
|
||||
original_description = "Wood Hoe",
|
||||
description = toolranks.create_description("Wood Hoe")})
|
||||
|
||||
minetest.override_item("farming:hoe_stone", {
|
||||
original_description = "Stone Hoe",
|
||||
description = toolranks.create_description("Stone Hoe")})
|
||||
|
||||
minetest.override_item("farming:hoe_steel", {
|
||||
original_description = "Steel Hoe",
|
||||
description = toolranks.create_description("Steel Hoe")})
|
||||
|
||||
minetest.override_item("farming:hoe_bronze", {
|
||||
original_description = "Bronze Hoe",
|
||||
description = toolranks.create_description("Bronze Hoe")})
|
||||
|
||||
minetest.override_item("farming:hoe_mese", {
|
||||
original_description = "Mese Hoe",
|
||||
description = toolranks.create_description("Mese Hoe")})
|
||||
|
||||
minetest.override_item("farming:hoe_diamond", {
|
||||
original_description = "Diamond Hoe",
|
||||
description = toolranks.create_description("Diamond Hoe")})
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user