Clean up names

This commit is contained in:
ezhh 2017-09-09 17:53:12 +01:00
parent 26b9a67e64
commit 87cd11f9ba

140
init.lua
View File

@ -12,156 +12,156 @@ minetest.register_privilege("hidden_one", {description = "Can hide from players.
-- Admin Curses -- Admin Curses
-- prevents player from jumping -- prevents player from jumping
local function hobble(name, param) local function hobble(user, target)
-- return if player is admin -- return if player is admin
local admin_name = minetest.setting_get ("name") local admin_name = minetest.setting_get ("name")
if param == admin_name then if target == admin_name then
return return
end end
-- apply curse -- apply curse
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
local privs=minetest.get_player_privs(param) local privs=minetest.get_player_privs(target)
privs.hobbled=true privs.hobbled=true
minetest.set_player_privs(param,privs) minetest.set_player_privs(target,privs)
player:set_physics_override({jump = 0}) player:set_physics_override({jump = 0})
end end
minetest.register_chatcommand("hobble", { minetest.register_chatcommand("hobble", {
params = "<person>", targets = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Prevent player jumping.", description = "Prevent player jumping.",
func = function(name, param) func = function(name, target)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
if player == nil then if player == nil then
minetest.chat_send_player(name,"Player does not exist") minetest.chat_send_player(name,"Player does not exist")
return return
end end
hobble(name,param) hobble(name,target)
minetest.chat_send_player(param, "Cursed by an admin! No more jumping!") minetest.chat_send_player(target, "Cursed by an admin! No more jumping!")
minetest.chat_send_player(name, "Curse successful!") minetest.chat_send_player(name, "Curse successful!")
end end
}) })
-- reduces player movement speed -- reduces player movement speed
local function slowmo(name, param) local function slowmo(name, target)
-- return if player is admin -- return if player is admin
local admin_name = minetest.setting_get ("name") local admin_name = minetest.setting_get ("name")
if param == admin_name then if target == admin_name then
return return
end end
-- apply curse -- apply curse
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
local privs = minetest.get_player_privs(param) local privs = minetest.get_player_privs(target)
privs.slowed = true privs.slowed = true
minetest.set_player_privs(param,privs) minetest.set_player_privs(target,privs)
player:set_physics_override({speed = 0.3}) player:set_physics_override({speed = 0.3})
end end
minetest.register_chatcommand("slowmo", { minetest.register_chatcommand("slowmo", {
params = "<person>", targets = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Reduce player movement speed.", description = "Reduce player movement speed.",
func = function(name, param) func = function(name, target)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
if player == nil then if player == nil then
minetest.chat_send_player(name,"Player does not exist") minetest.chat_send_player(name,"Player does not exist")
return return
end end
slowmo(name,param) slowmo(name,target)
minetest.chat_send_player(param, "Cursed by an admin! You feel sloooooow!") minetest.chat_send_player(target, "Cursed by an admin! You feel sloooooow!")
minetest.chat_send_player(name, "Curse successful!") minetest.chat_send_player(name, "Curse successful!")
end end
}) })
-- disable sneak glitch for the player -- disable sneak glitch for the player
local function noglitch(name, param) local function noglitch(name, target)
-- return if player is admin -- return if player is admin
local admin_name = minetest.setting_get ("name") local admin_name = minetest.setting_get ("name")
if param == admin_name then if target == admin_name then
return return
end end
-- apply curse -- apply curse
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
local privs=minetest.get_player_privs(param) local privs=minetest.get_player_privs(target)
privs.unglitched=true privs.unglitched=true
minetest.set_player_privs(param,privs) minetest.set_player_privs(target,privs)
player:set_physics_override({sneak = false}) player:set_physics_override({sneak = false})
end end
minetest.register_chatcommand("noglitch", { minetest.register_chatcommand("noglitch", {
params = "<person>", targets = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Disable sneak glitch for a player.", description = "Disable sneak glitch for a player.",
func = function(name, param) func = function(name, target)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
if player == nil then if player == nil then
minetest.chat_send_player(name,"Player does not exist") minetest.chat_send_player(name,"Player does not exist")
return return
end end
noglitch(name, param) noglitch(name, target)
minetest.chat_send_player(param, "Cursed by an admin! You feel less glitchy...") minetest.chat_send_player(target, "Cursed by an admin! You feel less glitchy...")
minetest.chat_send_player(name, "Curse successful!") minetest.chat_send_player(name, "Curse successful!")
end end
}) })
-- prevent player from changing speed/direction and jumping -- prevent player from changing speed/direction and jumping
local function freeze(name, param) local function freeze(name, target)
-- return if player is admin -- return if player is admin
local admin_name = minetest.setting_get ("name") local admin_name = minetest.setting_get ("name")
if param == admin_name then if target == admin_name then
return return
end end
-- apply curse -- apply curse
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
local privs=minetest.get_player_privs(param) local privs=minetest.get_player_privs(target)
privs.frozen=true privs.frozen=true
minetest.set_player_privs(param,privs) minetest.set_player_privs(target,privs)
player:set_physics_override({jump = 0, speed = 0}) player:set_physics_override({jump = 0, speed = 0})
end end
minetest.register_chatcommand("freeze", { minetest.register_chatcommand("freeze", {
params = "<person>", targets = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Prevent player movement.", description = "Prevent player movement.",
func = function(name, param) func = function(name, target)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
if player == nil then if player == nil then
minetest.chat_send_player(name,"Player does not exist") minetest.chat_send_player(name,"Player does not exist")
return return
end end
freeze(name, param) freeze(name, target)
minetest.chat_send_player(param, "Cursed by an admin! You are now frozen!") minetest.chat_send_player(target, "Cursed by an admin! You are now frozen!")
minetest.chat_send_player(name, "Curse successful!") minetest.chat_send_player(name, "Curse successful!")
end end
}) })
-- disables minimap for player -- disables minimap for player
local function getlost(name,param) local function getlost(name,target)
-- return if player is admin -- return if player is admin
local admin_name = minetest.setting_get ("name") local admin_name = minetest.setting_get ("name")
if param == admin_name then if target == admin_name then
return return
end end
-- apply curse -- apply curse
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
local privs = minetest.get_player_privs(param) local privs = minetest.get_player_privs(target)
privs.lost = true privs.lost = true
minetest.set_player_privs(param,privs) minetest.set_player_privs(target,privs)
player:hud_set_flags({minimap = false}) player:hud_set_flags({minimap = false})
end end
minetest.register_chatcommand("getlost", { minetest.register_chatcommand("getlost", {
params = "<person>", targets = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Prevent player from using the minimap.", description = "Prevent player from using the minimap.",
func = function(name, param) func = function(name, target)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
if player == nil then if player == nil then
minetest.chat_send_player(name,"Player does not exist") minetest.chat_send_player(name,"Player does not exist")
return return
end end
getlost(name,param) getlost(name,target)
minetest.chat_send_player(param, "Cursed by an admin! You will get lost now!") minetest.chat_send_player(target, "Cursed by an admin! You will get lost now!")
minetest.chat_send_player(name, "Curse successful!") minetest.chat_send_player(name, "Curse successful!")
end end
}) })
@ -189,25 +189,25 @@ end)
-- reset player physics -- reset player physics
minetest.register_chatcommand("setfree",{ minetest.register_chatcommand("setfree",{
params = "<person>", targets = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Reset player movement.", description = "Reset player movement.",
func = function(name, param) func = function(name, target)
local player = minetest.get_player_by_name(param) local player = minetest.get_player_by_name(target)
if player == nil then if player == nil then
minetest.chat_send_player(name,"Player does not exist") minetest.chat_send_player(name,"Player does not exist")
return return
end end
local privs=minetest.get_player_privs(param) local privs=minetest.get_player_privs(target)
privs.frozen=nil privs.frozen=nil
privs.hobbled=nil privs.hobbled=nil
privs.slowed=nil privs.slowed=nil
privs.unglitched=nil privs.unglitched=nil
privs.lost=nil privs.lost=nil
minetest.set_player_privs(param,privs) minetest.set_player_privs(target,privs)
player:set_physics_override({jump = 1, speed = 1, sneak = true}) player:set_physics_override({jump = 1, speed = 1, sneak = true})
player:hud_set_flags({minimap = true}) player:hud_set_flags({minimap = true})
minetest.chat_send_player(param, "The curse is lifted. You have been set free!") minetest.chat_send_player(target, "The curse is lifted. You have been set free!")
minetest.chat_send_player(name, "The curse is lifted.") minetest.chat_send_player(name, "The curse is lifted.")
end, end,
}) })
@ -253,7 +253,7 @@ end)
-- put a player in the cage -- put a player in the cage
minetest.register_chatcommand("cage", { minetest.register_chatcommand("cage", {
params = "<person>", targets = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Put a player in the cage.", description = "Put a player in the cage.",
func = function(warden_name, target_name) func = function(warden_name, target_name)
@ -293,7 +293,7 @@ minetest.register_chatcommand("cage", {
-- free a player from the cage -- free a player from the cage
minetest.register_chatcommand("uncage", { minetest.register_chatcommand("uncage", {
params = "<person>", targets = "<person>",
privs = {secret=true}, privs = {secret=true},
description = "Free a player from the cage.", description = "Free a player from the cage.",
func = function(warden_name, target_name) func = function(warden_name, target_name)
@ -329,7 +329,7 @@ minetest.register_chatcommand("uncage", {
-- list caged players -- list caged players
minetest.register_chatcommand("list_caged", { minetest.register_chatcommand("list_caged", {
params = "", targets = "",
description = "List all caged players.", description = "List all caged players.",
privs = {server = true}, privs = {server = true},
func = function (_, _) func = function (_, _)
@ -349,14 +349,14 @@ minetest.register_chatcommand("list_caged", {
vanished_players = {} vanished_players = {}
minetest.register_chatcommand("vanish", { minetest.register_chatcommand("vanish", {
params = "", targets = "",
description = "Make user invisible", description = "Make user invisible",
privs = {hidden_one = true}, privs = {hidden_one = true},
func = function(name, param) func = function(user)
local prop local prop
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(user)
vanished_players[name] = not vanished_players[name] vanished_players[user] = not vanished_players[user]
if vanished_players[name] then if vanished_players[user] then
prop = {visual_size = {x = 0, y = 0}, prop = {visual_size = {x = 0, y = 0},
collisionbox = {0,0,0,0,0,0}} collisionbox = {0,0,0,0,0,0}}
player:set_nametag_attributes({color = {a = 0, r = 255, g = 255, b = 255}}) player:set_nametag_attributes({color = {a = 0, r = 255, g = 255, b = 255}})
@ -372,18 +372,18 @@ minetest.register_chatcommand("vanish", {
-- announcements -- announcements
minetest.register_chatcommand("proclaim", { minetest.register_chatcommand("proclaim", {
params = "<text>", targets = "<text>",
description = "Sends text to all players", description = "Sends text to all players",
privs = {server = true}, privs = {server = true},
func = function (name, param) func = function (user, text)
if not param if not text
or param == "" then or text == "" then
return return
end end
minetest.chat_send_all(param) minetest.chat_send_all(text)
if minetest.get_modpath("irc") then if minetest.get_modpath("irc") then
if irc.connected and irc.config.send_join_part then if irc.connected and irc.config.send_join_part then
irc:say(param) irc:say(text)
end end
end end
end end