replace old fishing mod by new improved fishing mod
22
mods/fishing/.gitattributes
vendored
@ -1,22 +0,0 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
215
mods/fishing/.gitignore
vendored
@ -1,215 +0,0 @@
|
||||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
#############
|
||||
## Windows detritus
|
||||
#############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
*.py[co]
|
||||
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
eggs/
|
||||
parts/
|
||||
var/
|
||||
sdist/
|
||||
develop-eggs/
|
||||
.installed.cfg
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
36
mods/fishing/README.md
Executable file
@ -0,0 +1,36 @@
|
||||
|
||||
## 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)
|
58
mods/fishing/baitball.lua
Executable file
@ -0,0 +1,58 @@
|
||||
|
||||
-- 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"}
|
||||
})
|
27
mods/fishing/baits.lua
Executable file
@ -0,0 +1,27 @@
|
||||
|
||||
--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,77 +1,12 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Bobber 0.1.7
|
||||
-- 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
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
local PoLeWeaR = (65535/(30-(math.random(15, 29))))
|
||||
local BooTSWear = (2000*(math.random(20, 29)))
|
||||
-- Here's what you can catch
|
||||
local CaTCH = {
|
||||
-- MoD iTeM WeaR MeSSaGe ("You caught "..) GeTBaiTBack NRMiN CHaNCe (../120)
|
||||
{"fishing", "fish_raw", 0, "a Fish.", false, 1, 80}, -- début 1
|
||||
{"animal_clownfish", "clownfish", 0, "a Clownfish.", false, 81, 15}, -- 96
|
||||
{"animal_fish_blue_white", "fish_blue_white", 0, "a Blue white fish.", false, 96, 10}, -- 106
|
||||
{"flowers_plus", "seaweed", 0, "some Seaweed.", true, 106, 2}, -- 108
|
||||
{"farming", "string", 0, "a String.", true, 108, 2}, -- 110
|
||||
{"trunks", "twig_1", 0, "a Twig.", true, 110, 1}, -- 111
|
||||
{"mobs", "rat", 0, "a Rat.", false, 111, 1}, -- 112
|
||||
{"default", "stick", 0, "a Twig.", true, 112, 1}, -- 113
|
||||
{"seaplants", "kelpgreen", 0, "a Green Kelp.", true, 113, 1}, -- 114
|
||||
{"fishing", "pole", PoLeWeaR, "an old Fishing Pole.", true, 114, 1}, -- 115
|
||||
{"3d_armor", "boots_steel", BooTSWear, "some very old Boots.", true, 115, 1}, -- 116
|
||||
{"3d_armor", "leggings_gold", BooTSWear, "some very old Leggings.", true, 116, 1}, -- 117
|
||||
{"3d_armor", "chestplate_bronze", BooTSWear, "a very old ChestPlate.", true, 117, 4}, -- 118
|
||||
-- nom mod nom item durabilité message dans le chat 106/120 de chance -- fin 121
|
||||
-- de l'objet de récupérer le worm
|
||||
}
|
||||
minetest.register_alias("flowers_plus:seaweed", "flowers:seaweed") -- exception
|
||||
|
||||
local PLaNTS = {
|
||||
-- MoD* iTeM MeSSaGe ("You caught "..)
|
||||
{"flowers", "waterlily", "a Waterlily." },
|
||||
{"flowers", "waterlily_225", "a Waterlily." },
|
||||
{"flowers", "waterlily_45", "a Waterlily." },
|
||||
{"flowers", "waterlily_675", "a Waterlily." },
|
||||
{"flowers", "waterlily_s1", "a Waterlily." },
|
||||
{"flowers", "waterlily_s2", "a Waterlily." },
|
||||
{"flowers", "waterlily_s3", "a Waterlily." },
|
||||
{"flowers", "waterlily_s4", "a Waterlily." },
|
||||
{"flowers", "seaweed", "some Seaweed."},
|
||||
{"flowers", "seaweed_2", "some Seaweed."},
|
||||
{"flowers", "seaweed_3", "some Seaweed."},
|
||||
{"flowers", "seaweed_4", "some Seaweed."},
|
||||
{"trunks", "twig_1", "a Twig." },
|
||||
{"trunks", "twig_2", "a Twig." },
|
||||
{"trunks", "twig_3", "a Twig." },
|
||||
{"trunks", "twig_4", "a Twig." },
|
||||
{"trunks", "twig_5", "a Twig." },
|
||||
{"trunks", "twig_7", "a Twig." },
|
||||
{"trunks", "twig_8", "a Twig." },
|
||||
{"trunks", "twig_9", "a Twig." },
|
||||
{"trunks", "twig_10", "a Twig." },
|
||||
{"trunks", "twig_11", "a Twig." },
|
||||
{"trunks", "twig_12", "a Twig." },
|
||||
{"trunks", "twig_13", "a Twig." },
|
||||
}
|
||||
-- *as used in the node name
|
||||
|
||||
local MoBS = { -- not in use
|
||||
-- iTeM MeSSaGe ("You caught "..)
|
||||
{"animal_clownfish:clownfish", "a Clownfish." },
|
||||
{"animal_fish_blue_white:fish_blue_white", "a Blue white fish."},
|
||||
}
|
||||
|
||||
-- bobber
|
||||
minetest.register_node("fishing:bobber_box", {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
@ -79,8 +14,8 @@ minetest.register_node("fishing:bobber_box", {
|
||||
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
|
||||
}
|
||||
{-2/16, -8/16, -2/16, 2/16, -4/16, 2/16}, -- bobber
|
||||
},
|
||||
},
|
||||
tiles = {
|
||||
"fishing_bobber_top.png",
|
||||
@ -89,10 +24,11 @@ minetest.register_node("fishing:bobber_box", {
|
||||
"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,
|
||||
@ -102,224 +38,150 @@ local FISHING_BOBBER_ENTITY={
|
||||
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, 0/16, 2/16},
|
||||
view_range = 7,
|
||||
-- DESTROY BOBBER WHEN PUNCHING IT
|
||||
-- {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()
|
||||
local inv = puncher:get_inventory()
|
||||
if MESSAGES == true then minetest.chat_send_player(player, S("You didn't catch anything."), false) end -- fish escaped
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
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=""})
|
||||
if MESSAGES == true then minetest.chat_send_player(player, S("The bait is still there."), false) end -- bait still there
|
||||
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,
|
||||
})
|
||||
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)
|
||||
|
||||
|
||||
-- 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 = clicker:get_player_name()
|
||||
if item:get_name() == "fishing:pole" or "fishing:pole_perfect" then
|
||||
local inv = clicker:get_inventory()
|
||||
local say = minetest.chat_send_player
|
||||
local pos = self.object:getpos()
|
||||
-- catch visible plant
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
for i in ipairs(PLaNTS) do
|
||||
local PLaNT = PLaNTS[i][1]..":"..PLaNTS[i][2]
|
||||
local MeSSaGe = PLaNTS[i][3]
|
||||
local DRoP = minetest.registered_nodes[PLaNT].drop
|
||||
if minetest.get_node(pos).name == PLaNT then
|
||||
minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"})
|
||||
if inv:room_for_item("main", {name=DRoP, count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name=DRoP, count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught Plant
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
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=""})
|
||||
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--end
|
||||
elseif minetest.get_node(pos).name == "air" then
|
||||
-- catch visible fish and invisible stuff
|
||||
if self.object:get_hp() <= 300 then
|
||||
if math.random(1, 100) < FISH_CHANCE then
|
||||
local chance = math.random(1, 122) -- ><((((º>
|
||||
for i in pairs(CaTCH) do
|
||||
local MoD = CaTCH[i][1]
|
||||
local iTeM = CaTCH[i][2]
|
||||
local WeaR = CaTCH[i][3]
|
||||
local MeSSaGe = CaTCH[i][4]
|
||||
local GeTBaiTBack = CaTCH[i][5]
|
||||
local NRMiN = CaTCH[i][6]
|
||||
local CHaNCe = CaTCH[i][7]
|
||||
local NRMaX = NRMiN + CHaNCe - 1
|
||||
if chance <= NRMaX and chance >= NRMiN then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
-- remove visible fish, if there
|
||||
local find_fish = minetest.get_objects_inside_radius({x=pos.x,y=pos.y+0.5,z=pos.z}, 1)
|
||||
for k, obj in pairs(find_fish) do
|
||||
if obj:get_luaentity() ~= nil and obj:get_luaentity().name == "animal_fish_blue_white:fish_blue_white" then
|
||||
MoD = "animal_fish_blue_white"
|
||||
iTeM = "fish_blue_white"
|
||||
WeaR = 0
|
||||
MeSSaGe = S("a Blue white fish.")
|
||||
obj:remove()
|
||||
end
|
||||
end
|
||||
-- add (in)visible fish to inventory
|
||||
if inv:room_for_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) then
|
||||
inv:add_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""})
|
||||
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught somethin'
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if GeTBaiTBack == true then
|
||||
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=""})
|
||||
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there?
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, S("You caught a Fish."), false) end -- caught Fish
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else --if math.random(1, 100) > FISH_CHANCE then
|
||||
if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped
|
||||
end
|
||||
end
|
||||
if self.object:get_hp() > 300 and minetest.get_node(pos).name == "air" then
|
||||
if MESSAGES == true then say(player, S("You didn't catch anything."), false) end -- fish escaped
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if math.random(1, 2) == 1 then
|
||||
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=""})
|
||||
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
|
||||
end
|
||||
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
|
||||
-- weither player has fishing pole or not
|
||||
-- make sound and remove bobber
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
self.object:remove()
|
||||
end,
|
||||
|
||||
|
||||
-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
if BOBBER_CHECK_RADIUS > 0 then
|
||||
local objs = minetest.get_objects_inside_radius(pos, BOBBER_CHECK_RADIUS)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name == "fishing:bobber_entity" then
|
||||
if obj:get_luaentity() ~= self then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--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
|
||||
local remove_entity = true
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if dist < self.view_range then
|
||||
remove_entity = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if remove_entity then
|
||||
-- make sound and remove bobber
|
||||
minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,})
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
|
||||
|
||||
if self.object:get_hp() > 310 then
|
||||
local find_fish = minetest.get_objects_inside_radius({x=pos.x,y=pos.y+0.5,z=pos.z}, 1)
|
||||
for k, obj in pairs(find_fish) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name == "animal_fish_blue_white:fish_blue_white" then
|
||||
if math.random(1, 30) == 1 then
|
||||
self.object:set_hp(310)
|
||||
end
|
||||
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.0325
|
||||
self.object:moveto(pos, false)
|
||||
self.old_pos2 = false
|
||||
else
|
||||
pos.y = pos.y+0.0325
|
||||
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
|
||||
|
||||
local do_env_damage = function(self)
|
||||
self.object:set_hp(self.object:get_hp()-self.water_damage)
|
||||
if self.object:get_hp() == 600 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 595 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 590 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 585 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z})
|
||||
self.object:set_hp(self.object:get_hp()-(math.random(1, 275)))
|
||||
elseif self.object:get_hp() == 300 then
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
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, "default_snow.png")
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() == 295 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() == 290 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() == 285 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.1,z=pos.z})
|
||||
elseif self.object:get_hp() < 284 then
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/1440*math.pi))
|
||||
elseif self.object:get_hp() == 0 then
|
||||
-- make sound and remove bobber
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
self.object:remove()
|
||||
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.prizes["plants"][math.random(1,#fishing_setting.prizes["plants"])]
|
||||
end
|
||||
end
|
||||
do_env_damage(self)
|
||||
|
||||
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_entity", FISHING_BOBBER_ENTITY)
|
||||
minetest.register_entity("fishing:bobber_fish_entity", FISHING_BOBBER_ENTITY)
|
||||
|
@ -1,67 +1,33 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Bobber Shark 0.0.6
|
||||
-- Fishing - crabman77 version - Bobber Shark
|
||||
-- Rewrited from original Fishing - Mossmanikin's version - Bobber Shark 0.0.6
|
||||
-- License (code & textures): WTFPL
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
-- 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 PoLeWeaR = (65535/(30-(math.random(15, 29))))
|
||||
local BooTSWear = (2000*(math.random(20, 29)))
|
||||
-- Here's what you can catch if you use a fish as bait
|
||||
local CaTCH_BiG = {
|
||||
-- MoD iTeM WeaR MeSSaGe ("You caught "..) GeTBaiTBack NRMiN CHaNCe (../120)
|
||||
{"fishing", "shark", 0, "a small Shark.", false, 1, 55}, -- 1 début
|
||||
{"fishing", "pike", 0, "a Northern Pike.", false, 56, 55}, -- 110
|
||||
{"3d_armor", "helmet_diamond", BooTSWear, "a very old Helmet.", true, 111, 2}, -- 112
|
||||
{"shields", "shield_enhanced_cactus", BooTSWear, "a very old Shield.", true, 113, 2}, -- 114
|
||||
{"shields", "shield_enhanced_cactus", BooTSWear, "a very old Shield.", true, 115, 1}, -- 115
|
||||
{"default", "sword_bronze", BooTSWear, "a very old Sword.", true, 116, 1}, -- 116
|
||||
{"default", "sword_mese", BooTSWear, "a very old Sword.", true, 117, 1}, -- 117
|
||||
{"default", "sword_nyan", BooTSWear, "a very old Sword.", true, 118, 1}, -- 118
|
||||
{"maptools", "gold_coin", 0, "a Gold Coin.", true, 119, 1}, -- 119
|
||||
{"default", "diamondblock", 0, "a Diamond Block.", true, 120, 1}, -- 120
|
||||
{"default", "nyancat", 0, "a Nyan Cat.", true, 121, 1}, -- 121
|
||||
-- nom mod nom item durabilité message dans le chat 106/120 de chance -- fin 121
|
||||
-- de l'objet de récupérer le worm
|
||||
}
|
||||
|
||||
local PLaNTS = {
|
||||
-- MoD* iTeM MeSSaGe ("You caught "..)
|
||||
{"flowers", "waterlily", "a Waterlily." },
|
||||
{"flowers", "waterlily_225", "a Waterlily." },
|
||||
{"flowers", "waterlily_45", "a Waterlily." },
|
||||
{"flowers", "waterlily_675", "a Waterlily." },
|
||||
{"flowers", "waterlily_s1", "a Waterlily." },
|
||||
{"flowers", "waterlily_s2", "a Waterlily." },
|
||||
{"flowers", "waterlily_s3", "a Waterlily." },
|
||||
{"flowers", "waterlily_s4", "a Waterlily." },
|
||||
{"flowers", "seaweed", "some Seaweed."},
|
||||
{"flowers", "seaweed_2", "some Seaweed."},
|
||||
{"flowers", "seaweed_3", "some Seaweed."},
|
||||
{"flowers", "seaweed_4", "some Seaweed."},
|
||||
{"trunks", "twig_1", "a Twig." },
|
||||
{"trunks", "twig_2", "a Twig." },
|
||||
{"trunks", "twig_3", "a Twig." },
|
||||
{"trunks", "twig_4", "a Twig." },
|
||||
{"trunks", "twig_5", "a Twig." },
|
||||
{"trunks", "twig_7", "a Twig." },
|
||||
{"trunks", "twig_8", "a Twig." },
|
||||
{"trunks", "twig_9", "a Twig." },
|
||||
{"trunks", "twig_10", "a Twig." },
|
||||
{"trunks", "twig_11", "a Twig." },
|
||||
{"trunks", "twig_12", "a Twig." },
|
||||
{"trunks", "twig_13", "a Twig." },
|
||||
}
|
||||
-- *as used in the node name
|
||||
|
||||
local FISHING_BOBBER_ENTITY_SHARK={
|
||||
local FISHING_BOBBER_SHARK_ENTITY={
|
||||
hp_max = 605,
|
||||
water_damage = 1,
|
||||
physical = true,
|
||||
@ -69,180 +35,160 @@ local FISHING_BOBBER_ENTITY_SHARK={
|
||||
env_damage_timer = 0,
|
||||
visual = "wielditem",
|
||||
visual_size = {x=1/3, y=1/3, z=1/3},
|
||||
textures = {"fishing:bobber_box"},
|
||||
textures = {"fishing:bobber_shark_box"},
|
||||
-- {left ,bottom, front, right, top , back}
|
||||
collisionbox = {-2/16, -4/16, -2/16, 2/16, 0/16, 2/16},
|
||||
view_range = 7,
|
||||
-- DESTROY BOBBER WHEN PUNCHING IT
|
||||
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)
|
||||
local player = puncher:get_player_name()
|
||||
if MESSAGES == true then minetest.chat_send_player(player, S("Your fish escaped."), false) end -- fish escaped
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
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)
|
||||
|
||||
|
||||
-- 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 = clicker:get_player_name()
|
||||
local say = minetest.chat_send_player
|
||||
if item:get_name() == "fishing:pole" or "fishing:pole_perfect" then
|
||||
local inv = clicker:get_inventory()
|
||||
local pos = self.object:getpos()
|
||||
-- catch visible plant
|
||||
if minetest.get_node(pos).name ~= "air" then
|
||||
for i in ipairs(PLaNTS) do
|
||||
local PLaNT = PLaNTS[i][1]..":"..PLaNTS[i][2]
|
||||
local MeSSaGe = PLaNTS[i][3]
|
||||
local DRoP = minetest.registered_nodes[PLaNT].drop
|
||||
if minetest.get_node(pos).name == PLaNT then
|
||||
minetest.add_node({x=pos.x, y=pos.y, z=pos.z}, {name="air"})
|
||||
if inv:room_for_item("main", {name=DRoP, count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name=DRoP, count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught Plant
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:bait_worm", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
|
||||
end
|
||||
end
|
||||
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
|
||||
--elseif minetest.get_node(pos).name == "air" then
|
||||
if self.object:get_hp() <= 300 then
|
||||
if math.random(1, 100) < SHARK_CHANCE then
|
||||
local chance = math.random(1, 5) -- ><((((º>
|
||||
for i in pairs(CaTCH_BiG) do
|
||||
local MoD = CaTCH_BiG[i][1]
|
||||
local iTeM = CaTCH_BiG[i][2]
|
||||
local WeaR = CaTCH_BiG[i][3]
|
||||
local MeSSaGe = CaTCH_BiG[i][4]
|
||||
local GeTBaiTBack = CaTCH_BiG[i][5]
|
||||
local NRMiN = CaTCH_BiG[i][6]
|
||||
local CHaNCe = CaTCH_BiG[i][7]
|
||||
local NRMaX = NRMiN + CHaNCe - 1
|
||||
if chance <= NRMaX and chance >= NRMiN then
|
||||
if minetest.get_modpath(MoD) ~= nil then
|
||||
if inv:room_for_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""}) then
|
||||
inv:add_item("main", {name=MoD..":"..iTeM, count=1, wear=WeaR, metadata=""})
|
||||
if MESSAGES == true then say(player, S("You caught "..MeSSaGe), false) end -- caught somethin'
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if GeTBaiTBack == true then
|
||||
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else --if math.random(1, 100) > FISH_CHANCE then
|
||||
if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped
|
||||
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
|
||||
if self.object:get_hp() > 300 and minetest.get_node(pos).name == "air" then
|
||||
if MESSAGES == true then say(player, S("You didn't catch any fish."), false) end -- fish escaped
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
if math.random(1, 3) == 1 then
|
||||
if inv:room_for_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""}) then
|
||||
inv:add_item("main", {name="fishing:fish_raw", count=1, wear=0, metadata=""})
|
||||
if MESSAGES == true then say(player, S("The bait is still there."), false) end -- bait still there
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--end
|
||||
else
|
||||
if MESSAGES == true then say(player, S("Your fish escaped."), false) end -- fish escaped
|
||||
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
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
self.object:remove()
|
||||
end,
|
||||
|
||||
|
||||
-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
if BOBBER_CHECK_RADIUS > 0 then
|
||||
local objs = minetest.get_objects_inside_radius({x=pos.x,y=pos.y,z=pos.z}, BOBBER_CHECK_RADIUS)
|
||||
for k, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil then
|
||||
if obj:get_luaentity().name == "fishing:bobber_entity_shark" then
|
||||
if obj:get_luaentity() ~= self then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--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
|
||||
local remove_entity = true
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
local s = self.object:getpos()
|
||||
local p = player:getpos()
|
||||
local dist = ((p.x-s.x)^2 + (p.y-s.y)^2 + (p.z-s.z)^2)^0.5
|
||||
if dist < self.view_range then
|
||||
remove_entity = false
|
||||
break
|
||||
|
||||
self.timer = self.timer + 1
|
||||
if self.timer < self.randomtime then
|
||||
-- if fish or others items, move bobber to simulate fish on the line
|
||||
if self.prize ~= "" and math.random(1,3) == 1 then
|
||||
if self.old_pos2 == true then
|
||||
pos.y = pos.y-0.0525
|
||||
self.object:moveto(pos, false)
|
||||
self.old_pos2 = false
|
||||
else
|
||||
pos.y = pos.y+0.0525
|
||||
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, maybe ...
|
||||
if chance == 1 then
|
||||
--You are lucky ? :)
|
||||
if math.random(1, 100) <= fishing_setting.settings["treasure_chance"] and fishing_setting.settings["treasure_enable"] then
|
||||
self.prize = fishing_setting.prizes["treasure"][math.random(1,#fishing_setting.prizes["treasure"])]
|
||||
else
|
||||
self.prize = fishing_setting.prizes["stuff"][math.random(1,#fishing_setting.prizes["stuff"])]
|
||||
end
|
||||
elseif chance <= fishing_setting.settings["fish_chance"] then
|
||||
self.prize = fishing_setting.prizes["shark"][math.random(1,#fishing_setting.prizes["shark"])]
|
||||
else
|
||||
if math.random(1, 100) <= 10 then
|
||||
self.prize = fishing_setting.prizes["plants"][math.random(1,#fishing_setting.prizes["plants"])]
|
||||
end
|
||||
end
|
||||
if remove_entity then
|
||||
-- make sound and remove bobber
|
||||
minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(),gain = 0.5,})
|
||||
self.object:remove()
|
||||
|
||||
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
|
||||
local do_env_damage = function(self)
|
||||
self.object:set_hp(self.object:get_hp()-self.water_damage)
|
||||
if self.object:get_hp() == 600 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 595 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 590 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.015625,z=pos.z})
|
||||
elseif self.object:get_hp() == 585 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.015625,z=pos.z})
|
||||
self.object:set_hp(self.object:get_hp()-(math.random(1, 200)))
|
||||
elseif self.object:get_hp() == 300 then
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.7,
|
||||
})
|
||||
minetest.add_particlespawner(40, 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-0.2,z=pos.z}, -- position min, pos max
|
||||
{x=-3,y=-0.0625,z=-3}, {x=3,y=5,z=3}, -- velocity min, vel max
|
||||
{x=0,y=-9.8,z=0}, {x=0,y=-9.8,z=0},
|
||||
0.3, 2.4,
|
||||
0.25, 0.5, -- min size, max size
|
||||
false, "default_snow.png")
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.625,z=pos.z})
|
||||
elseif self.object:get_hp() == 295 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.425,z=pos.z})
|
||||
elseif self.object:get_hp() == 290 then
|
||||
self.object:moveto({x=pos.x,y=pos.y+0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() == 285 then
|
||||
self.object:moveto({x=pos.x,y=pos.y-0.0625,z=pos.z})
|
||||
elseif self.object:get_hp() < 284 then
|
||||
self.object:moveto({x=pos.x+(0.001*(math.random(-8, 8))),y=pos.y,z=pos.z+(0.001*(math.random(-8, 8)))})
|
||||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/720*math.pi))
|
||||
elseif self.object:get_hp() == 0 then
|
||||
minetest.sound_play("fishing_bobber1", {
|
||||
pos = self.object:getpos(),
|
||||
gain = 0.5,
|
||||
})
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
do_env_damage(self)
|
||||
end,
|
||||
}
|
||||
|
||||
minetest.register_entity("fishing:bobber_entity_shark", FISHING_BOBBER_ENTITY_SHARK)
|
||||
minetest.register_entity("fishing:bobber_shark_entity", FISHING_BOBBER_SHARK_ENTITY)
|
||||
|
@ -1,5 +1,6 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Recipes 0.0.8
|
||||
-- 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
|
||||
@ -11,60 +12,93 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing Pole
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Wooden Fishing Pole
|
||||
-- Wood Fishing Pole
|
||||
minetest.register_craft({
|
||||
output = "fishing:pole",
|
||||
recipe = {
|
||||
{"", "", "group:stick" },
|
||||
{"", "group:stick", "farming:string"},
|
||||
{"group:stick", "", "farming:string"},
|
||||
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",
|
||||
recipe = {
|
||||
{"", "", "group:stick" },
|
||||
{"", "group:stick", "moreblocks:rope" },
|
||||
{"group:stick", "", "moreblocks:rope" },
|
||||
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",
|
||||
recipe = {
|
||||
{"", "", "group:stick" },
|
||||
{"", "group:stick", "ropes:rope" },
|
||||
{"group:stick", "", "ropes:rope" },
|
||||
output = "fishing:pole_perfect",
|
||||
recipe = {
|
||||
{"", "", "moreores:mithril_ingot" },
|
||||
{"", "moreores:mithril_ingot", "mobs:spider_cobweb" },
|
||||
{"moreores:mithril_ingot", "", "mobs:spider_cobweb" },
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Mithril Fishing Pole
|
||||
if minetest.get_modpath("moreores") ~= nil then
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing bait
|
||||
-----------------------------------------------------------------------------------------------
|
||||
--bait corn
|
||||
minetest.register_craft({
|
||||
output = "fishing:pole_perfect",
|
||||
output = "fishing:bait_corn 9",
|
||||
recipe = {
|
||||
{"", "", "moreores:mithril_ingot" },
|
||||
{"", "moreores:mithril_ingot", "mobs:spider_cobweb" },
|
||||
{"moreores:mithril_ingot", "", "mobs:spider_cobweb" },
|
||||
{"", "farming:corn", ""},
|
||||
}
|
||||
})
|
||||
|
||||
--bait bread
|
||||
minetest.register_craft({
|
||||
output = "fishing:bait_bread 9",
|
||||
recipe = {
|
||||
{"", "farming:bread", ""},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Roasted Fish
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "fishing:fish",
|
||||
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
|
||||
-----------------------------------------------------------------------------------------------
|
||||
@ -73,21 +107,26 @@ minetest.register_craft({
|
||||
output = "farming:seed_wheat",
|
||||
recipe = {"farming:wheat"},
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Sushi
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "fishing:sushi",
|
||||
recipe = {"fishing:fish_raw", "farming:seed_wheat", "flowers:seaweed" },
|
||||
})
|
||||
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
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "fishing:sushi",
|
||||
recipe = {"fishing:fish_raw", "farming:seed_wheat", "seaplants:kelpgreen" },
|
||||
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
|
||||
@ -95,7 +134,7 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "fishing:shark_cooked",
|
||||
recipe = "fishing:shark",
|
||||
recipe = "fishing:shark_raw",
|
||||
cooktime = 2,
|
||||
})
|
||||
|
||||
@ -105,6 +144,115 @@ minetest.register_craft({
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "fishing:pike_cooked",
|
||||
recipe = "fishing:pike",
|
||||
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,2 +1,9 @@
|
||||
default
|
||||
unified_inventory?
|
||||
farming
|
||||
moreblocks?
|
||||
ropes?
|
||||
moreores?
|
||||
mobs?
|
||||
flowers_plus?
|
||||
seaplants?
|
||||
|
@ -1,31 +1,23 @@
|
||||
-------------------------------------------------------------------------------------------
|
||||
-- Fishing - crabman77 version
|
||||
-- Rewrited from original Fishing - Mossmanikin's version - Fishes 0.0.4
|
||||
-- License (code & textures): WTFPL
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Fishes 0.0.4
|
||||
-- License (code & textures): WTFPL
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fish
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:fish_raw", {
|
||||
description = S("Fish"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_fish.png",
|
||||
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", {
|
||||
description = S("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),
|
||||
@ -34,26 +26,46 @@ minetest.register_craftitem("fishing:fish_raw", {
|
||||
-- Sushi
|
||||
-----------------------------------------------------
|
||||
minetest.register_craftitem("fishing:sushi", {
|
||||
description = S("Sushi (Hoso Maki)"),
|
||||
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", {
|
||||
description = S("Shark"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_shark.png",
|
||||
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 = S("Roasted Shark"),
|
||||
description = fishing_setting.func.S("Roasted Shark"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_shark_cooked.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
@ -62,17 +74,17 @@ minetest.register_craftitem("fishing:shark", {
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Pike
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:pike", {
|
||||
description = S("Northern Pike"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_pike.png",
|
||||
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 = S("Roasted Northern Pike"),
|
||||
description = fishing_setting.func.S("Roasted Northern Pike"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_pike_cooked.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
|
625
mods/fishing/functions.lua
Executable file
@ -0,0 +1,625 @@
|
||||
|
||||
--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
|
||||
|
||||
|
||||
-- Show notification when a player catches treasure
|
||||
function fishing_setting.func.notify(f_name, treasure)
|
||||
local title = fishing_setting.func.S("Lucky %s, he caught the treasure, %s!"):format(f_name, treasure[4])
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local player_name = player:get_player_name()
|
||||
if player_name == f_name then
|
||||
minetest.chat_send_player(player_name, fishing_setting.func.S("You caught the treasure, %s!"):format(treasure[4]))
|
||||
else
|
||||
minetest.chat_send_player(player_name, title)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Menu: fishing configuration
|
||||
fishing_setting.func.on_show_settings = function(player_name)
|
||||
local S = fishing_setting.func.S
|
||||
if not fishing_setting.tmp_setting then
|
||||
fishing_setting.tmp_setting = {}
|
||||
fishing_setting.func.set_settings(fishing_setting.tmp_setting, fishing_setting.settings)
|
||||
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)
|
||||
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, fishing_setting.func.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, fishing_setting.func.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(fishing_setting.func.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 S = fishing_setting.func.S
|
||||
local formspec = "size[5,5]label[1.6,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_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(fishing_setting.func.S("End of fishing contest."))
|
||||
minetest.sound_play("fishing_contest_end",{gain=0.8})
|
||||
fishing_setting.func.show_result()
|
||||
end
|
||||
|
||||
--Menu fishing configuration
|
||||
fishing_setting.func.on_show_settings_contest = function(player_name)
|
||||
local S = fishing_setting.func.S
|
||||
if not fishing_setting.tmp_setting then
|
||||
fishing_setting.tmp_setting = { ["contest"] = (fishing_setting.contest["contest"] or false),
|
||||
["duration"] = (math.floor(fishing_setting.contest["duration"]) or 3600),
|
||||
["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(fishing_setting.func.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 S = fishing_setting.func.S
|
||||
local formspec = {"size[12,8]label[3.7,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.5,7.5;1.2,1;close;"..S("Close").."]")
|
||||
return table.concat(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,10 +1,11 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
local title = "Fishing - Mossmanikin's version"
|
||||
local version = "0.2.3"
|
||||
local title = "Fishing - Crabman77's version"
|
||||
local version = "0.0.1"
|
||||
local mname = "fishing"
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
|
||||
-- this version by Mossmanikin (https://forum.minetest.net/viewtopic.php?id=6480)
|
||||
-- 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
|
||||
@ -12,530 +13,84 @@ local mname = "fishing"
|
||||
-- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- todo: item wear done
|
||||
-- automatic re-baiting option done (but not optional)
|
||||
-- different types of fish, done, but not finished
|
||||
-- add sound done
|
||||
-- bobber done
|
||||
-- change rainworms filling inv & make 'em disappear done
|
||||
minetest.log("action","[mod fishing] Loading...")
|
||||
local path = minetest.get_modpath("fishing").."/"
|
||||
|
||||
-- placable fishing rod for decoration done
|
||||
-- make bobber move slowly while fish on hook done
|
||||
-- catch bigger fish with smaller done, but not finished
|
||||
-- change color of bobber when fish on hook done
|
||||
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 = {}
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
fishing_setting.func.S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
fishing_setting.func.S = function ( s ) return s end
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath("fishing").."/settings.txt")
|
||||
dofile(minetest.get_modpath("fishing").."/bobber.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/bobber_shark.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/crafting.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/fishes.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/worm.lua")
|
||||
dofile(minetest.get_modpath("fishing").."/trophies.lua")
|
||||
dofile(path .."settings.txt")
|
||||
dofile(path .."functions.lua")
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing Pole
|
||||
-----------------------------------------------------------------------------------------------
|
||||
--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
|
||||
|
||||
local function rod_wear(itemstack, user, pointed_thing, uses)
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
return itemstack
|
||||
end
|
||||
-- load config file if exist in worldpath
|
||||
fishing_setting.func.load()
|
||||
|
||||
--Canne à pêche normal
|
||||
minetest.register_tool("fishing:pole", {
|
||||
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")
|
||||
--dofile(path .."material.lua")
|
||||
|
||||
description = S("Fishing Pole"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_pole.png",
|
||||
wield_image = "fishing_pole.png^[transformFXR270",
|
||||
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 string.find(node.name, "default:water") then
|
||||
local player = user:get_player_name()
|
||||
local inv = user:get_inventory()
|
||||
if inv:get_stack("main", user:get_wield_index()+1):get_name() == "fishing:bait_worm" then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "fishing:bait_worm")
|
||||
end
|
||||
minetest.sound_play("fishing_bobber2", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity")
|
||||
--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()
|
||||
|
||||
if WEAR_OUT == true
|
||||
and not minetest.setting_getbool("creative_mode") then
|
||||
return rod_wear(itemstack, user, pointed_thing, 30)
|
||||
else
|
||||
return {name="fishing:pole", count=1, wear=0, metadata=""}
|
||||
end
|
||||
end
|
||||
if inv:get_stack("main", user:get_wield_index()+1):get_name() == "fishing:fish_raw" then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "fishing:fish_raw")
|
||||
end
|
||||
minetest.sound_play("fishing_bobber2", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity_shark")
|
||||
|
||||
if WEAR_OUT == true
|
||||
and not minetest.setting_getbool("creative_mode") then
|
||||
return rod_wear(itemstack, user, pointed_thing, 30)
|
||||
else
|
||||
return {name="fishing:pole", count=1, wear=0, metadata=""}
|
||||
end
|
||||
end
|
||||
end
|
||||
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
|
||||
return nil
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pt = pointed_thing
|
||||
if minetest.get_node(pt.under).name~="default:water_source" and minetest.get_node(pt.under).name~="default:water_flowing" then
|
||||
local wear = itemstack:get_wear()
|
||||
--print (wear)
|
||||
local direction = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
--local meta1 = minetest.get_meta(pt.under)
|
||||
local meta = minetest.get_meta(pt.above)
|
||||
minetest.set_node(pt.above, {name="fishing:pole_deco", param2=direction})
|
||||
--meta1:set_int("wear", wear)
|
||||
meta:set_int("wear", wear)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
if fishing_setting.contest["duration"] < 0 then
|
||||
fishing_setting.func.end_contest()
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
--Canne à pêche parfaite
|
||||
minetest.register_tool("fishing:pole_perfect", {
|
||||
|
||||
description = S("Perfect Fishing Pole"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_pole_perfect.png",
|
||||
wield_image = "fishing_pole_perfect.png^[transformFXR270",
|
||||
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 string.find(node.name, "default:water") then
|
||||
local player = user:get_player_name()
|
||||
local inv = user:get_inventory()
|
||||
if inv:get_stack("main", user:get_wield_index()+1):get_name() == "fishing:bait_worm" then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "fishing:bait_worm")
|
||||
end
|
||||
minetest.sound_play("fishing_bobber2", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity")
|
||||
|
||||
if WEAR_OUT == true
|
||||
and not minetest.setting_getbool("creative_mode") then
|
||||
return rod_wear(itemstack, user, pointed_thing, 1500)
|
||||
else
|
||||
return {name="fishing:pole_perfect", count=1, wear=0, metadata=""}
|
||||
end
|
||||
end
|
||||
if inv:get_stack("main", user:get_wield_index()+1):get_name() == "fishing:fish_raw" then
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
inv:remove_item("main", "fishing:fish_raw")
|
||||
end
|
||||
minetest.sound_play("fishing_bobber2", {
|
||||
pos = pt.under,
|
||||
gain = 0.5,
|
||||
})
|
||||
minetest.add_entity({interval = 1,x=pt.under.x, y=pt.under.y+(45/64), z=pt.under.z}, "fishing:bobber_entity_shark")
|
||||
|
||||
if WEAR_OUT == true
|
||||
and not minetest.setting_getbool("creative_mode") then
|
||||
return rod_wear(itemstack, user, pointed_thing, 1500)
|
||||
else
|
||||
return {name="fishing:pole_perfect", count=1, wear=0, metadata=""}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pt = pointed_thing
|
||||
if minetest.get_node(pt.under).name~="default:water_source" and minetest.get_node(pt.under).name~="default:water_flowing" then
|
||||
local wear = itemstack:get_wear()
|
||||
--print (wear)
|
||||
local direction = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
--local meta1 = minetest.get_meta(pt.under)
|
||||
local meta = minetest.get_meta(pt.above)
|
||||
minetest.set_node(pt.above, {name="fishing:pole_perfect_deco", param2=direction})
|
||||
--meta1:set_int("wear", wear)
|
||||
meta:set_int("wear", wear)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
if SIMPLE_DECO_FISHING_POLE == true then
|
||||
--Canne à pêche deco
|
||||
minetest.register_node("fishing:pole_deco", {
|
||||
description = S("Fishing Pole"),
|
||||
inventory_image = "fishing_pole.png",
|
||||
wield_image = "fishing_pole.png^[transformFXR270",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"fishing_pole_simple.png",
|
||||
"fishing_pole_simple.png",
|
||||
"fishing_pole_simple.png",
|
||||
"fishing_pole_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", count=1, wear=wear_out, metadata=""})
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
--Canne à pêche parfaite deco
|
||||
minetest.register_node("fishing:pole_perfect_deco", {
|
||||
description = S("Perfect Fishing Pole"),
|
||||
inventory_image = "fishing_pole_perfect.png",
|
||||
wield_image = "fishing_pole_perfect.png^[transformFXR270",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"fishing_pole_perfect_simple.png",
|
||||
"fishing_pole_perfect_simple.png",
|
||||
"fishing_pole_perfect_simple.png",
|
||||
"fishing_pole_perfect_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_perfect", count=1, wear=wear_out, metadata=""})
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
else
|
||||
--Canne à pêche deco
|
||||
minetest.register_node("fishing:pole_deco", {
|
||||
description = S("Fishing Pole"),
|
||||
inventory_image = "fishing_pole.png",
|
||||
wield_image = "fishing_pole.png^[transformFXR270",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"fishing_pole_top.png",
|
||||
"fishing_pole_bottom.png",
|
||||
"fishing_pole_deco.png", -- right
|
||||
"fishing_pole_deco.png^[transformFX", -- left
|
||||
"fishing_pole_back.png",
|
||||
"fishing_pole_front.png"
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
-- { left , bottom , front , right , top , back }
|
||||
fixed = {
|
||||
{-1/32 , -1/16 , 14/16 , 1/32 , 6/16 , 15/16},
|
||||
{-1/32 , -3/16 , 13/16 , 1/32 , -1/16 , 14/16},
|
||||
{-1/32 , -4/16 , 12/16 , 1/32 , -3/16 , 13/16},
|
||||
{-1/32 , -5/16 , 11/16 , 1/32 , -4/16 , 12/16},
|
||||
{-1/32 , -6/16 , 9/16 , 1/32 , -5/16 , 11/16},
|
||||
{-1/32 , -5/16 , 9/16 , 1/32 , -4/16 , 10/16},
|
||||
-- stick
|
||||
{-1/32 , 6/16 , 12/16 , 1/32 , 7/16 , 15/16}, -- top
|
||||
{-1/32 , 5/16 , 11/16 , 1/32 , 7/16 , 12/16},
|
||||
{-1/32 , 5/16 , 10/16 , 1/32 , 6/16 , 11/16},
|
||||
{-1/32 , 4/16 , 9/16 , 1/32 , 6/16 , 10/16},
|
||||
{-1/32 , 3/16 , 8/16 , 1/32 , 5/16 , 9/16},
|
||||
{-1/32 , 2/16 , 7/16 , 1/32 , 4/16 , 8/16},
|
||||
{-1/32 , 1/16 , 6/16 , 1/32 , 3/16 , 7/16},
|
||||
{-1/32 , 0 , 5/16 , 1/32 , 2/16 , 6/16},
|
||||
{-1/32 , -2/16 , 4/16 , 1/32 , 1/16 , 5/16},
|
||||
{-1/32 , -3/16 , 3/16 , 1/32 , 0 , 4/16},
|
||||
{-1/32 , -5/16 , 2/16 , 1/32 , -1/16 , 3/16},
|
||||
{-1/32 , -7/16 , 1/16 , 1/32 , -3/16 , 2/16},
|
||||
{-1/32 , -1/2 , 0 , 1/32 , -5/16 , 1/16}, -- bottom
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/16 , -1/2 , 0 , 1/16 , 1/2 , 1 },
|
||||
}
|
||||
},
|
||||
groups = {
|
||||
snappy=3,
|
||||
flammable=2,
|
||||
not_in_creative_inventory=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", count=1, wear=wear_out, metadata=""})
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
--Canne à pêche parfaite deco
|
||||
minetest.register_node("fishing:pole_perfect_deco", {
|
||||
description = S("Perfect Fishing Pole"),
|
||||
inventory_image = "fishing_pole_perfect.png",
|
||||
wield_image = "fishing_pole_perfect.png^[transformFXR270",
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
tiles = {
|
||||
"fishing_pole_perfect_top.png",
|
||||
"fishing_pole_perfect_bottom.png",
|
||||
"fishing_pole_perfect_deco.png", -- right
|
||||
"fishing_pole_perfect_deco.png^[transformFX", -- left
|
||||
"fishing_pole_perfect_back.png",
|
||||
"fishing_pole_perfect_front.png"
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
-- { left , bottom , front , right , top , back }
|
||||
fixed = {
|
||||
{-1/32 , -1/16 , 14/16 , 1/32 , 6/16 , 15/16},
|
||||
{-1/32 , -3/16 , 13/16 , 1/32 , -1/16 , 14/16},
|
||||
{-1/32 , -4/16 , 12/16 , 1/32 , -3/16 , 13/16},
|
||||
{-1/32 , -5/16 , 11/16 , 1/32 , -4/16 , 12/16},
|
||||
{-1/32 , -6/16 , 9/16 , 1/32 , -5/16 , 11/16},
|
||||
{-1/32 , -5/16 , 9/16 , 1/32 , -4/16 , 10/16},
|
||||
-- stick
|
||||
{-1/32 , 6/16 , 12/16 , 1/32 , 7/16 , 15/16}, -- top
|
||||
{-1/32 , 5/16 , 11/16 , 1/32 , 7/16 , 12/16},
|
||||
{-1/32 , 5/16 , 10/16 , 1/32 , 6/16 , 11/16},
|
||||
{-1/32 , 4/16 , 9/16 , 1/32 , 6/16 , 10/16},
|
||||
{-1/32 , 3/16 , 8/16 , 1/32 , 5/16 , 9/16},
|
||||
{-1/32 , 2/16 , 7/16 , 1/32 , 4/16 , 8/16},
|
||||
{-1/32 , 1/16 , 6/16 , 1/32 , 3/16 , 7/16},
|
||||
{-1/32 , 0 , 5/16 , 1/32 , 2/16 , 6/16},
|
||||
{-1/32 , -2/16 , 4/16 , 1/32 , 1/16 , 5/16},
|
||||
{-1/32 , -3/16 , 3/16 , 1/32 , 0 , 4/16},
|
||||
{-1/32 , -5/16 , 2/16 , 1/32 , -1/16 , 3/16},
|
||||
{-1/32 , -7/16 , 1/16 , 1/32 , -3/16 , 2/16},
|
||||
{-1/32 , -1/2 , 0 , 1/32 , -5/16 , 1/16}, -- bottom
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-1/16 , -1/2 , 0 , 1/16 , 1/2 , 1 },
|
||||
}
|
||||
},
|
||||
groups = {
|
||||
snappy=3,
|
||||
flammable=2,
|
||||
not_in_creative_inventory=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_perfect", count=1, wear=wear_out, metadata=""})
|
||||
end
|
||||
minetest.remove_node(pos)
|
||||
end,
|
||||
})
|
||||
end
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- GETTING WORMS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- get worms from digging in dirt:
|
||||
if NEW_WORM_SOURCE == false then
|
||||
|
||||
minetest.register_node(":default:dirt", {
|
||||
description = 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) < 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 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) < WORM_CHANCE then
|
||||
if WORM_IS_MOB == true then
|
||||
minetest.add_entity({x=pt.under.x, y=pt.under.y+0.4, z=pt.under.z}, "fishing:bait_worm_entity")
|
||||
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 = 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 = 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 = 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 = 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
|
||||
end)
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
@ -1,56 +1,87 @@
|
||||
# Translation by Xanthin
|
||||
# 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 Blue white fish. = Du hast einen blau-weissen Fisch 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.
|
||||
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 Waterlily. = Du hast eine Seerose gefangen.
|
||||
You didn't catch anything. = Du hast nichts gefangen.
|
||||
The bait is still there. = Der Koeder ist noch vorhanden.
|
||||
Your fish escaped. = Dein Fisch ist entkommen.
|
||||
|
||||
### 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 didn't catch any fish. = Du hast keinen Fisch 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
|
||||
|
||||
### init.lua ###
|
||||
|
||||
### 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
|
||||
Dirt = Erde
|
||||
Wooden Hoe = Holzhacke
|
||||
Stone Hoe = Steinhacke
|
||||
Steel Hoe = Stahlhacke
|
||||
Bronze Hoe = Bronzehacke
|
||||
Perfect Fishing Pole =
|
||||
|
||||
|
||||
### trophies.lua ###
|
||||
Fish Trophy = Fisch-Trophaee
|
||||
Northern Pike Trophy = Hecht-Trophaee
|
||||
Shark Trophy = Hai-Trophaee
|
||||
Clownfish Trophy = Clownfisch-Trophaee
|
||||
Blue white fish Trophy = Blau-weisser-Fisch-Trophaee
|
||||
Trophy = 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 Blue white fish was caught by the Famous Angler %s ! = Dieser riesige blau-weisse Fisch 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
|
||||
|
101
mods/fishing/locale/fr.txt
Executable file
@ -0,0 +1,101 @@
|
||||
|
||||
# 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,56 +1,127 @@
|
||||
# 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 Blue white fish. =
|
||||
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. =
|
||||
You caught an old Fishing Pole. =
|
||||
You caught some very old Boots. =
|
||||
You caught a Waterlily. =
|
||||
You didn't catch anything. =
|
||||
The bait is still there. =
|
||||
Your fish escaped. =
|
||||
|
||||
### bobber_shark.lua ###
|
||||
You caught small Shark. =
|
||||
You caught a small Shark. =
|
||||
You caught a Northern Pike. =
|
||||
You didn't catch any fish. =
|
||||
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 =
|
||||
Fish =
|
||||
Roasted Fish =
|
||||
Sushi (Hoso Maki) =
|
||||
Clownfish =
|
||||
Bluefish =
|
||||
Shark =
|
||||
Roasted Shark =
|
||||
Northern Pike =
|
||||
Roasted Northern Pike =
|
||||
|
||||
### init.lua ###
|
||||
Fishing Pole =
|
||||
Dirt =
|
||||
Wooden Hoe =
|
||||
Stone Hoe =
|
||||
Steel Hoe =
|
||||
Bronze Hoe =
|
||||
|
||||
### 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 =
|
||||
Blue white fish Trophy =
|
||||
Trophy =
|
||||
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 Blue white fish was caught by the Famous Angler %s ! =
|
||||
This Huge Bluefish was caught by the Famous Angler %s ! =
|
||||
|
||||
### worms.lua ###
|
||||
Worm =
|
||||
Worm =
|
||||
Dirt =
|
||||
Wooden Hoe =
|
||||
Stone Hoe =
|
||||
Steel Hoe =
|
||||
Bronze Hoe =
|
||||
|
||||
|
35
mods/fishing/material.lua
Executable file
@ -0,0 +1,35 @@
|
||||
|
||||
|
||||
-- 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' },
|
||||
})
|
171
mods/fishing/poles.lua
Executable file
@ -0,0 +1,171 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing Pole
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
local function rod_wear(itemstack, user, pointed_thing, uses)
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
return itemstack
|
||||
end
|
||||
|
||||
fishing_setting.poles = {}
|
||||
fishing_setting.poles.wood = {["name"] = "wood", ["max_use"] = 30, ["desc"] = fishing_setting.func.S("Fishing Pole"),["bobber_max"] = 2 }
|
||||
fishing_setting.poles.perfect = {["name"] = "perfect", ["max_use"] = 1500, ["desc"] = fishing_setting.func.S("Perfect Fishing Pole"),["bobber_max"] = 5}
|
||||
|
||||
|
||||
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^[transformFXR270",
|
||||
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
|
||||
|
||||
--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
|
||||
|
||||
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, fishing_setting.func.S("You don't have mores %s bobbers!"):format(bobber_max))
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local bobbers = {}
|
||||
local objs = minetest.get_objects_inside_radius(pt.under, 3)
|
||||
for m, obj in pairs(objs) do
|
||||
if obj:get_luaentity() ~= nil and string.find(obj:get_luaentity().name, "fishing:bobber") ~= nil then
|
||||
bobbers[m] = obj
|
||||
end
|
||||
end
|
||||
|
||||
local nodes = {}
|
||||
local i = 1
|
||||
for _,k in pairs({ 1, 0, -1}) do
|
||||
for _,l in pairs({ -1, 0, 1}) do
|
||||
local node_name = minetest.get_node({x=pt.under.x+l, y=pt.under.y, z=pt.under.z+k}).name
|
||||
if node and string.find(node_name, "water_source") ~= nil
|
||||
and minetest.get_node({x=pt.under.x+l, y=pt.under.y+1, z=pt.under.z+k}).name == "air" then
|
||||
local empty = true
|
||||
for o, obj in pairs(bobbers) do
|
||||
local p = obj:getpos()
|
||||
local dist = ((p.x-pt.under.x)^2 + (p.y-pt.under.y)^2 + (p.z-pt.under.z)^2)^0.5
|
||||
if dist < 2 then
|
||||
empty = false
|
||||
break
|
||||
end
|
||||
end
|
||||
if empty then
|
||||
nodes[i] = {x=pt.under.x+l, y=pt.under.y, z=pt.under.z+k}
|
||||
i = i+1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--if water == -3 nodes
|
||||
if #nodes < 2 then
|
||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player_name, fishing_setting.func.S("You don't fishing in a bottle!")) end
|
||||
return nil
|
||||
end
|
||||
local new_pos = nodes[math.random(1, #nodes)]
|
||||
new_pos.y=new_pos.y+(45/64)
|
||||
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 meta = minetest.get_meta(pt.above)
|
||||
minetest.set_node(pt.above, {name="fishing:pole_".. pole.name .."_deco", param2=direction})
|
||||
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
|
46
mods/fishing/prizes.lua
Executable file
@ -0,0 +1,46 @@
|
||||
|
||||
|
||||
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."}
|
||||
}
|
||||
|
||||
|
||||
-- Here's what you can prizes
|
||||
local plants = {
|
||||
-- MoD iTeM WeaR MeSSaGe ("You caught "..)
|
||||
{"default", "stick", 0, "a Twig."},
|
||||
{"mobs", "rat", 0, "a Rat."},
|
||||
{"flowers", "seaweed", 0, "some Seaweed."},
|
||||
{"seaplants", "kelpgreen", 0, "a Green Kelp."},
|
||||
{"farming", "string", 0, "a String."},
|
||||
{"trunks", "twig_1", 0, "a Twig."}
|
||||
}
|
||||
fishing_setting.prizes["plants"] = fishing_setting.func.ignore_mod(plants)
|
||||
|
||||
local stuff = {
|
||||
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole."},
|
||||
{"3d_armor", "boots_wood", "random", "some very old Boots."},
|
||||
{"maptools", "gold_coin", 0, "a Gold Coin."},
|
||||
{"3d_armor", "helmet_diamond", "random", "a very old Helmet."},
|
||||
{"shields", "shield_enhanced_cactus", "random", "a very old Shield."},
|
||||
{"default", "sword_bronze", "random", "a very old Sword."},
|
||||
{"default", "sword_mese", "random", "a very old Sword."},
|
||||
{"default", "sword_nyan", "random", "a very old Sword."}
|
||||
}
|
||||
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,9 +1,12 @@
|
||||
MESSAGES = true
|
||||
FISH_CHANCE = 94
|
||||
SIMPLE_DECO_FISHING_POLE = true
|
||||
WEAR_OUT = true
|
||||
BOBBER_VIEW_RANGE = 7
|
||||
NEW_WORM_SOURCE = true
|
||||
WORM_IS_MOB = true
|
||||
WORM_CHANCE = 66
|
||||
WEAR_OUT = true
|
||||
BOBBER_CHECK_RADIUS = 5
|
||||
SIMPLE_DECO_FISHING_POLE = true
|
||||
SHARK_CHANCE = 42
|
||||
FISH_CHANCE = 60
|
||||
SHARK_CHANCE = 50
|
||||
TREASURE_CHANCE = 5
|
||||
TREASURE_RANDOM_ENABLE = true
|
||||
ESCAPE_CHANCE = 5
|
||||
|
@ -1,4 +1,11 @@
|
||||
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_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/
|
||||
|
BIN
mods/fishing/sounds/fishing_baitball.ogg
Executable file
BIN
mods/fishing/sounds/fishing_contest_end.ogg
Executable file
BIN
mods/fishing/sounds/fishing_contest_start.ogg
Executable file
Before Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 122 B |
Before Width: | Height: | Size: 122 B |
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 251 B |
Before Width: | Height: | Size: 229 B |
BIN
mods/fishing/textures/fishing_bait_bread.png
Executable file
After Width: | Height: | Size: 596 B |
BIN
mods/fishing/textures/fishing_bait_corn.png
Executable file
After Width: | Height: | Size: 540 B |
BIN
mods/fishing/textures/fishing_bait_worm.png
Executable file
After Width: | Height: | Size: 280 B |
BIN
mods/fishing/textures/fishing_baitball.png
Executable file
After Width: | Height: | Size: 503 B |
BIN
mods/fishing/textures/fishing_baitball_shark.png
Executable file
After Width: | Height: | Size: 569 B |
BIN
mods/fishing/textures/fishing_bluewhite_raw.png
Executable file
After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 580 B |
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 352 B |
BIN
mods/fishing/textures/fishing_bobber_shark.png
Executable file
After Width: | Height: | Size: 541 B |
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 205 B |
BIN
mods/fishing/textures/fishing_clownfish_raw.png
Executable file
After Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 486 B After Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 448 B |
BIN
mods/fishing/textures/fishing_fish_raw.png
Executable file
After Width: | Height: | Size: 486 B |
BIN
mods/fishing/textures/fishing_particle_baitball.png
Executable file
After Width: | Height: | Size: 180 B |
BIN
mods/fishing/textures/fishing_particle_baitball_shark.png
Executable file
After Width: | Height: | Size: 223 B |
Before Width: | Height: | Size: 192 B |
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 702 B |
BIN
mods/fishing/textures/fishing_pike_raw.png
Executable file
After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 158 B |
Before Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 134 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 177 B |
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 132 B After Width: | Height: | Size: 190 B |
Before Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 132 B |
BIN
mods/fishing/textures/fishing_pole_wood.png
Executable file
After Width: | Height: | Size: 265 B |
BIN
mods/fishing/textures/fishing_pole_wood_back.png
Executable file
After Width: | Height: | Size: 235 B |
BIN
mods/fishing/textures/fishing_pole_wood_bottom.png
Executable file
After Width: | Height: | Size: 215 B |
BIN
mods/fishing/textures/fishing_pole_wood_deco.png
Executable file
After Width: | Height: | Size: 354 B |
BIN
mods/fishing/textures/fishing_pole_wood_front.png
Executable file
After Width: | Height: | Size: 214 B |
BIN
mods/fishing/textures/fishing_pole_wood_simple.png
Executable file
After Width: | Height: | Size: 303 B |
BIN
mods/fishing/textures/fishing_pole_wood_top.png
Executable file
After Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 321 B |
Before Width: | Height: | Size: 699 B After Width: | Height: | Size: 763 B |
BIN
mods/fishing/textures/fishing_shark_raw.png
Executable file
After Width: | Height: | Size: 389 B |
Before Width: | Height: | Size: 562 B After Width: | Height: | Size: 590 B |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 206 B |
Before Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 137 B |
Before Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 323 B |
@ -1,26 +1,19 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Trophies 0.0.2
|
||||
-- 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
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
local TRoPHY = {
|
||||
-- MoD iTeM NaMe iCoN
|
||||
{"fishing", "fish_raw", "Fish", "fishing_fish.png"},
|
||||
{"fishing", "pike", "Northern Pike", "fishing_pike.png"},
|
||||
{"fishing", "shark", "Shark", "fishing_shark.png"},
|
||||
{"animal_clownfish", "clownfish", "Clownfish", "animal_clownfish_clownfish_item.png"},
|
||||
{"animal_fish_blue_white", "fish_blue_white", "Blue white fish", "animal_fish_blue_white_fish_blue_white_item.png"},
|
||||
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)
|
||||
@ -30,14 +23,14 @@ local function has_trophy_privilege(meta, player)
|
||||
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 = S(NaMe.." Trophy"),
|
||||
inventory_image = "default_chest_top.png^"..iCoN.."^fishing_trophy_label.png",
|
||||
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 = "default_chest_top.png^"..icon.."^fishing_trophy_label.png",
|
||||
drawtype = "nodebox",
|
||||
tiles = {
|
||||
"default_chest_top.png", -- top
|
||||
@ -45,7 +38,7 @@ for i in pairs(TRoPHY) do
|
||||
"default_chest_top.png", -- right
|
||||
"default_chest_top.png", -- left
|
||||
"default_chest_top.png", -- back
|
||||
"default_chest_top.png^"..iCoN.."^fishing_trophy_label.png", -- front
|
||||
"default_chest_top.png^"..icon.."^fishing_trophy_label.png", -- front
|
||||
},
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -68,11 +61,11 @@ for i in pairs(TRoPHY) do
|
||||
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", S("This Huge "..NaMe.." was caught by the Famous Angler %s !"):format((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("infotext", name)
|
||||
meta:set_string("owner", "")
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
@ -81,10 +74,11 @@ for i in pairs(TRoPHY) do
|
||||
end,
|
||||
})
|
||||
|
||||
--[[
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "fishing:trophy_"..iTeM,
|
||||
recipe = {MoD..":"..iTeM, "default:sign_wall"},
|
||||
output = "fishing:trophy_"..item,
|
||||
recipe = {mod..":"..item, "default:sign_wall"},
|
||||
})
|
||||
|
||||
--]]
|
||||
end
|
||||
|
@ -1,5 +1,6 @@
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing - Mossmanikin's version - Worm 0.0.2
|
||||
-- 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
|
||||
@ -7,22 +8,13 @@
|
||||
-- Dependencies: default
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- WORM ITEM
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:bait_worm", {
|
||||
description = S("Worm"),
|
||||
groups = { fishing_bait=1 },
|
||||
inventory_image = "fishing_worm.png",
|
||||
description = fishing_setting.func.S("Worm"),
|
||||
groups = { fishing_bait=1 },
|
||||
inventory_image = "fishing_bait_worm.png",
|
||||
on_use = minetest.item_eat(1),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pt = pointed_thing
|
||||
@ -46,7 +38,7 @@ minetest.register_entity("fishing:bait_worm_entity", {
|
||||
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_worm.png", "fishing_worm.png"},
|
||||
textures = { "fishing_bait_worm.png", "fishing_bait_worm.png"},
|
||||
view_range = 32,
|
||||
-- Don't punch this poor creature...
|
||||
on_punch = function(self, puncher)
|
||||
@ -62,6 +54,20 @@ minetest.register_entity("fishing:bait_worm_entity", {
|
||||
-- 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)
|
||||
@ -74,7 +80,6 @@ minetest.register_entity("fishing:bait_worm_entity", {
|
||||
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)
|
||||
@ -125,4 +130,116 @@ minetest.register_craft({
|
||||
{"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 p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z}
|
||||
local above = minetest.get_node(p)
|
||||
|
||||
-- return if any of the nodes is not registered
|
||||
if not minetest.registered_nodes[under.name] then
|
||||
return
|
||||
end
|
||||
if not minetest.registered_nodes[above.name] then
|
||||
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, play sound, get worm and wear out item
|
||||
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
|
||||
itemstack:add_wear(65535/(uses-1))
|
||||
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
|