2015-07-15 17:08:22 +02:00
|
|
|
-------------------
|
|
|
|
-- Player Classes
|
|
|
|
--
|
|
|
|
|
|
|
|
-- NOTE: This is a very simple interface for classes, more features will be
|
|
|
|
-- added depending on the various mechanisms we will need
|
|
|
|
|
|
|
|
-- Global namespace
|
|
|
|
pclasses = {}
|
|
|
|
|
|
|
|
-- API
|
|
|
|
pclasses.api = {}
|
2015-07-26 01:05:10 +02:00
|
|
|
pclasses.api.util = {}
|
2015-07-15 17:08:22 +02:00
|
|
|
|
2015-07-17 13:44:11 +02:00
|
|
|
-- Configuration
|
|
|
|
pclasses.conf = {}
|
|
|
|
pclasses.conf.default_class = "adventurer"
|
|
|
|
pclasses.conf.save_interval = 3 * 60
|
|
|
|
pclasses.conf.datafile = minetest.get_worldpath() .. "/pclasses"
|
|
|
|
|
2015-07-15 17:08:22 +02:00
|
|
|
-- Classes
|
|
|
|
pclasses.classes = {}
|
|
|
|
|
|
|
|
-- Data
|
2015-07-30 23:37:25 +02:00
|
|
|
pclasses.data = {}
|
|
|
|
pclasses.data.players = {}
|
|
|
|
pclasses.data.reserved_items = {}
|
|
|
|
pclasses.data.hud_ids = {} -- HUD maybe?
|
2015-07-15 17:08:22 +02:00
|
|
|
|
2015-07-27 19:13:30 +02:00
|
|
|
dofile(minetest.get_modpath("pclasses") .. "/api.lua")
|
2015-07-15 17:08:22 +02:00
|
|
|
|
|
|
|
|
2015-07-17 13:44:11 +02:00
|
|
|
|
2015-07-27 19:13:30 +02:00
|
|
|
------------------
|
|
|
|
-- Default class
|
2015-07-17 13:44:11 +02:00
|
|
|
--
|
2015-07-27 19:13:30 +02:00
|
|
|
|
2015-07-17 13:44:11 +02:00
|
|
|
if pclasses.conf.default_class then
|
2015-07-27 19:13:30 +02:00
|
|
|
dofile(minetest.get_modpath("pclasses") .. "/" .. pclasses.conf.default_class .. ".lua")
|
|
|
|
if pclasses.api.get_class_by_name(pclasses.conf.default_class) then
|
2015-07-17 13:44:11 +02:00
|
|
|
minetest.register_on_joinplayer(function(player)
|
2015-07-30 23:37:25 +02:00
|
|
|
pclasses.api.assign_class(player)
|
2015-07-17 13:44:11 +02:00
|
|
|
end)
|
|
|
|
end
|
|
|
|
end
|
2015-07-18 18:31:24 +02:00
|
|
|
|
2015-07-27 19:13:30 +02:00
|
|
|
|
2015-07-18 18:31:24 +02:00
|
|
|
|
|
|
|
------------
|
|
|
|
-- Classes
|
|
|
|
--
|
|
|
|
|
2015-07-27 19:13:30 +02:00
|
|
|
dofile(minetest.get_modpath("pclasses") .. "/warrior.lua")
|
|
|
|
dofile(minetest.get_modpath("pclasses") .. "/hunter.lua")
|
2015-07-28 16:14:51 +02:00
|
|
|
dofile(minetest.get_modpath("pclasses") .. "/admin.lua")
|
2015-07-19 23:20:01 +02:00
|
|
|
|