Compare commits

..

No commits in common. "lsr" and "main" have entirely different histories.
lsr ... main

4 changed files with 15 additions and 86 deletions

View File

@ -2,15 +2,10 @@ local S = minetest.get_translator("jail")
jail = {} jail = {}
jail.forced_labor = {y = tonumber(minetest.settings:get("jail_upper_limit_underground_y")) or -14848} jail.forced_labor = {y = tonumber(minetest.settings:get("jail_upper_limit_underground_y")) or -14848}
jail.spawnpos = {
x = tonumber(minetest.settings:get("jail_prison_spawn_point_x")) or 666,
y = tonumber(minetest.settings:get("jail_prison_spawn_point_y")) or 5,
z = tonumber(minetest.settings:get("jail_prison_spawn_point_z")) or 2
}
jail.jailpos = { jail.jailpos = {
x = tonumber(minetest.settings:get("jail_prison_center_point_x")) or 690, x = tonumber(minetest.settings:get("jail_prison_spawn_point_x")) or 690,
y = tonumber(minetest.settings:get("jail_prison_center_point_y")) or 5, y = tonumber(minetest.settings:get("jail_prison_spawn_point_y")) or 5,
z = tonumber(minetest.settings:get("jail_prison_center_point_z")) or -7 z = tonumber(minetest.settings:get("jail_prison_spawn_point_z")) or -7
} }
jail.escape_boundary = tonumber(minetest.settings:get("jail_wrap_radius")) or 50 jail.escape_boundary = tonumber(minetest.settings:get("jail_wrap_radius")) or 50
local releasepos = { local releasepos = {
@ -36,25 +31,10 @@ end
jail.set_permissions_for_the_jail = function (player) jail.set_permissions_for_the_jail = function (player)
minetest.set_player_privs(player, { minetest.set_player_privs(player, {
interact = true, interact = true,
shout = true,
}) })
end end
jail.remove_all_inventory = function (player_name)
local player = minetest.env:get_player_by_name(player_name)
local player_inv = player:get_inventory() -- получить инвентарь игрока
local bags_inv = minetest.get_inventory({
type = "detached",
name = player_name .. "_bags"
}) -- получить сумки игрока
player_inv:set_list("main", {}) -- очистить инвентарь
for i = 1, 4 do
player_inv:set_list("bag" .. i .. "contents", {}) -- очистить инвентарь сумок
if (bags_inv) then
bags_inv:set_stack("bag" .. i, 1, "") -- отобрать сумки
end
end
end
jail.add_jail = function(self_player_name, player_name) jail.add_jail = function(self_player_name, player_name)
if (minetest.player_exists(player_name)) then if (minetest.player_exists(player_name)) then
for i = 1, #prisoners_list do for i = 1, #prisoners_list do
@ -69,8 +49,7 @@ jail.add_jail = function(self_player_name, player_name)
minetest.chat_send_all(minetest.colorize("red", minetest.chat_send_all(minetest.colorize("red",
"" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name)) "" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name))
if (player) then if (player) then
jail.remove_all_inventory(player_name) player:setpos(jail.jailpos)
player:setpos(jail.spawnpos)
minetest.chat_send_player(player_name, minetest.colorize("red", S("You have been sent to jail"))) minetest.chat_send_player(player_name, minetest.colorize("red", S("You have been sent to jail")))
end end
else else
@ -92,7 +71,7 @@ jail.set_release_privs = function(self_name, player, prisoners_list_id)
table.remove(prisoners_list, prisoners_list_id) table.remove(prisoners_list, prisoners_list_id)
end end
jail.release_id = function(self_name, id_player) jail.release = function(self_name, id_player)
local id = tonumber(id_player) local id = tonumber(id_player)
local playername = prisoners_list[id] local playername = prisoners_list[id]
if (id == nil or id > #prisoners_list or id <= 0) then if (id == nil or id > #prisoners_list or id <= 0) then
@ -110,22 +89,6 @@ jail.release_id = function(self_name, id_player)
end end
end end
jail.release = function(self_name, player_name)
for i = 1, #prisoners_list do
if player_name == prisoners_list[i] then
local player = minetest.env:get_player_by_name(player_name)
if (player) then
player:setpos(releasepos)
minetest.chat_send_player(player_name, minetest.colorize("green", S("You have been released from jail")))
end
jail.set_release_privs(self_name, player_name, i)
return
else
minetest.chat_send_player(self_name, S("Invalid playername"))
end
end
end
minetest.register_chatcommand("jail", { minetest.register_chatcommand("jail", {
params = "<player>", params = "<player>",
description = S("Sends a player to Jail"), description = S("Sends a player to Jail"),
@ -148,7 +111,7 @@ minetest.register_chatcommand("jail_return", {
end end
local player = minetest.env:get_player_by_name(playername) local player = minetest.env:get_player_by_name(playername)
if (player) then if (player) then
player:setpos(jail.spawnpos) player:setpos(jailpos)
minetest.chat_send_player(playername, minetest.colorize("red", S("You have been return to jail"))) minetest.chat_send_player(playername, minetest.colorize("red", S("You have been return to jail")))
minetest.chat_send_all(minetest.colorize("red", minetest.chat_send_all(minetest.colorize("red",
"" .. param .. " " .. S("has been return to jail by") .. " " .. name)) "" .. param .. " " .. S("has been return to jail by") .. " " .. name))
@ -157,20 +120,11 @@ minetest.register_chatcommand("jail_return", {
}) })
minetest.register_chatcommand("release", { minetest.register_chatcommand("release", {
params = "<nickname prisoners>",
description = S("Releases a player from Jail by nickname"),
privs = { jail = true },
func = function(name, param)
jail.release(name, param)
end,
})
minetest.register_chatcommand("release_id", {
params = "<ID prisoners>", params = "<ID prisoners>",
description = S("Releases a player from Jail by ID"), description = S("Releases a player from Jail by ID"),
privs = { jail = true }, privs = { jail = true },
func = function(name, param) func = function(name, param)
jail.release_id(name, param) jail.release(name, param)
end, end,
}) })
@ -211,22 +165,6 @@ minetest.register_chatcommand("jailb_off", {
end end
}) })
minetest.register_chatcommand("remove_all_inventory", {
params = "<player>",
description = S("Remove bags and clear inventory"),
privs = { jail = true },
func = function(self_player_name, player_name)
local player = minetest.env:get_player_by_name(player_name)
if (player) then
jail.remove_all_inventory(player_name)
minetest.chat_send_player(self_player_name,S('The players inventory has been completely cleared'))
else
minetest.chat_send_player(self_player_name,minetest.colorize("red",
S("The player '") .. player_name .. S("' does not exist, check that the nickname is correct")))
end
end,
})
minetest.register_on_shutdown(function() minetest.register_on_shutdown(function()
local prisoners = table.concat(prisoners_list, "\n") local prisoners = table.concat(prisoners_list, "\n")
mod_storage:set_string("prisoners", prisoners) mod_storage:set_string("prisoners", prisoners)
@ -268,7 +206,7 @@ minetest.register_globalstep(function(dtime)
if (max_pos_x < pos.x or pos.x < min_pos_x or max_pos_z < pos.z or pos.z < min_pos_z or pos.y > max_pos_y) if (max_pos_x < pos.x or pos.x < min_pos_x or max_pos_z < pos.z or pos.z < min_pos_z or pos.y > max_pos_y)
and pos.y > lower_prison_limit then and pos.y > lower_prison_limit then
object:set_pos(jail.spawnpos) object:set_pos(jail.jailpos)
msg = minetest.colorize("red", S("Escape attempt: ") .. " " .. prisoners_list[i]) msg = minetest.colorize("red", S("Escape attempt: ") .. " " .. prisoners_list[i])
jail.private_messages_with_privilege({ban = true}, msg) jail.private_messages_with_privilege({ban = true}, msg)
minetest.chat_send_player(prisoners_list[i], msg) minetest.chat_send_player(prisoners_list[i], msg)
@ -277,7 +215,7 @@ minetest.register_globalstep(function(dtime)
--Проверка если игрок копает в низ по кординатам тюрьмы --Проверка если игрок копает в низ по кординатам тюрьмы
if pos.y < lower_prison_limit and pos.y > forced_labor then if pos.y < lower_prison_limit and pos.y > forced_labor then
object:set_pos(jail.spawnpos) object:set_pos(jail.jailpos)
msg = minetest.colorize("red", prisoners_list[i] .. S(": He dug under the prison")) msg = minetest.colorize("red", prisoners_list[i] .. S(": He dug under the prison"))
jail.private_messages_with_privilege({ban = true}, msg) jail.private_messages_with_privilege({ban = true}, msg)
minetest.chat_send_player(prisoners_list[i], msg) minetest.chat_send_player(prisoners_list[i], msg)
@ -286,7 +224,7 @@ minetest.register_globalstep(function(dtime)
--Условие если игрок находится взаданом параметре jail.forced_labor.y под землей --Условие если игрок находится взаданом параметре jail.forced_labor.y под землей
if pos.y > jail.forced_labor.y and pos.y < -10 then if pos.y > jail.forced_labor.y and pos.y < -10 then
object:set_pos(jail.spawnpos) object:set_pos(jail.jailpos)
minetest.chat_send_player(prisoners_list[i], minetest.colorize("red", S("You are prohibited from leaving this area"))) minetest.chat_send_player(prisoners_list[i], minetest.colorize("red", S("You are prohibited from leaving this area")))
jail.set_permissions_for_the_jail(prisoners_list[i]) jail.set_permissions_for_the_jail(prisoners_list[i])
end end

View File

@ -4,7 +4,6 @@ Allows one to send/release prisoners=Позволяет заключать и о
Sends a player to Jail=Отправить игрока в тюрьму Sends a player to Jail=Отправить игрока в тюрьму
Sends the player to prison for a limited time= Sends the player to prison for a limited time=
Releases a player from Jail by ID=Освободить игрока из тюрьмы по ID Releases a player from Jail by ID=Освободить игрока из тюрьмы по ID
Releases a player from Jail by nickname=Освободить игрока из тюрьмы по никнейму
You have been sent to jail=Вы помещены в тюрьму You have been sent to jail=Вы помещены в тюрьму
You have been return to jail=Вы возвращены в тюрьму You have been return to jail=Вы возвращены в тюрьму
You have been released from jail=Вы были освобождены из тюрьмы You have been released from jail=Вы были освобождены из тюрьмы
@ -14,7 +13,6 @@ has been released from jail by=был освобожден из тюрьмы и
List of prisoners=Список заключенных List of prisoners=Список заключенных
Prisoners:=Заключенные: Prisoners:=Заключенные:
Invalid ID=Неверный ID Invalid ID=Неверный ID
Invalid playername=Неверное имя игрока
Return a prisoner to jail=Возвратить заключенного в тюрьму Return a prisoner to jail=Возвратить заключенного в тюрьму
The player is already in jail=Игрок уже в тюреме The player is already in jail=Игрок уже в тюреме
Total number of prisoners:=Общее число заключенных: Total number of prisoners:=Общее число заключенных:
@ -32,6 +30,4 @@ To jail=В тюрьму
To freedom=На свободу To freedom=На свободу
Graphical prisoner management shell=Интерфейс управления заключенными Graphical prisoner management shell=Интерфейс управления заключенными
The player '=Игрока ' The player '=Игрока '
' does not exist, check that the nickname is correct=' не сущеcтвует, проверьте правильность ника ' does not exist, check that the nickname is correct=' не сущеcтвует, проверьте правильность ника
Remove bags and clear inventory=Удалить сумки и очистить инвентарь
The players inventory has been completely cleared=Инвентарь игрока был полностью очищен

View File

@ -13,6 +13,4 @@ Prisoners:=
Invalid ID= Invalid ID=
Return a prisoner to jail= Return a prisoner to jail=
The player is already in jail= The player is already in jail=
Total number of prisoners:= Total number of prisoners:=
Remove bags and clear inventory=
The players inventory has been completely cleared=

View File

@ -1,10 +1,7 @@
[Prison spawn point] [Prison spawn point]
jail_prison_spawn_point_x (Position X) int 666 jail_prison_spawn_point_x (Position X) int 690
jail_prison_spawn_point_y (Position Y) int 5 jail_prison_spawn_point_y (Position Y) int 5
jail_prison_spawn_point_z (Position z) int 2 jail_prison_spawn_point_z (Position z) int -7
jail_prison_center_point_x (Position X) int 690
jail_prison_center_point_y (Position Y) int 5
jail_prison_center_point_z (Position z) int -7
[End of the border] [End of the border]
jail_wrap_radius (Wrap radius) int 50 jail_wrap_radius (Wrap radius) int 50