mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-17 15:58:26 +01:00
Removed useless chatcommands redifinition and moved eject system
- The system controlling the items' ejection from a solid node is now in mods/builtin_items/init.lua - The file mods/_misc/chatcommands.lua has been cleared from its comments, and the chatcommands redefined but outdated (like /time)
This commit is contained in:
parent
8633fc47c2
commit
b4996ee69b
@ -2,44 +2,10 @@
|
||||
-- Edited chat commands from core
|
||||
--
|
||||
|
||||
-- /me
|
||||
-- /help
|
||||
-- /privs
|
||||
-- /grant
|
||||
-- /revoke
|
||||
-- /setpassword
|
||||
-- /clearpassword
|
||||
-- /auth_reload
|
||||
-- /teleport
|
||||
-- /set
|
||||
-- /mods
|
||||
-- /give
|
||||
-- /giveme
|
||||
-- /spawnentity
|
||||
-- /pulverize
|
||||
-- /rollback_check
|
||||
-- /rollback
|
||||
-- /status
|
||||
-- /shutdown
|
||||
-- /ban
|
||||
-- /itemdb
|
||||
|
||||
minetest.register_chatcommand("time", {
|
||||
params = "<0...24000>",
|
||||
description = "set time of day",
|
||||
privs = {settime=true},
|
||||
func = function(name, param)
|
||||
if param == "" then
|
||||
return false, "Missing time."
|
||||
end
|
||||
local newtime = tonumber(param)
|
||||
if newtime == nil then
|
||||
return false, "Invalid time."
|
||||
end
|
||||
minetest.set_timeofday((newtime % 24000) / 24000)
|
||||
minetest.log("action", name .. " sets time " .. newtime)
|
||||
minetest.chat_send_all(name .. " changed the time of day.")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_chatcommand("shutdown", {
|
||||
description = "shutdown server",
|
||||
privs = {server=true},
|
||||
@ -93,69 +59,3 @@ minetest.register_chatcommand("itemdb", {
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- /unban
|
||||
-- /kick
|
||||
-- /clearobjects
|
||||
-- /msg
|
||||
|
||||
--
|
||||
-- Other chat commands
|
||||
--
|
||||
|
||||
-- Spawn command
|
||||
--minetest.register_chatcommand("spawn", {
|
||||
-- params = "",
|
||||
-- description = "Teleport to the spawn location.",
|
||||
-- privs = {shout=true},
|
||||
-- func = function(name, param)
|
||||
-- local player = minetest.get_player_by_name(name)
|
||||
-- minetest.chat_send_player(name, "Teleported to spawn!")
|
||||
-- player:setpos({x=0.0, y=5.0, z=0.0})
|
||||
-- return true
|
||||
-- end,
|
||||
--})
|
||||
--[[
|
||||
-- Sethome command
|
||||
minetest.register_chatcommand("sethome", {
|
||||
params = "",
|
||||
description = "Set your home location.",
|
||||
privs = {shout=true},
|
||||
func = function(name, param)
|
||||
player = minetest.get_player_by_name(name)
|
||||
test = player:getpos()
|
||||
local file = io.open(minetest.get_worldpath().."/home/"..player:get_player_name().."_home", "w")
|
||||
if not file then
|
||||
minetest.chat_send_player(name, "Il y a eut une erreur, s'il vous plait contactez le detenteur du serveur.")
|
||||
return
|
||||
end
|
||||
file:write(minetest.pos_to_string(test))
|
||||
file:close()
|
||||
minetest.chat_send_player(name, "Votre emplacement 'home' est definit ! Tapez /home pour vous y teleporter.")
|
||||
end
|
||||
})
|
||||
|
||||
-- Home command
|
||||
minetest.register_chatcommand("home", {
|
||||
params = "",
|
||||
description = "Vous teleporte a l'emplacement de votre 'home'.",
|
||||
privs = {shout=true},
|
||||
func = function(name, param)
|
||||
player = minetest.get_player_by_name(name)
|
||||
local file = io.open(minetest.get_worldpath().."/home/"..player:get_player_name().."_home", "r")
|
||||
if not file then
|
||||
minetest.chat_send_player(name, "Vous devez definir votre emplacement 'home' ! Pour ce faire, utilisez la commande /sethome.")
|
||||
return
|
||||
end
|
||||
local line = file:read("*line")
|
||||
file:close()
|
||||
local pos = minetest.string_to_pos(string.sub(line, 1, string.find(line, ")")))
|
||||
if not pos or type(pos) ~= "table" then
|
||||
minetest.chat_send_player(name, "Il y a eut une erreur, s'il vous plait contactez le detenteur du serveur.")
|
||||
return
|
||||
end
|
||||
minetest.get_player_by_name(name):setpos(pos)
|
||||
minetest.chat_send_player(name, "Vous voilà chez vous.")
|
||||
end
|
||||
})
|
||||
--]]
|
||||
|
@ -27,6 +27,3 @@ dofile(minetest.get_modpath("_misc").."/uncraft_woll.lua")
|
||||
|
||||
-- List players
|
||||
dofile(minetest.get_modpath("_misc").."/list_players.lua")
|
||||
|
||||
-- Eject entites when putting a node
|
||||
dofile(minetest.get_modpath("_misc").."/eject_entities.lua")
|
||||
|
@ -3,6 +3,15 @@ if not time then
|
||||
time = 600
|
||||
end
|
||||
|
||||
unwalkable_nodes = {}
|
||||
|
||||
minetest.after(0, function()
|
||||
for itemname, node in pairs(minetest.registered_nodes) do
|
||||
if node.walkable == false then
|
||||
table.insert(unwalkable_nodes, 1, itemname)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_entity(":__builtin:item", {
|
||||
initial_properties = {
|
||||
@ -182,6 +191,16 @@ minetest.register_entity(":__builtin:item", {
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- Eject if not walkable
|
||||
local upnode = minetest.get_node({x = p.x, y = math.ceil(p.y), z = p.z}).name
|
||||
if minetest.registered_nodes[upnode] and minetest.registered_nodes[upnode].walkable then
|
||||
local minp, maxp = {x=p.x-1, y=math.ceil(p.y), z=p.z-1}, {x=p.x+1, y=math.ceil(p.y)+1, z=p.z+1}
|
||||
local nodes = minetest.find_nodes_in_area(minp, maxp, unwalkable_nodes)
|
||||
if table.getn(nodes) > 0 then
|
||||
self.object:setpos(nodes[math.random(1,#nodes)])
|
||||
end
|
||||
end
|
||||
end,
|
||||
--[[ This causes a duplication glitch if a player walks upon an item and clicks on it at the same time.
|
||||
on_punch = function(self, hitter)
|
||||
|
Loading…
Reference in New Issue
Block a user