1
0
mirror of https://github.com/MinetestForFun/fishing.git synced 2025-07-21 17:40:27 +02:00

finished rewriting

This commit is contained in:
2015-06-26 22:33:51 +02:00
parent b54cc08fe3
commit 3af28b21b7
69 changed files with 1296 additions and 398 deletions

View File

@ -1,10 +1,26 @@
print("loading [fishing] mod")
-----------------------------------------------------------------------------------------------
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)
-- rewrited by Mossmanikin (https://forum.minetest.net/viewtopic.php?id=6480)
-- this version rewrited by Crabman77
-- License (code & textures): WTFPL
-- Contains code from: animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
-- Looked at code from: default, farming
-- Dependencies: default
-- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
-----------------------------------------------------------------------------------------------
minetest.log("action","[mod fishing] Loading...")
local path = minetest.get_modpath("fishing").."/"
fishing_setting = {}
fishing_setting.func = {}
fishing_setting.is_creative_mode = minetest.setting_getbool("creative_mode")
fishing_setting.file = minetest.get_worldpath() .. "/fishing_config.txt"
fishing_setting.file_settings = minetest.get_worldpath() .. "/fishing_config.txt"
fishing_setting.file_trophies = minetest.get_worldpath() .. "/fishing_trophies.txt"
fishing_setting.settings = {}
--for random object
@ -12,6 +28,7 @@ random_objects = {}
fishing_setting.baits = {}
fishing_setting.hungry = {}
fishing_setting.prizes = {}
fishing_setting.trophies = {}
if (minetest.get_modpath("intllib")) then
dofile(minetest.get_modpath("intllib").."/intllib.lua")
@ -20,7 +37,6 @@ else
fishing_setting.func.S = function ( s ) return s end
end
dofile(path .."settings.txt")
dofile(path .."functions.lua")
@ -35,48 +51,28 @@ 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["tresor_chance"] = TRESOR_CHANCE
fishing_setting.settings["tresor_timer"] = TRESOR_TIMER
fishing_setting.settings["tresor_random_enable"] = TRESOR_RANDOM_ENABLE
fishing_setting.settings["tresor_enable"] = TRESOR_RANDOM_ENABLE
fishing_setting.settings["escape_chance"] = ESCAPE_CHANCE
-- load config file if exist in worldpath
fishing_setting.func.load()
dofile(path .."worms.lua")
dofile(path .."crafting.lua")
dofile(path .."baits.lua")
dofile(path .."prizes.lua")
dofile(path .."baitball.lua")
dofile(path .."bobber.lua")
--dofile(path .."bobber_shark.lua")
dofile(path .."bobber_shark.lua")
dofile(path .."fishes.lua")
dofile(path .."trophies.lua")
dofile(path .."poles.lua")
dofile(path .."chatcommands.lua")
--dofile(path .."material.lua")
--random hungry bait
fishing_setting.func.hungry_random()
--load table catched fish by players
fishing_setting.func.load_trophies()
-- timer
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["tresor_timer"]
-- 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
--set random object
fishing_setting.timer = fishing_setting.settings["tresor_timer"]
end
end)
print("loaded [fishing] mod")
-----------------------------------------------------------------------------------------------
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
-----------------------------------------------------------------------------------------------