mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-18 16:20:38 +01:00
farming and fishing function hoes_on_use are the same
This commit is contained in:
parent
2300952694
commit
b26a0e4f29
@ -171,14 +171,19 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
local under = minetest.get_node(pt.under)
|
local under = minetest.get_node(pt.under)
|
||||||
|
local upos = pointed_thing.under
|
||||||
|
|
||||||
|
if minetest.is_protected(upos, user:get_player_name()) then
|
||||||
|
minetest.record_protection_violation(upos, user:get_player_name())
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
||||||
local above = minetest.get_node(p)
|
local above = minetest.get_node(p)
|
||||||
|
|
||||||
-- return if any of the nodes is not registered
|
-- return if any of the nodes is not registered
|
||||||
if not minetest.registered_nodes[under.name] then
|
if not minetest.registered_nodes[under.name]
|
||||||
return
|
or not minetest.registered_nodes[above.name] then
|
||||||
end
|
|
||||||
if not minetest.registered_nodes[above.name] then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -191,16 +196,12 @@ else
|
|||||||
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
-- turn the node into soil, wear out item and play sound
|
||||||
-- turn the node into soil, play sound, get worm and wear out item
|
|
||||||
minetest.set_node(pt.under, {name="farming:soil"})
|
minetest.set_node(pt.under, {name="farming:soil"})
|
||||||
minetest.sound_play("default_dig_crumbly", {
|
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,})
|
||||||
pos = pt.under,
|
|
||||||
gain = 0.5,
|
|
||||||
})
|
|
||||||
|
|
||||||
if math.random(1, 100) < fishing_setting.settings["worm_chance"] then
|
if math.random(1, 100) < WORM_CHANCE then
|
||||||
if fishing_setting.settings["worm_is_mob"] == true then
|
if WORM_IS_MOB == true then
|
||||||
minetest.add_entity({x=pt.under.x, y=pt.under.y+0.4, z=pt.under.z}, "fishing:bait_worm_entity")
|
minetest.add_entity({x=pt.under.x, y=pt.under.y+0.4, z=pt.under.z}, "fishing:bait_worm_entity")
|
||||||
else
|
else
|
||||||
local inv = user:get_inventory()
|
local inv = user:get_inventory()
|
||||||
@ -209,10 +210,19 @@ else
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not minetest.setting_getbool("creative_mode") then
|
||||||
|
local tool_name = itemstack:get_name()
|
||||||
itemstack:add_wear(65535/(uses-1))
|
itemstack:add_wear(65535/(uses-1))
|
||||||
|
if itemstack:get_wear() == 0 and minetest.get_modpath("invtweak") then
|
||||||
|
local index = user:get_wield_index()
|
||||||
|
minetest.sound_play("invtweak_tool_break", {pos = user:getpos(), gain = 0.9, max_hear_distance = 5})
|
||||||
|
minetest.after(0.20, refill, user, tool_name, index)
|
||||||
|
end
|
||||||
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- didn't change the hoes, just here because hoe_on_use is local
|
-- didn't change the hoes, just here because hoe_on_use is local
|
||||||
minetest.register_tool(":farming:hoe_wood", {
|
minetest.register_tool(":farming:hoe_wood", {
|
||||||
description = fishing_setting.func.S("Wooden Hoe"),
|
description = fishing_setting.func.S("Wooden Hoe"),
|
||||||
|
Loading…
Reference in New Issue
Block a user