Editor: icon to enable an arena while leaving the editor

master
Marco 2020-06-13 14:44:15 +02:00
parent e8651a7d9d
commit 9acf645210
8 changed files with 28 additions and 6 deletions

View File

@ -44,7 +44,7 @@ Two things are needed to have an arena up to go: spawners and signs. There are t
#### 1.2.1 Editor
From version 3.0.0, arena_lib comes with a fancy editor via hotbar so you don't have to configure and memorise a lot of commands (if you still want to go full CLI/chat though, skip this paragraph).
In order to use the editor, the specified arena must be disabled and no other players must be editing the same arena. The rest is pretty straightforward :D and if you're not sure of what something does, just open the inventory and read its name.
In order to use the editor, no other players must be editing the same arena. When entering it, the arena is disabled automatically. The rest is pretty straightforward :D if you're not sure of what something does, just open the inventory and read its name.
The function calling the editor is
`arena_lib.enter_editor(sender, mod, arena_name)`
@ -90,7 +90,7 @@ ChatCmdBuilder.new("NAMEOFYOURCOMMAND", function(cmd)
##### 1.2.2.2 Signs
`arena_lib.set_sign(sender, <pos, remove>, <mod, arena_name>)` via chat uses `sender`, `mod` and `arena_name`, while the editor `pos` and `remove` (hence the weird subdivision). When used via chat, it takes the block the player is pointing at in a 5 blocks radius. If the block is a sign, it then creates (or remove if already set) the "arena sign".
#### 1.2.3 Enabling an arena
#### 1.2.2.3 Enabling an arena
When a sign has been set, it won't work. This because an arena must be enabled manually via
`arena_lib.enable_arena(sender, mod, arena_name)`
If all the conditions are met, you'll receive a confirmation. If not, you'll receive the reason why it didn't through and the arena will remain disabled. Conditions are:

View File

@ -85,6 +85,26 @@ minetest.register_tool("arena_lib:editor_return", {
minetest.register_tool("arena_lib:editor_enable", {
description = S("Enable and leave"),
inventory_image = "arenalib_editor_enable.png",
groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"},
on_place = function() end,
on_drop = function() end,
on_use = function(itemstack, user)
local mod = user:get_meta():get_string("arena_lib_editor.mod")
local arena_name = user:get_meta():get_string("arena_lib_editor.arena")
arena_lib.enable_arena(user:get_player_name(), mod, arena_name)
end
})
minetest.register_tool("arena_lib:editor_quit", {
description = S("Leave the editor"),

View File

@ -7,8 +7,8 @@ local editor_tools = {
"arena_lib:editor_signs",
"",
"",
"",
"arena_lib:editor_info",
"arena_lib:editor_enable",
"arena_lib:editor_quit"
}

View File

@ -1,4 +1,4 @@
local version = "3.1.0"
local version = "3.2.0-dev"
dofile(minetest.get_modpath("arena_lib") .. "/api.lua")
dofile(minetest.get_modpath("arena_lib") .. "/callbacks.lua")

View File

@ -1,4 +1,4 @@
# version 3.1.0
# version 3.2.0
# author(s): Zughy
# reviewer(s):
# textdomain: arena_lib
@ -120,6 +120,7 @@ Signs=Cartelli
One sign per arena=Un cartello per arena
Info=Info
Go back=Torna indietro
Enable and leave=Abilita ed esci
Leave the editor=Esci dall'editor
# tools_spawner.lua

View File

@ -1,4 +1,4 @@
# version 3.1.0
# version 3.2.0
# author(s):
# reviewer(s):
# textdomain: arena_lib
@ -120,6 +120,7 @@ Signs=
One sign per arena=
Info=
Go back=
Enable and leave=
Leave the editor=

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 167 B