remove material.lua useless

added formspec to display hunger baits chance(admin only)
remove worm eat function
update hoes function
new prizes method
decrement bobber move when fish,too hard to click this
remove whitespace
remove function to place bobber on random node
This commit is contained in:
crabman77 2015-08-20 16:08:03 +02:00
parent fe062390ed
commit f5486507b1
9 changed files with 143 additions and 155 deletions

View File

@ -24,7 +24,7 @@ minetest.register_node("fishing:bobber_box", {
"fishing_bobber.png",
"fishing_bobber.png",
"fishing_bobber.png^[transformFX"
}, --
},
groups = {not_in_creative_inventory=1},
})
@ -144,11 +144,11 @@ local FISHING_BOBBER_ENTITY={
-- if fish or others items, move bobber to simulate fish on the line
if self.prize ~= "" and math.random(1,3) == 1 then
if self.old_pos2 == true then
pos.y = pos.y-0.0325
pos.y = pos.y-0.0280
self.object:moveto(pos, false)
self.old_pos2 = false
else
pos.y = pos.y+0.0325
pos.y = pos.y+0.0280
self.object:moveto(pos, false)
self.old_pos2 = true
end
@ -172,7 +172,7 @@ local FISHING_BOBBER_ENTITY={
self.prize = fishing_setting.prizes["fish"][math.random(1,#fishing_setting.prizes["fish"])]
else
if math.random(1, 100) <= 10 then
self.prize = fishing_setting.prizes["plants"][math.random(1,#fishing_setting.prizes["plants"])]
self.prize = fishing_setting.func.get_loot()
end
end

View File

@ -22,7 +22,7 @@ minetest.register_node("fishing:bobber_shark_box", {
"fishing_bobber_shark.png",
"fishing_bobber_shark.png",
"fishing_bobber_shark.png^[transformFX"
}, --
},
groups = {not_in_creative_inventory=1},
})
@ -42,7 +42,7 @@ local FISHING_BOBBER_SHARK_ENTITY={
baitball = 0,
prize = "",
bait = "",
-- DESTROY BOBBER WHEN PUNCHING IT
on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir)
if not puncher:is_player() then return end
@ -60,8 +60,8 @@ local FISHING_BOBBER_SHARK_ENTITY={
minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, })
self.object:remove()
end,
-- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE)
on_rightclick = function (self, clicker)
local item = clicker:get_wielded_item()
@ -90,7 +90,7 @@ local FISHING_BOBBER_SHARK_ENTITY={
-- weither player has fishing pole or not
minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, })
self.object:remove()
elseif item_name == "fishing:baitball_shark" then
if not fishing_setting.is_creative_mode then
inv:remove_item("main", "fishing:baitball_shark")
@ -108,8 +108,8 @@ local FISHING_BOBBER_SHARK_ENTITY={
minetest.sound_play("fishing_baitball", {pos = self.object:getpos(), gain = 0.2, })
end
end,
-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
on_step = function(self, dtime)
local pos = self.object:getpos()
@ -131,29 +131,29 @@ local FISHING_BOBBER_SHARK_ENTITY={
self.object:remove()
return
end
--rotate bobber
if math.random(1, 4) == 1 then
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi))
end
self.timer = self.timer + 1
if self.timer < self.randomtime then
-- if fish or others items, move bobber to simulate fish on the line
if self.prize ~= "" and math.random(1,3) == 1 then
if self.old_pos2 == true then
pos.y = pos.y-0.0525
pos.y = pos.y-0.0425
self.object:moveto(pos, false)
self.old_pos2 = false
else
pos.y = pos.y+0.0525
pos.y = pos.y+0.0425
self.object:moveto(pos, false)
self.old_pos2 = true
end
end
return
return
end
--change item on line
self.timer = 0
self.prize = ""
@ -164,25 +164,22 @@ local FISHING_BOBBER_SHARK_ENTITY={
self.randomtime = math.random(20,60)*10
return
end
self.randomtime = math.random(1,5)*10
local chance = math.random(1, 100)
--if 1 you catch a treasure, maybe ...
--if 1 you catch a treasure
if chance == 1 then
--You are lucky ? :)
if math.random(1, 100) <= fishing_setting.settings["treasure_chance"] and fishing_setting.settings["treasure_enable"] then
self.prize = fishing_setting.prizes["treasure"][math.random(1,#fishing_setting.prizes["treasure"])]
else
self.prize = fishing_setting.prizes["stuff"][math.random(1,#fishing_setting.prizes["stuff"])]
end
elseif chance <= fishing_setting.settings["fish_chance"] then
self.prize = fishing_setting.prizes["shark"][math.random(1,#fishing_setting.prizes["shark"])]
else
if math.random(1, 100) <= 10 then
self.prize = fishing_setting.prizes["plants"][math.random(1,#fishing_setting.prizes["plants"])]
self.prize = fishing_setting.func.get_loot()
end
end
if self.prize ~= "" then
pos.y = self.old_pos.y-0.2
self.object:moveto(pos, false)

View File

@ -15,7 +15,7 @@
-- Wood Fishing Pole
minetest.register_craft({
output = "fishing:pole_wood",
recipe = {
recipe = {
{"", "", "group:stick" },
{"", "group:stick", "farming:string" },
{"group:stick", "", "farming:string" },
@ -25,7 +25,7 @@ minetest.register_craft({
if minetest.get_modpath("moreblocks") ~= nil then
minetest.register_craft({
output = "fishing:pole_wood",
recipe = {
recipe = {
{"", "", "group:stick" },
{"", "group:stick", "moreblocks:rope" },
{"group:stick", "", "moreblocks:rope" },
@ -36,7 +36,7 @@ end
if minetest.get_modpath("ropes") ~= nil then
minetest.register_craft({
output = "fishing:pole_wood",
recipe = {
recipe = {
{"", "", "group:stick" },
{"", "group:stick", "ropes:rope" },
{"group:stick", "", "ropes:rope" },
@ -48,7 +48,7 @@ end
if minetest.get_modpath("moreores") ~= nil and minetest.get_modpath("mobs") ~= nil then
minetest.register_craft({
output = "fishing:pole_perfect",
recipe = {
recipe = {
{"", "", "moreores:mithril_ingot" },
{"", "moreores:mithril_ingot", "mobs:spider_cobweb" },
{"moreores:mithril_ingot", "", "mobs:spider_cobweb" },

View File

@ -1,4 +1,6 @@
local S = fishing_setting.func.S
--function save settings
function fishing_setting.func.save()
local input, err = io.open(fishing_setting.file_settings, "w")
@ -107,13 +109,27 @@ function fishing_setting.func.hungry_random()
end
function fishing_setting.func.get_loot()
local c = math.random(1, 67)
for i in pairs(fishing_setting.prizes["stuff"]) do
local min = fishing_setting.prizes["stuff"][i][5]
local chance = fishing_setting.prizes["stuff"][i][6]
local max = min + chance - 1
if c <= max and c >= min then
return fishing_setting.prizes["stuff"][i]
end
end
return ""
end
-- Show notification when a player catches treasure
function fishing_setting.func.notify(f_name, treasure)
local title = fishing_setting.func.S("Lucky %s, he caught the treasure, %s!"):format(f_name, treasure[4])
local title = S("Lucky %s, he caught the treasure, %s!"):format(f_name, treasure[4])
for _, player in ipairs(minetest.get_connected_players()) do
local player_name = player:get_player_name()
if player_name == f_name then
minetest.chat_send_player(player_name, fishing_setting.func.S("You caught the treasure, %s!"):format(treasure[4]))
minetest.chat_send_player(player_name, S("You caught the treasure, %s!"):format(treasure[4]))
else
minetest.chat_send_player(player_name, title)
end
@ -123,7 +139,6 @@ end
-- Menu: fishing configuration
fishing_setting.func.on_show_settings = function(player_name)
local S = fishing_setting.func.S
if not fishing_setting.tmp_setting then
fishing_setting.tmp_setting = {}
fishing_setting.func.set_settings(fishing_setting.tmp_setting, fishing_setting.settings)
@ -262,6 +277,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
fishing_setting.func.on_show_settings_contest(player_name)
elseif fields["configuration"] then
fishing_setting.func.on_show_settings(player_name)
elseif fields["hungerinfo"] then
fishing_setting.func.get_hunger_info(player_name)
end
end
end)
@ -296,7 +313,6 @@ minetest.register_on_shutdown(function()
end)
function fishing_setting.func.timetostr(time)
local countdown = time
local answer = ""
@ -320,7 +336,7 @@ end
minetest.register_on_joinplayer(function(player)
local player_name = player:get_player_name()
if fishing_setting.contest["contest"] == true then
minetest.chat_send_player(player_name, fishing_setting.func.S("A fishing contest is in progress. (remaining time %s)"):format(fishing_setting.func.timetostr(fishing_setting.contest["duration"])))
minetest.chat_send_player(player_name, S("A fishing contest is in progress. (remaining time %s)"):format(fishing_setting.func.timetostr(fishing_setting.contest["duration"])))
end
end)
@ -334,7 +350,7 @@ function fishing_setting.func.add_to_trophies(player, fish, desc)
end
fishing_setting.trophies[fish][player_name] = (fishing_setting.trophies[fish][player_name] or 0) + 1
if fishing_setting.trophies[fish][player_name]%100 == 0 then
minetest.chat_send_player(player_name, fishing_setting.func.S("You win a new trophy, you have caught %s " .. fish.."."):format(fishing_setting.trophies[fish][player_name]))
minetest.chat_send_player(player_name, S("You win a new trophy, you have caught %s " .. fish.."."):format(fishing_setting.trophies[fish][player_name]))
local inv = player:get_inventory()
local name = "fishing:trophy_"..fish
if inv:room_for_item("main", {name=name, count=1, wear=0, metadata=""}) then
@ -349,7 +365,7 @@ function fishing_setting.func.add_to_trophies(player, fish, desc)
fishing_setting.contest[fish] = {}
end
fishing_setting.contest[fish][player_name] = (fishing_setting.contest[fish][player_name] or 0) + 1
minetest.chat_send_all(fishing_setting.func.S("Yeah, %s caught "..desc):format(player_name))
minetest.chat_send_all(S("Yeah, %s caught "..desc):format(player_name))
end
end
end
@ -357,11 +373,11 @@ end
-- Menu: fishing configuration/contest
fishing_setting.func.on_show_admin_menu = function(player_name)
local S = fishing_setting.func.S
local formspec = "size[5,5]label[1.6,0;"..S("Fishing Menu").."]"..
local formspec = "size[5,5]label[1.7,0;"..S("Fishing Menu").."]"..
"button[0.5,0.5;4,1;classement;"..S("Contest rankings").."]"..
"button[0.5,1.5;4,1;contest;"..S("Contests").."]"..
"button[0.5,2.5;4,1;configuration;"..S("Configuration").."]"..
"button[0.5,3.5;4,1;hungerinfo;"..S("Hunger info").."]"..
"button_exit[1,4.5;3,1;close;"..S("Close").."]"
minetest.show_formspec(player_name, "fishing:admin_conf", formspec)
end
@ -436,14 +452,13 @@ end
function fishing_setting.func.end_contest()
fishing_setting.contest["contest"] = false
minetest.chat_send_all(fishing_setting.func.S("End of fishing contest."))
minetest.chat_send_all(S("End of fishing contest."))
minetest.sound_play("fishing_contest_end",{gain=0.8})
fishing_setting.func.show_result()
end
--Menu fishing configuration
fishing_setting.func.on_show_settings_contest = function(player_name)
local S = fishing_setting.func.S
if not fishing_setting.tmp_setting then
fishing_setting.tmp_setting = { ["contest"] = (fishing_setting.contest["contest"] or false),
["duration"] = (math.floor(fishing_setting.contest["duration"]) or 3600),
@ -496,7 +511,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
fishing_setting.contest["contest"] = true
fishing_setting.contest["warning_said"] = false
local time = fishing_setting.func.timetostr(fishing_setting.contest["duration"])
minetest.chat_send_all(fishing_setting.func.S("Attention, Fishing contest start (duration %s)!!!"):format(time))
minetest.chat_send_all(S("Attention, Fishing contest start (duration %s)!!!"):format(time))
minetest.sound_play("fishing_contest_start",{gain=0.8})
elseif progress == true and fishing_setting.tmp_setting["contest"] == false then
fishing_setting.func.end_contest()
@ -570,8 +585,7 @@ function fishing_setting.func.get_stat()
end
end
end
local S = fishing_setting.func.S
local formspec = {"size[12,8]label[3.7,0;"..S("Fishing contest rankings").."]"}
local formspec = {"size[12,8]label[4.6,0;"..S("Fishing contest rankings").."]"}
local X = 0
local Y
for fish, fishers in pairs(winners) do
@ -586,10 +600,21 @@ function fishing_setting.func.get_stat()
end
X = X + 2.3
end
table.insert(formspec, "button_exit[5.5,7.5;1.2,1;close;"..S("Close").."]")
table.insert(formspec, "button_exit[5.4,7.5;1.2,1;close;"..S("Close").."]")
return table.concat(formspec)
end
function fishing_setting.func.get_hunger_info(player_name)
local formspec = "size[6,8]label[1.9,0;Fishing Info Center]"
local y = 1
for i, a in pairs(fishing_setting.baits) do
formspec = formspec .."item_image_button[1,"..tostring(y)..";1,1;"..tostring(i)..";"..tostring(i)..";]"..
"label[2.2,"..tostring(y+0.2)..";Chance to fish :"..tostring(a["hungry"]).."%]"
y = y+1
end
formspec = formspec .."button_exit[2,7.5;2,1;close;"..S("Close").."]"
minetest.show_formspec(player_name,"fishing:material_info", formspec)
end
minetest.register_chatcommand("fishing_menu", {
params = "",

View File

@ -1,6 +1,6 @@
-----------------------------------------------------------------------------------------------
local title = "Fishing - Crabman77's version"
local version = "0.0.1"
local version = "0.0.2"
local mname = "fishing"
-----------------------------------------------------------------------------------------------
-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
@ -24,7 +24,7 @@ fishing_setting.file_trophies = minetest.get_worldpath() .. "/fishing_trophies.t
fishing_setting.file_contest = minetest.get_worldpath() .. "/fishing_contest.txt"
fishing_setting.settings = {}
fishing_setting.contest = {}
--for random object
--for random object
random_objects = {}
fishing_setting.baits = {}
fishing_setting.hungry = {}
@ -43,7 +43,7 @@ dofile(path .."functions.lua")
--default_settings
fishing_setting.settings["message"] = MESSAGES
fishing_setting.settings["worm_is_mob"] = WORM_IS_MOB
fishing_setting.settings["worm_is_mob"] = WORM_IS_MOB
fishing_setting.settings["worm_chance"] = WORM_CHANCE
fishing_setting.settings["new_worm_source"] = NEW_WORM_SOURCE
fishing_setting.settings["wear_out"] = WEAR_OUT
@ -68,7 +68,6 @@ dofile(path .."bobber_shark.lua")
dofile(path .."fishes.lua")
dofile(path .."trophies.lua")
dofile(path .."poles.lua")
--dofile(path .."material.lua")
--random hungry bait
fishing_setting.func.hungry_random()
@ -81,7 +80,7 @@ fishing_setting.func.load_contest()
minetest.register_globalstep(function(dtime)
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
fishing_setting.contest["duration"] = fishing_setting.contest["duration"] - dtime
if fishing_setting.contest["duration"] < 30 and fishing_setting.contest["warning_said"] ~= true then
minetest.chat_send_all(fishing_setting.func.S("WARNING, Fishing contest will finish in 30 seconds."))
fishing_setting.contest["warning_said"] = true

View File

@ -1,35 +0,0 @@
-- useless or useful ??? No activated
minetest.register_node("fishing:material_info", {
description = fishing_setting.func.S("Show information about hunger fish"),
name = "Fishing Info Center",
tiles = {"default_wood.png", "default_wood.png", "default_wood.png",
"default_wood.png", "default_wood.png", "default_wood.png"},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
paramtype2 = "facedir",
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
on_rightclick = function(pos, _, clicker)
local formspec = "size[6,8]label[1.7,0;Fishing Info Center]"
local y = 1
for i, a in pairs(fishing_setting.baits) do
formspec = formspec .."item_image_button[1,"..tostring(y)..";1,1;"..tostring(i)..";"..tostring(i)..";]"..
--formspec = formspec .."image[1,"..tostring(y)..";1,1;"..tostring(a["texture"]).."]"..
"label[2.2,"..tostring(y+0.2)..";Chance to fish :"..tostring(a["hungry"]).."%]"
y = y+1
end
minetest.show_formspec(clicker:get_player_name(),"fishing:material_info", formspec)
end
})
minetest.register_craft({
output = 'fishing:material_info',
type = 'shapeless',
recipe = { 'default:steel_ingot', 'default:steel_ingot' },
})

View File

@ -2,18 +2,20 @@
-- Fishing Pole
-----------------------------------------------------------------------------------------------
local S = fishing_setting.func.S
local function rod_wear(itemstack, user, pointed_thing, uses)
itemstack:add_wear(65535/(uses-1))
return itemstack
end
fishing_setting.poles = {}
fishing_setting.poles.wood = {["name"] = "wood", ["max_use"] = 30, ["desc"] = fishing_setting.func.S("Fishing Pole"),["bobber_max"] = 2 }
fishing_setting.poles.perfect = {["name"] = "perfect", ["max_use"] = 1500, ["desc"] = fishing_setting.func.S("Perfect Fishing Pole"),["bobber_max"] = 5}
fishing_setting.poles.wood = {["name"] = "wood", ["max_use"] = 30, ["desc"] = S("Fishing Pole"),["bobber_max"] = 2 }
fishing_setting.poles.perfect = {["name"] = "perfect", ["max_use"] = 1500, ["desc"] = S("Perfect Fishing Pole"),["bobber_max"] = 5}
for _,pole in pairs(fishing_setting.poles) do
local bobbermax = pole["bobber_max"]
local bobbermax = pole["bobber_max"]
minetest.register_tool("fishing:pole_".. pole.name, {
description = pole.desc,
groups = {},
@ -32,15 +34,23 @@ local bobbermax = pole["bobber_max"]
local bait = inv:get_stack("main", user:get_wield_index()+1 ):get_name()
if fishing_setting.baits[bait] == nil then return nil end
local objs = minetest.get_objects_inside_radius(pt.under, 1)
for m, obj in pairs(objs) do
if obj:get_luaentity() ~= nil and string.find(obj:get_luaentity().name, "fishing:bobber") then
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, S("Sorry, there is another bobber!")) end
return nil
end
end
--if contest then player must have only 2 boober
local bobber_nb = 0
local bobber_max
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
bobber_max = fishing_setting.contest["bobber_nb"]
else
bobber_max = bobbermax
end
--player has others bobbers?
for m, obj in pairs(minetest.get_objects_inside_radius(pt.under, 20)) do
if obj:get_luaentity() ~= nil and string.find(obj:get_luaentity().name, "fishing:bobber") ~= nil then
if obj:get_luaentity().owner == player_name then
@ -50,49 +60,25 @@ local bobbermax = pole["bobber_max"]
end
if bobber_nb >= bobber_max then
if fishing_setting.settings["message"] == true then
minetest.chat_send_player(player_name, fishing_setting.func.S("You don't have mores %s bobbers!"):format(bobber_max))
minetest.chat_send_player(player_name, S("You don't have mores %s bobbers!"):format(bobber_max))
end
return nil
end
local bobbers = {}
local objs = minetest.get_objects_inside_radius(pt.under, 3)
for m, obj in pairs(objs) do
if obj:get_luaentity() ~= nil and string.find(obj:get_luaentity().name, "fishing:bobber") ~= nil then
bobbers[m] = obj
end
end
local nodes = {}
local i = 1
for _,k in pairs({ 1, 0, -1}) do
for _,l in pairs({ -1, 0, 1}) do
local node_name = minetest.get_node({x=pt.under.x+l, y=pt.under.y, z=pt.under.z+k}).name
if node and string.find(node_name, "water_source") ~= nil
and minetest.get_node({x=pt.under.x+l, y=pt.under.y+1, z=pt.under.z+k}).name == "air" then
local empty = true
for o, obj in pairs(bobbers) do
local p = obj:getpos()
local dist = ((p.x-pt.under.x)^2 + (p.y-pt.under.y)^2 + (p.z-pt.under.z)^2)^0.5
if dist < 2 then
empty = false
break
end
end
if empty then
nodes[i] = {x=pt.under.x+l, y=pt.under.y, z=pt.under.z+k}
i = i+1
end
end
local nodes = 1
for _,k in pairs({ {1, 0}, {-1,0}, {0,1}, {0,-1} }) do
local node_name = minetest.get_node({x=pt.under.x+k[1], y=pt.under.y, z=pt.under.z+k[2]}).name
if node_name and string.find(node_name, "water_source") ~= nil
and minetest.get_node({x=pt.under.x+k[1], y=pt.under.y+1, z=pt.under.z+k[2]}).name == "air" then
nodes = nodes + 1
end
end
--if water == -3 nodes
if #nodes < 2 then
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, fishing_setting.func.S("You don't fishing in a bottle!")) end
if nodes < 2 then
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, S("You don't fishing in a bottle!")) end
return nil
end
local new_pos = nodes[math.random(1, #nodes)]
new_pos.y=new_pos.y+(45/64)
local new_pos = {x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}
local ent = minetest.add_entity({interval = 1,x=new_pos.x, y=new_pos.y, z=new_pos.z}, fishing_setting.baits[bait].bobber)
if not ent then return nil end
local luaentity = ent:get_luaentity()
@ -120,8 +106,15 @@ local bobbermax = pole["bobber_max"]
if string.find(pt_under_name, "water_") == nil then
local wear = itemstack:get_wear()
local direction = minetest.dir_to_facedir(placer:get_look_dir())
local meta = minetest.get_meta(pt.above)
local dir = minetest.facedir_to_dir(direction)
local p = vector.add(pt.above, dir)
local n2 = minetest.get_node_or_nil(p)
local def = n2 and minetest.registered_items[n2.name]
if not def or not def.buildable_to then
return nil
end
minetest.set_node(pt.above, {name="fishing:pole_".. pole.name .."_deco", param2=direction})
local meta = minetest.get_meta(pt.above)
meta:set_int("wear", wear)
if not fishing_setting.is_creative_mode then
itemstack:take_item()

View File

@ -12,27 +12,27 @@ fishing_setting.prizes["shark"] = {
}
-- Here's what you can prizes
local plants = {
-- MoD iTeM WeaR MeSSaGe ("You caught "..)
{"default", "stick", 0, "a Twig."},
{"mobs", "rat", 0, "a Rat."},
{"flowers", "seaweed", 0, "some Seaweed."},
{"seaplants", "kelpgreen", 0, "a Green Kelp."},
{"farming", "string", 0, "a String."},
{"trunks", "twig_1", 0, "a Twig."}
}
fishing_setting.prizes["plants"] = fishing_setting.func.ignore_mod(plants)
local stuff = {
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole."},
{"3d_armor", "boots_wood", "random", "some very old Boots."},
{"maptools", "gold_coin", 0, "a Gold Coin."},
{"3d_armor", "helmet_diamond", "random", "a very old Helmet."},
{"shields", "shield_enhanced_cactus", "random", "a very old Shield."},
{"default", "sword_bronze", "random", "a very old Sword."},
{"default", "sword_mese", "random", "a very old Sword."},
{"default", "sword_nyan", "random", "a very old Sword."}
-- mod item wear message ("You caught "..) nrmin chance (1/67)
{"flowers", "seaweed", 0, "some Seaweed.", 1, 5},
{"farming", "string", 0, "a String.", 6, 5},
{"trunks", "twig_1", 0, "a Twig.", 11, 5},
{"mobs", "rat", 0, "a Rat.", 16, 5},
{"default", "stick", 0, "a Twig.", 21, 5},
{"seaplants", "kelpgreen", 0, "a Green Kelp.", 26, 5},
{"3d_armor", "boots_steel", "random", "some very old Boots.", 31, 2},
{"3d_armor", "leggings_gold", "random", "some very old Leggings.", 33, 5},
{"3d_armor", "chestplate_bronze", "random", "a very old ChestPlate.", 38, 5},
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole.", 43, 10},
{"3d_armor", "boots_wood", "random", "some very old Boots.", 53, 5},
{"maptools", "gold_coin", 0, "a Gold Coin.", 58, 1},
{"3d_armor", "helmet_diamond", "random", "a very old Helmet.", 59, 1},
{"shields", "shield_enhanced_cactus", "random", "a very old Shield.", 60, 2},
{"default", "sword_bronze", "random", "a very old Sword.", 62, 2},
{"default", "sword_mese", "random", "a very old Sword.", 64, 2},
{"default", "sword_nyan", "random", "a very old Sword.", 66, 2},
-- nom mod nom item durabilité message dans le chat -- fin 67
-- de l'objet
}
fishing_setting.prizes["stuff"] = fishing_setting.func.ignore_mod(stuff)

View File

@ -15,7 +15,6 @@ minetest.register_craftitem("fishing:bait_worm", {
description = fishing_setting.func.S("Worm"),
groups = { fishing_bait=1 },
inventory_image = "fishing_bait_worm.png",
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
minetest.add_entity({x=pt.under.x, y=pt.under.y+0.6, z=pt.under.z}, "fishing:bait_worm_entity")
@ -171,14 +170,19 @@ else
end
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 above = minetest.get_node(p)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[above.name] then
if not minetest.registered_nodes[under.name]
or not minetest.registered_nodes[above.name] then
return
end
@ -191,13 +195,9 @@ else
if minetest.get_item_group(under.name, "soil") ~= 1 then
return
end
-- turn the node into soil, play sound, get worm and wear out item
-- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name="farming:soil"})
minetest.sound_play("default_dig_crumbly", {
pos = pt.under,
gain = 0.5,
})
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5,})
if math.random(1, 100) < fishing_setting.settings["worm_chance"] then
if fishing_setting.settings["worm_is_mob"] == true then
@ -209,10 +209,19 @@ else
end
end
end
itemstack:add_wear(65535/(uses-1))
if not minetest.setting_getbool("creative_mode") then
local tool_name = itemstack:get_name()
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
end
-- didn't change the hoes, just here because hoe_on_use is local
minetest.register_tool(":farming:hoe_wood", {
description = fishing_setting.func.S("Wooden Hoe"),