mirror of
https://github.com/MinetestForFun/fishing.git
synced 2024-11-13 01:20:19 +01:00
continue rewriting
refactor code rename files
This commit is contained in:
parent
ab67ad83b3
commit
03e2321a22
|
@ -1,4 +1,12 @@
|
|||
minetest fishing mod
|
||||
|
||||
NOT STABLE VERSION
|
||||
|
||||
DO NO USE
|
||||
|
||||
IMCOMPLETE CODE
|
||||
|
||||
--rewriting total in progress...
|
||||
|
||||
|
||||
-- original by 4aiman https://github.com/4aiman/fishing
|
||||
|
|
19
baitball.lua
Normal file
19
baitball.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- baitball
|
||||
|
||||
minetest.register_craftitem("fishing:baitball", {
|
||||
description = "Bait Ball",
|
||||
inventory_image = "fishing_baitball.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "fishing:baitball",
|
||||
recipe = {"farming:flour", "farming:corn", "food:egg", "bucket:bucket_water"}
|
||||
})
|
25
baits.lua
25
baits.lua
|
@ -1,20 +1,31 @@
|
|||
|
||||
|
||||
|
||||
--fish bait
|
||||
--bait_corn
|
||||
minetest.register_craftitem("fishing:bait_corn", {
|
||||
description = "Bait corn",
|
||||
inventory_image = "fishing_bait_corn.png",
|
||||
})
|
||||
|
||||
fishing_setting.baits["fishing:bait_corn"] = { ["bait"] = "fishing:bait_corn", ["bobber"] = "fishing:bobber_entity" }
|
||||
fishing_setting.baits["fishing:bait_corn"] = { ["bait"] = "fishing:bait_corn", ["bobber"] = "fishing:bobber_entity", ["hungry"] = 50 }
|
||||
|
||||
|
||||
|
||||
--bait_pain
|
||||
minetest.register_craftitem("fishing:bait_pain", {
|
||||
description = "Bait pain",
|
||||
--bait_bread
|
||||
minetest.register_craftitem("fishing:bait_bread", {
|
||||
description = "Bait Bread",
|
||||
inventory_image = "fishing_bait_corn.png",
|
||||
})
|
||||
|
||||
fishing_setting.baits["fishing:bait_pain"] = { ["bait"] = "fishing:bait_pain", ["bobber"] = "fishing:bobber_entity" }
|
||||
fishing_setting.baits["fishing:bait_bread"] = { ["bait"] = "fishing:bait_bread", ["bobber"] = "fishing:bobber_entity", ["hungry"] = 50 }
|
||||
|
||||
|
||||
--bait_worm
|
||||
fishing_setting.baits["fishing:bait_worm"] = { ["bait"] = "fishing:bait_worm", ["bobber"] = "fishing:bobber_entity", ["hungry"] = 50 }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--shark bait
|
||||
--bait_fish
|
||||
fishing_setting.baits["fishing:bait_fish"] = { ["bait"] = "fishing:bait_fish", ["bobber"] = "fishing:bobber_entity_shark", ["hungry"] = 50 }
|
||||
|
|
60
bobber.lua
60
bobber.lua
|
@ -1,5 +1,4 @@
|
|||
|
||||
|
||||
-- bobber
|
||||
minetest.register_node("fishing:bobber_box", {
|
||||
drawtype = "nodebox",
|
||||
|
@ -35,20 +34,21 @@ local FISHING_BOBBER_ENTITY={
|
|||
-- {left ,bottom, front, right, top , back}
|
||||
collisionbox = {-2/16, -4/16, -2/16, 2/16, 0/16, 2/16},
|
||||
randomtime = 50,
|
||||
amorce = 0,
|
||||
baitball = 0,
|
||||
prize = "",
|
||||
bait = "",
|
||||
|
||||
-- DESTROY BOBBER WHEN PUNCHING IT
|
||||
on_punch = function (self, puncher, time_from_last_punch, tool_capabilities, dir)
|
||||
if not puncher:is_player() then return end
|
||||
local player = puncher:get_player_name()
|
||||
if player ~= self.owner then return end
|
||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player, fishing_setting.S("You didn't prizes anything."), false) end
|
||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player, fishing_setting.func.S("You didn't prizes 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, fishing_setting.S("The bait is still there."), false) end
|
||||
if fishing_setting.settings["message"] == true then minetest.chat_send_player(player, fishing_setting.func.S("The bait is still there."), false) end
|
||||
end
|
||||
end
|
||||
-- make sound and remove bobber
|
||||
|
@ -57,8 +57,6 @@ local FISHING_BOBBER_ENTITY={
|
|||
end,
|
||||
|
||||
|
||||
|
||||
|
||||
-- WHEN RIGHTCLICKING THE BOBBER THE FOLLOWING HAPPENS (CLICK AT THE RIGHT TIME WHILE HOLDING A FISHING POLE)
|
||||
on_rightclick = function (self, clicker)
|
||||
local item = clicker:get_wielded_item()
|
||||
|
@ -71,7 +69,6 @@ local FISHING_BOBBER_ENTITY={
|
|||
if self.prize ~= "" then
|
||||
local name = self.prize[1]..":"..self.prize[2]
|
||||
local desc = self.prize[4]
|
||||
print("You caught "..name.." "..desc)
|
||||
minetest.chat_send_player(player, "You caught "..desc, false)
|
||||
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
|
||||
|
@ -85,11 +82,11 @@ local FISHING_BOBBER_ENTITY={
|
|||
minetest.sound_play("fishing_bobber1", { pos = self.object:getpos(), gain = 0.5, })
|
||||
self.object:remove()
|
||||
|
||||
elseif item:get_name() == "fishing:amorce" then
|
||||
elseif item:get_name() == "fishing:baitball" then
|
||||
if not fishing_setting.is_creative_mode then
|
||||
inv:remove_item("main", "fishing:amorce")
|
||||
inv:remove_item("main", "fishing:baitball")
|
||||
end
|
||||
self.amorce = 20
|
||||
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
|
||||
|
@ -97,16 +94,13 @@ local FISHING_BOBBER_ENTITY={
|
|||
{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_amorce.png")
|
||||
false, "fishing_particle_baitball.png")
|
||||
-- add sound
|
||||
minetest.sound_play("fishing_bobber1", {pos = self.object:getpos(), gain = 0.2, })
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-- AS SOON AS THE BOBBER IS PLACED IT WILL ACT LIKE
|
||||
on_step = function(self, dtime)
|
||||
local pos = self.object:getpos()
|
||||
|
@ -127,9 +121,7 @@ local FISHING_BOBBER_ENTITY={
|
|||
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/2880*math.pi))
|
||||
end
|
||||
|
||||
|
||||
self.timer = self.timer + 1
|
||||
|
||||
if self.timer < self.randomtime then
|
||||
-- if fish or others items, move bobber to simulate fish on the line
|
||||
if self.prize ~= "" and math.random(1,3) == 1 then
|
||||
|
@ -137,7 +129,6 @@ local FISHING_BOBBER_ENTITY={
|
|||
pos.y = pos.y-0.0325
|
||||
self.object:moveto(pos, false)
|
||||
self.old_pos2 = false
|
||||
--minetest.sound_play("fishing_bobber1", {pos=pos,gain = 0.5,})
|
||||
else
|
||||
pos.y = pos.y+0.0325
|
||||
self.object:moveto(pos, false)
|
||||
|
@ -147,49 +138,32 @@ local FISHING_BOBBER_ENTITY={
|
|||
return
|
||||
end
|
||||
|
||||
if self.prize == fishing_setting.prizes.tresor then
|
||||
minetest.chat_send_player(player, "You lost the tresor, bad luck", false)
|
||||
end
|
||||
|
||||
--change item on line
|
||||
self.timer = 0
|
||||
self.prize = ""
|
||||
self.object:moveto(self.old_pos, false)
|
||||
self.randomtime = math.random(2,12)*10
|
||||
--Once the fish are not hungry :)
|
||||
-- amorce increase lucky + 20%
|
||||
if math.random(1, 100) > fishing_setting.settings.chance["hungry_fish"] + self.amorce then
|
||||
--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 chance = math.random(1, 100)
|
||||
print(" chance: " .. tostring(chance) .. " randomtime: "..tostring(self.randomtime))
|
||||
--if 1 you catch a tresor, maybe ...
|
||||
if chance == 1 then
|
||||
--You are lucky ? :)
|
||||
if math.random(1, 100) <= fishing_setting.settings.chance["tresor"] then
|
||||
self.prize = fishing_setting.prizes.tresor
|
||||
else
|
||||
self.prize = fishing_setting.prizes.stuff[math.random(1,#fishing_setting.prizes.stuff)]
|
||||
end
|
||||
elseif chance <= fishing_setting.settings.chance["fish"] then
|
||||
self.prize = fishing_setting.prizes.fish[math.random(1,#fishing_setting.prizes.fish)]
|
||||
self.randomtime = math.random(1,5)*10
|
||||
if math.random(1, 100) <= fishing_setting.settings.chance["fish"] 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.loose[math.random(1,#fishing_setting.prizes.loose)]
|
||||
self.prize = fishing_setting.prizes["plants"][math.random(1,#fishing_setting.prizes["plants"])]
|
||||
end
|
||||
end
|
||||
|
||||
if self.prize ~= nil and self.prize ~= "" then
|
||||
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,})
|
||||
print("prize: "..tostring(self.prize[1])..":"..tostring(self.prize[2]))
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
minetest.register_entity("fishing:bobber_entity", FISHING_BOBBER_ENTITY)
|
||||
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
|
||||
|
||||
|
||||
|
||||
minetest.register_chatcommand("fishingset", {
|
||||
params = "",
|
||||
description = "Display volume menu formspec",
|
||||
privs = {interact=true},
|
||||
func = function(name, param)
|
||||
if not name then return end
|
||||
fishing_setting.func.on_show_settings(name)
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
-----------------------------------------------------------------------------------------------
|
||||
-- Fishing Pole
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- Wood Fishing Pole
|
||||
minetest.register_craft({
|
||||
output = "fishing:pole_wood",
|
||||
recipe = {
|
||||
|
@ -57,9 +58,9 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
--bait pain
|
||||
--bait bread
|
||||
minetest.register_craft({
|
||||
output = "fishing:bait_pain 9",
|
||||
output = "fishing:bait_bread 9",
|
||||
recipe = {
|
||||
{"", "farming:bread", ""},
|
||||
}
|
||||
|
|
22
fishes.lua
22
fishes.lua
|
@ -3,20 +3,12 @@
|
|||
-- 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"),
|
||||
description = fishing_setting.func.S("Fish"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_fish.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
|
@ -25,7 +17,7 @@ minetest.register_craftitem("fishing:fish_raw", {
|
|||
-- Roasted Fish
|
||||
-----------------------------------------------------
|
||||
minetest.register_craftitem("fishing:fish", {
|
||||
description = S("Roasted Fish"),
|
||||
description = fishing_setting.func.S("Roasted Fish"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_fish_cooked.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
|
@ -34,7 +26,7 @@ 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),
|
||||
|
@ -44,7 +36,7 @@ minetest.register_craftitem("fishing:fish_raw", {
|
|||
-- Whatthef... it's a freakin' Shark!
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:shark", {
|
||||
description = S("Shark"),
|
||||
description = fishing_setting.func.S("Shark"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_shark.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
|
@ -53,7 +45,7 @@ minetest.register_craftitem("fishing:shark", {
|
|||
-- 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),
|
||||
|
@ -63,7 +55,7 @@ minetest.register_craftitem("fishing:shark", {
|
|||
-- Pike
|
||||
-----------------------------------------------------------------------------------------------
|
||||
minetest.register_craftitem("fishing:pike", {
|
||||
description = S("Northern Pike"),
|
||||
description = fishing_setting.func.S("Northern Pike"),
|
||||
groups = {},
|
||||
inventory_image = "fishing_pike.png",
|
||||
on_use = minetest.item_eat(2),
|
||||
|
@ -72,7 +64,7 @@ minetest.register_craftitem("fishing:pike", {
|
|||
-- 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),
|
||||
|
|
210
functions.lua
210
functions.lua
|
@ -6,14 +6,11 @@ function fishing_setting.func.save()
|
|||
input:write(minetest.serialize(fishing_setting.settings))
|
||||
input:close()
|
||||
else
|
||||
minetest.log("action","echec d'ouverture (mode:w) de " .. fishing_setting.file)
|
||||
minetest.log("action","Open failed (mode:w) of " .. fishing_setting.file)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function fishing_setting.func.load()
|
||||
local file = io.open(fishing_setting.file, "r")
|
||||
local settings = {}
|
||||
|
@ -64,10 +61,6 @@ function fishing_setting.func.load()
|
|||
fishing_setting.settings.chance["shark"] = settings.chance["shark"]
|
||||
end
|
||||
|
||||
if settings.chance["hungry_fish"] ~= nil then
|
||||
fishing_setting.settings.chance["hungry_fish"] = settings.chance["hungry_fish"]
|
||||
end
|
||||
|
||||
if settings["tresor_timer"] ~= nil then
|
||||
fishing_setting.settings["tresor_timer"] = settings["tresor_timer"]
|
||||
end
|
||||
|
@ -77,8 +70,6 @@ function fishing_setting.func.load()
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--function return wear tool value (old or new)
|
||||
function fishing_setting.func.wear_value(wear)
|
||||
local used = 0
|
||||
|
@ -90,13 +81,202 @@ function fishing_setting.func.wear_value(wear)
|
|||
return used
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
minetest.log("action", "[fishing] Server shuts down. Saving config")
|
||||
fishing_setting.func.save()
|
||||
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)
|
||||
print("hungry " ..i..": " ..fishing_setting.baits[i]["hungry"])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- show notification when player catch tresor
|
||||
function fishing_setting.func.notify(f_name, tresor)
|
||||
local title = f_name .." catch a tresor"
|
||||
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
--FIXME display message
|
||||
--if name == f_name then
|
||||
-- fishing_setting.func.notify_send(name, tresor, message)
|
||||
--else
|
||||
fishing_setting.func.notify_send(name, title, tresor[4])
|
||||
--end
|
||||
end
|
||||
end
|
||||
|
||||
-- show notification when player catch tresor
|
||||
function fishing_setting.func.notify_send(name, title, message)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
local one = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
name = "award_bg",
|
||||
scale = {x = 1, y = 1},
|
||||
text = "bg_default.png",
|
||||
position = {x = 0.5, y = 0},
|
||||
offset = {x = 0, y = 138},
|
||||
alignment = {x = 0, y = -1}
|
||||
})
|
||||
local two = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
name = "award_au",
|
||||
number = 0xFFFFFF,
|
||||
scale = {x = 100, y = 20},
|
||||
text = title,
|
||||
position = {x = 0.5, y = 0},
|
||||
offset = {x = 0, y = 40},
|
||||
alignment = {x = 0, y = -1}
|
||||
})
|
||||
local three = player:hud_add({
|
||||
hud_elem_type = "text",
|
||||
name = "award_title",
|
||||
number = 0xFFFFFF,
|
||||
scale = {x = 100, y = 20},
|
||||
text = message,
|
||||
position = {x = 0.5, y = 0},
|
||||
offset = {x = 30, y = 100},
|
||||
alignment = {x = 0, y = -1}
|
||||
})
|
||||
local four = player:hud_add({
|
||||
hud_elem_type = "image",
|
||||
name = "award_icon",
|
||||
scale = {x = 4, y = 4},
|
||||
text = "fishing_pole_perfect.png",
|
||||
position = {x = 0.5, y = 0},
|
||||
offset = {x = -81.5, y = 126},
|
||||
alignment = {x = 0, y = -1}
|
||||
})
|
||||
minetest.after(6, function()
|
||||
player:hud_remove(one)
|
||||
player:hud_remove(two)
|
||||
player:hud_remove(three)
|
||||
player:hud_remove(four)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--Menu fishing configuration
|
||||
local formspec = "size[11,10]"..
|
||||
"label[4,0;Fishing Config]"..
|
||||
|
||||
--Chance fish
|
||||
"label[1.6,0.5;Chance fish]"..
|
||||
"button[0,1;1,1;hsharkd1;-1]"..
|
||||
"button[1,1;1,1;hsharkd10;-10]"..
|
||||
"label[2.1,1.2;%s]"..
|
||||
"button[2.7,1;1,1;hsharki10;+10]"..
|
||||
"button[3.7,1;1,1;hsharki1;+1]"..
|
||||
|
||||
--Chance shark
|
||||
"label[1.5,2;Chance shark]"..
|
||||
"button[0,2.5;1,1;hfishd1;-1]"..
|
||||
"button[1,2.5;1,1;hfishd10;-10]"..
|
||||
"label[2.1,2.7;%s]"..
|
||||
"button[2.7,2.5;1,1;hfishi10;+10]"..
|
||||
"button[3.7,2.5;1,1;hfishi1;+1]"..
|
||||
|
||||
|
||||
--Chance tresor
|
||||
"label[1.5,3.5;Chance tresor]"..
|
||||
"button[0,4.;1,1;hfishd1;-1]"..
|
||||
"button[1,4;1,1;hfishd10;-10]"..
|
||||
"label[2.1,4.2;%s]"..
|
||||
"button[2.7,4;1,1;hfishi10;+10]"..
|
||||
"button[3.7,4;1,1;hfishi1;+1]"..
|
||||
|
||||
|
||||
|
||||
--Bobber view range
|
||||
"label[7.4,0.5;Bobber view range]"..
|
||||
"button[7,1;1,1;hfishd1;-1]"..
|
||||
"label[8.1,1.2;%s]"..
|
||||
"button[8.7,1;1,1;hfishi1;+1]"..
|
||||
|
||||
--Chance worm
|
||||
"label[7.5,2;Chance worm]"..
|
||||
"button[6,2.5;1,1;hfishd1;-1]"..
|
||||
"button[7,2.5;1,1;hfishd10;-10]"..
|
||||
"label[8.1,2.7;%s]"..
|
||||
"button[8.7,2.5;1,1;hfishi10;+10]"..
|
||||
"button[9.7,2.5;1,1;hfishi1;+1]"..
|
||||
|
||||
|
||||
--Timer tresor
|
||||
"label[7.5,3.5;Timer tresor]"..
|
||||
"button[6,4.;1,1;hfishd10;-10]"..
|
||||
"button[7,4;1,1;hfishd100;-100]"..
|
||||
"label[8.1,4.2;%s]"..
|
||||
"button[8.7,4;1,1;hfishi100;+100]"..
|
||||
"button[9.7,4;1,1;hfishi10;+10]"..
|
||||
|
||||
|
||||
"button[0,5.2;1,1;messages;true]"..
|
||||
"label[1,5.4;Messages]"..
|
||||
|
||||
"button[0,6;1,1;poledeco;true]"..
|
||||
"label[1,6.2;Simple pole deco]"..
|
||||
|
||||
"button[0,8.2;1,1;wearout;true]"..
|
||||
"label[1,8.4;Wear out]"..
|
||||
|
||||
"button[0,9.7;1,1;newworm;true]"..
|
||||
"label[1,9.4;New worm source]"..
|
||||
|
||||
|
||||
"button_exit[0.5,9.2;1.5,1;abort;Abort]"..
|
||||
"button_exit[8,9.2;1.5,1;abort;Ok]"
|
||||
|
||||
|
||||
|
||||
--[[
|
||||
MESSAGES = true
|
||||
SIMPLE_DECO_FISHING_POLE = true
|
||||
WEAR_OUT = true
|
||||
NEW_WORM_SOURCE = true
|
||||
WORM_IS_MOB = true
|
||||
TRESOR_RANDOM_ENABLE = true
|
||||
|
||||
|
||||
BOBBER_VIEW_RANGE = 7
|
||||
CHANCE_FISH = 60
|
||||
CHANCE_SHARK = 30
|
||||
CHANCE_TRESOR = 5
|
||||
TRESOR_TIMER = 3600
|
||||
WORM_CHANCE = 66
|
||||
--]]
|
||||
|
||||
|
||||
fishing_setting.func.on_show_settings = function(name, music, ambience, other)
|
||||
minetest.show_formspec( name, "fishing:settings", string.format(formspec, tostring("7"), tostring("80"), tostring("80"), tostring("08"), tostring("08"), tostring("08")))
|
||||
end
|
||||
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname == "fishing:settings" then
|
||||
local name = player:get_player_name()
|
||||
if not name then return end
|
||||
|
||||
if fields["abort"] == "Ok" then
|
||||
print("ok")
|
||||
--fishing_setting.func.save()
|
||||
return
|
||||
elseif fields["abort"] == "Abort" then
|
||||
return
|
||||
elseif fields["quit"] == "true" then
|
||||
return
|
||||
else
|
||||
return
|
||||
end
|
||||
|
||||
fishing_setting.func.on_show_settings(name)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
|
25
init.lua
25
init.lua
|
@ -10,22 +10,22 @@ fishing_setting.settings = {}
|
|||
--for random object
|
||||
random_objects = {}
|
||||
fishing_setting.baits = {}
|
||||
fishing_setting.hungry = {}
|
||||
fishing_setting.prizes = {}
|
||||
fishing_setting.settings["timer_tresor"] = 3600
|
||||
fishing_setting.settings.chance = {}
|
||||
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
fishing_setting.S = intllib.Getter(minetest.get_current_modname())
|
||||
fishing_setting.func.S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
fishing_setting.S = function ( s ) return s end
|
||||
fishing_setting.func.S = function ( s ) return s end
|
||||
end
|
||||
|
||||
|
||||
dofile(path .."settings.txt")
|
||||
dofile(path .."functions.lua")
|
||||
|
||||
|
||||
--default_settings
|
||||
fishing_setting.settings["message"] = MESSAGES
|
||||
fishing_setting.settings["worm_is_mob"] = WORM_IS_MOB
|
||||
fishing_setting.settings["worm_chance"] = WORM_CHANCE
|
||||
|
@ -36,12 +36,9 @@ fishing_setting.settings["bobber_view_range"] = BOBBER_VIEW_RANGE
|
|||
fishing_setting.settings.chance["fish"] = CHANCE_FISH
|
||||
fishing_setting.settings.chance["tresor"] = CHANCE_TRESOR
|
||||
fishing_setting.settings.chance["shark"] = CHANCE_SHARK
|
||||
fishing_setting.settings.chance["hungry_fish"] = HUNGRY_FISH
|
||||
fishing_setting.settings["tresor_timer"] = TRESOR_TIMER
|
||||
fishing_setting.settings["tresor_random_enable"] = TRESOR_RANDOM_ENABLE
|
||||
|
||||
|
||||
|
||||
-- load config file if exist in worldpath
|
||||
fishing_setting.func.load()
|
||||
|
||||
|
@ -49,23 +46,25 @@ fishing_setting.func.load()
|
|||
dofile(path .."crafting.lua")
|
||||
dofile(path .."baits.lua")
|
||||
dofile(path .."prizes.lua")
|
||||
dofile(path .."amorce.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 .."chatcommands.lua")
|
||||
|
||||
|
||||
--random hungry bait
|
||||
fishing_setting.func.hungry_random()
|
||||
|
||||
-- timer
|
||||
fishing_setting.timer = fishing_setting.settings["timer_tresor"]
|
||||
fishing_setting.timer = fishing_setting.settings["tresor_timer"]
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if fishing_setting.enable == false then return end
|
||||
fishing_setting.timer = fishing_setting.timer - dtime
|
||||
-- if fishing.new_object then
|
||||
-- new object is item, time to catch is timer
|
||||
-- fishing_setting.timer = fishing_setting.settings["timer_tresor"]
|
||||
-- fishing_setting.timer = fishing_setting.settings["tresor_timer"]
|
||||
-- end
|
||||
-- if timer == 300 then
|
||||
--you have 5min for catch item
|
||||
|
@ -75,8 +74,8 @@ minetest.register_globalstep(function(dtime)
|
|||
local name = player:get_player_name()
|
||||
--FIXME display message
|
||||
end
|
||||
--get random object
|
||||
fishing_setting.timer = fishing_setting.settings["timer_tresor"]
|
||||
--set random object
|
||||
fishing_setting.timer = fishing_setting.settings["tresor_timer"]
|
||||
end
|
||||
end)
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ end
|
|||
|
||||
|
||||
fishing_setting.poles = {}
|
||||
fishing_setting.poles.wood = {["name"] = "wood", ["max_use"] = 30, ["desc"] = fishing_setting.S("Fishing Pole") }
|
||||
fishing_setting.poles.perfect = {["name"] = "perfect", ["max_use"] = 1500, ["desc"] = fishing_setting.S("Perfect Fishing Pole") }
|
||||
fishing_setting.poles.wood = {["name"] = "wood", ["max_use"] = 30, ["desc"] = fishing_setting.func.S("Fishing Pole") }
|
||||
fishing_setting.poles.perfect = {["name"] = "perfect", ["max_use"] = 1500, ["desc"] = fishing_setting.func.S("Perfect Fishing Pole") }
|
||||
|
||||
|
||||
for _,pole in pairs(fishing_setting.poles) do
|
||||
|
|
14
prizes.lua
14
prizes.lua
|
@ -1,13 +1,13 @@
|
|||
minetest.register_alias("flowers_plus:seaweed", "flowers:seaweed") -- exception
|
||||
|
||||
|
||||
fishing_setting.prizes.fish = {
|
||||
fishing_setting.prizes["fish"] = {
|
||||
{"fishing", "fish_raw", 0, "a Fish."}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
-- Here's what you can prizes
|
||||
fishing_setting.prizes.loose = {
|
||||
fishing_setting.prizes["plants"] = {
|
||||
-- MoD iTeM WeaR MeSSaGe ("You caught "..)
|
||||
{"default", "stick", 0, "a Twig."},
|
||||
{"mobs", "rat", 0, "a Rat."},
|
||||
|
@ -18,9 +18,11 @@ fishing_setting.prizes.loose = {
|
|||
}
|
||||
|
||||
|
||||
fishing_setting.prizes.stuff = {
|
||||
fishing_setting.prizes["stuff"] = {
|
||||
{"fishing", "pole_wood", "randomtools", "an old Fishing Pole."},
|
||||
{"3d_armor", "boots_wood", "random", "some very old Boots."}
|
||||
}
|
||||
|
||||
fishing_setting.prizes.tresor = {"default", "mese", 0, "a mese block."}
|
||||
|
||||
fishing_setting.prizes["tresor"] = {"default", "mese", 0, "a mese block."}
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
MESSAGES = true
|
||||
SIMPLE_DECO_FISHING_POLE = true
|
||||
WEAR_OUT = true
|
||||
BOBBER_VIEW_RANGE = 7
|
||||
NEW_WORM_SOURCE = true
|
||||
WORM_IS_MOB = true
|
||||
WORM_CHANCE = 66
|
||||
BOBBER_VIEW_RANGE = 7
|
||||
CHANCE_FISH = 60
|
||||
CHANCE_SHARK = 30
|
||||
CHANCE_SHARK = 50
|
||||
CHANCE_TRESOR = 5
|
||||
HUNGRY_FISH = 80
|
||||
TRESOR_TIMER = 3600
|
||||
TRESOR_RANDOM_ENABLE = true
|
||||
|
|
BIN
textures/fishing_baitball.png
Normal file
BIN
textures/fishing_baitball.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 503 B |
BIN
textures/fishing_particle_baitball.png
Normal file
BIN
textures/fishing_particle_baitball.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 180 B |
Loading…
Reference in New Issue
Block a user