water_life/init.lua

129 lines
5.0 KiB
Lua
Raw Normal View History

2020-07-19 10:03:38 +02:00
-----------------------------------------------------------
--
-- Water_life copyright 2020 by Gundul
-- see software and media licenses in the licenses folder
--
-----------------------------------------------------------
2019-10-13 14:21:27 +02:00
water_life = {}
2020-07-25 12:20:45 +02:00
water_life.version = "250720"
2019-10-27 11:58:44 +01:00
water_life.shark_food = {}
2020-02-18 18:56:27 +07:00
water_life.petz = minetest.get_modpath("petz")
2020-05-18 18:48:34 +02:00
water_life.mobsredo = minetest.get_modpath("mobs")
2020-02-18 18:56:27 +07:00
water_life.abr = tonumber(minetest.settings:get('active_block_range')) or 2
water_life.abo = tonumber(minetest.settings:get('active_object_send_range_blocks')) or 3
2020-04-13 18:24:05 +02:00
water_life.whale_spawn_rate = tonumber(minetest.settings:get("water_life_whale_spawn_rate")) or 100
water_life.shark_spawn_rate = tonumber(minetest.settings:get("water_life_shark_spawn_rate")) or 100
water_life.urchin_spawn_rate = tonumber(minetest.settings:get("water_life_urchin_spawn_rate")) or 700
water_life.clams_spawn_rate = tonumber(minetest.settings:get("water_life_clams_spawn_rate")) or 500
2020-04-13 18:24:05 +02:00
water_life.fish_spawn_rate = tonumber(minetest.settings:get("water_life_fish_spawn_rate")) or 1000
water_life.maxwhales = tonumber(minetest.settings:get("water_life_maxwhales")) or 1
water_life.maxsharks = tonumber(minetest.settings:get("water_life_maxsharks")) or 5
2020-05-31 18:51:00 +02:00
water_life.maxmobs = tonumber(minetest.settings:get("water_life_maxmobs")) or 60
2020-04-13 18:24:05 +02:00
water_life.apionly = minetest.settings:get_bool("water_life_apionly") or false
water_life.radar_debug = minetest.settings:get_bool("water_life_radar_debug") or false
water_life.muddy_water = minetest.settings:get_bool("water_life_muddy_water") or false
2019-10-09 17:50:59 +02:00
2019-10-13 14:21:27 +02:00
local path = minetest.get_modpath(minetest.get_current_modname())
2020-02-18 18:56:27 +07:00
2020-04-04 16:31:30 +02:00
dofile(path.."/api.lua") -- load water_life api
2020-07-19 09:58:41 +02:00
dofile(path.."/paths.lua") -- load pathfinding
2020-04-04 16:31:30 +02:00
if water_life.muddy_water then dofile(path.."/mapgen.lua") end -- load muddy_water
2020-02-05 21:33:11 +07:00
dofile(path.."/crafts.lua") -- load crafts
dofile(path.."/buoy.lua") -- load buoy
2020-06-20 18:27:27 +02:00
dofile(path.."/chatcommands.lua") -- load chatcommands
2020-06-20 18:43:10 +02:00
dofile(path.."/behaviors.lua") -- load behaviors
2020-06-20 18:27:27 +02:00
2020-01-12 20:27:16 +07:00
if not water_life.apionly then
dofile(path.."/spawn.lua") -- load spawn function
2020-06-06 09:17:40 +02:00
dofile(path.."/animals/whale.lua") -- load whales
dofile(path.."/animals/shark.lua") -- load sharks
dofile(path.."/animals/riverfish.lua") -- load riverfish
dofile(path.."/animals/piranha.lua") -- load piranha
dofile(path.."/animals/sea_urchin.lua") -- load sea urchin
dofile(path.."/animals/clams.lua") -- load clams
dofile(path.."/flora/plants.lua") -- load water plants
dofile(path.."/flora/corals.lua") -- load corals
dofile(path.."/animals/jellyfish.lua") -- load jellyfish
dofile(path.."/animals/coralfish.lua") -- load coralfish
dofile(path.."/animals/clownfish.lua") -- load clownfish
2020-06-14 16:54:26 +02:00
dofile(path.."/animals/crocodile.lua") -- load crocodile
2020-07-25 12:20:45 +02:00
dofile(path.."/animals/gulls.lua") -- load gulls
2020-01-12 20:27:16 +07:00
end
2019-10-09 17:50:59 +02:00
2019-10-27 11:58:44 +01:00
2020-05-18 18:48:34 +02:00
--check which lasso to use
if water_life.mobsredo then
2020-05-21 09:49:26 +02:00
water_life.catchBA = "mobs:lasso"
2020-05-18 18:48:34 +02:00
if water_life.petz then minetest.unregister_item("petz:lasso") end
elseif water_life.petz then
water_life.catchBA = "petz:lasso"
else
water_life.catchBA = "water_life:lasso"
end
2019-10-27 11:58:44 +01:00
2020-02-05 21:33:11 +07:00
math.randomseed(os.time()) --init random seed
2019-11-10 11:39:00 +01:00
--remove old sharks
2019-10-09 17:50:59 +02:00
minetest.register_entity(":sharks:shark", {
on_activate = function(self, staticdata)
self.object:remove()
end,
})
2019-10-04 13:21:12 +02:00
2019-11-10 11:39:00 +01:00
minetest.register_entity(":zombiestrd:shark", {
on_activate = function(self, staticdata)
self.object:remove()
end,
})
2019-10-04 13:21:12 +02:00
2019-11-30 13:01:47 +01:00
-- register shark food
2020-06-20 18:27:27 +02:00
2019-11-30 13:01:47 +01:00
if minetest.get_modpath("wildlife") then
water_life.register_shark_food("wildlife:deer")
water_life.register_shark_food("wildlife:deer_tamed")
water_life.register_shark_food("wildlife:wolf")
2019-11-01 16:59:34 +01:00
end
2019-12-25 21:13:40 +08:00
if minetest.get_modpath("aerotest") then
water_life.register_shark_food("aerotest:eagle")
2019-12-25 21:13:40 +08:00
end
if minetest.get_modpath("petz") then
water_life.register_shark_food("petz:kitty")
2020-06-14 17:29:42 +02:00
water_life.register_shark_food("petz:rat")
water_life.register_shark_food("petz:goat")
water_life.register_shark_food("petz:puppy")
water_life.register_shark_food("petz:ducky")
water_life.register_shark_food("petz:lamb")
water_life.register_shark_food("petz:camel")
water_life.register_shark_food("petz:calf")
water_life.register_shark_food("petz:chicken")
water_life.register_shark_food("petz:piggy")
water_life.register_shark_food("petz:hamster")
water_life.register_shark_food("petz:chimp")
water_life.register_shark_food("petz:beaver")
water_life.register_shark_food("petz:turtle")
water_life.register_shark_food("petz:penguin")
water_life.register_shark_food("petz:lion")
water_life.register_shark_food("petz:grizzly")
water_life.register_shark_food("petz:pony")
water_life.register_shark_food("petz:wolf")
water_life.register_shark_food("petz:elephant")
water_life.register_shark_food("petz:elephant_female")
water_life.register_shark_food("petz:foxy")
water_life.register_shark_food("petz:polar_bear")
water_life.register_shark_food("petz:tarantula")
end