2015-04-16 21:33:56 +02:00
|
|
|
print("loading [fishing] mod")
|
2015-06-09 23:09:47 +02:00
|
|
|
local path = minetest.get_modpath("fishing").."/"
|
|
|
|
|
2015-04-16 21:33:56 +02:00
|
|
|
fishing_setting = {}
|
2015-06-09 23:09:47 +02:00
|
|
|
fishing_setting.func = {}
|
|
|
|
fishing_setting.is_creative_mode = minetest.setting_getbool("creative_mode")
|
|
|
|
fishing_setting.file = minetest.get_worldpath() .. "/fishing_config.txt"
|
2015-04-16 21:33:56 +02:00
|
|
|
|
2015-06-09 23:09:47 +02:00
|
|
|
fishing_setting.settings = {}
|
|
|
|
--for random object
|
|
|
|
random_objects = {}
|
|
|
|
fishing_setting.baits = {}
|
2015-06-16 01:42:05 +02:00
|
|
|
fishing_setting.hungry = {}
|
2015-06-09 23:09:47 +02:00
|
|
|
fishing_setting.prizes = {}
|
|
|
|
fishing_setting.settings.chance = {}
|
2015-04-16 21:33:56 +02:00
|
|
|
|
|
|
|
if (minetest.get_modpath("intllib")) then
|
|
|
|
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
2015-06-16 01:42:05 +02:00
|
|
|
fishing_setting.func.S = intllib.Getter(minetest.get_current_modname())
|
2015-04-16 21:33:56 +02:00
|
|
|
else
|
2015-06-16 01:42:05 +02:00
|
|
|
fishing_setting.func.S = function ( s ) return s end
|
2015-04-16 21:33:56 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2015-06-09 23:09:47 +02:00
|
|
|
dofile(path .."settings.txt")
|
|
|
|
dofile(path .."functions.lua")
|
2015-04-16 21:33:56 +02:00
|
|
|
|
2015-06-16 01:42:05 +02:00
|
|
|
--default_settings
|
2015-06-09 23:09:47 +02:00
|
|
|
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.chance["fish"] = CHANCE_FISH
|
|
|
|
fishing_setting.settings.chance["tresor"] = CHANCE_TRESOR
|
|
|
|
fishing_setting.settings.chance["shark"] = CHANCE_SHARK
|
|
|
|
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()
|
|
|
|
|
2015-04-16 21:33:56 +02:00
|
|
|
|
|
|
|
dofile(path .."crafting.lua")
|
|
|
|
dofile(path .."baits.lua")
|
|
|
|
dofile(path .."prizes.lua")
|
2015-06-16 01:42:05 +02:00
|
|
|
dofile(path .."baitball.lua")
|
2015-04-16 21:33:56 +02:00
|
|
|
dofile(path .."bobber.lua")
|
|
|
|
--dofile(path .."bobber_shark.lua")
|
|
|
|
dofile(path .."fishes.lua")
|
|
|
|
dofile(path .."trophies.lua")
|
|
|
|
dofile(path .."poles.lua")
|
2015-06-16 01:42:05 +02:00
|
|
|
dofile(path .."chatcommands.lua")
|
2015-04-16 21:33:56 +02:00
|
|
|
|
2015-06-16 01:42:05 +02:00
|
|
|
--random hungry bait
|
|
|
|
fishing_setting.func.hungry_random()
|
2015-04-16 21:33:56 +02:00
|
|
|
|
|
|
|
-- timer
|
2015-06-16 01:42:05 +02:00
|
|
|
fishing_setting.timer = fishing_setting.settings["tresor_timer"]
|
2015-04-16 21:33:56 +02:00
|
|
|
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
|
2015-06-16 01:42:05 +02:00
|
|
|
-- fishing_setting.timer = fishing_setting.settings["tresor_timer"]
|
2015-04-16 21:33:56 +02:00
|
|
|
-- end
|
|
|
|
-- if timer == 300 then
|
|
|
|
--you have 5min for catch item
|
|
|
|
-- end
|
|
|
|
if fishing_setting.timer < 0 then
|
|
|
|
for _, player in ipairs(minetest.get_connected_players()) do
|
|
|
|
local name = player:get_player_name()
|
|
|
|
--FIXME display message
|
|
|
|
end
|
2015-06-16 01:42:05 +02:00
|
|
|
--set random object
|
|
|
|
fishing_setting.timer = fishing_setting.settings["tresor_timer"]
|
2015-04-16 21:33:56 +02:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
2015-06-09 23:09:47 +02:00
|
|
|
print("loaded [fishing] mod")
|