From 66c5c1d564f9dba7be251f4c4b00308c6daea508 Mon Sep 17 00:00:00 2001 From: Shepel Pavel Date: Tue, 17 Dec 2024 12:01:42 +0300 Subject: [PATCH] fix jailb and spawnpoint --- .vscode/settings.json | 5 +++++ init.lua | 17 +++++++++++------ settingtypes.txt | 3 +++ 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c15b181 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "Lua.diagnostics.globals": [ + "minetest" + ] +} \ No newline at end of file diff --git a/init.lua b/init.lua index ad89442..256f445 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/settingtypes.txt b/settingtypes.txt index 610f6c9..ca1232d 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -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