added: extarnal commands, clean unknown, settings file and WIP - areas privilages
parent
d7cc4be1b8
commit
9bfc9a98f4
14
README.md
14
README.md
|
@ -6,9 +6,10 @@ To install, rename to "enhancements" and place in the mods/ directory.
|
|||
* scale and override different tools
|
||||
* clean-up server - unknown nodes and entities
|
||||
* [external_cmd]server chat messages from outside Minetest game
|
||||
* areas - control privilages
|
||||
|
||||
External Commands
|
||||
----------------
|
||||
------------------
|
||||
This mod allows sending chat messages from outside minetest. Support for server commands is planned.
|
||||
The following command will send a chat message to all players on the server:
|
||||
|
||||
|
@ -16,4 +17,13 @@ The following command will send a chat message to all players on the server:
|
|||
echo [message] > [world folder]/message
|
||||
|
||||
The mod folder depends on where you installed the mod; it is usually “~/.minetest/mods/minetest/external_cmd”
|
||||
Also can be added to the World directory. You have to create a "SERVER" user and grant him all privs - this account should not be active and used only for displaying the images.
|
||||
Also can be added to the World directory. You have to create a "SERVER" user and grant him all privs - this account should not be active and used only for displaying the images.
|
||||
|
||||
Areas Enhance - WIP
|
||||
--------------------
|
||||
|
||||
Manage players privileges in 'areas' mod if using the mod only for admin purposes
|
||||
|
||||
TODO:
|
||||
* create tables from where you can read/write the privileges
|
||||
* don't repeat grand/revoke on globalstep - only once when in/out of area - check within tables!
|
|
@ -0,0 +1,25 @@
|
|||
--
|
||||
-- Manage players privileges in 'areas' mod if using the mod only for admin purposes
|
||||
--
|
||||
|
||||
-- TODO:
|
||||
-- - create tables from where you can read/write the privileges
|
||||
-- - don't repeat grand/revoke on globalstep - only once when in/out of area - check within tables!
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
for _, player in pairs(minetest.get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
local pos = vector.round(player:getpos())
|
||||
local privs = minetest.get_player_privs(name)
|
||||
|
||||
if not privs then
|
||||
print("[Mod][enhancements-areas] player does not exist error!")
|
||||
end
|
||||
|
||||
if areas:canInteract(pos, name) then
|
||||
print("grant")
|
||||
else
|
||||
print("revoke")
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,228 @@
|
|||
--
|
||||
-- define unknown nodes
|
||||
--
|
||||
|
||||
-- workbench advanced [DOM]
|
||||
-- plantlife_modpack:
|
||||
-- - flowers_plus
|
||||
-- - along_shore
|
||||
-- - bushes
|
||||
-- - trunks
|
||||
-- - cavestuff
|
||||
-- - dryplants
|
||||
-- - ferns
|
||||
-- - molehills
|
||||
-- - youngtrees
|
||||
|
||||
local old_nodes = {
|
||||
"workbench:D",
|
||||
"flowers:waterlily_s1",
|
||||
"flowers:waterlily_s2",
|
||||
"flowers:waterlily_s3",
|
||||
"flowers:waterlily_s4",
|
||||
"flowers:seaweed",
|
||||
"flowers:seaweed_2",
|
||||
"flowers:seaweed_3",
|
||||
"flowers:seaweed_4",
|
||||
"flowers:waterlily",
|
||||
"flowers:waterlily_225",
|
||||
"flowers:waterlily_45",
|
||||
"flowers:waterlily_675",
|
||||
"flowers:sunflower",
|
||||
"flowers:cotton_plant",
|
||||
"flowers:flower_cotton",
|
||||
"flowers:flower_cotton_pot",
|
||||
"flowers:potted_dandelion_white",
|
||||
"flowers:potted_cotton_plant",
|
||||
"flowers:cotton",
|
||||
"flowers:cotton_wad",
|
||||
"sunflower:sunflower",
|
||||
"bushes:youngtree2_bottom",
|
||||
"bushes:bushbranches",
|
||||
"bushes:bushbranches1",
|
||||
"bushes:bushbranches2",
|
||||
"bushes:bushbranches3",
|
||||
"bushes:bushbranches4",
|
||||
"bushes:BushLeaves",
|
||||
"bushes:BushLeaves1",
|
||||
"bushes:BushLeaves2",
|
||||
"trunks:twig",
|
||||
"trunks:twig_1",
|
||||
"trunks:twig_2",
|
||||
"trunks:twig_3",
|
||||
"trunks:twig_4",
|
||||
"trunks:twig_5",
|
||||
"trunks:twig_6",
|
||||
"trunks:twig_7",
|
||||
"trunks:twig_8",
|
||||
"trunks:twig_9",
|
||||
"trunks:twig_10",
|
||||
"trunks:twig_11",
|
||||
"trunks:twig_12",
|
||||
"trunks:twig_13",
|
||||
"trunks:twigs",
|
||||
"trunks:twigs_slab",
|
||||
"trunks:twigs_roof",
|
||||
"trunks:twigs_roof_corner",
|
||||
"trunks:twigs_roof_corner_2",
|
||||
"trunks:moss_fungus",
|
||||
"trunks:moss",
|
||||
"trunks:treeroot",
|
||||
"trunks:jungletreeroot",
|
||||
"trunks:pine_treeroot",
|
||||
"trunks:tree_coniferroot",
|
||||
"trunks:tree_mangroveroot",
|
||||
"trunks:tree_palmroot",
|
||||
"trunks:apple_tree_trunkroot",
|
||||
"trunks:beech_trunkroot",
|
||||
"trunks:birch_trunkroot",
|
||||
"trunks:fir_trunkroot",
|
||||
"trunks:oak_trunkroot",
|
||||
"trunks:palm_trunkroot",
|
||||
"trunks:rubber_tree_trunkroot",
|
||||
"trunks:rubber_tree_trunk_emptyroot",
|
||||
"trunks:sequoia_trunkroot",
|
||||
"trunks:spruce_trunkroot",
|
||||
"trunks:willow_trunkroot",
|
||||
"cavestuff:pebble_1",
|
||||
"cavestuff:pebble_2",
|
||||
"cavestuff:desert_pebble_1",
|
||||
"cavestuff:desert_pebble_2",
|
||||
"cavestuff:stalactite_1",
|
||||
"cavestuff:stalactite_2",
|
||||
"cavestuff:stalactite_3",
|
||||
"dryplants:grass_short",
|
||||
"dryplants:grass",
|
||||
"dryplants:sickle",
|
||||
"dryplants:hay",
|
||||
"dryplants:wetreed",
|
||||
"dryplants:reedmace_sapling",
|
||||
"dryplants:reedmace_top",
|
||||
"dryplants:reedmace",
|
||||
"dryplants:reedmace_bottom",
|
||||
"dryplants:reed",
|
||||
"dryplants:reed_slab",
|
||||
"dryplants:wetreed_slab",
|
||||
"dryplants:reed_roof",
|
||||
"dryplants:wetreed_roof",
|
||||
"dryplants:reed_roof_corner",
|
||||
"dryplants:wetreed_roof_corner",
|
||||
"dryplants:reed_roof_corner_2",
|
||||
"dryplants:wetreed_roof_corner_2",
|
||||
"dryplants:juncus",
|
||||
"dryplants:juncus_02",
|
||||
"dryplants:reedmace_height_2",
|
||||
"dryplants:reedmace_height_3_spikes",
|
||||
"dryplants:reedmace_height_3",
|
||||
"dryplants:reedmace_water_entity",
|
||||
"dryplants:reedmace_spikes",
|
||||
"dryplants:reedmace_water",
|
||||
"ferns:fiddlehead",
|
||||
"ferns:ferntuber",
|
||||
"ferns:tree_fern_leaves",
|
||||
"ferns:tree_fern_leaves_02",
|
||||
"ferns:sapling_tree_fern",
|
||||
"ferns:fiddlehead_roasted",
|
||||
"ferns:ferntuber_roasted",
|
||||
"ferns:fern_01",
|
||||
"ferns:fern_02",
|
||||
"ferns:fern_03",
|
||||
"ferns:fern_04",
|
||||
"ferns:sapling_giant_tree_fern",
|
||||
"ferns:fern_trunk_big",
|
||||
"ferns:fern_trunk_big_top",
|
||||
"ferns:tree_fern_leaves_giant",
|
||||
"ferns:tree_fern_leave_big",
|
||||
"ferns:tree_fern_leave_big_end",
|
||||
"ferns:horsetail_01",
|
||||
"ferns:horsetail_02",
|
||||
"ferns:horsetail_03",
|
||||
"ferns:horsetail_04",
|
||||
"ferns:fern_trunk",
|
||||
"molehills:molehill",
|
||||
"youngtrees:bamboo",
|
||||
"youngtrees:youngtree2_middle",
|
||||
"youngtrees:youngtree_top",
|
||||
"youngtrees:youngtree_middle",
|
||||
"youngtrees:youngtree_bottom"
|
||||
}
|
||||
|
||||
-- spacial case
|
||||
|
||||
-- plantlife_modpack:
|
||||
-- - woodsoils
|
||||
|
||||
local old_nodes2 = {
|
||||
"woodsoils:dirt_with_leaves_1",
|
||||
"woodsoils:dirt_with_leaves_2",
|
||||
"woodsoils:grass_with_leaves_1",
|
||||
"woodsoils:grass_with_leaves_2",
|
||||
"woodsoils:grass_with_leaves_2"
|
||||
}
|
||||
|
||||
--
|
||||
-- define unknown entities
|
||||
--
|
||||
|
||||
local old_entities = {}
|
||||
|
||||
--
|
||||
-- assign a flag to nodes what should be removed
|
||||
--
|
||||
|
||||
for _,node_name in ipairs(old_nodes) do
|
||||
minetest.register_node(":"..node_name, {
|
||||
groups = {old=1},
|
||||
})
|
||||
end
|
||||
|
||||
for _,node_name2 in ipairs(old_nodes2) do
|
||||
minetest.register_node(":"..node_name2, {
|
||||
groups = {old2=1},
|
||||
})
|
||||
end
|
||||
|
||||
--
|
||||
-- remove unknown nodes
|
||||
--
|
||||
|
||||
-- remove node {"air"}
|
||||
if #old_nodes > 0 then
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:old"},
|
||||
interval = 3,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
minetest.remove_node(pos)
|
||||
minetest.log("action", "[Mod][clean_unknown] Cleaning node "..node.name.." at position "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- set node {"default:dirt_with_grass"}
|
||||
if #old_nodes2 > 0 then
|
||||
minetest.register_abm({
|
||||
nodenames = {"group:old2"},
|
||||
interval = 3,
|
||||
chance = 1,
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, {name="default:dirt_with_grass"})
|
||||
minetest.log("action", "[Mod][clean_unknown] Cleaning node "..node.name.." at position "..minetest.pos_to_string(pos))
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
--
|
||||
-- remove unknown entities
|
||||
--
|
||||
|
||||
if #old_entities > 0 then
|
||||
for _,entity_name in ipairs(old_entities) do
|
||||
minetest.register_entity(":"..entity_name, {
|
||||
on_activate = function(self, staticdata)
|
||||
self.object:remove()
|
||||
minetest.log("action", "[Mod][clean_unknown] Cleaning entity "..entity_name)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
|
@ -1,3 +1,4 @@
|
|||
default
|
||||
diamonds?
|
||||
moreores?
|
||||
moreores?
|
||||
areas?
|
|
@ -0,0 +1,34 @@
|
|||
-- External Command (external_cmd) mod by Menche
|
||||
-- Allows server commands / chat from outside minetest
|
||||
-- License: LGPL
|
||||
|
||||
local admin = "SERVER"
|
||||
-- local admin = minetest.setting_get("name")
|
||||
|
||||
-- if admin == nil then
|
||||
-- admin = "SERVER"
|
||||
-- end
|
||||
|
||||
minetest.register_globalstep(
|
||||
function(dtime)
|
||||
local f = (io.open(minetest.get_worldpath("external_cmd").."/message", "r"))
|
||||
if f ~= nil then
|
||||
local message = f:read("*line")
|
||||
f:close()
|
||||
os.remove(minetest.get_worldpath("external_cmd").."/message")
|
||||
|
||||
if message ~= nil then
|
||||
local cmd, param = string.match(message, "^/([^ ]+) *(.*)")
|
||||
if not param then
|
||||
param = ""
|
||||
end
|
||||
local cmd_def = minetest.chatcommands[cmd]
|
||||
if cmd_def then
|
||||
cmd_def.func(admin, param)
|
||||
else
|
||||
minetest.chat_send_all(admin..": "..message)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
36
init.lua
36
init.lua
|
@ -1,3 +1,33 @@
|
|||
dofile(minetest.get_modpath("enhancements").."/swords.lua")
|
||||
dofile(minetest.get_modpath("enhancements").."/axe.lua")
|
||||
dofile(minetest.get_modpath("enhancements").."/shovels.lua")
|
||||
-- main setings
|
||||
dofile(minetest.get_modpath("enhancements").."/settings.txt")
|
||||
|
||||
-- tools enhancements
|
||||
if TOOLS_ENHANCE then
|
||||
dofile(minetest.get_modpath("enhancements").."/swords.lua")
|
||||
dofile(minetest.get_modpath("enhancements").."/axe.lua")
|
||||
dofile(minetest.get_modpath("enhancements").."/shovels.lua")
|
||||
|
||||
print("[Mod][enhancements] TOOLS_ENHANCE enabled")
|
||||
end
|
||||
|
||||
-- clean-up unknown nodes and entities (configuration in that file)
|
||||
if CLEAN_UNKNOWN then
|
||||
dofile(minetest.get_modpath("enhancements").."/clean_unknown.lua")
|
||||
|
||||
print("[Mod][enhancements] CLEAN_UNKNOWN enabled")
|
||||
end
|
||||
|
||||
-- allow external command from outside of minetest (see readme)
|
||||
if EXTERNAL_CMD then
|
||||
dofile(minetest.get_modpath("enhancements").."/external_cmd.lua")
|
||||
|
||||
print("[Mod][enhancements] EXTERNAL_CMD enabled")
|
||||
end
|
||||
|
||||
-- manage privileges i areas mod - if using areas mod only for admin purposes
|
||||
-- WIP DONT ENABLE!
|
||||
if AREAS_ENHANCE and minetest.get_modpath("areas") then
|
||||
dofile(minetest.get_modpath("enhancements").."/areas.lua")
|
||||
|
||||
print("[Mod][enhancements] AREAS_ENHANCE enabled")
|
||||
end
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
TOOLS_ENHANCE = true
|
||||
CLEAN_UNKNOWN = true
|
||||
EXTERNAL_CMD = true
|
||||
AREAS_ENHANCE = disable
|
Loading…
Reference in New Issue