added fishing as submodule
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[submodule "mods/quests"]
|
[submodule "mods/quests"]
|
||||||
path = mods/quests
|
path = mods/quests
|
||||||
url = https://github.com/MinetestForFun/quests.git
|
url = https://github.com/MinetestForFun/quests.git
|
||||||
|
[submodule "mods/fishing"]
|
||||||
|
path = mods/fishing
|
||||||
|
url = https://github.com/MinetestForFun/fishing.git
|
||||||
|
1
mods/fishing
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 7f9809d9bec8b18f6187e10995f8ba5a39d3e080
|
@ -1,36 +0,0 @@
|
|||||||
|
|
||||||
## Minetest Fishing Mod
|
|
||||||
|
|
||||||
### Original by Mossmanikin https://github.com/Mossmanikin/fishing
|
|
||||||
### Rewrited by Crabman77
|
|
||||||
|
|
||||||
5 fish type
|
|
||||||
3 small fish (fish, clownfish,bluewhite fish)
|
|
||||||
2 predator fish (small shark, Northern Pike)
|
|
||||||
|
|
||||||
|
|
||||||
3 kind of bait for small fish (corn, bread, worm)
|
|
||||||
3 kind of bait for predator fish (small fish)
|
|
||||||
2 poles, wood 30 uses and mithril 1500 uses
|
|
||||||
The baits have a variable luck(15% to 80%) changed between 30 minutes to 6 hours for a better gameplay
|
|
||||||
Baitball improves lucky bait of 20%
|
|
||||||
|
|
||||||
##Contest Game
|
|
||||||
|
|
||||||
Contest game can be launched by admin, duration variable 2min to 4heures
|
|
||||||
Start/End is announced in chat and sound
|
|
||||||
A ranking appears(formspec) after contest
|
|
||||||
|
|
||||||
Adjustable settings in formspec
|
|
||||||
if the unified_inventory mod is active there is a button for classification or settings for the admin only
|
|
||||||
|
|
||||||
|
|
||||||
[demo video youtube](https://youtu.be/8rt8g3F2Gmk)
|
|
||||||
|
|
||||||
|
|
||||||
![fishing]( http://nsm08.casimages.com/img/2015/07/01/1507010157379539613411965.png)
|
|
||||||
![fishing]( http://nsm08.casimages.com/img/2015/07/01//1507010157329539613411964.png)
|
|
||||||
![fishing]( http://nsm08.casimages.com/img/2015/07/01//1507010157319539613411963.png)
|
|
||||||
![fishing]( http://nsm08.casimages.com/img/2015/07/01//1507010157389539613411968.png)
|
|
||||||
![fishing]( http://nsm08.casimages.com/img/2015/07/01//1507010157379539613411966.png)
|
|
||||||
![fishing]( http://nsm08.casimages.com/img/2015/07/01//1507010157389539613411967.png)
|
|
@ -1,58 +0,0 @@
|
|||||||
|
|
||||||
-- baitball
|
|
||||||
minetest.register_craftitem("fishing:baitball", {
|
|
||||||
description = fishing_setting.func.S("Bait Ball"),
|
|
||||||
inventory_image = "fishing_baitball.png",
|
|
||||||
stack_max = 99,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball 20",
|
|
||||||
recipe = {"farming:flour", "farming:corn", "bucket:bucket_water"},
|
|
||||||
replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- baitball_shark
|
|
||||||
minetest.register_craftitem("fishing:baitball_shark", {
|
|
||||||
description = fishing_setting.func.S("Shark Bait Ball"),
|
|
||||||
inventory_image = "fishing_baitball_shark.png",
|
|
||||||
stack_max = 99,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:fish_raw", "fishing:fish_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:shark_raw", "fishing:shark_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:pike_raw", "fishing:pike_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:fish_raw", "fishing:shark_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:fish_raw", "fishing:pike_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:shark_raw", "fishing:pike_raw"}
|
|
||||||
})
|
|
@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
--fish bait
|
|
||||||
--bait_corn
|
|
||||||
minetest.register_craftitem("fishing:bait_corn", {
|
|
||||||
description = fishing_setting.func.S("Bait Corn"),
|
|
||||||
inventory_image = "fishing_bait_corn.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
fishing_setting.baits["fishing:bait_corn"] = { ["bait"] = "fishing:bait_corn", ["bobber"] = "fishing:bobber_fish_entity",["texture"] = "fishing_bait_corn.png", ["hungry"] = 50 }
|
|
||||||
|
|
||||||
--bait_bread
|
|
||||||
minetest.register_craftitem("fishing:bait_bread", {
|
|
||||||
description = fishing_setting.func.S("Bait Bread"),
|
|
||||||
inventory_image = "fishing_bait_bread.png",
|
|
||||||
})
|
|
||||||
|
|
||||||
fishing_setting.baits["fishing:bait_bread"] = { ["bait"] = "fishing:bait_bread", ["bobber"] = "fishing:bobber_fish_entity",["texture"] = "fishing_bait_bread.png", ["hungry"] = 50 }
|
|
||||||
|
|
||||||
--bait_worm
|
|
||||||
fishing_setting.baits["fishing:bait_worm"] = { ["bait"] = "fishing:bait_worm", ["bobber"] = "fishing:bobber_fish_entity",["texture"] = "fishing_bait_worm.png", ["hungry"] = 50 }
|
|
||||||
|
|
||||||
--shark bait
|
|
||||||
--bait_fish
|
|
||||||
fishing_setting.baits["fishing:fish_raw"] = { ["bait"] = "fishing:fish_raw", ["bobber"] = "fishing:bobber_shark_entity",["texture"] = "fishing_fish_raw.png", ["hungry"] = 50 }
|
|
||||||
|
|
||||||
fishing_setting.baits["fishing:clownfish_raw"] = { ["bait"] = "fishing:clownfish_raw", ["bobber"] = "fishing:bobber_shark_entity",["texture"] = "fishing_clownfish_raw.png", ["hungry"] = 50 }
|
|
||||||
fishing_setting.baits["fishing:bluewhite_raw"] = { ["bait"] = "fishing:bluewhite_raw", ["bobber"] = "fishing:bobber_shark_entity",["texture"] = "fishing_bluewhite_raw.png", ["hungry"] = 50 }
|
|
@ -1,187 +0,0 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Fishing - crabman77's version - Bobber
|
|
||||||
-- Rewrited from original Fishing - Mossmanikin's version - Bobber 0.1.7
|
|
||||||
-- License (code & textures): WTFPL
|
|
||||||
-- Contains code from: fishing (original), mobs, throwing, volcano
|
|
||||||
-- Supports: 3d_armor, animal_clownfish, animal_fish_blue_white, animal_rat, flowers_plus, mobs, seaplants
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- bobber
|
|
||||||
minetest.register_node("fishing:bobber_box", {
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
-- { left, bottom, front, right, top , back}
|
|
||||||
{-8/16, -8/16, 0, 8/16, 8/16, 0}, -- feathers
|
|
||||||
{-2/16, -8/16, -2/16, 2/16, -4/16, 2/16}, -- bobber
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tiles = {
|
|
||||||
"fishing_bobber_top.png",
|
|
||||||
"fishing_bobber_bottom.png",
|
|
||||||
"fishing_bobber.png",
|
|
||||||
"fishing_bobber.png",
|
|
||||||
"fishing_bobber.png",
|
|
||||||
"fishing_bobber.png^[transformFX"
|
|
||||||
},
|
|
||||||
groups = {not_in_creative_inventory=1},
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
local FISHING_BOBBER_ENTITY={
|
|
||||||
hp_max = 605,
|
|
||||||
water_damage = 1,
|
|
||||||
physical = true,
|
|
||||||
timer = 0,
|
|
||||||
env_damage_timer = 0,
|
|
||||||
visual = "wielditem",
|
|
||||||
visual_size = {x=1/3, y=1/3, z=1/3},
|
|
||||||
textures = {"fishing:bobber_box"},
|
|
||||||
-- {left ,bottom, front, right, top , back}
|
|
||||||
collisionbox = {-2/16, -4/16, -2/16, 2/16, 1/16, 2/16},
|
|
||||||
randomtime = 50,
|
|
||||||
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
|
|
||||||
local player = puncher:get_player_name()
|
|
||||||
if playername ~= self.owner then return end
|
|
||||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(playername, fishing_setting.func.S("You didn't catch anything."), false) end
|
|
||||||
if not fishing_setting.is_creative_mode then
|
|
||||||
local inv = puncher:get_inventory()
|
|
||||||
if inv:room_for_item("main", {name=self.bait, count=1, wear=0, metadata=""}) then
|
|
||||||
inv:add_item("main", {name=self.bait, count=1, wear=0, metadata=""})
|
|
||||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(playername, fishing_setting.func.S("The bait is still there."), false) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- make sound and remove bobber
|
|
||||||
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()
|
|
||||||
local playername = clicker:get_player_name()
|
|
||||||
local inv = clicker:get_inventory()
|
|
||||||
local pos = self.object:getpos()
|
|
||||||
local item_name = item:get_name()
|
|
||||||
if string.find(item_name, "fishing:pole_") ~= nil then
|
|
||||||
if playername ~= 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(playername, fishing_setting.func.S("Your fish escaped."), false) end -- fish escaped
|
|
||||||
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(playername, 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
|
|
||||||
inv:add_item("main", {name=name, count=1, wear=wear_value, metadata=""})
|
|
||||||
else
|
|
||||||
minetest.spawn_item(clicker:getpos(), {name=name, count=1, wear=wear_value, metadata=""})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- 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" then
|
|
||||||
if not fishing_setting.is_creative_mode then
|
|
||||||
inv:remove_item("main", "fishing:baitball")
|
|
||||||
end
|
|
||||||
self.baitball = 20
|
|
||||||
--addparticle
|
|
||||||
minetest.add_particlespawner(30, 0.5, -- for how long (?) -- Particles on splash
|
|
||||||
{x=pos.x,y=pos.y-0.0625,z=pos.z}, {x=pos.x,y=pos.y,z=pos.z}, -- position min, pos max
|
|
||||||
{x=-2,y=-0.0625,z=-2}, {x=2,y=3,z=2}, -- velocity min, vel max
|
|
||||||
{x=0,y=-9.8,z=0}, {x=0,y=-9.8,z=0},
|
|
||||||
0.3, 1.2,
|
|
||||||
0.25, 0.5, -- min size, max size
|
|
||||||
false, "fishing_particle_baitball.png")
|
|
||||||
-- add sound
|
|
||||||
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()
|
|
||||||
--remove if no owner, no player, owner no in bobber_view_range
|
|
||||||
if self.owner == nil then self.object:remove(); return end
|
|
||||||
--remove if not node water
|
|
||||||
local node = minetest.get_node_or_nil({x=pos.x, y=pos.y-0.5, z=pos.z})
|
|
||||||
if not node or string.find(node.name, "water_source") == nil then
|
|
||||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(self.owner, "Haha, Fishing is prohibited outside water!") end
|
|
||||||
self.object:remove()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local player = minetest.get_player_by_name(self.owner)
|
|
||||||
if not player then self.object:remove(); return end
|
|
||||||
local p = player:getpos()
|
|
||||||
local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5
|
|
||||||
if dist > fishing_setting.settings["bobber_view_range"] then
|
|
||||||
minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,})
|
|
||||||
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.0280
|
|
||||||
self.object:moveto(pos, false)
|
|
||||||
self.old_pos2 = false
|
|
||||||
else
|
|
||||||
pos.y = pos.y+0.0280
|
|
||||||
self.object:moveto(pos, false)
|
|
||||||
self.old_pos2 = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--change item on line
|
|
||||||
self.timer = 0
|
|
||||||
self.prize = ""
|
|
||||||
self.object:moveto(self.old_pos, false)
|
|
||||||
--Once the fish are not hungry :), baitball increase hungry + 20%
|
|
||||||
if math.random(1, 100) > fishing_setting.baits[self.bait]["hungry"] + self.baitball then
|
|
||||||
--Fish not hungry !(
|
|
||||||
self.randomtime = math.random(20,60)*10
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
self.randomtime = math.random(1,5)*10
|
|
||||||
if math.random(1, 100) <= fishing_setting.settings["fish_chance"] then
|
|
||||||
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.func.get_loot()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.prize ~= "" then
|
|
||||||
pos.y = self.old_pos.y-0.1
|
|
||||||
self.object:moveto(pos, false)
|
|
||||||
minetest.sound_play("fishing_bobber1", {pos=pos,gain = 0.5,})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_entity("fishing:bobber_fish_entity", FISHING_BOBBER_ENTITY)
|
|
@ -1,191 +0,0 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Fishing - crabman77 version - Bobber Shark
|
|
||||||
-- Rewrited from original Fishing - Mossmanikin's version - Bobber Shark 0.0.6
|
|
||||||
-- License (code & textures): WTFPL
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- bobber shark
|
|
||||||
minetest.register_node("fishing:bobber_shark_box", {
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
-- { left, bottom, front, right, top , back}
|
|
||||||
{-8/16, -8/16, 0, 8/16, 8/16, 0}, -- feathers
|
|
||||||
{-2/16, -8/16, -2/16, 2/16, -4/16, 2/16}, -- bobber
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tiles = {
|
|
||||||
"fishing_bobber_top.png",
|
|
||||||
"fishing_bobber_bottom.png",
|
|
||||||
"fishing_bobber_shark.png",
|
|
||||||
"fishing_bobber_shark.png",
|
|
||||||
"fishing_bobber_shark.png",
|
|
||||||
"fishing_bobber_shark.png^[transformFX"
|
|
||||||
},
|
|
||||||
groups = {not_in_creative_inventory=1},
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
local FISHING_BOBBER_SHARK_ENTITY={
|
|
||||||
hp_max = 605,
|
|
||||||
water_damage = 1,
|
|
||||||
physical = true,
|
|
||||||
timer = 0,
|
|
||||||
env_damage_timer = 0,
|
|
||||||
visual = "wielditem",
|
|
||||||
visual_size = {x=1/3, y=1/3, z=1/3},
|
|
||||||
textures = {"fishing:bobber_shark_box"},
|
|
||||||
-- {left ,bottom, front, right, top , back}
|
|
||||||
collisionbox = {-3/16, -4/16, -3/16, 3/16, 4/16, 3/16},
|
|
||||||
randomtime = 50,
|
|
||||||
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
|
|
||||||
local player_name = puncher:get_player_name()
|
|
||||||
if player_name ~= self.owner then return end
|
|
||||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, fishing_setting.func.S("You didn't catch anything."), false) end
|
|
||||||
if not fishing_setting.is_creative_mode then
|
|
||||||
local inv = puncher:get_inventory()
|
|
||||||
if inv:room_for_item("main", {name=self.bait, count=1, wear=0, metadata=""}) then
|
|
||||||
inv:add_item("main", {name=self.bait, count=1, wear=0, metadata=""})
|
|
||||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, fishing_setting.func.S("The bait is still there."), false) end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- make sound and remove bobber
|
|
||||||
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()
|
|
||||||
local player_name = clicker:get_player_name()
|
|
||||||
local inv = clicker:get_inventory()
|
|
||||||
local pos = self.object:getpos()
|
|
||||||
local item_name = item:get_name()
|
|
||||||
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
|
|
||||||
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
|
|
||||||
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
|
|
||||||
inv:add_item("main", {name=name, count=1, wear=wear_value, metadata=""})
|
|
||||||
else
|
|
||||||
minetest.spawn_item(clicker:getpos(), {name=name, count=1, wear=wear_value, metadata=""})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- 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")
|
|
||||||
end
|
|
||||||
self.baitball = 20
|
|
||||||
--addparticle
|
|
||||||
minetest.add_particlespawner(30, 0.5, -- for how long (?) -- Particles on splash
|
|
||||||
{x=pos.x,y=pos.y-0.0325,z=pos.z}, {x=pos.x,y=pos.y,z=pos.z}, -- position min, pos max
|
|
||||||
{x=-2,y=-0.0325,z=-2}, {x=2,y=3,z=2}, -- velocity min, vel max
|
|
||||||
{x=0,y=-3.8,z=0}, {x=0,y=-9.8,z=0},
|
|
||||||
0.3, 1.2,
|
|
||||||
0.25, 0.40, -- min size, max size
|
|
||||||
false, "fishing_particle_baitball_shark.png")
|
|
||||||
-- add sound
|
|
||||||
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()
|
|
||||||
--remove if no owner, no player, owner no in bobber_view_range
|
|
||||||
if self.owner == nil then self.object:remove(); return end
|
|
||||||
--remove if not node water
|
|
||||||
local node = minetest.get_node_or_nil({x=pos.x, y=pos.y-0.5, z=pos.z})
|
|
||||||
if not node or string.find(node.name, "water_source") == nil then
|
|
||||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(self.owner, fishing_setting.func.S("Haha, Fishing is prohibited outside water!")) end
|
|
||||||
self.object:remove()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local player = minetest.get_player_by_name(self.owner)
|
|
||||||
if not player then self.object:remove(); return end
|
|
||||||
local p = player:getpos()
|
|
||||||
local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5
|
|
||||||
if dist > fishing_setting.settings["bobber_view_range"] then
|
|
||||||
minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,})
|
|
||||||
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.0425
|
|
||||||
self.object:moveto(pos, false)
|
|
||||||
self.old_pos2 = false
|
|
||||||
else
|
|
||||||
pos.y = pos.y+0.0425
|
|
||||||
self.object:moveto(pos, false)
|
|
||||||
self.old_pos2 = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--change item on line
|
|
||||||
self.timer = 0
|
|
||||||
self.prize = ""
|
|
||||||
self.object:moveto(self.old_pos, false)
|
|
||||||
--Once the fish are not hungry :), baitball increase hungry + 20%
|
|
||||||
if math.random(1, 100) > fishing_setting.baits[self.bait]["hungry"] + self.baitball then
|
|
||||||
--Fish not hungry !(
|
|
||||||
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
|
|
||||||
if chance == 1 then
|
|
||||||
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"])]
|
|
||||||
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.func.get_loot()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if self.prize ~= "" then
|
|
||||||
pos.y = self.old_pos.y-0.2
|
|
||||||
self.object:moveto(pos, false)
|
|
||||||
minetest.sound_play("fishing_bobber1", {pos=pos,gain = 0.5,})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
minetest.register_entity("fishing:bobber_shark_entity", FISHING_BOBBER_SHARK_ENTITY)
|
|
@ -1,258 +0,0 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Fishing - crabman77 version
|
|
||||||
-- Rewrited from original Fishing - Mossmanikin's version - Recipes 0.0.8
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- License (code & textures): WTFPL
|
|
||||||
-- Contains code from: animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
|
|
||||||
-- Looked at code from:
|
|
||||||
-- Dependencies: default, farming
|
|
||||||
-- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Fishing Pole
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Wood Fishing Pole
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "fishing:pole_wood",
|
|
||||||
recipe = {
|
|
||||||
{"", "", "group:stick" },
|
|
||||||
{"", "group:stick", "farming:string" },
|
|
||||||
{"group:stick", "", "farming:string" },
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if minetest.get_modpath("moreblocks") ~= nil then
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "fishing:pole_wood",
|
|
||||||
recipe = {
|
|
||||||
{"", "", "group:stick" },
|
|
||||||
{"", "group:stick", "moreblocks:rope" },
|
|
||||||
{"group:stick", "", "moreblocks:rope" },
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_modpath("ropes") ~= nil then
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "fishing:pole_wood",
|
|
||||||
recipe = {
|
|
||||||
{"", "", "group:stick" },
|
|
||||||
{"", "group:stick", "ropes:rope" },
|
|
||||||
{"group:stick", "", "ropes:rope" },
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Mithril Fishing Pole
|
|
||||||
if minetest.get_modpath("moreores") ~= nil and minetest.get_modpath("mobs") ~= nil then
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "fishing:pole_perfect",
|
|
||||||
recipe = {
|
|
||||||
{"", "", "moreores:mithril_ingot" },
|
|
||||||
{"", "moreores:mithril_ingot", "mobs:spider_cobweb" },
|
|
||||||
{"moreores:mithril_ingot", "", "mobs:spider_cobweb" },
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Fishing bait
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
--bait corn
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "fishing:bait_corn 9",
|
|
||||||
recipe = {
|
|
||||||
{"", "farming:corn", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
--bait bread
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "fishing:bait_bread 9",
|
|
||||||
recipe = {
|
|
||||||
{"", "farming:bread", ""},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Roasted Fish
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "cooking",
|
|
||||||
output = "fishing:fish_cooked",
|
|
||||||
recipe = "fishing:fish_raw",
|
|
||||||
cooktime = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "cooking",
|
|
||||||
output = "fishing:fish_cooked",
|
|
||||||
recipe = "fishing:clownfish_raw",
|
|
||||||
cooktime = 2,
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "cooking",
|
|
||||||
output = "fishing:fish_cooked",
|
|
||||||
recipe = "fishing:bluewhite_raw",
|
|
||||||
cooktime = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Wheat Seed
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "farming:seed_wheat",
|
|
||||||
recipe = {"farming:wheat"},
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Sushi
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
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" },
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
if minetest.get_modpath("seaplants") ~= nil then
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:sushi",
|
|
||||||
recipe = {"fishing:fish_cooked", "farming:seed_wheat", "seaplants:kelpgreen" },
|
|
||||||
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Roasted Shark
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "cooking",
|
|
||||||
output = "fishing:shark_cooked",
|
|
||||||
recipe = "fishing:shark_raw",
|
|
||||||
cooktime = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Roasted Pike
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "cooking",
|
|
||||||
output = "fishing:pike_cooked",
|
|
||||||
recipe = "fishing:pike_raw",
|
|
||||||
cooktime = 2,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- baitball
|
|
||||||
minetest.register_craftitem("fishing:baitball", {
|
|
||||||
description = fishing_setting.func.S("Bait Ball"),
|
|
||||||
inventory_image = "fishing_baitball.png",
|
|
||||||
stack_max = 99,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball 20",
|
|
||||||
recipe = {"farming:flour", "farming:corn", "bucket:bucket_water"},
|
|
||||||
replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- baitball_shark
|
|
||||||
minetest.register_craftitem("fishing:baitball_shark", {
|
|
||||||
description = fishing_setting.func.S("Shark Bait Ball"),
|
|
||||||
inventory_image = "fishing_baitball_shark.png",
|
|
||||||
stack_max = 99,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:fish_raw", "fishing:fish_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:clownfish_raw", "fishing:clownfish_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:clownfish_raw", "fishing:fish_raw"}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:bluewhite_raw", "fishing:bluewhite_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:bluewhite_raw", "fishing:fish_raw"}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:clownfish_raw", "fishing:bluewhite_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:clownfish_raw", "fishing:shark_raw"}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:clownfish_raw", "fishing:pike_raw"}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:bluewhite_raw", "fishing:shark_raw"}
|
|
||||||
})
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:bluewhite_raw", "fishing:pike_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:shark_raw", "fishing:shark_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:pike_raw", "fishing:pike_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:fish_raw", "fishing:shark_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:fish_raw", "fishing:pike_raw"}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:baitball_shark 20",
|
|
||||||
recipe = {"fishing:shark_raw", "fishing:pike_raw"}
|
|
||||||
})
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
default
|
|
||||||
unified_inventory?
|
|
||||||
farming
|
|
||||||
moreblocks?
|
|
||||||
ropes?
|
|
||||||
moreores?
|
|
||||||
mobs?
|
|
||||||
flowers_plus?
|
|
||||||
seaplants?
|
|
@ -1,91 +0,0 @@
|
|||||||
-------------------------------------------------------------------------------------------
|
|
||||||
-- Fishing - crabman77 version
|
|
||||||
-- Rewrited from original Fishing - Mossmanikin's version - Fishes 0.0.4
|
|
||||||
-- License (code & textures): WTFPL
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Fish
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:fish_raw", {
|
|
||||||
description = fishing_setting.func.S("Fish"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_fish_raw.png",
|
|
||||||
on_use = minetest.item_eat(2),
|
|
||||||
})
|
|
||||||
-----------------------------------------------------
|
|
||||||
-- Roasted Fish
|
|
||||||
-----------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:fish_cooked", {
|
|
||||||
description = fishing_setting.func.S("Roasted Fish"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_fish_cooked.png",
|
|
||||||
on_use = minetest.item_eat(4),
|
|
||||||
})
|
|
||||||
-----------------------------------------------------
|
|
||||||
-- Sushi
|
|
||||||
-----------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:sushi", {
|
|
||||||
description = fishing_setting.func.S("Sushi (Hoso Maki)"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_sushi.png",
|
|
||||||
on_use = minetest.item_eat(6),
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- clownfish
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:clownfish_raw", {
|
|
||||||
description = fishing_setting.func.S("Clownfish"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_clownfish_raw.png",
|
|
||||||
on_use = minetest.item_eat(2),
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- bluewhite
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:bluewhite_raw", {
|
|
||||||
description = fishing_setting.func.S("Bluewhite"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_bluewhite_raw.png",
|
|
||||||
on_use = minetest.item_eat(2),
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Whatthef... it's a freakin' Shark!
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:shark_raw", {
|
|
||||||
description = fishing_setting.func.S("Shark"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_shark_raw.png",
|
|
||||||
on_use = minetest.item_eat(2),
|
|
||||||
})
|
|
||||||
-----------------------------------------------------
|
|
||||||
-- Roasted Shark
|
|
||||||
-----------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:shark_cooked", {
|
|
||||||
description = fishing_setting.func.S("Roasted Shark"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_shark_cooked.png",
|
|
||||||
on_use = minetest.item_eat(6),
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Pike
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:pike_raw", {
|
|
||||||
description = fishing_setting.func.S("Northern Pike"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_pike_raw.png",
|
|
||||||
on_use = minetest.item_eat(2),
|
|
||||||
})
|
|
||||||
-----------------------------------------------------
|
|
||||||
-- Roasted Pike
|
|
||||||
-----------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:pike_cooked", {
|
|
||||||
description = fishing_setting.func.S("Roasted Northern Pike"),
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_pike_cooked.png",
|
|
||||||
on_use = minetest.item_eat(6),
|
|
||||||
})
|
|
@ -1,650 +0,0 @@
|
|||||||
|
|
||||||
local S = fishing_setting.func.S
|
|
||||||
|
|
||||||
--function save settings
|
|
||||||
function fishing_setting.func.save()
|
|
||||||
local input, err = io.open(fishing_setting.file_settings, "w")
|
|
||||||
if input then
|
|
||||||
input:write(minetest.serialize(fishing_setting.settings))
|
|
||||||
input:close()
|
|
||||||
else
|
|
||||||
minetest.log("error", "open(" .. fishing_setting.file_settings .. ", 'w') failed: " .. err)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function fishing_setting.func.set_settings(new_settings, settings)
|
|
||||||
if settings["message"] ~= nil then
|
|
||||||
new_settings["message"] = settings["message"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["worm_is_mob"] ~= nil then
|
|
||||||
new_settings["worm_is_mob"] = settings["worm_is_mob"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["worm_chance"] ~= nil then
|
|
||||||
new_settings["worm_chance"] = settings["worm_chance"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["new_worm_source"] ~= nil then
|
|
||||||
new_settings["new_worm_source"] = settings["new_worm_source"]
|
|
||||||
end
|
|
||||||
if settings["wear_out"] ~= nil then
|
|
||||||
new_settings["wear_out"] = settings["wear_out"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["bobber_view_range"] ~= nil then
|
|
||||||
new_settings["bobber_view_range"] = settings["bobber_view_range"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["simple_deco_fishing_pole"] ~= nil then
|
|
||||||
new_settings["simple_deco_fishing_pole"] = settings["simple_deco_fishing_pole"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["fish_chance"] ~= nil then
|
|
||||||
new_settings["fish_chance"] = settings["fish_chance"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["treasure_chance"] ~= nil then
|
|
||||||
new_settings["treasure_chance"] = settings["treasure_chance"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["shark_chance"] ~= nil then
|
|
||||||
new_settings["shark_chance"] = settings["shark_chance"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["treasure_enable"] ~= nil then
|
|
||||||
new_settings["treasure_enable"] = settings["treasure_enable"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if settings["escape_chance"] ~= nil then
|
|
||||||
new_settings["escape_chance"] = settings["escape_chance"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--function load settings from file
|
|
||||||
function fishing_setting.func.load()
|
|
||||||
local file = io.open(fishing_setting.file_settings, "r")
|
|
||||||
local settings = {}
|
|
||||||
if file then
|
|
||||||
settings = minetest.deserialize(file:read("*all"))
|
|
||||||
file:close()
|
|
||||||
if settings and type(settings) == "table" then
|
|
||||||
fishing_setting.func.set_settings(fishing_setting.settings, settings)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--function return wear tool value (old or new)
|
|
||||||
function fishing_setting.func.wear_value(wear)
|
|
||||||
local used = 0
|
|
||||||
if wear == "random" then
|
|
||||||
used = (2000*(math.random(20, 29)))
|
|
||||||
elseif wear == "randomtools" then
|
|
||||||
used = (65535/(30-(math.random(15, 29))))
|
|
||||||
end
|
|
||||||
return used
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- function return table where mods actived
|
|
||||||
function fishing_setting.func.ignore_mod(list)
|
|
||||||
local listOk = {}
|
|
||||||
for i,v in ipairs(list) do
|
|
||||||
if minetest.get_modpath(v[1]) ~= nil then
|
|
||||||
table.insert(listOk, v)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return listOk
|
|
||||||
end
|
|
||||||
|
|
||||||
--function random hungry by bait type
|
|
||||||
function fishing_setting.func.hungry_random()
|
|
||||||
for i,a in pairs(fishing_setting.baits) do
|
|
||||||
fishing_setting.baits[i]["hungry"] = math.random(15, 80)
|
|
||||||
end
|
|
||||||
--change hungry after random time, min 0h30, max 6h00
|
|
||||||
minetest.after(math.random(1, 12)*1800,function() fishing_setting.func.hungry_random() end)
|
|
||||||
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 = 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, S("You caught the treasure, %s!"):format(treasure[4]))
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(player_name, title)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Menu: fishing configuration
|
|
||||||
fishing_setting.func.on_show_settings = function(player_name)
|
|
||||||
if not fishing_setting.tmp_setting then
|
|
||||||
fishing_setting.tmp_setting = {}
|
|
||||||
fishing_setting.func.set_settings(fishing_setting.tmp_setting, fishing_setting.settings)
|
|
||||||
end
|
|
||||||
local formspec = "size[10.8,9]label[4,0;"..S("Fishing configuration").."]"..
|
|
||||||
-- Fish chance
|
|
||||||
"label[1.6,0.5;"..S("Fish chance").."]"..
|
|
||||||
"button[0,1;1,1;cfish;-1]"..
|
|
||||||
"button[1,1;1,1;cfish;-10]"..
|
|
||||||
"label[2.1,1.2;"..tostring(fishing_setting.tmp_setting["fish_chance"]).."]"..
|
|
||||||
"button[2.7,1;1,1;cfish;+10]"..
|
|
||||||
"button[3.7,1;1,1;cfish;+1]"..
|
|
||||||
-- Shark chance
|
|
||||||
"label[1.5,2;"..S("Shark chance").."]"..
|
|
||||||
"button[0,2.5;1,1;cshark;-1]"..
|
|
||||||
"button[1,2.5;1,1;cshark;-10]"..
|
|
||||||
"label[2.1,2.7;"..tostring(fishing_setting.tmp_setting["shark_chance"]).."]"..
|
|
||||||
"button[2.7,2.5;1,1;cshark;+10]"..
|
|
||||||
"button[3.7,2.5;1,1;cshark;+1]"..
|
|
||||||
-- Treasure chance
|
|
||||||
"label[1.5,3.5;"..S("Treasure chance").."]"..
|
|
||||||
"button[0,4.;1,1;ctreasure;-1]"..
|
|
||||||
"button[1,4;1,1;ctreasure;-10]"..
|
|
||||||
"label[2.1,4.2;"..tostring(fishing_setting.tmp_setting["treasure_chance"]).."]"..
|
|
||||||
"button[2.7,4;1,1;ctreasure;+10]"..
|
|
||||||
"button[3.7,4;1,1;ctreasure;+1]"..
|
|
||||||
-- Worm chance
|
|
||||||
"label[7.5,0.5;"..S("Worm chance").."]"..
|
|
||||||
"button[6,1;1,1;cworm;-1]"..
|
|
||||||
"button[7,1;1,1;cworm;-10]"..
|
|
||||||
"label[8.1,1.2;"..tostring(fishing_setting.tmp_setting["worm_chance"]).."]"..
|
|
||||||
"button[8.7,1;1,1;cworm;+10]"..
|
|
||||||
"button[9.7,1;1,1;cworm;+1]"..
|
|
||||||
-- Escape chance
|
|
||||||
"label[7.4,2;"..S("Escape chance").."]"..
|
|
||||||
"button[6,2.5;1,1;cescape;-1]"..
|
|
||||||
"button[7,2.5;1,1;cescape;-10]"..
|
|
||||||
"label[8.1,2.7;"..tostring(fishing_setting.tmp_setting["escape_chance"]).."]"..
|
|
||||||
"button[8.7,2.5;1,1;cescape;+10]"..
|
|
||||||
"button[9.7,2.5;1,1;cescape;+1]"..
|
|
||||||
-- Bobber view range
|
|
||||||
"label[7.2,3.5;"..S("Bobber view range").."]"..
|
|
||||||
"button[7,4;1,1;bvrange;-1]"..
|
|
||||||
"label[8.1,4.2;"..tostring(fishing_setting.tmp_setting["bobber_view_range"]).."]"..
|
|
||||||
"button[8.7,4;1,1;bvrange;+1]"..
|
|
||||||
-- Messages display
|
|
||||||
"label[0,5.7;"..S("Display messages in chat").."]"..
|
|
||||||
"button[3.7,5.5;1,1;dmessages;"..tostring(fishing_setting.tmp_setting["message"]).."]"..
|
|
||||||
--poledeco
|
|
||||||
"label[0,6.5;"..S("Simple pole deco").."]"..
|
|
||||||
"button[3.7,6.3;1,1;poledeco;"..tostring(fishing_setting.tmp_setting["simple_deco_fishing_pole"]).."]"..
|
|
||||||
-- Wearout
|
|
||||||
"label[0,7.3;"..S("Poles wearout").."]"..
|
|
||||||
"button[3.7,7.1;1,1;wearout;"..tostring(fishing_setting.tmp_setting["wear_out"]).."]"..
|
|
||||||
-- TREASURE_ENABLE
|
|
||||||
"label[6,5.7;"..S("Enable treasure").."]"..
|
|
||||||
"button[9.7,5.5;1,1;treasureenable;"..tostring(fishing_setting.tmp_setting["treasure_enable"]).."]"..
|
|
||||||
-- NEW_WORM_SOURCE
|
|
||||||
"label[6,6.5;"..S("New worm source (reboot)").."]"..
|
|
||||||
"button[9.7,6.3;1,1;newworm;"..tostring(fishing_setting.tmp_setting["new_worm_source"]).."]"..
|
|
||||||
-- WORM_IS_MOB
|
|
||||||
"label[6,7.3;"..S("Worm is a mob (reboot)").."]"..
|
|
||||||
"button[9.7,7.1;1,1;wormmob;"..tostring(fishing_setting.tmp_setting["worm_is_mob"]).."]"..
|
|
||||||
"button_exit[0,8.2;1.5,1;abort;"..S("Abort").."]"..
|
|
||||||
"button_exit[9.2,8.2;1.5,1;save;"..S("OK").."]"
|
|
||||||
minetest.show_formspec(player_name, "fishing:settings", formspec)
|
|
||||||
end
|
|
||||||
|
|
||||||
local inc = function(value, field, min, max)
|
|
||||||
local inc = tonumber(field)
|
|
||||||
local v = value
|
|
||||||
if inc ~= nil then
|
|
||||||
v = value + inc
|
|
||||||
end
|
|
||||||
|
|
||||||
if v > max then
|
|
||||||
return max
|
|
||||||
end
|
|
||||||
if v < min then
|
|
||||||
return min
|
|
||||||
end
|
|
||||||
return v
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local bool = function(field)
|
|
||||||
return field ~= "true"
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if not player_name then return end
|
|
||||||
if formname == "fishing:settings" then
|
|
||||||
if fields["save"] then
|
|
||||||
fishing_setting.func.set_settings(fishing_setting.settings, fishing_setting.tmp_setting)
|
|
||||||
fishing_setting.func.save()
|
|
||||||
fishing_setting.tmp_setting = nil
|
|
||||||
return
|
|
||||||
elseif fields["quit"] or fields["abort"] then
|
|
||||||
fishing_setting.tmp_setting = nil
|
|
||||||
return
|
|
||||||
elseif fields["cfish"] then
|
|
||||||
fishing_setting.tmp_setting["fish_chance"] = inc(fishing_setting.tmp_setting["fish_chance"], fields["cfish"], 1, 100)
|
|
||||||
elseif fields["cshark"] then
|
|
||||||
fishing_setting.tmp_setting["shark_chance"] = inc(fishing_setting.tmp_setting["shark_chance"], fields["cshark"], 1, 100)
|
|
||||||
elseif fields["ctreasure"] then
|
|
||||||
fishing_setting.tmp_setting["treasure_chance"] = inc(fishing_setting.tmp_setting["treasure_chance"], fields["ctreasure"], 1, 100)
|
|
||||||
elseif fields["bvrange"] then
|
|
||||||
fishing_setting.tmp_setting["bobber_view_range"] = inc(fishing_setting.tmp_setting["bobber_view_range"], fields["bvrange"], 4, 20)
|
|
||||||
elseif fields["cworm"] then
|
|
||||||
fishing_setting.tmp_setting["worm_chance"] = inc(fishing_setting.tmp_setting["worm_chance"], fields["cworm"], 1, 100)
|
|
||||||
elseif fields["cescape"] then
|
|
||||||
fishing_setting.tmp_setting["escape_chance"] = inc(fishing_setting.tmp_setting["escape_chance"], fields["cescape"], 1, 50)
|
|
||||||
elseif fields["dmessages"] then
|
|
||||||
fishing_setting.tmp_setting["message"] = bool(fields["dmessages"])
|
|
||||||
elseif fields["poledeco"] then
|
|
||||||
fishing_setting.tmp_setting["simple_deco_fishing_pole"] = bool(fields["poledeco"])
|
|
||||||
elseif fields["wearout"] then
|
|
||||||
fishing_setting.tmp_setting["wear_out"] = bool(fields["wearout"])
|
|
||||||
elseif fields["treasureenable"] then
|
|
||||||
fishing_setting.tmp_setting["treasure_enable"] = bool(fields["treasureenable"])
|
|
||||||
elseif fields["newworm"] then
|
|
||||||
fishing_setting.tmp_setting["new_worm_source"] = bool(fields["newworm"])
|
|
||||||
elseif fields["wormmob"] then
|
|
||||||
fishing_setting.tmp_setting["worm_is_mob"] = bool(fields["wormmob"])
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
fishing_setting.func.on_show_settings(player_name)
|
|
||||||
elseif formname == "fishing:admin_conf" then
|
|
||||||
if fields["classement"] then
|
|
||||||
local formspec = fishing_setting.func.get_stat()
|
|
||||||
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
|
||||||
elseif fields["contest"] then
|
|
||||||
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)
|
|
||||||
|
|
||||||
--function load settings from file
|
|
||||||
function fishing_setting.func.load_trophies()
|
|
||||||
local file = io.open(fishing_setting.file_trophies, "r")
|
|
||||||
fishing_setting.trophies = {}
|
|
||||||
if file then
|
|
||||||
fishing_setting.trophies = minetest.deserialize(file:read("*all"))
|
|
||||||
file:close()
|
|
||||||
if not fishing_setting.trophies or type(fishing_setting.trophies) ~= "table" then
|
|
||||||
fishing_setting.trophies = {}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function fishing_setting.func.save_trophies()
|
|
||||||
local input = io.open(fishing_setting.file_trophies, "w")
|
|
||||||
if input then
|
|
||||||
input:write(minetest.serialize(fishing_setting.trophies))
|
|
||||||
input:close()
|
|
||||||
else
|
|
||||||
minetest.log("action","Open failed (mode:w) of " .. fishing_setting.file_trophies)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_shutdown(function()
|
|
||||||
minetest.log("action", "[fishing] Server shuts down. saving trophies table")
|
|
||||||
fishing_setting.func.save_trophies()
|
|
||||||
fishing_setting.func.save_contest()
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
function fishing_setting.func.timetostr(time)
|
|
||||||
local countdown = time
|
|
||||||
local answer = ""
|
|
||||||
if countdown >= 3600 then
|
|
||||||
local hours = math.floor(countdown / 3600)
|
|
||||||
countdown = countdown % 3600
|
|
||||||
answer = hours .. "h"
|
|
||||||
end
|
|
||||||
if countdown >= 60 then
|
|
||||||
local minutes = math.floor(countdown / 60)
|
|
||||||
countdown = countdown % 60
|
|
||||||
answer = answer .. minutes .. "m"
|
|
||||||
else
|
|
||||||
answer = answer .. "0m"
|
|
||||||
end
|
|
||||||
local seconds = countdown
|
|
||||||
answer = answer .. math.floor(seconds) .. "s"
|
|
||||||
return answer
|
|
||||||
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, S("A fishing contest is in progress. (remaining time %s)"):format(fishing_setting.func.timetostr(fishing_setting.contest["duration"])))
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
function fishing_setting.func.add_to_trophies(player, fish, desc)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if not player_name then return end
|
|
||||||
if fish == "fish_raw" or fish == "shark_raw" or fish == "pike_raw" or fish == "clownfish_raw" or fish == "bluewhite_raw" then
|
|
||||||
if fishing_setting.trophies[fish] == nil then
|
|
||||||
fishing_setting.trophies[fish] = {}
|
|
||||||
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, 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
|
|
||||||
inv:add_item("main", {name=name, count=1, wear=0, metadata=""})
|
|
||||||
else
|
|
||||||
minetest.spawn_item(player:getpos(), {name=name, count=1, wear=0, metadata=""})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
|
|
||||||
if fishing_setting.contest[fish] == nil then
|
|
||||||
fishing_setting.contest[fish] = {}
|
|
||||||
end
|
|
||||||
fishing_setting.contest[fish][player_name] = (fishing_setting.contest[fish][player_name] or 0) + 1
|
|
||||||
minetest.chat_send_all(S("Yeah, %s caught "..desc):format(player_name))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Menu: fishing configuration/contest
|
|
||||||
fishing_setting.func.on_show_admin_menu = function(player_name)
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
if (minetest.get_modpath("unified_inventory")) then
|
|
||||||
unified_inventory.register_button("menu_fishing", {
|
|
||||||
type = "image",
|
|
||||||
image = "fishing_fish_raw.png",
|
|
||||||
tooltip = "fishing menu configuration",
|
|
||||||
action = function(player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if not player_name then return end
|
|
||||||
if minetest.check_player_privs(player_name, {server=true}) then
|
|
||||||
fishing_setting.func.on_show_admin_menu(player_name)
|
|
||||||
else
|
|
||||||
local formspec = fishing_setting.func.get_stat()
|
|
||||||
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--function save settings
|
|
||||||
function fishing_setting.func.save_contest()
|
|
||||||
local input = io.open(fishing_setting.file_contest, "w")
|
|
||||||
if input then
|
|
||||||
input:write(minetest.serialize(fishing_setting.contest))
|
|
||||||
input:close()
|
|
||||||
else
|
|
||||||
minetest.log("action","Open failed (mode:w) of " .. fishing_setting.file_contest)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--function load councours data from file
|
|
||||||
function fishing_setting.func.load_contest()
|
|
||||||
local file = io.open(fishing_setting.file_contest, "r")
|
|
||||||
local settings = {}
|
|
||||||
fishing_setting.contest = {["contest"] = false, ["duration"] = 3600, ["bobber_nb"] = 4}
|
|
||||||
if file then
|
|
||||||
settings = minetest.deserialize(file:read("*all"))
|
|
||||||
file:close()
|
|
||||||
if settings ~= nil and type(settings) == "table" then
|
|
||||||
if settings["contest"] ~= nil then
|
|
||||||
fishing_setting.contest["contest"] = settings["contest"]
|
|
||||||
end
|
|
||||||
if settings["duration"] ~= nil then
|
|
||||||
fishing_setting.contest["duration"] = settings["duration"]
|
|
||||||
end
|
|
||||||
if settings["bobber_nb"] ~= nil then
|
|
||||||
fishing_setting.contest["bobber_nb"] = settings["bobber_nb"]
|
|
||||||
end
|
|
||||||
if settings["fish_raw"] ~= nil then
|
|
||||||
fishing_setting.contest["fish_raw"] = settings["fish_raw"]
|
|
||||||
end
|
|
||||||
if settings["clownfish_raw"] ~= nil then
|
|
||||||
fishing_setting.contest["clownfish_raw"] = settings["clownfish_raw"]
|
|
||||||
end
|
|
||||||
if settings["bluewhite_raw"] ~= nil then
|
|
||||||
fishing_setting.contest["bluewhite_raw"] = settings["bluewhite_raw"]
|
|
||||||
end
|
|
||||||
if settings["shark_raw"] ~= nil then
|
|
||||||
fishing_setting.contest["shark_raw"] = settings["shark_raw"]
|
|
||||||
end
|
|
||||||
if settings["pike_raw"] ~= nil then
|
|
||||||
fishing_setting.contest["pike_raw"] = settings["pike_raw"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function fishing_setting.func.end_contest()
|
|
||||||
fishing_setting.contest["contest"] = false
|
|
||||||
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)
|
|
||||||
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),
|
|
||||||
["bobber_nb"] = (fishing_setting.contest["bobber_nb"] or 2),
|
|
||||||
["reset"] = false
|
|
||||||
}
|
|
||||||
end
|
|
||||||
local formspec = "size[6.1,7]label[1.9,0;"..S("Fishing contest").."]"..
|
|
||||||
--Time contest
|
|
||||||
"label[2.2,0.5;"..S("Duration(in sec)").."]"..
|
|
||||||
"button[0.8,1;1,1;duration;-60]"..
|
|
||||||
"button[1.8,1;1,1;duration;-600]"..
|
|
||||||
"label[2.7,1.2;"..tostring(fishing_setting.tmp_setting["duration"]).."]"..
|
|
||||||
"button[3.5,1;1,1;duration;+600]"..
|
|
||||||
"button[4.5,1;1,1;duration;+60]"..
|
|
||||||
--bobber nb
|
|
||||||
"label[2,2;"..S("Bobber number limit").."]"..
|
|
||||||
"button[1.8,2.5;1,1;bobbernb;-1]"..
|
|
||||||
"label[2.9,2.7;"..tostring(fishing_setting.tmp_setting["bobber_nb"]).."]"..
|
|
||||||
"button[3.5,2.5;1,1;bobbernb;+1]"..
|
|
||||||
--contest enable
|
|
||||||
"label[0.8,3.8;"..S("Enable contests").."]"..
|
|
||||||
"button[4.5,3.6;1,1;contest;"..tostring(fishing_setting.tmp_setting["contest"]).."]"..
|
|
||||||
--reset
|
|
||||||
"label[0.8,5.2;"..S("Reset rankings").."]"..
|
|
||||||
"button[4.5,5;1,1;reset;"..tostring(fishing_setting.tmp_setting["reset"]).."]"..
|
|
||||||
"button_exit[0.8,6.2;1.5,1;abort;"..S("Abort").."]"..
|
|
||||||
"button_exit[4,6.2;1.5,1;save;"..S("OK").."]"
|
|
||||||
minetest.show_formspec(player_name, "fishing:contest", formspec)
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
||||||
if formname == "fishing:contest" then
|
|
||||||
local name = player:get_player_name()
|
|
||||||
if not name then return end
|
|
||||||
if fields["save"] then
|
|
||||||
if fishing_setting.tmp_setting["reset"] == true then
|
|
||||||
fishing_setting.contest["fish_raw"] = {}
|
|
||||||
fishing_setting.contest["clownfish_raw"] = {}
|
|
||||||
fishing_setting.contest["bluewhite_raw"] = {}
|
|
||||||
fishing_setting.contest["shark_raw"] = {}
|
|
||||||
fishing_setting.contest["pike_raw"] = {}
|
|
||||||
end
|
|
||||||
|
|
||||||
local progress = (fishing_setting.contest["contest"] or false)
|
|
||||||
fishing_setting.contest["duration"] = fishing_setting.tmp_setting["duration"]
|
|
||||||
fishing_setting.contest["contest"] = fishing_setting.tmp_setting["contest"]
|
|
||||||
fishing_setting.contest["bobber_nb"] = fishing_setting.tmp_setting["bobber_nb"]
|
|
||||||
if progress == false and fishing_setting.tmp_setting["contest"] == true then
|
|
||||||
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(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()
|
|
||||||
end
|
|
||||||
fishing_setting.func.save_contest()
|
|
||||||
fishing_setting.tmp_setting = nil
|
|
||||||
return
|
|
||||||
elseif fields["quit"] or fields["abort"] then
|
|
||||||
fishing_setting.tmp_setting = nil
|
|
||||||
return
|
|
||||||
elseif fields["duration"] then
|
|
||||||
fishing_setting.tmp_setting["duration"] = inc(fishing_setting.tmp_setting["duration"], fields["duration"], 120, 14400)
|
|
||||||
elseif fields["contest"] then
|
|
||||||
fishing_setting.tmp_setting["contest"] = bool(fields["contest"])
|
|
||||||
elseif fields["bobbernb"] then
|
|
||||||
fishing_setting.tmp_setting["bobber_nb"] = inc(fishing_setting.tmp_setting["bobber_nb"], fields["bobbernb"], 1, 8)
|
|
||||||
elseif fields["reset"] then
|
|
||||||
fishing_setting.tmp_setting["reset"] = bool(fields["reset"])
|
|
||||||
else
|
|
||||||
return
|
|
||||||
end
|
|
||||||
fishing_setting.func.on_show_settings_contest(name)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
function spairs(t, order)
|
|
||||||
-- collect the keys
|
|
||||||
local keys = {}
|
|
||||||
for k in pairs(t) do keys[#keys+1] = k end
|
|
||||||
-- if order function given, sort by it by passing the table and keys a, b,
|
|
||||||
-- otherwise just sort the keys
|
|
||||||
if order then
|
|
||||||
table.sort(keys, function(a,b) return order(t, a, b) end)
|
|
||||||
else
|
|
||||||
table.sort(keys)
|
|
||||||
end
|
|
||||||
-- return the iterator function
|
|
||||||
local i = 0
|
|
||||||
return function()
|
|
||||||
i = i + 1
|
|
||||||
if keys[i] then
|
|
||||||
return keys[i], t[keys[i]]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function fishing_setting.func.set_winners(list)
|
|
||||||
local win = {}
|
|
||||||
local i = 1
|
|
||||||
-- this uses an custom sorting function ordering by score descending
|
|
||||||
for k,v in spairs(list, function(t,a,b) return t[b] < t[a] end) do
|
|
||||||
table.insert(win, {[k]=v})
|
|
||||||
if #win >= 6 then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return win
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
function fishing_setting.func.get_stat()
|
|
||||||
local winners= {}
|
|
||||||
for k,v in pairs(fishing_setting.contest) do
|
|
||||||
if string.find(k, "_raw") ~= nil then
|
|
||||||
if fishing_setting.contest[k] ~= nil then
|
|
||||||
winners[k] = fishing_setting.func.set_winners(fishing_setting.contest[k])
|
|
||||||
else
|
|
||||||
winners[k] = {}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
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
|
|
||||||
Y = 1.1
|
|
||||||
table.insert(formspec, "label["..(X+0.4)..",0.5;"..string.gsub(fish, "_raw", ""):upper().."]") --fish name
|
|
||||||
for _,s in ipairs(fishers) do
|
|
||||||
for pl,nb in pairs(s) do
|
|
||||||
table.insert(formspec, "label["..(X) ..","..Y..";"..tostring(nb).."]") -- nb fish caught
|
|
||||||
table.insert(formspec, "label["..(X+0.5) ..","..Y..";"..tostring(pl).."]") -- playername
|
|
||||||
end
|
|
||||||
Y = Y + 0.4
|
|
||||||
end
|
|
||||||
X = X + 2.3
|
|
||||||
end
|
|
||||||
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 = "",
|
|
||||||
description = "Show fishing menu (admin only)",
|
|
||||||
privs = {server=true},
|
|
||||||
func = function(player_name, param)
|
|
||||||
if not player_name then return end
|
|
||||||
fishing_setting.func.on_show_admin_menu(player_name)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_chatcommand("fishing_classement", {
|
|
||||||
params = "display classement",
|
|
||||||
description = "",
|
|
||||||
privs = {interact=true},
|
|
||||||
func = function(player_name, param)
|
|
||||||
if not player_name then return end
|
|
||||||
local formspec = fishing_setting.func.get_stat()
|
|
||||||
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
function fishing_setting.func.show_result()
|
|
||||||
minetest.after(3, function()
|
|
||||||
local formspec = fishing_setting.func.get_stat()
|
|
||||||
for _,player in pairs(minetest.get_connected_players()) do
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if player_name ~= nil then
|
|
||||||
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
@ -1,95 +0,0 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
local title = "Fishing - Crabman77's version"
|
|
||||||
local version = "0.0.2"
|
|
||||||
local mname = "fishing"
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
|
|
||||||
-- rewrited by Mossmanikin (https://forum.minetest.net/viewtopic.php?id=6480)
|
|
||||||
-- this version rewrited by Crabman77
|
|
||||||
-- License (code & textures): WTFPL
|
|
||||||
-- Contains code from: animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
|
|
||||||
-- Looked at code from: default, farming
|
|
||||||
-- Dependencies: default
|
|
||||||
-- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
minetest.log("action","[mod fishing] Loading...")
|
|
||||||
local path = minetest.get_modpath("fishing").."/"
|
|
||||||
|
|
||||||
fishing_setting = {}
|
|
||||||
fishing_setting.func = {}
|
|
||||||
fishing_setting.is_creative_mode = minetest.setting_getbool("creative_mode")
|
|
||||||
fishing_setting.file_settings = minetest.get_worldpath() .. "/fishing_config.txt"
|
|
||||||
fishing_setting.file_trophies = minetest.get_worldpath() .. "/fishing_trophies.txt"
|
|
||||||
fishing_setting.file_contest = minetest.get_worldpath() .. "/fishing_contest.txt"
|
|
||||||
fishing_setting.settings = {}
|
|
||||||
fishing_setting.contest = {}
|
|
||||||
--for random object
|
|
||||||
random_objects = {}
|
|
||||||
fishing_setting.baits = {}
|
|
||||||
fishing_setting.hungry = {}
|
|
||||||
fishing_setting.prizes = {}
|
|
||||||
fishing_setting.trophies = {}
|
|
||||||
|
|
||||||
if (minetest.get_modpath("intllib")) then
|
|
||||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
|
||||||
fishing_setting.func.S = intllib.Getter(minetest.get_current_modname())
|
|
||||||
else
|
|
||||||
fishing_setting.func.S = function ( s ) return s end
|
|
||||||
end
|
|
||||||
|
|
||||||
dofile(path .."settings.txt")
|
|
||||||
dofile(path .."functions.lua")
|
|
||||||
|
|
||||||
--default_settings
|
|
||||||
fishing_setting.settings["message"] = MESSAGES
|
|
||||||
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
|
|
||||||
fishing_setting.settings["simple_deco_fishing_pole"] = SIMPLE_DECO_FISHING_POLE
|
|
||||||
fishing_setting.settings["bobber_view_range"] = BOBBER_VIEW_RANGE
|
|
||||||
fishing_setting.settings["fish_chance"] = FISH_CHANCE
|
|
||||||
fishing_setting.settings["shark_chance"] = SHARK_CHANCE
|
|
||||||
fishing_setting.settings["treasure_chance"] = TREASURE_CHANCE
|
|
||||||
fishing_setting.settings["treasure_enable"] = TREASURE_RANDOM_ENABLE
|
|
||||||
fishing_setting.settings["escape_chance"] = ESCAPE_CHANCE
|
|
||||||
|
|
||||||
-- load config file if exist in worldpath
|
|
||||||
fishing_setting.func.load()
|
|
||||||
|
|
||||||
dofile(path .."worms.lua")
|
|
||||||
dofile(path .."crafting.lua")
|
|
||||||
dofile(path .."baits.lua")
|
|
||||||
dofile(path .."prizes.lua")
|
|
||||||
dofile(path .."baitball.lua")
|
|
||||||
dofile(path .."bobber.lua")
|
|
||||||
dofile(path .."bobber_shark.lua")
|
|
||||||
dofile(path .."fishes.lua")
|
|
||||||
dofile(path .."trophies.lua")
|
|
||||||
dofile(path .."poles.lua")
|
|
||||||
|
|
||||||
--random hungry bait
|
|
||||||
fishing_setting.func.hungry_random()
|
|
||||||
--load table caught fish by players
|
|
||||||
fishing_setting.func.load_trophies()
|
|
||||||
--load table contest
|
|
||||||
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
|
|
||||||
end
|
|
||||||
if fishing_setting.contest["duration"] < 0 then
|
|
||||||
fishing_setting.func.end_contest()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
@ -1,87 +0,0 @@
|
|||||||
# Translation original by Xanthin
|
|
||||||
# adapted for new fishing version by crabman77
|
|
||||||
|
|
||||||
### bobber.lua ###
|
|
||||||
You didn't catch anything. = Du hast nichts gefangen.
|
|
||||||
The bait is still there. =
|
|
||||||
Your fish escaped. = Dein Fisch ist entkommen.
|
|
||||||
You caught a Fish. = Du hast einen Fisch gefangen.
|
|
||||||
You caught a Clownfish. = Du hast einen Clownfisch gefangen.
|
|
||||||
You caught a Bluewhite. = Du hast einen blau-weissen Fisch gefangen.
|
|
||||||
You caught a Twig. = Du hast einen Zweig gefangen.
|
|
||||||
You caught a Rat. = Du hast eine Ratte gefangen.
|
|
||||||
You caught some Seaweed. = Du hast etwas Seetang gefangen.
|
|
||||||
You caught a Green Kelp. = Du hast etwas gruenen Kelp gefangen.
|
|
||||||
You caught a String. = Du hast eine Schnur gefangen.
|
|
||||||
|
|
||||||
### bobber_shark.lua ###
|
|
||||||
You caught a small Shark. = Du hast einen kleinen Hai gefangen.
|
|
||||||
You caught a Northern Pike. = Du hast einen Hecht gefangen.
|
|
||||||
You caught an old Fishing Pole. = Du hast eine alte Angelrute gefangen.
|
|
||||||
You caught some very old Boots. = Du hast ein Paar sehr alte Schuhe gefangen.
|
|
||||||
You caught a Gold Coin. =
|
|
||||||
You caught a very old Helmet. =
|
|
||||||
You caught a very old Shield. =
|
|
||||||
You caught a very old Sword. =
|
|
||||||
You caught a mese block. =
|
|
||||||
You caught a Nyan Cat. =
|
|
||||||
You caught a Diamond Block. =
|
|
||||||
Haha, Fishing is prohibited outside water! =
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### crafting.lua ###
|
|
||||||
Bait Ball =
|
|
||||||
Shark Bait Ball =
|
|
||||||
|
|
||||||
|
|
||||||
### fishes.lua ###
|
|
||||||
Fish = Fisch
|
|
||||||
Roasted Fish = Gebratener Fisch
|
|
||||||
Sushi (Hoso Maki) = Sushi (Hoso Maki)
|
|
||||||
Clownfish = Clownfisch
|
|
||||||
Bluewhite = blau-weisse Fisch
|
|
||||||
Shark = Hai
|
|
||||||
Roasted Shark = Gebratener Hai
|
|
||||||
Northern Pike = Hecht
|
|
||||||
Roasted Northern Pike = Gebratener Hecht
|
|
||||||
|
|
||||||
|
|
||||||
### functions.lua ###
|
|
||||||
You don't have the server priviledge! =
|
|
||||||
You win a new trophy, you have caught %s fish. =
|
|
||||||
You win a new trophy, you have caught %s shark. =
|
|
||||||
You win a new trophy, you have caught %s pike. =
|
|
||||||
You win a new trophy, you have caught %s clownfish. =
|
|
||||||
You win a new trophy, you have caught %s bluewhite. =
|
|
||||||
|
|
||||||
|
|
||||||
### material.lua ###
|
|
||||||
Show information about hunger fish =
|
|
||||||
|
|
||||||
|
|
||||||
### poles.lua ###
|
|
||||||
Fishing Pole = Angelrute
|
|
||||||
Perfect Fishing Pole =
|
|
||||||
|
|
||||||
|
|
||||||
### trophies.lua ###
|
|
||||||
Fish Trophy = Fisch-Trophaee
|
|
||||||
Northern Pike Trophy = Hecht-Trophaee
|
|
||||||
Shark Trophy = Hai-Trophaee
|
|
||||||
Clownfish Trophy = Clownfisch-Trophaee
|
|
||||||
Bluewhite Trophy = Blau-weisser-Fisch-Trophaee
|
|
||||||
This Huge Fish was caught by the Famous Angler %s ! = Dieser riesige Fisch wurde vom beruehmten Angler %s gefangen!
|
|
||||||
This Huge Northern Pike was caught by the Famous Angler %s ! = Dieser riesige Hecht wurde vom beruehmten Angler %s gefangen!
|
|
||||||
This Huge Shark was caught by the Famous Angler %s ! = Dieser riesige Hai wurde vom beruehmten Angler %s gefangen!
|
|
||||||
This Huge Clownfish was caught by the Famous Angler %s ! = Dieser riesige Clownfisch wurde vom beruehmten Angler %s gefangen!
|
|
||||||
This Huge Bluewhite was caught by the Famous Angler %s ! = Dieser riesige blau-weisse Fisch wurde vom beruehmten Angler %s gefangen!
|
|
||||||
|
|
||||||
### worms.lua ###
|
|
||||||
Worm = Wurm
|
|
||||||
Dirt = Erde
|
|
||||||
Wooden Hoe = Holzhacke
|
|
||||||
Stone Hoe = Steinhacke
|
|
||||||
Steel Hoe = Stahlhacke
|
|
||||||
Bronze Hoe = Bronzehacke
|
|
@ -1,101 +0,0 @@
|
|||||||
|
|
||||||
# Template
|
|
||||||
Bait Corn = Appats au Mais
|
|
||||||
Bait Bread = Appats au Pain
|
|
||||||
|
|
||||||
### bobber.lua ###
|
|
||||||
You didn't catch anything. = Vous n'avez rien attrape.
|
|
||||||
The bait is still there. = L'appat est toujours la.
|
|
||||||
Your fish escaped. = Le poisson s'est decroche.
|
|
||||||
You caught a Fish. = Vous avez attrape un poisson.
|
|
||||||
You caught a Clownfish. = Vous avez attrape un poisson clown.
|
|
||||||
You caught a Bluewhite. = Vous avez attrape un poisson bleu.
|
|
||||||
You caught a Twig. = Vous avez attrape une brindille .
|
|
||||||
You caught a Rat. = Vous avez attrape un rat.
|
|
||||||
You caught some Seaweed. = Vous avez attrape des algues.
|
|
||||||
You caught a Green Kelp. = Vous avez attrape une algue verte.
|
|
||||||
You caught a String. = Vous avez attrape une ficelle.
|
|
||||||
|
|
||||||
### bobber_shark.lua ###
|
|
||||||
You caught a small Shark. = Vous avez attrape un requin
|
|
||||||
You caught a Northern Pike. = Vous avez attrape un brochet.
|
|
||||||
You caught an old Fishing Pole. = Vous avez attrape une vielle canne a peche.
|
|
||||||
You caught some very old Boots. = Vous avez attrape de tres vieilles bottes.
|
|
||||||
You caught a Gold Coin. = Vous avez attrape une pice en or.
|
|
||||||
You caught a very old Helmet. = Vous avez attrape un casque tres vieux.
|
|
||||||
You caught a very old Shield. = Vous avez attrape un bouclier tres vieux.
|
|
||||||
You caught a very old Sword. = Vous avez attrape une epee tres ancienne.
|
|
||||||
You caught a mese block. = Vous avez attrape un bloc de mese.
|
|
||||||
You caught a Nyan Cat. = Vous avez attrape un Nyan Cat.
|
|
||||||
You caught a Diamond Block. = Vous avez attrape block de diamant.
|
|
||||||
Haha, Fishing is prohibited outside water! = Haha, pecher est interdit en dehors de l'eau!
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### crafting.lua ###
|
|
||||||
Bait Ball = Amorce
|
|
||||||
Shark Bait Ball = Amorce a carnassier
|
|
||||||
|
|
||||||
|
|
||||||
### fishes.lua ###
|
|
||||||
Fish = Poisson
|
|
||||||
Roasted Fish = Poisson grille
|
|
||||||
Sushi (Hoso Maki) = Sushi (Hoso Maki)
|
|
||||||
Clownfish = Poisson clown
|
|
||||||
Bluewhite = Poisson bleu
|
|
||||||
Shark = Requin
|
|
||||||
Roasted Shark = Requin grille
|
|
||||||
Northern Pike = Brochet
|
|
||||||
Roasted Northern Pike = Brochet grille
|
|
||||||
|
|
||||||
|
|
||||||
### functions.lua ###
|
|
||||||
You don't have the server priviledge! = Vous n'avez pas les privilèges serveur!
|
|
||||||
You win a new trophy, you have caught %s fish. = Vous gagnez un trophee, vous avez attrape %s poissons.
|
|
||||||
You win a new trophy, you have caught %s shark. = Vous gagnez un trophee, vous avez attrape %s requins.
|
|
||||||
You win a new trophy, you have caught %s pike. = Vous gagnez un trophee, vous avez attrape %s brochets.
|
|
||||||
You win a new trophy, you have caught %s clownfish. = Vous gagnez un trophee, vous avez attrape %s poissons clown.
|
|
||||||
You win a new trophy, you have caught %s bluewhite. = Vous gagnez un trophee, vous avez attrape %s poissons bleu.
|
|
||||||
Good luck to %s, He catch the treasure, %s! = %s a de la chance, Il attrappe le tresor, %s!
|
|
||||||
You catch the treasure, %s! = Vous attrappez le tresor, %s!
|
|
||||||
Yeah, %s caught a Fish. = Wouah, %s a attrappe un poisson
|
|
||||||
Yeah, %s caught a Clownfish. = Wouah, %s a attrappe un poisson clown.
|
|
||||||
Yeah, %s caught a Bluewhite. = Wouah, %s a attrappe un poisson bleu.
|
|
||||||
Yeah, %s caught a Northern Pike. = Wouah, %s a attrappe un brochet.
|
|
||||||
Yeah, %s caught a small Shark. = Wouah, %s a attrappe un requin.
|
|
||||||
A fishing contest is in progress. (remaining time %s) = Un concours de peche est en cours. (temps restant %s)
|
|
||||||
Attention, Fishing contest start(duration %s)!!! = Attention, un concours de peche viens de commence(duree %s)!!!
|
|
||||||
WARNING, Fishing contest will finish in 30 seconds. = Attention, le concours de peche se termine dans 30 secondes
|
|
||||||
End of fishing contest. = Le concours est fini
|
|
||||||
|
|
||||||
### material.lua ###
|
|
||||||
View information about hunger fish = Afficher les informations sur la faim des poissons
|
|
||||||
|
|
||||||
|
|
||||||
### poles.lua ###
|
|
||||||
Fishing Pole = Canne a peche
|
|
||||||
Perfect Fishing Pole = Canne a peche parfaite
|
|
||||||
You don't fishing in a bottle! = Vous ne pouvez pas pecher dans une bouteille!
|
|
||||||
You don't have mores %s bobbers! = Vous ne pouvez pas avoir plus de %s flotteurs
|
|
||||||
|
|
||||||
### trophies.lua ###
|
|
||||||
Fish Trophy = Trophee poisson
|
|
||||||
Northern Pike Trophy = Trophee brochet
|
|
||||||
Shark Trophy = Trophee requin
|
|
||||||
Clownfish Trophy = Trophee poisson clown
|
|
||||||
Bluewhite Trophy = Trophee poisson bleu
|
|
||||||
This Huge Fish was caught by the Famous Angler %s ! =
|
|
||||||
This Huge Northern Pike was caught by the Famous Angler %s ! =
|
|
||||||
This Huge Shark was caught by the Famous Angler %s ! =
|
|
||||||
This Huge Clownfish was caught by the Famous Angler %s ! =
|
|
||||||
This Huge Bluewhite was caught by the Famous Angler %s ! =
|
|
||||||
|
|
||||||
### worms.lua ###
|
|
||||||
Worm = ver
|
|
||||||
Dirt = terre
|
|
||||||
Wooden Hoe = Hoe en bois
|
|
||||||
Stone Hoe = Hoe en pierre
|
|
||||||
Steel Hoe = Hoe en fer
|
|
||||||
Bronze Hoe = Hoe en bronze
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
|||||||
# Template
|
|
||||||
### baits.lua ###
|
|
||||||
Bait Corn =
|
|
||||||
Bait Bread =
|
|
||||||
|
|
||||||
|
|
||||||
### bobber.lua ###
|
|
||||||
You didn't catch anything. =
|
|
||||||
The bait is still there. =
|
|
||||||
Your fish escaped. =
|
|
||||||
You caught a Fish. =
|
|
||||||
You caught a Clownfish. =
|
|
||||||
You caught a Bluefish. =
|
|
||||||
You caught a Twig. =
|
|
||||||
You caught a Rat. =
|
|
||||||
You caught some Seaweed. =
|
|
||||||
You caught a Green Kelp. =
|
|
||||||
You caught a String. =
|
|
||||||
|
|
||||||
### bobber_shark.lua ###
|
|
||||||
You caught a small Shark. =
|
|
||||||
You caught a Northern Pike. =
|
|
||||||
You caught an old Fishing Pole. =
|
|
||||||
You caught some very old Boots. =
|
|
||||||
You caught a Gold Coin. =
|
|
||||||
You caught a very old Helmet. =
|
|
||||||
You caught a very old Shield. =
|
|
||||||
You caught a very old Sword. =
|
|
||||||
You caught a mese block. =
|
|
||||||
You caught a Nyan Cat. =
|
|
||||||
You caught a Diamond Block. =
|
|
||||||
Haha, Fishing is prohibited outside water! =
|
|
||||||
|
|
||||||
|
|
||||||
### crafting.lua ###
|
|
||||||
Bait Ball =
|
|
||||||
Shark Bait Ball =
|
|
||||||
|
|
||||||
|
|
||||||
### fishes.lua ###
|
|
||||||
Fish =
|
|
||||||
Roasted Fish =
|
|
||||||
Sushi (Hoso Maki) =
|
|
||||||
Clownfish =
|
|
||||||
Bluefish =
|
|
||||||
Shark =
|
|
||||||
Roasted Shark =
|
|
||||||
Northern Pike =
|
|
||||||
Roasted Northern Pike =
|
|
||||||
|
|
||||||
|
|
||||||
### functions.lua ###
|
|
||||||
You don't have the server priviledge! =
|
|
||||||
You win a new trophy, you have caught %s fish. =
|
|
||||||
You win a new trophy, you have caught %s shark. =
|
|
||||||
You win a new trophy, you have caught %s pike. =
|
|
||||||
You win a new trophy, you have caught %s clownfish. =
|
|
||||||
You win a new trophy, you have caught %s bluewhite. =
|
|
||||||
Lucky %s, he caught the treasure, %s! =
|
|
||||||
You caught the treasure, %s!=
|
|
||||||
Yeah, %s caught a Fish. =
|
|
||||||
Yeah, %s caught a Clownfish. =
|
|
||||||
Yeah, %s caught a Bluefish. =
|
|
||||||
Yeah, %s caught a Northern Pike. =
|
|
||||||
Yeah, %s caught a small Shark. =
|
|
||||||
A fishing contest is in progress. (remaining time %s) =
|
|
||||||
Attention, Fishing contest start(duration %s)!!! =
|
|
||||||
WARNING, Fishing contest will finish in 30 seconds. =
|
|
||||||
End of fishing contest. =
|
|
||||||
Fishing configuration =
|
|
||||||
Fish chance =
|
|
||||||
Shark chance =
|
|
||||||
Treasure chance =
|
|
||||||
Worm chance =
|
|
||||||
Escape chance =
|
|
||||||
Bobber view range =
|
|
||||||
Display messages in chat =
|
|
||||||
Simple pole deco =
|
|
||||||
Poles wearout =
|
|
||||||
Enable treasure =
|
|
||||||
New worm source (reboot) =
|
|
||||||
Worm is a mob (reboot) =
|
|
||||||
Abort =
|
|
||||||
OK =
|
|
||||||
Fishing Menu =
|
|
||||||
Contest rankings =
|
|
||||||
Contests =
|
|
||||||
Configuration =
|
|
||||||
Close =
|
|
||||||
|
|
||||||
Fishing contest =
|
|
||||||
Duration(in sec) =
|
|
||||||
Bobber number limit =
|
|
||||||
Enable contests =
|
|
||||||
Reset rankings (type 'yes') =
|
|
||||||
Fishing contest rankings =
|
|
||||||
|
|
||||||
### material.lua ###
|
|
||||||
Show information about hunger fish =
|
|
||||||
|
|
||||||
|
|
||||||
### poles.lua ###
|
|
||||||
Fishing Pole =
|
|
||||||
Perfect Fishing Pole =
|
|
||||||
You don't fishing in a bottle! =
|
|
||||||
You don't have mores %s bobbers! =
|
|
||||||
|
|
||||||
### trophies.lua ###
|
|
||||||
Fish Trophy =
|
|
||||||
Northern Pike Trophy =
|
|
||||||
Shark Trophy =
|
|
||||||
Clownfish Trophy =
|
|
||||||
Bluefish Trophy =
|
|
||||||
This Huge Fish was caught by the Famous Angler %s ! =
|
|
||||||
This Huge Northern Pike was caught by the Famous Angler %s ! =
|
|
||||||
This Huge Shark was caught by the Famous Angler %s ! =
|
|
||||||
This Huge Clownfish was caught by the Famous Angler %s ! =
|
|
||||||
This Huge Bluefish was caught by the Famous Angler %s ! =
|
|
||||||
|
|
||||||
### worms.lua ###
|
|
||||||
Worm =
|
|
||||||
Dirt =
|
|
||||||
Wooden Hoe =
|
|
||||||
Stone Hoe =
|
|
||||||
Steel Hoe =
|
|
||||||
Bronze Hoe =
|
|
||||||
|
|
@ -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' },
|
|
||||||
})
|
|
@ -1,164 +0,0 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- 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"] = 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"]
|
|
||||||
minetest.register_tool("fishing:pole_".. pole.name, {
|
|
||||||
description = pole.desc,
|
|
||||||
groups = {},
|
|
||||||
inventory_image = "fishing_pole_".. pole.name ..".png",
|
|
||||||
wield_image = "fishing_pole_".. pole.name ..".png",
|
|
||||||
stack_max = 1,
|
|
||||||
liquids_pointable = true,
|
|
||||||
|
|
||||||
on_use = function (itemstack, user, pointed_thing)
|
|
||||||
if pointed_thing and pointed_thing.under then
|
|
||||||
local pt = pointed_thing
|
|
||||||
local node = minetest.get_node(pt.under)
|
|
||||||
if not node or string.find(node.name, "water_source") == nil then return nil end
|
|
||||||
local player_name = user:get_player_name()
|
|
||||||
local inv = user:get_inventory()
|
|
||||||
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
|
|
||||||
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
|
|
||||||
bobber_nb = bobber_nb + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if bobber_nb >= bobber_max then
|
|
||||||
if fishing_setting.settings["message"] == true then
|
|
||||||
minetest.chat_send_player(player_name, S("You don't have mores %s bobbers!"):format(bobber_max))
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
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, S("You don't fishing in a bottle!")) end
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
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()
|
|
||||||
luaentity.owner = player_name
|
|
||||||
luaentity.bait = bait
|
|
||||||
luaentity.old_pos = new_pos
|
|
||||||
luaentity.old_pos2 = true
|
|
||||||
if not fishing_setting.is_creative_mode then
|
|
||||||
inv:remove_item("main", bait)
|
|
||||||
end
|
|
||||||
minetest.sound_play("fishing_bobber2", {pos = new_pos, gain = 0.5})
|
|
||||||
if fishing_setting.settings["wear_out"] == true and not fishing_setting.is_creative_mode then
|
|
||||||
return rod_wear(itemstack, user, pointed_thing, pole.max_use)
|
|
||||||
else
|
|
||||||
return {name="fishing:pole_".. pole.name, count=1, wear=0, metadata=""}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nil
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
|
||||||
if fishing_setting.settings["simple_deco_fishing_pole"] == false then return end
|
|
||||||
local pt = pointed_thing
|
|
||||||
local pt_under_name = minetest.get_node(pt.under).name
|
|
||||||
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 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()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("fishing:pole_".. pole.name .."_deco", {
|
|
||||||
description = pole.desc,
|
|
||||||
inventory_image = "fishing_pole_".. pole.name ..".png",
|
|
||||||
wield_image = "fishing_pole.png^[transformFXR270",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
tiles = {
|
|
||||||
"fishing_pole_".. pole.name .."_simple.png",
|
|
||||||
"fishing_pole_".. pole.name .."_simple.png",
|
|
||||||
"fishing_pole_".. pole.name .."_simple.png",
|
|
||||||
"fishing_pole_".. pole.name .."_simple.png^[transformFX",
|
|
||||||
},
|
|
||||||
groups = { snappy=3, flammable=2, not_in_creative_inventory=1 },
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ 0 , -1/2 , 0 , 0 , 1/2 , 1 },
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{-1/16 , -1/2 , 0 , 1/16 , 1/2 , 1 },
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
on_dig = function(pos, node, digger)
|
|
||||||
if digger:is_player() and digger:get_inventory() then
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local wear_out = meta:get_int("wear")
|
|
||||||
digger:get_inventory():add_item("main", {name="fishing:pole_".. pole.name, count=1, wear=wear_out, metadata=""})
|
|
||||||
end
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
end
|
|
@ -1,46 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
fishing_setting.prizes["fish"] = {
|
|
||||||
{"fishing", "fish_raw", 0, "a Fish."},
|
|
||||||
{"fishing", "clownfish_raw", 0, "a Clownfish."},
|
|
||||||
{"fishing", "bluewhite_raw", 0, "a Bluewhite."}
|
|
||||||
}
|
|
||||||
|
|
||||||
fishing_setting.prizes["shark"] = {
|
|
||||||
{"fishing", "shark_raw", 0, "a small Shark."},
|
|
||||||
{"fishing", "pike_raw", 0, "a Northern Pike."}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
fishing_setting.prizes["stuff"] = fishing_setting.func.ignore_mod(stuff)
|
|
||||||
|
|
||||||
|
|
||||||
local treasure = {
|
|
||||||
{"default", "mese", 0, "a mese block."},
|
|
||||||
{"default", "nyancat", 0, "a Nyan Cat."},
|
|
||||||
{"default", "diamondblock", 0, "a Diamond Block."},
|
|
||||||
}
|
|
||||||
fishing_setting.prizes["treasure"] = fishing_setting.func.ignore_mod(treasure)
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
|||||||
MESSAGES = true
|
|
||||||
SIMPLE_DECO_FISHING_POLE = true
|
|
||||||
WEAR_OUT = true
|
|
||||||
BOBBER_VIEW_RANGE = 7
|
|
||||||
NEW_WORM_SOURCE = true
|
|
||||||
WORM_IS_MOB = true
|
|
||||||
WORM_CHANCE = 66
|
|
||||||
FISH_CHANCE = 60
|
|
||||||
SHARK_CHANCE = 50
|
|
||||||
TREASURE_CHANCE = 5
|
|
||||||
TREASURE_RANDOM_ENABLE = true
|
|
||||||
ESCAPE_CHANCE = 5
|
|
@ -1,11 +0,0 @@
|
|||||||
These sounds are used for the Mod for Minetest; Fishing - Mossmanikin's version.
|
|
||||||
The included sounds are http://creativecommons.org/licenses/by-nc-sa/3.0/
|
|
||||||
|
|
||||||
--"fishing_bobber1" & "fishing_bobber2" sampled from "01260 water swimming splashing 1.wav", Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/
|
|
||||||
|
|
||||||
|
|
||||||
"fishing_contest_start" resampled from "cor 9.mp3", Pierre Grandjean, https://www.freesound.org/people/Pierre%20Grandjean/sounds/125973/
|
|
||||||
|
|
||||||
"fishing_contest_end" resampled from "Trompette 8", jebb, https://www.freesound.org/people/jebb/sounds/205848/
|
|
||||||
|
|
||||||
"fishing_baitball" resampled from "dog steps around in water" , noctaro, https://www.freesound.org/people/noctaro/sounds/243574/
|
|
Before Width: | Height: | Size: 723 B |
Before Width: | Height: | Size: 650 B |
Before Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 693 B |
Before Width: | Height: | Size: 431 B |
Before Width: | Height: | Size: 723 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 421 B |
Before Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 521 B |
Before Width: | Height: | Size: 495 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 629 B |
Before Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 1000 B |
Before Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 344 B |
Before Width: | Height: | Size: 200 B |
Before Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 323 B |
Before Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 312 B |
Before Width: | Height: | Size: 213 B |
Before Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 345 B |
Before Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 563 B |
Before Width: | Height: | Size: 654 B |
Before Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 727 B |
@ -1,84 +0,0 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Fishing - crabman77's version
|
|
||||||
-- Rewrited from original Fishing - Mossmanikin's version - Trophies 0.0.2
|
|
||||||
-- License (code & textures): WTFPL
|
|
||||||
-- Contains code from: default
|
|
||||||
-- Supports: animal_clownfish, animal_fish_blue_white
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
local trophy = {
|
|
||||||
-- mod item name icon
|
|
||||||
{"fishing", "fish_raw", "Fish", "fishing_fish_raw.png"},
|
|
||||||
{"fishing", "pike_raw", "Northern Pike", "fishing_pike_raw.png"},
|
|
||||||
{"fishing", "shark_raw", "Shark", "fishing_shark_raw.png"},
|
|
||||||
{"fishing", "clownfish_raw", "Clownfish", "fishing_clownfish_raw.png"},
|
|
||||||
{"fishing", "bluewhite_raw", "Bluewhite", "fishing_bluewhite_raw.png"},
|
|
||||||
}
|
|
||||||
|
|
||||||
local function has_trophy_privilege(meta, player)
|
|
||||||
if player:get_player_name() ~= meta:get_string("owner") then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
for i in pairs(trophy) do
|
|
||||||
local mod = trophy[i][1]
|
|
||||||
local item = trophy[i][2]
|
|
||||||
local name = trophy[i][3]
|
|
||||||
local icon = trophy[i][4]
|
|
||||||
minetest.register_node("fishing:trophy_"..item, {
|
|
||||||
description = fishing_setting.func.S(name.." Trophy"),
|
|
||||||
inventory_image = "fishing_trophy_plank.png^"..icon.."^fishing_trophy_label.png",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
tiles = {
|
|
||||||
"fishing_trophy_plank.png", -- top
|
|
||||||
"fishing_trophy_plank.png", -- bottom
|
|
||||||
"fishing_trophy_plank.png", -- right
|
|
||||||
"fishing_trophy_plank.png", -- left
|
|
||||||
"fishing_trophy_plank.png", -- back
|
|
||||||
"fishing_trophy_plank.png^"..icon.."^fishing_trophy_label.png", -- front
|
|
||||||
},
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
walkable = false,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
-- { left , bottom , front , right , top , back }
|
|
||||||
{ -1/2 , -1/2 , 7/16 , 1/2 , 1/2 , 1/2 },
|
|
||||||
}
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {
|
|
||||||
{ -1/2 , -1/2 , 7/16 , 1/2 , 1/2 , 1/2 },
|
|
||||||
}
|
|
||||||
},
|
|
||||||
groups = {choppy=2,oddly_breakable_by_hand=3,flammable=2},
|
|
||||||
sounds = default.node_sound_wood_defaults(),
|
|
||||||
after_place_node = function(pos, placer)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("owner", placer:get_player_name() or "")
|
|
||||||
meta:set_string("infotext", fishing_setting.func.S("This Huge "..name.." was caught by the Famous Angler %s !"):format((placer:get_player_name() or "")))
|
|
||||||
end,
|
|
||||||
on_construct = function(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_string("infotext", name)
|
|
||||||
meta:set_string("owner", "")
|
|
||||||
end,
|
|
||||||
can_dig = function(pos,player)
|
|
||||||
local meta = minetest.get_meta(pos);
|
|
||||||
return has_trophy_privilege(meta, player)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
--[[
|
|
||||||
minetest.register_craft({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "fishing:trophy_"..item,
|
|
||||||
recipe = {mod..":"..item, "default:sign_wall"},
|
|
||||||
})
|
|
||||||
--]]
|
|
||||||
end
|
|
@ -1,254 +0,0 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- Fishing - crabman77's version
|
|
||||||
-- Rewrited from original Fishing - Mossmanikin's version - Worm 0.0.2
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- License (code & textures): WTFPL
|
|
||||||
-- Contains code from: fishing (original), mobs
|
|
||||||
-- Looked at code from: my_mobs
|
|
||||||
-- Dependencies: default
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- WORM ITEM
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_craftitem("fishing:bait_worm", {
|
|
||||||
description = fishing_setting.func.S("Worm"),
|
|
||||||
groups = { fishing_bait=1 },
|
|
||||||
inventory_image = "fishing_bait_worm.png",
|
|
||||||
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")
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
on_drop = function(itemstack, dropper, pos)
|
|
||||||
minetest.add_entity({x = pos.x, y = pos.y, z = pos.z}, "fishing:bait_worm_entity")
|
|
||||||
itemstack:take_item()
|
|
||||||
return itemstack
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- WORM MOB
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
minetest.register_entity("fishing:bait_worm_entity", {
|
|
||||||
hp_max = 300,
|
|
||||||
damage_over_time = 1,
|
|
||||||
collisionbox = {-3/16, -3/16, -3/16, 3/16, 3/16, 3/16},
|
|
||||||
visual = "sprite",
|
|
||||||
visual_size = {x=1/2, y=1/2},
|
|
||||||
textures = { "fishing_bait_worm.png", "fishing_bait_worm.png"},
|
|
||||||
view_range = 32,
|
|
||||||
-- Don't punch this poor creature...
|
|
||||||
on_punch = function(self, puncher)
|
|
||||||
self.object:remove()
|
|
||||||
end,
|
|
||||||
-- ...softly take it into your hand.
|
|
||||||
on_rightclick = function(self, clicker)
|
|
||||||
if clicker:is_player() and clicker:get_inventory() then
|
|
||||||
clicker:get_inventory():add_item("main", "fishing:bait_worm")
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
-- AI :D
|
|
||||||
on_step = function(self, dtime)
|
|
||||||
local pos = self.object:getpos()
|
|
||||||
-- despawn when no player in range
|
|
||||||
local remove_entity = true
|
|
||||||
for _,player in pairs(minetest.get_connected_players()) do
|
|
||||||
local p = player:getpos()
|
|
||||||
local dist = ((p.x-pos.x)^2 + (p.y-pos.y)^2 + (p.z-pos.z)^2)^0.5
|
|
||||||
if dist < 25 then
|
|
||||||
remove_entity = false
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if remove_entity then
|
|
||||||
self.object:remove()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local n = minetest.get_node({x=pos.x,y=pos.y-0.3,z=pos.z})
|
|
||||||
-- move in world
|
|
||||||
local look_whats_up = function(self)
|
|
||||||
self.object:set_hp(self.object:get_hp()-self.damage_over_time) -- creature is getting older
|
|
||||||
if n.name == "air" then -- fall when in air
|
|
||||||
self.object:moveto({x=pos.x,y=pos.y-0.5,z=pos.z})
|
|
||||||
self.object:set_hp(self.object:get_hp()-75)
|
|
||||||
|
|
||||||
--if n.name == "snappy" then -- fall when leaves or similar
|
|
||||||
elseif minetest.get_item_group(n.name, "snappy") ~= 0 then
|
|
||||||
self.object:moveto({x=pos.x+(0.001*(math.random(-32, 32))),y=pos.y-(0.001*(math.random(0, 64))),z=pos.z+(0.001*(math.random(-32, 32)))})
|
|
||||||
|
|
||||||
elseif string.find(n.name, "default:water") then -- sink when in water
|
|
||||||
self.object:moveto({x=pos.x,y=pos.y-0.25,z=pos.z})
|
|
||||||
self.object:set_hp(self.object:get_hp()-37)
|
|
||||||
|
|
||||||
elseif minetest.get_item_group(n.name, "soil") ~= 0 then
|
|
||||||
if minetest.get_item_group(minetest.get_node({x=pos.x,y=pos.y-0.1,z=pos.z}).name, "soil") == 0 and self.object:get_hp() > 200 then
|
|
||||||
self.object:set_hp(199)
|
|
||||||
elseif self.object:get_hp() > 200 then -- leave dirt to see whats going on
|
|
||||||
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y+0.003,z=pos.z+(0.001*(math.random(-2, 2)))})
|
|
||||||
elseif self.object:get_hp() < 199 then -- no rain here, let's get outa here
|
|
||||||
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y-0.001,z=pos.z+(0.001*(math.random(-2, 2)))})
|
|
||||||
elseif self.object:get_hp() == 0 then
|
|
||||||
self.object:remove()
|
|
||||||
end
|
|
||||||
else -- check if there's dirt anywhere (not finished)
|
|
||||||
local check_group = minetest.get_item_group
|
|
||||||
local goal_01 = check_group(minetest.get_node({x = pos.x + 1, y = pos.y-0.4, z = pos.z }).name, "soil")
|
|
||||||
local goal_02 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z + 1}).name, "soil")
|
|
||||||
local goal_03 = check_group(minetest.get_node({x = pos.x - 1, y = pos.y-0.4, z = pos.z }).name, "soil")
|
|
||||||
local goal_04 = check_group(minetest.get_node({x = pos.x, y = pos.y-0.4, z = pos.z - 1}).name, "soil")
|
|
||||||
|
|
||||||
local goal_1a = check_group(minetest.get_node({x = pos.x + 1, y = pos.y+0.6, z = pos.z }).name, "soil")
|
|
||||||
local goal_2a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z + 1}).name, "soil")
|
|
||||||
local goal_3a = check_group(minetest.get_node({x = pos.x - 1, y = pos.y+0.6, z = pos.z }).name, "soil")
|
|
||||||
local goal_4a = check_group(minetest.get_node({x = pos.x, y = pos.y+0.6, z = pos.z - 1}).name, "soil")
|
|
||||||
-- if there's dirt nearby, go there
|
|
||||||
if goal_01 ~= 0 or goal_1a ~= 0 then
|
|
||||||
self.object:moveto({x=pos.x+0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})
|
|
||||||
elseif goal_02 ~= 0 or goal_2a ~= 0 then
|
|
||||||
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z+0.002})
|
|
||||||
elseif goal_03 ~= 0 or goal_3a ~= 0 then
|
|
||||||
self.object:moveto({x=pos.x-0.002,y=pos.y,z=pos.z+(0.001*(math.random(-2, 2)))})
|
|
||||||
elseif goal_04 ~= 0 or goal_4a ~= 0 then
|
|
||||||
self.object:moveto({x=pos.x+(0.001*(math.random(-2, 2))),y=pos.y,z=pos.z-0.002})
|
|
||||||
else -- I'm lost, no dirt
|
|
||||||
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
look_whats_up(self)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Bait Worm Entity
|
|
||||||
minetest.register_craft({
|
|
||||||
output = "fishing:bait_worm_entity 8",
|
|
||||||
recipe = {
|
|
||||||
{"default:dirt"},
|
|
||||||
{"default:dirt"},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- GETTING WORMS
|
|
||||||
-----------------------------------------------------------------------------------------------
|
|
||||||
-- get worms from digging in dirt:
|
|
||||||
if fishing_setting.settings["new_worm_source"] == false then
|
|
||||||
minetest.register_node(":default:dirt", {
|
|
||||||
description = fishing_setting.func.S("Dirt"),
|
|
||||||
tiles = {"default_dirt.png"},
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = {crumbly=3},
|
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
|
||||||
after_dig_node = function (pos, oldnode, oldmetadata, digger)
|
|
||||||
if math.random(1, 100) <= fishing_setting.settings["worm_chance"] then
|
|
||||||
local tool_in_use = digger:get_wielded_item():get_name()
|
|
||||||
if tool_in_use == "" or tool_in_use == "default:dirt" then
|
|
||||||
if fishing_setting.settings["worm_is_mob"] == true then
|
|
||||||
minetest.add_entity({x = pos.x, y = pos.y+0.4, z = pos.z}, "fishing:bait_worm_entity")
|
|
||||||
else
|
|
||||||
local inv = digger:get_inventory()
|
|
||||||
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
|
||||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
else
|
|
||||||
-- get worms from digging with hoes:
|
|
||||||
-- turns nodes with group soil=1 into soil
|
|
||||||
local function hoe_on_use(itemstack, user, pointed_thing, uses)
|
|
||||||
local pt = pointed_thing
|
|
||||||
-- check if pointing at a node
|
|
||||||
if not pt or pt.type ~= "node" then
|
|
||||||
return
|
|
||||||
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]
|
|
||||||
or not minetest.registered_nodes[above.name] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- check if the node above the pointed thing is air
|
|
||||||
if above.name ~= "air" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- check if pointing at dirt
|
|
||||||
if minetest.get_item_group(under.name, "soil") ~= 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
-- 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,})
|
|
||||||
|
|
||||||
if math.random(1, 100) < fishing_setting.settings["worm_chance"] then
|
|
||||||
if fishing_setting.settings["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")
|
|
||||||
else
|
|
||||||
local inv = user:get_inventory()
|
|
||||||
if inv:room_for_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""}) then
|
|
||||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
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"),
|
|
||||||
inventory_image = "farming_tool_woodhoe.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return hoe_on_use(itemstack, user, pointed_thing, 30)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
minetest.register_tool(":farming:hoe_stone", {
|
|
||||||
description = fishing_setting.func.S("Stone Hoe"),
|
|
||||||
inventory_image = "farming_tool_stonehoe.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return hoe_on_use(itemstack, user, pointed_thing, 90)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
minetest.register_tool(":farming:hoe_steel", {
|
|
||||||
description = fishing_setting.func.S("Steel Hoe"),
|
|
||||||
inventory_image = "farming_tool_steelhoe.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return hoe_on_use(itemstack, user, pointed_thing, 200)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
minetest.register_tool(":farming:hoe_bronze", {
|
|
||||||
description = fishing_setting.func.S("Bronze Hoe"),
|
|
||||||
inventory_image = "farming_tool_bronzehoe.png",
|
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
|
||||||
return hoe_on_use(itemstack, user, pointed_thing, 220)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|