forked from mff/fishing
fix PR traduction break condition and missing variable renamed
fix typo in worms.lua
This commit is contained in:
parent
74486b832a
commit
fe062390ed
|
@ -1,7 +1,4 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- baitball
|
-- baitball
|
||||||
minetest.register_craftitem("fishing:baitball", {
|
minetest.register_craftitem("fishing:baitball", {
|
||||||
description = fishing_setting.func.S("Bait Ball"),
|
description = fishing_setting.func.S("Bait Ball"),
|
||||||
|
|
|
@ -25,4 +25,3 @@ fishing_setting.baits["fishing:fish_raw"] = { ["bait"] = "fishing:fish_raw", ["b
|
||||||
|
|
||||||
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: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 }
|
fishing_setting.baits["fishing:bluewhite_raw"] = { ["bait"] = "fishing:bluewhite_raw", ["bobber"] = "fishing:bobber_shark_entity",["texture"] = "fishing_bluewhite_raw.png", ["hungry"] = 50 }
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ local FISHING_BOBBER_ENTITY={
|
||||||
visual = "wielditem",
|
visual = "wielditem",
|
||||||
visual_size = {x=1/3, y=1/3, z=1/3},
|
visual_size = {x=1/3, y=1/3, z=1/3},
|
||||||
textures = {"fishing:bobber_box"},
|
textures = {"fishing:bobber_box"},
|
||||||
-- {left ,bottom, front, right, top , back}
|
-- {left ,bottom, front, right, top , back}
|
||||||
collisionbox = {-2/16, -4/16, -2/16, 2/16, 1/16, 2/16},
|
collisionbox = {-2/16, -4/16, -2/16, 2/16, 1/16, 2/16},
|
||||||
randomtime = 50,
|
randomtime = 50,
|
||||||
baitball = 0,
|
baitball = 0,
|
||||||
|
@ -64,7 +64,7 @@ local FISHING_BOBBER_ENTITY={
|
||||||
end,
|
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)
|
on_rightclick = function (self, clicker)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
local playername = clicker:get_player_name()
|
local playername = clicker:get_player_name()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
--function save settings
|
--function save settings
|
||||||
function fishing_setting.func.save()
|
function fishing_setting.func.save()
|
||||||
local input, err = io.open(fishing_setting.file_settings, "w")
|
local input, err = io.open(fishing_setting.file_settings, "w")
|
||||||
if input then
|
if input then
|
||||||
|
@ -61,7 +61,7 @@ function fishing_setting.func.set_settings(new_settings, settings)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--function load settings from file
|
--function load settings from file
|
||||||
function fishing_setting.func.load()
|
function fishing_setting.func.load()
|
||||||
local file = io.open(fishing_setting.file_settings, "r")
|
local file = io.open(fishing_setting.file_settings, "r")
|
||||||
local settings = {}
|
local settings = {}
|
||||||
|
@ -187,7 +187,7 @@ fishing_setting.func.on_show_settings = function(player_name)
|
||||||
-- WORM_IS_MOB
|
-- WORM_IS_MOB
|
||||||
"label[6,7.3;"..S("Worm is a mob (reboot)").."]"..
|
"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[9.7,7.1;1,1;wormmob;"..tostring(fishing_setting.tmp_setting["worm_is_mob"]).."]"..
|
||||||
"button_exit[0,8.2;1.5,1;save;"..S("Abort").."]"..
|
"button_exit[0,8.2;1.5,1;abort;"..S("Abort").."]"..
|
||||||
"button_exit[9.2,8.2;1.5,1;save;"..S("OK").."]"
|
"button_exit[9.2,8.2;1.5,1;save;"..S("OK").."]"
|
||||||
minetest.show_formspec(player_name, "fishing:settings", formspec)
|
minetest.show_formspec(player_name, "fishing:settings", formspec)
|
||||||
end
|
end
|
||||||
|
@ -217,7 +217,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if not player_name then return end
|
if not player_name then return end
|
||||||
if formname == "fishing:settings" then
|
if formname == "fishing:settings" then
|
||||||
if fields["save"] == "Ok" then
|
if fields["save"] then
|
||||||
fishing_setting.func.set_settings(fishing_setting.settings, fishing_setting.tmp_setting)
|
fishing_setting.func.set_settings(fishing_setting.settings, fishing_setting.tmp_setting)
|
||||||
fishing_setting.func.save()
|
fishing_setting.func.save()
|
||||||
fishing_setting.tmp_setting = nil
|
fishing_setting.tmp_setting = nil
|
||||||
|
@ -266,7 +266,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--function load settings from file
|
--function load settings from file
|
||||||
function fishing_setting.func.load_trophies()
|
function fishing_setting.func.load_trophies()
|
||||||
local file = io.open(fishing_setting.file_trophies, "r")
|
local file = io.open(fishing_setting.file_trophies, "r")
|
||||||
fishing_setting.trophies = {}
|
fishing_setting.trophies = {}
|
||||||
|
@ -303,15 +303,17 @@ function fishing_setting.func.timetostr(time)
|
||||||
if countdown >= 3600 then
|
if countdown >= 3600 then
|
||||||
local hours = math.floor(countdown / 3600)
|
local hours = math.floor(countdown / 3600)
|
||||||
countdown = countdown % 3600
|
countdown = countdown % 3600
|
||||||
answer = hours .. "H"
|
answer = hours .. "h"
|
||||||
end
|
end
|
||||||
if countdown >= 60 then
|
if countdown >= 60 then
|
||||||
local minutes = math.floor(countdown / 60)
|
local minutes = math.floor(countdown / 60)
|
||||||
countdown = countdown % 60
|
countdown = countdown % 60
|
||||||
answer = answer .. minutes .. "M"
|
answer = answer .. minutes .. "m"
|
||||||
|
else
|
||||||
|
answer = answer .. "0m"
|
||||||
end
|
end
|
||||||
local seconds = countdown
|
local seconds = countdown
|
||||||
answer = answer .. math.floor(seconds) .. "S"
|
answer = answer .. math.floor(seconds) .. "s"
|
||||||
return answer
|
return answer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -341,7 +343,7 @@ function fishing_setting.func.add_to_trophies(player, fish, desc)
|
||||||
minetest.spawn_item(player:getpos(), {name=name, count=1, wear=0, metadata=""})
|
minetest.spawn_item(player:getpos(), {name=name, count=1, wear=0, metadata=""})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
|
if fishing_setting.contest["contest"] ~= nil and fishing_setting.contest["contest"] == true then
|
||||||
if fishing_setting.contest[fish] == nil then
|
if fishing_setting.contest[fish] == nil then
|
||||||
fishing_setting.contest[fish] = {}
|
fishing_setting.contest[fish] = {}
|
||||||
|
@ -379,13 +381,12 @@ if (minetest.get_modpath("unified_inventory")) then
|
||||||
local formspec = fishing_setting.func.get_stat()
|
local formspec = fishing_setting.func.get_stat()
|
||||||
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
minetest.show_formspec(player_name, "fishing:classement", formspec)
|
||||||
end
|
end
|
||||||
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--function save settings
|
--function save settings
|
||||||
function fishing_setting.func.save_contest()
|
function fishing_setting.func.save_contest()
|
||||||
local input = io.open(fishing_setting.file_contest, "w")
|
local input = io.open(fishing_setting.file_contest, "w")
|
||||||
if input then
|
if input then
|
||||||
|
@ -396,7 +397,7 @@ function fishing_setting.func.save_contest()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--function load councours data from file
|
--function load councours data from file
|
||||||
function fishing_setting.func.load_contest()
|
function fishing_setting.func.load_contest()
|
||||||
local file = io.open(fishing_setting.file_contest, "r")
|
local file = io.open(fishing_setting.file_contest, "r")
|
||||||
local settings = {}
|
local settings = {}
|
||||||
|
@ -433,6 +434,12 @@ function fishing_setting.func.load_contest()
|
||||||
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
|
--Menu fishing configuration
|
||||||
fishing_setting.func.on_show_settings_contest = function(player_name)
|
fishing_setting.func.on_show_settings_contest = function(player_name)
|
||||||
|
@ -441,7 +448,7 @@ fishing_setting.func.on_show_settings_contest = function(player_name)
|
||||||
fishing_setting.tmp_setting = { ["contest"] = (fishing_setting.contest["contest"] or false),
|
fishing_setting.tmp_setting = { ["contest"] = (fishing_setting.contest["contest"] or false),
|
||||||
["duration"] = (math.floor(fishing_setting.contest["duration"]) or 3600),
|
["duration"] = (math.floor(fishing_setting.contest["duration"]) or 3600),
|
||||||
["bobber_nb"] = (fishing_setting.contest["bobber_nb"] or 2),
|
["bobber_nb"] = (fishing_setting.contest["bobber_nb"] or 2),
|
||||||
["reset"] = ""
|
["reset"] = false
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
local formspec = "size[6.1,7]label[1.9,0;"..S("Fishing contest").."]"..
|
local formspec = "size[6.1,7]label[1.9,0;"..S("Fishing contest").."]"..
|
||||||
|
@ -461,9 +468,9 @@ fishing_setting.func.on_show_settings_contest = function(player_name)
|
||||||
"label[0.8,3.8;"..S("Enable contests").."]"..
|
"label[0.8,3.8;"..S("Enable contests").."]"..
|
||||||
"button[4.5,3.6;1,1;contest;"..tostring(fishing_setting.tmp_setting["contest"]).."]"..
|
"button[4.5,3.6;1,1;contest;"..tostring(fishing_setting.tmp_setting["contest"]).."]"..
|
||||||
--reset
|
--reset
|
||||||
"label[0.8,5.2;"..S("Reset rankings (type 'yes')").."]"..
|
"label[0.8,5.2;"..S("Reset rankings").."]"..
|
||||||
"field[4.8,5.4;1,1;reset;;]"..
|
"button[4.5,5;1,1;reset;"..tostring(fishing_setting.tmp_setting["reset"]).."]"..
|
||||||
"button_exit[0.8,6.2;1.5,1;save;"..S("Abort").."]"..
|
"button_exit[0.8,6.2;1.5,1;abort;"..S("Abort").."]"..
|
||||||
"button_exit[4,6.2;1.5,1;save;"..S("OK").."]"
|
"button_exit[4,6.2;1.5,1;save;"..S("OK").."]"
|
||||||
minetest.show_formspec(player_name, "fishing:contest", formspec)
|
minetest.show_formspec(player_name, "fishing:contest", formspec)
|
||||||
end
|
end
|
||||||
|
@ -472,15 +479,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname == "fishing:contest" then
|
if formname == "fishing:contest" then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if not name then return end
|
if not name then return end
|
||||||
if fields["save"] == "Ok" then
|
if fields["save"] then
|
||||||
if fields["reset"] and fields["reset"]:lower() == "yes" then
|
if fishing_setting.tmp_setting["reset"] == true then
|
||||||
fishing_setting.contest["fish_raw"] = {}
|
fishing_setting.contest["fish_raw"] = {}
|
||||||
fishing_setting.contest["clownfish_raw"] = {}
|
fishing_setting.contest["clownfish_raw"] = {}
|
||||||
fishing_setting.contest["bluewhite_raw"] = {}
|
fishing_setting.contest["bluewhite_raw"] = {}
|
||||||
fishing_setting.contest["shark_raw"] = {}
|
fishing_setting.contest["shark_raw"] = {}
|
||||||
fishing_setting.contest["pike_raw"] = {}
|
fishing_setting.contest["pike_raw"] = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local progress = (fishing_setting.contest["contest"] or false)
|
local progress = (fishing_setting.contest["contest"] or false)
|
||||||
fishing_setting.contest["duration"] = fishing_setting.tmp_setting["duration"]
|
fishing_setting.contest["duration"] = fishing_setting.tmp_setting["duration"]
|
||||||
fishing_setting.contest["contest"] = fishing_setting.tmp_setting["contest"]
|
fishing_setting.contest["contest"] = fishing_setting.tmp_setting["contest"]
|
||||||
|
@ -491,9 +498,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local time = fishing_setting.func.timetostr(fishing_setting.contest["duration"])
|
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.chat_send_all(fishing_setting.func.S("Attention, Fishing contest start (duration %s)!!!"):format(time))
|
||||||
minetest.sound_play("fishing_contest_start",{gain=0.8})
|
minetest.sound_play("fishing_contest_start",{gain=0.8})
|
||||||
|
|
||||||
elseif progress == true and fishing_setting.tmp_setting["contest"] == false then
|
elseif progress == true and fishing_setting.tmp_setting["contest"] == false then
|
||||||
fishing_setting.contest["contest"] = false
|
fishing_setting.func.end_contest()
|
||||||
end
|
end
|
||||||
fishing_setting.func.save_contest()
|
fishing_setting.func.save_contest()
|
||||||
fishing_setting.tmp_setting = nil
|
fishing_setting.tmp_setting = nil
|
||||||
|
@ -507,6 +513,8 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
fishing_setting.tmp_setting["contest"] = bool(fields["contest"])
|
fishing_setting.tmp_setting["contest"] = bool(fields["contest"])
|
||||||
elseif fields["bobbernb"] then
|
elseif fields["bobbernb"] then
|
||||||
fishing_setting.tmp_setting["bobber_nb"] = inc(fishing_setting.tmp_setting["bobber_nb"], fields["bobbernb"], 1, 8)
|
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
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -520,7 +528,7 @@ function spairs(t, order)
|
||||||
local keys = {}
|
local keys = {}
|
||||||
for k in pairs(t) do keys[#keys+1] = k end
|
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,
|
-- if order function given, sort by it by passing the table and keys a, b,
|
||||||
-- otherwise just sort the keys
|
-- otherwise just sort the keys
|
||||||
if order then
|
if order then
|
||||||
table.sort(keys, function(a,b) return order(t, a, b) end)
|
table.sort(keys, function(a,b) return order(t, a, b) end)
|
||||||
else
|
else
|
||||||
|
@ -615,6 +623,3 @@ function fishing_setting.func.show_result()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
9
init.lua
9
init.lua
|
@ -51,8 +51,8 @@ fishing_setting.settings["simple_deco_fishing_pole"] = SIMPLE_DECO_FISHING_POLE
|
||||||
fishing_setting.settings["bobber_view_range"] = BOBBER_VIEW_RANGE
|
fishing_setting.settings["bobber_view_range"] = BOBBER_VIEW_RANGE
|
||||||
fishing_setting.settings["fish_chance"] = FISH_CHANCE
|
fishing_setting.settings["fish_chance"] = FISH_CHANCE
|
||||||
fishing_setting.settings["shark_chance"] = SHARK_CHANCE
|
fishing_setting.settings["shark_chance"] = SHARK_CHANCE
|
||||||
fishing_setting.settings["treasure_chance"] = TRESOR_CHANCE
|
fishing_setting.settings["treasure_chance"] = TREASURE_CHANCE
|
||||||
fishing_setting.settings["treasure_enable"] = TRESOR_RANDOM_ENABLE
|
fishing_setting.settings["treasure_enable"] = TREASURE_RANDOM_ENABLE
|
||||||
fishing_setting.settings["escape_chance"] = ESCAPE_CHANCE
|
fishing_setting.settings["escape_chance"] = ESCAPE_CHANCE
|
||||||
|
|
||||||
-- load config file if exist in worldpath
|
-- load config file if exist in worldpath
|
||||||
|
@ -87,10 +87,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
fishing_setting.contest["warning_said"] = true
|
fishing_setting.contest["warning_said"] = true
|
||||||
end
|
end
|
||||||
if fishing_setting.contest["duration"] < 0 then
|
if fishing_setting.contest["duration"] < 0 then
|
||||||
minetest.chat_send_all(fishing_setting.func.S("End of fishing contest."))
|
fishing_setting.func.end_contest()
|
||||||
minetest.sound_play("fishing_contest_end",{gain=0.8})
|
|
||||||
fishing_setting.contest["contest"] = false
|
|
||||||
fishing_setting.func.show_result()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
|
|
||||||
-- useless or useful ???
|
-- useless or useful ??? No activated
|
||||||
minetest.register_node("fishing:material_info", {
|
minetest.register_node("fishing:material_info", {
|
||||||
description = fishing_setting.func.S("Show information about hunger fish"),
|
description = fishing_setting.func.S("Show information about hunger fish"),
|
||||||
name = "Fishing Info Center",
|
name = "Fishing Info Center",
|
||||||
|
|
|
@ -138,7 +138,7 @@ minetest.register_craft({
|
||||||
-- get worms from digging in dirt:
|
-- get worms from digging in dirt:
|
||||||
if fishing_setting.settings["new_worm_source"] == false then
|
if fishing_setting.settings["new_worm_source"] == false then
|
||||||
minetest.register_node(":default:dirt", {
|
minetest.register_node(":default:dirt", {
|
||||||
description = fishing_setting.func.fishing_setting.func.S("Dirt"),
|
description = fishing_setting.func.S("Dirt"),
|
||||||
tiles = {"default_dirt.png"},
|
tiles = {"default_dirt.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly=3},
|
groups = {crumbly=3},
|
||||||
|
|
Loading…
Reference in New Issue