Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
f4914fc516 | |||
|
8814c417af | ||
|
89a96d69e3 |
34
init.lua
34
init.lua
@ -3,9 +3,9 @@ local S = minetest.get_translator("jail")
|
||||
jail = {}
|
||||
jail.forced_labor = {y = tonumber(minetest.settings:get("jail_upper_limit_underground_y")) or -14848}
|
||||
jail.jailpos = {
|
||||
x = tonumber(minetest.settings:get("jail_prison_spawn_point_x")) or 690,
|
||||
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 -7
|
||||
z = tonumber(minetest.settings:get("jail_prison_spawn_point_z")) or 2
|
||||
}
|
||||
jail.escape_boundary = tonumber(minetest.settings:get("jail_wrap_radius")) or 50
|
||||
local releasepos = {
|
||||
@ -31,7 +31,6 @@ end
|
||||
jail.set_permissions_for_the_jail = function (player)
|
||||
minetest.set_player_privs(player, {
|
||||
interact = true,
|
||||
shout = true,
|
||||
})
|
||||
end
|
||||
|
||||
@ -71,7 +70,7 @@ jail.set_release_privs = function(self_name, player, prisoners_list_id)
|
||||
table.remove(prisoners_list, prisoners_list_id)
|
||||
end
|
||||
|
||||
jail.release = function(self_name, id_player)
|
||||
jail.release_id = function(self_name, id_player)
|
||||
local id = tonumber(id_player)
|
||||
local playername = prisoners_list[id]
|
||||
if (id == nil or id > #prisoners_list or id <= 0) then
|
||||
@ -89,6 +88,22 @@ jail.release = function(self_name, id_player)
|
||||
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", {
|
||||
params = "<player>",
|
||||
description = S("Sends a player to Jail"),
|
||||
@ -120,11 +135,20 @@ minetest.register_chatcommand("jail_return", {
|
||||
})
|
||||
|
||||
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>",
|
||||
description = S("Releases a player from Jail by ID"),
|
||||
privs = { jail = true },
|
||||
func = function(name, param)
|
||||
jail.release(name, param)
|
||||
jail.release_id(name, param)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -4,6 +4,7 @@ Allows one to send/release prisoners=Позволяет заключать и о
|
||||
Sends a player to Jail=Отправить игрока в тюрьму
|
||||
Sends the player to prison for a limited time=
|
||||
Releases a player from Jail by ID=Освободить игрока из тюрьмы по ID
|
||||
Releases a player from Jail by nickname=Освободить игрока из тюрьмы по никнейму
|
||||
You have been sent to jail=Вы помещены в тюрьму
|
||||
You have been return to jail=Вы возвращены в тюрьму
|
||||
You have been released from jail=Вы были освобождены из тюрьмы
|
||||
@ -13,6 +14,7 @@ has been released from jail by=был освобожден из тюрьмы и
|
||||
List of prisoners=Список заключенных
|
||||
Prisoners:=Заключенные:
|
||||
Invalid ID=Неверный ID
|
||||
Invalid playername=Неверное имя игрока
|
||||
Return a prisoner to jail=Возвратить заключенного в тюрьму
|
||||
The player is already in jail=Игрок уже в тюреме
|
||||
Total number of prisoners:=Общее число заключенных:
|
||||
|
@ -1,7 +1,7 @@
|
||||
[Prison spawn point]
|
||||
jail_prison_spawn_point_x (Position X) int 690
|
||||
jail_prison_spawn_point_x (Position X) int 666
|
||||
jail_prison_spawn_point_y (Position Y) int 5
|
||||
jail_prison_spawn_point_z (Position z) int -7
|
||||
jail_prison_spawn_point_z (Position z) int 2
|
||||
|
||||
[End of the border]
|
||||
jail_wrap_radius (Wrap radius) int 50
|
||||
|
Loading…
Reference in New Issue
Block a user