forked from mff/fishing
fix unknown flowers_plus node
better prize stuff check fix indentation
This commit is contained in:
parent
fe52e29d0e
commit
ae9db8700d
@ -2,7 +2,7 @@
|
||||
## Minetest Fishing Mod
|
||||
|
||||
### Original by Mossmanikin https://github.com/Mossmanikin/fishing
|
||||
### Rewrited by Crabman77
|
||||
### Rewrited by Crabman77 (MFF team)
|
||||
|
||||
###9 fish type
|
||||
**fish in rivers**
|
||||
|
10
bobber.lua
10
bobber.lua
@ -78,12 +78,16 @@ local FISHING_BOBBER_ENTITY={
|
||||
if string.find(item_name, "fishing:pole_") ~= nil then
|
||||
if player_name ~= self.owner then return end
|
||||
if self.prize ~= "" then
|
||||
if math.random(1, 100) <= fishing_setting.settings["escape_chance"] then
|
||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, fishing_setting.func.S("Your fish escaped."), false) end -- fish escaped
|
||||
if math.random(1, 100) <= fishing_setting.settings["escape_chance"] then -- fish escaped
|
||||
if fishing_setting.settings["message"] == true then
|
||||
minetest.chat_send_player(player_name, fishing_setting.func.S("Your fish escaped."), false)
|
||||
end
|
||||
else
|
||||
local name = self.prize[1]..":"..self.prize[2]
|
||||
local desc = self.prize[4]
|
||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, fishing_setting.func.S("You caught "..desc), false) end
|
||||
if fishing_setting.settings["message"] == true then
|
||||
minetest.chat_send_player(player_name, fishing_setting.func.S("You caught "..desc), false)
|
||||
end
|
||||
fishing_setting.func.add_to_trophies(clicker, self.prize[2], desc)
|
||||
local wear_value = fishing_setting.func.wear_value(self.prize[3])
|
||||
if inv:room_for_item("main", {name=name, count=1, wear=wear_value, metadata=""}) then
|
||||
|
@ -76,12 +76,16 @@ local FISHING_BOBBER_SHARK_ENTITY={
|
||||
if string.find(item_name, "fishing:pole_") ~= nil then
|
||||
if player_name ~= self.owner then return end
|
||||
if self.prize ~= "" then
|
||||
if math.random(1, 100) <= fishing_setting.settings["escape_chance"] then
|
||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, fishing_setting.func.S("Your fish escaped."), false) end -- fish escaped
|
||||
if math.random(1, 100) <= fishing_setting.settings["escape_chance"] then -- fish escaped
|
||||
if fishing_setting.settings["message"] == true then
|
||||
minetest.chat_send_player(player_name, fishing_setting.func.S("Your fish escaped."), false)
|
||||
end
|
||||
else
|
||||
local name = self.prize[1]..":"..self.prize[2]
|
||||
local desc = self.prize[4]
|
||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, fishing_setting.func.S("You caught "..desc), false) end
|
||||
if fishing_setting.settings["message"] == true then
|
||||
minetest.chat_send_player(player_name, fishing_setting.func.S("You caught "..desc), false)
|
||||
end
|
||||
fishing_setting.func.add_to_trophies(clicker, self.prize[2], desc)
|
||||
local wear_value = fishing_setting.func.wear_value(self.prize[3])
|
||||
if inv:room_for_item("main", {name=name, count=1, wear=wear_value, metadata=""}) then
|
||||
|
@ -158,7 +158,7 @@ if minetest.get_modpath("flowers_plus") ~= nil then
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "fishing:sushi",
|
||||
recipe = {"fishing:fish_cooked", "farming:seed_wheat", "flowers:seaweed" },
|
||||
recipe = {"fishing:fish_cooked", "farming:seed_wheat", "flowers_plus:seaweed" },
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -106,7 +106,7 @@ function fishing_setting.func.hungry_random()
|
||||
fishing_setting.baits[i]["hungry"] = math.random(15, 80)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- to mobs_fish modpack
|
||||
if fishing_setting.baits["mobs_fish:clownfish"] then
|
||||
fishing_setting.baits["mobs_fish:clownfish"]["hungry"] = fishing_setting.baits["fishing:clownfish_raw"]["hungry"]
|
||||
@ -116,18 +116,20 @@ function fishing_setting.func.hungry_random()
|
||||
end
|
||||
|
||||
--change hungry after random time, min 0h30, max 6h00
|
||||
minetest.after(math.random(1, 12)*1800,function() fishing_setting.func.hungry_random() end)
|
||||
minetest.after(math.random(1, 12)*1800, 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]
|
||||
if #fishing_setting.prizes["stuff"] > 0 then
|
||||
local c = math.random(1, fishing_setting.prizes["stuff"][#fishing_setting.prizes["stuff"]][5])
|
||||
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
|
||||
if c <= max and c >= min then
|
||||
return fishing_setting.prizes["stuff"][i]
|
||||
end
|
||||
end
|
||||
end
|
||||
return ""
|
||||
|
4
init.lua
4
init.lua
@ -1,6 +1,6 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
local title = "Fishing - Crabman77's version"
|
||||
local version = "0.0.4"
|
||||
local title = "Fishing - Crabman77's (MFF team) version"
|
||||
local version = "0.0.5"
|
||||
local mname = "fishing"
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
|
||||
|
@ -37,7 +37,9 @@ for _,pole in pairs(fishing_setting.poles) do
|
||||
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
|
||||
if fishing_setting.settings["message"] == true then
|
||||
minetest.chat_send_player(player_name, S("Sorry, there is another bobber!"))
|
||||
end
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
52
prizes.lua
52
prizes.lua
@ -24,29 +24,39 @@ fishing_setting.prizes["sea"]["big"] = {
|
||||
}
|
||||
|
||||
|
||||
if (minetest.get_modpath("flowers_plus")) then -- exception flowers_plus register flowers:*
|
||||
minetest.register_alias("flowers_plus:seaweed", "flowers:seaweed")
|
||||
end
|
||||
|
||||
local stuff = {
|
||||
-- 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
|
||||
-- mod item wear message ("You caught "..) chance
|
||||
{"flowers_plus", "seaweed", 0, "some Seaweed.", 10},
|
||||
{"farming", "string", 0, "a String.", 5},
|
||||
{"trunks", "twig_1", 0, "a Twig.", 5},
|
||||
{"mobs", "rat", 0, "a Rat.", 5},
|
||||
{"default", "stick", 0, "a Twig.", 5},
|
||||
{"seaplants", "kelpgreen", 0, "a Green Kelp.", 5},
|
||||
{"3d_armor", "boots_steel", "random", "some very old Boots.", 2},
|
||||
{"3d_armor", "leggings_gold", "random", "some very old Leggings.", 5},
|
||||
{"3d_armor", "chestplate_bronze", "random", "a very old ChestPlate.", 5},
|
||||
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole.", 10},
|
||||
{"3d_armor", "boots_wood", "random", "some very old Boots.", 5},
|
||||
{"maptools", "gold_coin", 0, "a Gold Coin.", 1},
|
||||
{"3d_armor", "helmet_diamond", "random", "a very old Helmet.", 1},
|
||||
{"shields", "shield_enhanced_cactus", "random", "a very old Shield.", 2},
|
||||
{"default", "sword_bronze", "random", "a very old Sword.", 2},
|
||||
{"default", "sword_mese", "random", "a very old Sword.", 2},
|
||||
{"default", "sword_nyan", "random", "a very old Sword.", 2},
|
||||
}
|
||||
fishing_setting.prizes["stuff"] = fishing_setting.func.ignore_mod(stuff)
|
||||
|
||||
fishing_setting.prizes["stuff"] = {}
|
||||
local nrmin = 1
|
||||
for i,v in ipairs(stuff) do
|
||||
if minetest.get_modpath(v[1]) ~= nil and minetest.registered_items[v[1]..":"..v[2]] ~= nil then
|
||||
table.insert(fishing_setting.prizes["stuff"], {v[1], v[2], v[3], v[4], nrmin, v[5]})
|
||||
nrmin = nrmin + v[5]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local treasure = {
|
||||
|
Loading…
Reference in New Issue
Block a user