fix jailb and spawnpoint (#9)

fix jailb and spawnpoint

Reviewed-on: #9
Reviewed-by: Александр Авдеев <reload@luanti.ru>
Co-authored-by: Shepel Pavel <shepelpavel@mail.ru>
Co-committed-by: Shepel Pavel <shepelpavel@mail.ru>
This commit is contained in:
Shepel Pavel 2024-12-17 12:32:08 +03:00 committed by Александр Авдеев
parent d0c49465c3
commit e26538f785
2 changed files with 14 additions and 6 deletions

View File

@ -2,11 +2,16 @@ local S = minetest.get_translator("jail")
jail = {}
jail.forced_labor = {y = tonumber(minetest.settings:get("jail_upper_limit_underground_y")) or -14848}
jail.jailpos = {
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 = {
x = tonumber(minetest.settings:get("jail_prison_center_point_x")) or 690,
y = tonumber(minetest.settings:get("jail_prison_center_point_y")) or 5,
z = tonumber(minetest.settings:get("jail_prison_center_point_z")) or -7
}
jail.escape_boundary = tonumber(minetest.settings:get("jail_wrap_radius")) or 50
local releasepos = {
x = tonumber(minetest.settings:get("jail_releasepos_x")) or 684,
@ -65,7 +70,7 @@ jail.add_jail = function(self_player_name, player_name)
"" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name))
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")))
end
else
@ -143,7 +148,7 @@ minetest.register_chatcommand("jail_return", {
end
local player = minetest.env:get_player_by_name(playername)
if (player) then
player:setpos(jailpos)
player:setpos(jail.spawnpos)
minetest.chat_send_player(playername, minetest.colorize("red", S("You have been return to jail")))
minetest.chat_send_all(minetest.colorize("red",
"" .. param .. " " .. S("has been return to jail by") .. " " .. name))
@ -263,7 +268,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)
and pos.y > lower_prison_limit then
object:set_pos(jail.jailpos)
object:set_pos(jail.spawnpos)
msg = minetest.colorize("red", S("Escape attempt: ") .. " " .. prisoners_list[i])
jail.private_messages_with_privilege({ban = true}, msg)
minetest.chat_send_player(prisoners_list[i], msg)
@ -272,7 +277,7 @@ minetest.register_globalstep(function(dtime)
--Проверка если игрок копает в низ по кординатам тюрьмы
if pos.y < lower_prison_limit and pos.y > forced_labor then
object:set_pos(jail.jailpos)
object:set_pos(jail.spawnpos)
msg = minetest.colorize("red", prisoners_list[i] .. S(": He dug under the prison"))
jail.private_messages_with_privilege({ban = true}, msg)
minetest.chat_send_player(prisoners_list[i], msg)
@ -281,7 +286,7 @@ minetest.register_globalstep(function(dtime)
--Условие если игрок находится взаданом параметре jail.forced_labor.y под землей
if pos.y > jail.forced_labor.y and pos.y < -10 then
object:set_pos(jail.jailpos)
object:set_pos(jail.spawnpos)
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])
end

View File

@ -2,6 +2,9 @@
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 2
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]
jail_wrap_radius (Wrap radius) int 50