Da mod a libreria interna + README esplicativo
parent
d4eccbd4c4
commit
b1ea1cc90d
Before Width: | Height: | Size: 313 B After Width: | Height: | Size: 313 B |
Before Width: | Height: | Size: 390 B After Width: | Height: | Size: 390 B |
36
README.md
36
README.md
|
@ -1,2 +1,38 @@
|
|||
# Arena_lib
|
||||
|
||||
Arena_lib is a library for Minetest working as a core for any minigame you have in mind.
|
||||
It comes with an arena manager and a signs system. The latter creates a bridge inside your own server between the hub and your actual mod (deathmatch, capture the flag, assault, you name it). In other words, you don't have to do the boring job and you can focus exclusively on your arena minigame :*
|
||||
|
||||
|
||||
### Config
|
||||
1) **You DON'T need to create a different folder in your mods path.** Instead, create a folder called `arena_lib` inside your specific mod folder and put all the files of this repo there (mind the textures!).
|
||||
|
||||
2) Add this in your init.lua
|
||||
`dofile(minetest.get_modpath("quake") .. "/arena_lib/api.lua")`
|
||||
|
||||
3) You can customize the lib calling
|
||||
|
||||
```arena_lib.settings({
|
||||
prefix = "[whatever] "
|
||||
--other parameters
|
||||
})
|
||||
```
|
||||
in your init.lua.
|
||||
|
||||
For a in-depth understanding of what you can do with the library, have a look at the API document (TODO).
|
||||
|
||||
### Arena phases
|
||||
|
||||
An arena comes in 4 phases:
|
||||
- load
|
||||
- start
|
||||
- celebration
|
||||
- end
|
||||
|
||||
To add events such as to expand what happens in one of those, there is a function for every arena phase you can easily override: `on_load`, `on_start`, `on_celebration`, `on_end`.
|
||||
|
||||
### Dependencies
|
||||
[signs_lib](https://gitlab.com/VanessaE/signs_lib) by Vanessa Dannenberg
|
||||
|
||||
### Known conflicts
|
||||
`Beds` or any other mod overriding the default respawn system
|
||||
|
|
11
api.lua
11
api.lua
|
@ -1,3 +1,12 @@
|
|||
arena_lib = {}
|
||||
arena_lib.arenas = {}
|
||||
arena_lib.mod_name = minetest.get_current_modname()
|
||||
|
||||
dofile(minetest.get_modpath("quake") .. "/arena_lib/debug_utilities.lua")
|
||||
dofile(minetest.get_modpath("quake") .. "/arena_lib/items.lua")
|
||||
dofile(minetest.get_modpath("quake") .. "/arena_lib/player_manager.lua")
|
||||
dofile(minetest.get_modpath("quake") .. "/arena_lib/signs.lua")
|
||||
|
||||
----------------------------------------------
|
||||
--------------GESTIONE STORAGE----------------
|
||||
----------------------------------------------
|
||||
|
@ -5,8 +14,6 @@
|
|||
local storage = minetest.get_mod_storage()
|
||||
--storage:set_string("arenas", nil) -- PER RESETTARE LO STORAGE
|
||||
|
||||
arena_lib = { arenas = {} }
|
||||
|
||||
if minetest.deserialize(storage:get_string("arenas")) ~= nil then
|
||||
arena_lib.arenas = minetest.deserialize(storage:get_string("arenas"))
|
||||
end
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
signs_lib
|
5
init.lua
5
init.lua
|
@ -1,5 +0,0 @@
|
|||
dofile(minetest.get_modpath("arena_lib") .. "/api.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/debug_utilities.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/items.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/player_manager.lua")
|
||||
dofile(minetest.get_modpath("arena_lib") .. "/signs.lua")
|
|
@ -1,4 +1,4 @@
|
|||
minetest.register_tool("arena_lib:immunity", {
|
||||
minetest.register_tool(arena_lib.mod_name .. ":immunity", {
|
||||
|
||||
description = "Sei immune!",
|
||||
inventory_image = "arena_immunity.png",
|
||||
|
@ -10,7 +10,7 @@ minetest.register_tool("arena_lib:immunity", {
|
|||
|
||||
--[[sovrascrizione "on_punch" nodo base dei cartelli per farli entrare
|
||||
nell'arena se sono cartelli appositi e "on_timer" per teletrasportali in partita quando la queue finisce]]
|
||||
minetest.register_tool("arena_lib:create_sign", {
|
||||
minetest.register_tool(arena_lib.mod_name .. ":create_sign", {
|
||||
|
||||
description = "Left click on a sign to create an entrance or to remove it",
|
||||
inventory_image = "arena_createsign.png",
|
||||
|
|
|
@ -120,7 +120,7 @@ function arena_lib.set_sign(sender, arena_name)
|
|||
return end
|
||||
|
||||
-- assegno item creazione arene con ID arena nei metadati da restituire al premere sul cartello
|
||||
local stick = ItemStack("arena_lib:create_sign")
|
||||
local stick = ItemStack(arena_lib.mod_name .. ":create_sign")
|
||||
local meta = stick:get_meta()
|
||||
meta:set_int("arenaID", arena_ID)
|
||||
|
||||
|
|
Loading…
Reference in New Issue