2019-03-06 04:57:23 -08:00
|
|
|
--
|
2020-02-18 03:40:21 -08:00
|
|
|
-- petz
|
2019-05-02 14:14:00 -07:00
|
|
|
-- License:GPLv3
|
2019-03-06 04:57:23 -08:00
|
|
|
--
|
|
|
|
|
|
|
|
local modname = "petz"
|
|
|
|
local modpath = minetest.get_modpath(modname)
|
|
|
|
|
|
|
|
-- internationalization boilerplate
|
|
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
|
|
|
|
2019-08-15 14:10:00 -07:00
|
|
|
--
|
|
|
|
--The Petz
|
|
|
|
--
|
|
|
|
|
|
|
|
petz = {}
|
|
|
|
|
|
|
|
--
|
|
|
|
--Settings
|
|
|
|
--
|
|
|
|
petz.settings = {}
|
|
|
|
petz.settings.mesh = nil
|
|
|
|
petz.settings.visual_size = {}
|
|
|
|
petz.settings.rotate = 0
|
2019-08-15 14:21:27 -07:00
|
|
|
|
2020-08-07 13:32:54 -07:00
|
|
|
assert(loadfile(modpath .. "/settings.lua"))(modpath) --Load the settings
|
2019-08-15 14:10:00 -07:00
|
|
|
|
2020-04-08 18:01:24 -07:00
|
|
|
petz.tamed_by_owner = {} --a list of tamed petz with owner
|
2019-08-15 14:10:00 -07:00
|
|
|
|
2020-11-15 04:03:45 -08:00
|
|
|
assert(loadfile(modpath .. "/api/api.lua"))(modpath, S)
|
2022-05-28 02:21:29 -07:00
|
|
|
assert(loadfile(modpath .. "/brains/brains.lua"))(modpath)
|
2020-01-20 09:20:59 -08:00
|
|
|
assert(loadfile(modpath .. "/misc/misc.lua"))(modpath, S)
|
2020-04-23 08:57:27 -07:00
|
|
|
assert(loadfile(modpath .. "/server/cron.lua"))(modname)
|
2019-03-06 04:57:23 -08:00
|
|
|
|
2019-07-20 17:26:32 -07:00
|
|
|
petz.file_exists = function(name)
|
|
|
|
local f = io.open(name,"r")
|
|
|
|
if f ~= nil then
|
|
|
|
io.close(f)
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-07-25 12:47:36 -07:00
|
|
|
if petz.settings["remove_list"] then
|
|
|
|
for i = 1, #petz.settings["remove_list"] do
|
2022-05-28 02:21:29 -07:00
|
|
|
local file_name = modpath .. "/petz/"..petz.settings["remove_list"][i].."_kitz"..".lua"
|
2021-07-25 12:47:36 -07:00
|
|
|
if petz.file_exists(file_name) then
|
|
|
|
assert(loadfile(file_name))(S)
|
|
|
|
end
|
|
|
|
--Override the petz_list
|
|
|
|
for j = 1, #petz.settings["petz_list"] do --load all the petz.lua files
|
|
|
|
if petz.settings["remove_list"][i] == petz.settings["petz_list"][j] then
|
|
|
|
table.remove(petz.settings["petz_list"], j)
|
2022-05-28 02:21:29 -07:00
|
|
|
--kitz.remove_table_by_key(petz.settings["petz_list"], j)
|
2021-07-25 12:47:36 -07:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-08-07 13:32:54 -07:00
|
|
|
for i = 1, #petz.settings["petz_list"] do --load all the petz.lua files
|
|
|
|
local file_name = modpath .. "/petz/"..petz.settings["petz_list"][i].."_mobkit"..".lua"
|
2019-10-18 07:00:51 -07:00
|
|
|
if petz.file_exists(file_name) then
|
2020-02-18 03:40:21 -08:00
|
|
|
assert(loadfile(file_name))(S)
|
2019-10-18 07:00:51 -07:00
|
|
|
end
|
2019-07-28 04:47:52 -07:00
|
|
|
end
|