From 6e969facb132e11d28134c88e136a1cdae67a8c0 Mon Sep 17 00:00:00 2001 From: Kinder Date: Thu, 24 May 2018 13:53:18 +0200 Subject: [PATCH] Add little API. --- README.md | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6484c8e..92fcd72 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,50 @@ For the Mods: Subgames, Skywars, Hiddenseeker, Mesewars, Main, Build: You are not allowed to distribute any copy or work based on this programm unless the copyright holder declares his consent. -HERE IS NO WARRANTY OF ANY KIND! +THE SOFTWARE IS PROVIDED WITHOUT WARRANTY OF ANY KIND! Derived from [minetest_game](https://github.com/minetest/minetest_game) + +API +--- + +The Server is splitted into diffrent lobbys. + +This is saved in player_lobby[name] = "main" + +All minetest registers like minetest.register_on_join_player(func(player)) are here subgames.register_on_join_player(func(player, lobby)) lobby is the name string of the Lobby where the Action happens. + +But not all registers are supported yet. + +Example: + +subgames.register_on_join_player(function(player, lobby) + if lobby == "main" then + minetest.chat_send_play(player:get_player_name(), "HI") + end +end) + +IMPORTANT: Registers like on_place_node don't allways have a player! +For this a Lobby must register its location at the top of mods/subgames/init.lua + +areas={ + ["mesewars"] = { + [1] = {x=(-76), y=158, z=154}, + [2] = {x=266, y=(-52), z=(-169)} + }, + ["main"] = { + [1] = {x=(-31), y=623, z=0}, + [2] = {x=9, y=595, z=39} + }, + ["hiddenseeker"] = { + [1] = {x=0, y=(-10000), z=0}, + [2] = {x=0, y=(-10000), z=0} + }, + ["skywars"] = { + [1] = {x=10000, y=1900, z=10000}, + [2] = {x=(-10000), y=2900, z=(-10000)} + } +} + +The API is not finished!