mirror of
https://github.com/MinetestForFun/fishing.git
synced 2025-01-08 10:10:16 +01:00
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
|
## Minetest Fishing Mod
|
||||||
|
|
||||||
### Original by Mossmanikin https://github.com/Mossmanikin/fishing
|
### Original by Mossmanikin https://github.com/Mossmanikin/fishing
|
||||||
### Rewrited by Crabman77
|
### Rewrited by Crabman77 (MFF team)
|
||||||
|
|
||||||
###9 fish type
|
###9 fish type
|
||||||
**fish in rivers**
|
**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 string.find(item_name, "fishing:pole_") ~= nil then
|
||||||
if player_name ~= self.owner then return end
|
if player_name ~= self.owner then return end
|
||||||
if self.prize ~= "" then
|
if self.prize ~= "" then
|
||||||
if math.random(1, 100) <= fishing_setting.settings["escape_chance"] then
|
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 -- 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
|
else
|
||||||
local name = self.prize[1]..":"..self.prize[2]
|
local name = self.prize[1]..":"..self.prize[2]
|
||||||
local desc = self.prize[4]
|
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)
|
fishing_setting.func.add_to_trophies(clicker, self.prize[2], desc)
|
||||||
local wear_value = fishing_setting.func.wear_value(self.prize[3])
|
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
|
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 string.find(item_name, "fishing:pole_") ~= nil then
|
||||||
if player_name ~= self.owner then return end
|
if player_name ~= self.owner then return end
|
||||||
if self.prize ~= "" then
|
if self.prize ~= "" then
|
||||||
if math.random(1, 100) <= fishing_setting.settings["escape_chance"] then
|
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 -- 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
|
else
|
||||||
local name = self.prize[1]..":"..self.prize[2]
|
local name = self.prize[1]..":"..self.prize[2]
|
||||||
local desc = self.prize[4]
|
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)
|
fishing_setting.func.add_to_trophies(clicker, self.prize[2], desc)
|
||||||
local wear_value = fishing_setting.func.wear_value(self.prize[3])
|
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
|
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({
|
minetest.register_craft({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "fishing:sushi",
|
output = "fishing:sushi",
|
||||||
recipe = {"fishing:fish_cooked", "farming:seed_wheat", "flowers:seaweed" },
|
recipe = {"fishing:fish_cooked", "farming:seed_wheat", "flowers_plus:seaweed" },
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ function fishing_setting.func.hungry_random()
|
|||||||
fishing_setting.baits[i]["hungry"] = math.random(15, 80)
|
fishing_setting.baits[i]["hungry"] = math.random(15, 80)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- to mobs_fish modpack
|
-- to mobs_fish modpack
|
||||||
if fishing_setting.baits["mobs_fish:clownfish"] then
|
if fishing_setting.baits["mobs_fish:clownfish"] then
|
||||||
fishing_setting.baits["mobs_fish:clownfish"]["hungry"] = fishing_setting.baits["fishing:clownfish_raw"]["hungry"]
|
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
|
end
|
||||||
|
|
||||||
--change hungry after random time, min 0h30, max 6h00
|
--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
|
end
|
||||||
|
|
||||||
|
|
||||||
function fishing_setting.func.get_loot()
|
function fishing_setting.func.get_loot()
|
||||||
local c = math.random(1, 67)
|
if #fishing_setting.prizes["stuff"] > 0 then
|
||||||
for i in pairs(fishing_setting.prizes["stuff"]) do
|
local c = math.random(1, fishing_setting.prizes["stuff"][#fishing_setting.prizes["stuff"]][5])
|
||||||
local min = fishing_setting.prizes["stuff"][i][5]
|
for i in pairs(fishing_setting.prizes["stuff"]) do
|
||||||
local chance = fishing_setting.prizes["stuff"][i][6]
|
local min = fishing_setting.prizes["stuff"][i][5]
|
||||||
local max = min + chance - 1
|
local chance = fishing_setting.prizes["stuff"][i][6]
|
||||||
if c <= max and c >= min then
|
local max = min + chance
|
||||||
return fishing_setting.prizes["stuff"][i]
|
if c <= max and c >= min then
|
||||||
|
return fishing_setting.prizes["stuff"][i]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return ""
|
return ""
|
||||||
|
4
init.lua
4
init.lua
@ -1,6 +1,6 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
local title = "Fishing - Crabman77's version"
|
local title = "Fishing - Crabman77's (MFF team) version"
|
||||||
local version = "0.0.4"
|
local version = "0.0.5"
|
||||||
local mname = "fishing"
|
local mname = "fishing"
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
|
-- 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)
|
local objs = minetest.get_objects_inside_radius(pt.under, 1)
|
||||||
for m, obj in pairs(objs) do
|
for m, obj in pairs(objs) do
|
||||||
if obj:get_luaentity() ~= nil and string.find(obj:get_luaentity().name, "fishing:bobber") then
|
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
|
return nil
|
||||||
end
|
end
|
||||||
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 = {
|
local stuff = {
|
||||||
-- mod item wear message ("You caught "..) nrmin chance (1/67)
|
-- mod item wear message ("You caught "..) chance
|
||||||
{"flowers", "seaweed", 0, "some Seaweed.", 1, 5},
|
{"flowers_plus", "seaweed", 0, "some Seaweed.", 10},
|
||||||
{"farming", "string", 0, "a String.", 6, 5},
|
{"farming", "string", 0, "a String.", 5},
|
||||||
{"trunks", "twig_1", 0, "a Twig.", 11, 5},
|
{"trunks", "twig_1", 0, "a Twig.", 5},
|
||||||
{"mobs", "rat", 0, "a Rat.", 16, 5},
|
{"mobs", "rat", 0, "a Rat.", 5},
|
||||||
{"default", "stick", 0, "a Twig.", 21, 5},
|
{"default", "stick", 0, "a Twig.", 5},
|
||||||
{"seaplants", "kelpgreen", 0, "a Green Kelp.", 26, 5},
|
{"seaplants", "kelpgreen", 0, "a Green Kelp.", 5},
|
||||||
{"3d_armor", "boots_steel", "random", "some very old Boots.", 31, 2},
|
{"3d_armor", "boots_steel", "random", "some very old Boots.", 2},
|
||||||
{"3d_armor", "leggings_gold", "random", "some very old Leggings.", 33, 5},
|
{"3d_armor", "leggings_gold", "random", "some very old Leggings.", 5},
|
||||||
{"3d_armor", "chestplate_bronze", "random", "a very old ChestPlate.", 38, 5},
|
{"3d_armor", "chestplate_bronze", "random", "a very old ChestPlate.", 5},
|
||||||
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole.", 43, 10},
|
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole.", 10},
|
||||||
{"3d_armor", "boots_wood", "random", "some very old Boots.", 53, 5},
|
{"3d_armor", "boots_wood", "random", "some very old Boots.", 5},
|
||||||
{"maptools", "gold_coin", 0, "a Gold Coin.", 58, 1},
|
{"maptools", "gold_coin", 0, "a Gold Coin.", 1},
|
||||||
{"3d_armor", "helmet_diamond", "random", "a very old Helmet.", 59, 1},
|
{"3d_armor", "helmet_diamond", "random", "a very old Helmet.", 1},
|
||||||
{"shields", "shield_enhanced_cactus", "random", "a very old Shield.", 60, 2},
|
{"shields", "shield_enhanced_cactus", "random", "a very old Shield.", 2},
|
||||||
{"default", "sword_bronze", "random", "a very old Sword.", 62, 2},
|
{"default", "sword_bronze", "random", "a very old Sword.", 2},
|
||||||
{"default", "sword_mese", "random", "a very old Sword.", 64, 2},
|
{"default", "sword_mese", "random", "a very old Sword.", 2},
|
||||||
{"default", "sword_nyan", "random", "a very old Sword.", 66, 2},
|
{"default", "sword_nyan", "random", "a very old Sword.", 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)
|
|
||||||
|
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 = {
|
local treasure = {
|
||||||
|
Loading…
Reference in New Issue
Block a user