init.lua 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. -----------------------------------------------------------------------------------------------
  2. local title = "Fishing - Crabman77's (MFF team) version"
  3. local version = "1.0.0"
  4. local mname = "fishing"
  5. -----------------------------------------------------------------------------------------------
  6. -- original by wulfsdad (http://forum.minetest.net/viewtopic.php?id=4375)
  7. -- rewrited by Mossmanikin (https://forum.minetest.net/viewtopic.php?id=6480)
  8. -- this version rewrited by Crabman77
  9. -- License (code & textures): WTFPL
  10. -- Contains code from: animal_clownfish, animal_fish_blue_white, fishing (original), stoneage
  11. -- Looked at code from: default, farming
  12. -- Dependencies: default
  13. -- Supports: animal_clownfish, animal_fish_blue_white, animal_rat, mobs
  14. -----------------------------------------------------------------------------------------------
  15. minetest.log("action","[mod fishing] Loading...")
  16. local path = minetest.get_modpath("fishing").."/"
  17. fishing_setting = {}
  18. fishing_setting.func = {}
  19. fishing_setting.is_creative_mode = minetest.setting_getbool("creative_mode")
  20. fishing_setting.file_settings = minetest.get_worldpath() .. "/fishing_config.txt"
  21. fishing_setting.file_trophies = minetest.get_worldpath() .. "/fishing_trophies.txt"
  22. fishing_setting.file_contest = minetest.get_worldpath() .. "/fishing_contest.txt"
  23. fishing_setting.file_planned = minetest.get_worldpath() .. "/fishing_planned.txt"
  24. fishing_setting.settings = {}
  25. fishing_setting.contest = {}
  26. fishing_setting.planned = {}
  27. --for random object
  28. random_objects = {}
  29. fishing_setting.baits = {}
  30. fishing_setting.hungry = {}
  31. fishing_setting.prizes = {}
  32. fishing_setting.trophies = {}
  33. if (minetest.get_modpath("intllib")) then
  34. dofile(minetest.get_modpath("intllib").."/intllib.lua")
  35. fishing_setting.func.S = intllib.Getter(minetest.get_current_modname())
  36. else
  37. fishing_setting.func.S = function ( s ) return s end
  38. end
  39. dofile(path .."settings.txt")
  40. dofile(path .."functions.lua")
  41. --default_settings
  42. fishing_setting.settings["message"] = MESSAGES
  43. fishing_setting.settings["worm_is_mob"] = WORM_IS_MOB
  44. fishing_setting.settings["worm_chance"] = WORM_CHANCE
  45. fishing_setting.settings["new_worm_source"] = NEW_WORM_SOURCE
  46. fishing_setting.settings["wear_out"] = WEAR_OUT
  47. fishing_setting.settings["simple_deco_fishing_pole"] = SIMPLE_DECO_FISHING_POLE
  48. fishing_setting.settings["bobber_view_range"] = BOBBER_VIEW_RANGE
  49. fishing_setting.settings["fish_chance"] = FISH_CHANCE
  50. fishing_setting.settings["shark_chance"] = SHARK_CHANCE
  51. fishing_setting.settings["treasure_chance"] = TREASURE_CHANCE
  52. fishing_setting.settings["treasure_enable"] = TREASURE_RANDOM_ENABLE
  53. fishing_setting.settings["escape_chance"] = ESCAPE_CHANCE
  54. -- to mobs_fish|mobs_sharks modpack
  55. if (minetest.get_modpath("mobs_fish") ~= nil or minetest.get_modpath("mobs_sharks") ~= nil) then
  56. fishing_setting.have_true_fish = true
  57. end
  58. -- load config file if exist in worldpath
  59. fishing_setting.func.load()
  60. dofile(path .."worms.lua")
  61. dofile(path .."crafting.lua")
  62. dofile(path .."baits.lua")
  63. dofile(path .."prizes.lua")
  64. dofile(path .."baitball.lua")
  65. dofile(path .."bobber.lua")
  66. dofile(path .."bobber_shark.lua")
  67. dofile(path .."fishes.lua")
  68. dofile(path .."trophies.lua")
  69. dofile(path .."poles.lua")
  70. --random hungry bait
  71. fishing_setting.func.hungry_random()
  72. --load table caught fish by players
  73. fishing_setting.func.load_trophies()
  74. --load table contest
  75. fishing_setting.func.load_contest()
  76. fishing_setting.func.tick()
  77. fishing_setting.func.planned_tick()
  78. -----------------------------------------------------------------------------------------------
  79. minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
  80. -----------------------------------------------------------------------------------------------