mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-05 10:00:26 +01:00
6b7b073cd9
- Moved callbacks call when setting class - Fixed reservation system
57 lines
1.2 KiB
Lua
Executable File
57 lines
1.2 KiB
Lua
Executable File
-------------------
|
|
-- 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 = {}
|
|
pclasses.api.util = {}
|
|
|
|
-- Configuration
|
|
pclasses.conf = {}
|
|
pclasses.conf.default_class = "adventurer"
|
|
pclasses.conf.save_interval = 3 * 60
|
|
pclasses.conf.datafile = minetest.get_worldpath() .. "/pclasses"
|
|
|
|
-- Classes
|
|
pclasses.classes = {}
|
|
|
|
-- Data
|
|
pclasses.data = {}
|
|
pclasses.data.players = {}
|
|
pclasses.data.reserved_items = {}
|
|
pclasses.data.hud_ids = {} -- HUD maybe?
|
|
|
|
dofile(minetest.get_modpath("pclasses") .. "/api.lua")
|
|
|
|
|
|
|
|
------------------
|
|
-- Default class
|
|
--
|
|
|
|
if pclasses.conf.default_class then
|
|
dofile(minetest.get_modpath("pclasses") .. "/" .. pclasses.conf.default_class .. ".lua")
|
|
if pclasses.api.get_class_by_name(pclasses.conf.default_class) then
|
|
minetest.register_on_joinplayer(function(player)
|
|
pclasses.api.assign_class(player)
|
|
end)
|
|
end
|
|
end
|
|
|
|
|
|
|
|
------------
|
|
-- Classes
|
|
--
|
|
|
|
dofile(minetest.get_modpath("pclasses") .. "/warrior.lua")
|
|
dofile(minetest.get_modpath("pclasses") .. "/hunter.lua")
|
|
dofile(minetest.get_modpath("pclasses") .. "/admin.lua")
|
|
|