init.lua 728 B

12345678910111213141516171819202122232425262728293031
  1. defense_mob_api = {}
  2. local modpath = minetest.get_modpath("defense_mob_api")
  3. local function dofile2(file)
  4. return dofile(modpath .. "/" .. file)
  5. end
  6. local time_speed = minetest.setting_get("time_speed")
  7. function defense_mob_api:get_day_count()
  8. return math.floor(minetest.get_gametime() * time_speed / 86400)
  9. end
  10. function defense_mob_api:is_dark()
  11. local tod = minetest.get_timeofday()
  12. return tod < 0.2 or tod > 0.8 --or defense.debug
  13. end
  14. function defense_mob_api:log(message)
  15. if self.debug then
  16. minetest.chat_send_all("[debug] " .. message)
  17. end
  18. minetest.debug(message)
  19. end
  20. dofile2("pathfinder.lua")
  21. defense_mob_api.Swarm = dofile2("swarm.lua")
  22. dofile2("mob.lua")
  23. dofile2("debug.lua")