added tool
This commit is contained in:
Mahmut Elmas 2016-11-21 12:58:53 +03:00
parent 6bbc55a2d1
commit 3766ac45d9
9 changed files with 41 additions and 74 deletions

View File

@ -1,28 +1,9 @@
# Commander
Chat commands Gui for Minetest
Mahmut Elmas
License WTFPL
Minecraft Aliases License CC0 1.0 Universal
Commander Mod for minetest by Mahmut Elmas
This mod provides Guid for all commands added to minetest by default or mods.
All possible commands will be shown in the gui.
Some new commands also provided by the mod
1 -- Suicide command from minetest for fun server
/Killme
2 -- Almost all default Minecraft commands by Mrlbby's Commands mod
3 -- The commands gui with the help of Rui
4 -- Commander tool to use in game
License = MIT
Dependecies = Default
This mod adds a tool to run command by gui.

View File

@ -1,47 +0,0 @@
-- Suicide from minetest for fun server
minetest.register_chatcommand("killme", {
params = "",
description = "Kills yourself",
func = function(name, param)
local player = minetest.get_player_by_name(name)
if not player then return end
player:set_hp(0)
if minetest.setting_getbool("enable_damage") == false then
minetest.chat_send_player(name, "[X] Damage is disabled on this server.")
else
minetest.chat_send_player(name, "[X] You suicided.")
end
end,
})
-- List banned players
minetest.register_chatcommand("banlist", {
description = "List bans",
privs = minetest.chatcommands["ban"].privs,
func = function(name)
return true, "Ban list: " .. core.get_ban_list()
end,
})
-- Aliases function
local function register_chatcommand_alias(alias, cmd)
local def = minetest.chatcommands[cmd]
minetest.register_chatcommand(alias, def)
end
-- Minecraft commands for minetest
register_chatcommand_alias("?", "help")
register_chatcommand_alias("list", "status")
register_chatcommand_alias("pardon", "unban")
register_chatcommand_alias("stop", "shutdown")
register_chatcommand_alias("tell", "msg")
register_chatcommand_alias("w", "msg")
register_chatcommand_alias("tp", "teleport")
register_chatcommand_alias("suicide", "killme")

2
depends.txt Normal file
View File

@ -0,0 +1,2 @@
default

9
description.txt Normal file
View File

@ -0,0 +1,9 @@
Commander Mod for minetest by Mahmut Elmas
License = MIT
Dependecies = Default
This mod adds a tool to run command by gui.

View File

@ -44,12 +44,13 @@
-- Open command gui by chat
minetest.register_chatcommand("command_gui", {
minetest.register_chatcommand("commander", {
func = function(name)
minetest.after(0.5, minetest.show_formspec, name, "command_gui:menu", formspec())
end
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= "command_gui:menu" then
return
@ -80,6 +81,26 @@
end
end)
------
-- Commander Tool
dofile(minetest.get_modpath("commander").."/commands.lua")
-- items
minetest.register_craftitem("commander:commander", {
description = "Commander",
inventory_image = "commander.png",
on_use = function(itemstack, user, pointed_thing)
local name = user:get_player_name()
minetest.after(0.5, minetest.show_formspec, name, "command_gui:menu", formspec())
end,
})
-- recipes
minetest.register_craft({
output = "commander:commander",
recipe = {
{"vessels:glass_fragments", "default:iron_lump", ""}
}
})

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = commander

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

BIN
screenshot2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

BIN
textures/commander.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B