add editor tools for setting the positions of the arena
parent
c8c67658dc
commit
05d6e79796
|
@ -0,0 +1,54 @@
|
|||
|
||||
arena_lib.register_editor_section("wormball", {
|
||||
|
||||
name = "wormball_settings",
|
||||
icon = "wormball_menu.png",
|
||||
hotbar_message = "Wormball Arena Settings",
|
||||
give_items = function(itemstack, user, arena)
|
||||
local tbl = {"wormball:pos1","wormball:pos2"}
|
||||
return tbl
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_tool("wormball:pos1",{
|
||||
|
||||
description = "Area to Clear Pos 1",
|
||||
inventory_image = "wormball_pos1.png",
|
||||
wield_image = "wormball_pos1.png",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
on_place = function() end,
|
||||
on_drop = function() end,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local mod = user:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = user:get_meta():get_string("arena_lib_editor.arena")
|
||||
local pos = vector.floor(user:get_pos())
|
||||
local pos_string = '{ x = '..pos.x .. ", y = " .. pos.y .. ", z = " .. pos.z .. "}"
|
||||
|
||||
arena_lib.change_arena_property(user:get_player_name(), 'wormball', arena_name, "area_to_clear_after_game_pos_1", pos_string , true)
|
||||
minetest.chat_send_player(user:get_player_name(), "Pos_1 has been set to :"..dump(pos))
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
minetest.register_tool("wormball:pos2",{
|
||||
|
||||
description = "Area to Clear Pos 2",
|
||||
inventory_image = "wormball_pos2.png",
|
||||
wield_image = "wormball_pos2.png",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
on_place = function() end,
|
||||
on_drop = function() end,
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
local mod = user:get_meta():get_string("arena_lib_editor.mod")
|
||||
local arena_name = user:get_meta():get_string("arena_lib_editor.arena")
|
||||
local pos = vector.floor(user:get_pos())
|
||||
local pos_string = '{ x = '..pos.x .. ", y = " .. pos.y .. ", z = " .. pos.z .. "}"
|
||||
arena_lib.change_arena_property(user:get_player_name(), 'wormball', arena_name, "area_to_clear_after_game_pos_2", pos_string , true) minetest.chat_send_player(user:get_player_name(), "Pos_2 has been set to :"..dump(pos))
|
||||
minetest.chat_send_player(user:get_player_name(), "Pos_2 has been set to :"..dump(pos))
|
||||
end
|
||||
})
|
9
init.lua
9
init.lua
|
@ -83,6 +83,8 @@ if not minetest.get_modpath("lib_chatcmdbuilder") then
|
|||
dofile(minetest.get_modpath("wormball") .. "/chatcmdbuilder.lua")
|
||||
end
|
||||
|
||||
dofile(minetest.get_modpath("wormball") .. "/editor.lua")
|
||||
|
||||
dofile(minetest.get_modpath("wormball") .. "/commands.lua")
|
||||
--nodes includes the attachment entity, also there are creative decorative worm body parts for decorating minigame hubs
|
||||
dofile(minetest.get_modpath("wormball") .. "/nodes.lua")
|
||||
|
@ -91,6 +93,13 @@ dofile(minetest.get_modpath("wormball") .. "/privs.lua")
|
|||
dofile(minetest.get_modpath("wormball") .. "/minigame_manager.lua")
|
||||
|
||||
|
||||
-- get highscores from storage if found
|
||||
|
||||
-- it doesnt seem to work for some reason
|
||||
|
||||
-- you will have to play one game before scores are available.
|
||||
|
||||
|
||||
if arena_lib.mods and arena_lib.mods["wormball"] and arena_lib.mods["wormball"].arenas and # arena_lib.mods["wormball"].arenas > 0 then
|
||||
for arena_name, arena_stats in pairs(arena_lib.mods["wormball"].arenas) do
|
||||
if wormball.storage:get_string(arena_name .. "_highscores") then
|
||||
|
|
2
mod.conf
2
mod.conf
|
@ -1,4 +1,4 @@
|
|||
name = wormball
|
||||
description = Wormball subgame
|
||||
depends = default, arena_lib, player_api, dye
|
||||
depends_optional = lib_chatcmdbuilder, panel_lib
|
||||
depends_optional = lib_chatcmdbuilder
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in New Issue