"Wipe On Upgrade Or Change": false,

"Wipe On Upgrade Or Change": false,

 

При любой перезагрузке o.reload если значение установлено на true после обновления происходит сброс.

 

[ApartmentAutoTP] [ApartmentAutoTP] Апартаменты найдены и ТП успешно настроен!
[ApartmentAutoTP] [ApartmentAutoTP] Точка телепорта: -1417.496 8.2 1853.742
[ApartmentAutoTP] [ApartmentAutoTP] Перезагружаю NTeleportation через 2 секунды...
[ApartmentAutoTP] [ApartmentAutoTP] Апартаменты найдены и ТП успешно настроен!
[ApartmentAutoTP] [ApartmentAutoTP] Точка телепорта: -1417.496 8.2 1853.742
[ApartmentAutoTP] [ApartmentAutoTP] Перезагружаю NTeleportation через 2 секунды...
Unloaded plugin NTeleportation v1.9.6 by nivex
Unloaded plugin NTeleportation v1.9.6 by nivex
[NTeleportation] Rust was upgraded or map changed - clearing homes and all locations!
Loaded plugin NTeleportation v1.9.6 by nivex
[ApartmentAutoTP] [ApartmentAutoTP] ГОТОВО! Команда /apartments работает с актуальной точкой.
[NTeleportation] Rust was upgraded or map changed - clearing homes and all locations! <============= Этого при o.reload БЫТЬ не должно!
Loaded plugin NTeleportation v1.9.6 by nivex
[ApartmentAutoTP] [ApartmentAutoTP] ГОТОВО! Команда /apartments работает с актуальной точкой.

 

 

До патча мой плагин маленький менял координаты без ошибок. сейчас перезагрузка плагина (вашего) зануляет все тп. (как будто карта новая. Хотя она не менялась)

 

 

FIX PLZ!

Я уточню любая перезагрузка сервера, вероятно, если стоит "Wipe On Upgrade Or Change": true,

Будет считать, что карта новая и сбросит все точки тп!

 

 

 

Subject: NTeleportation v1.9.6 – Wipe On Upgrade Or Change resets data on every plugin reload (not just map change)

Hi nivex,

I'm using NTeleportation v1.9.6 with the following config:

json
"Wipe On Upgrade Or Change": true

I also have a helper plugin (ApartmentAutoTP) that automatically finds the Apartment Complex monument and writes its coordinates into the Dynamic Commands → Apartments section of the NTeleportation config. After writing the config, the helper plugin executes oxide.reload NTeleportation to apply the changes.

The issue:
On every reload (even a simple oxide.reload), NTeleportation logs:

text
[NTeleportation] Rust was upgraded or map changed - clearing homes and all locations!

and clears all dynamic command locations, including the freshly written Apartments coordinates (resetting them to 0 0 0). As a result, /apartments becomes unusable until the coordinates are re-added.

I updated to v1.9.6 hoping this would be fixed, but it still happens. The reload is not a map change or an upgrade – it’s just a plugin reload. The wipe should only occur on real map changes (seed/size change, save version change, or plugin version upgrade), not on every manual reload.

Steps to reproduce:

  1. Set "Wipe On Upgrade Or Change": true in config.

  2. Add a location to Dynamic Commands (e.g., Apartments).

  3. Reload the plugin via oxide.reload NTeleportation.

  4. Observe the wipe message and lost coordinates.

Expected behaviour:
Data should persist across normal reloads and only be cleared when the map actually changes or when the plugin version is updated.

Temporary workaround:
Setting "Wipe On Upgrade Or Change": false prevents the wipe, but then the plugin won't auto-clear on legitimate map changes, which is not ideal.

Could you please look into this? It seems the detection logic for "upgrade or change" is too aggressive.

Thanks!

hi, the detection logic being too aggressive is intentional. as I previously wrote, it will always reset on wipe and when the map is still empty from that wipe. reloading makes no difference to that; player structures are required to prevent it and this has been the case for 5 years.

I can appreciate the time you've spent on this report, and I will make the latter optional but it is not advised to disable an option meant to prevent an issue where positions may not be reset otherwise. disable at your own risk.

Thank you. I understand now. (At first I thought you didn't quite get my problem, but it seems I was the one who didn't fully understand the logic behind it.)

I'm manually deleting all data files in the oxide/data folder myself, so I'll just keep "Wipe On Upgrade Or Change": false.

If it's not too much trouble, could you tell me if there is a built‑in way to automatically set the teleport point for the Apartment Complex monument when the map changes? My other plugin (ApartmentAutoTP) does this custom job, but if NTeleportation already has a native solution for that, I'd prefer to use it. Otherwise, no problem – I'll stick with my custom plugin.

Thanks again for your time and for the clarification.

hi, where do you expect the teleport point to be set for such an option? it does not currently exist

nivex

hi, where do you expect the teleport point to be set for such an option? it does not currently exist

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Oxide.Core;
using Oxide.Core.Plugins;
using System;
using System.IO;
using UnityEngine;

namespace Oxide.Plugins
{
[Info("ApartmentAutoTP", "AutoSetup", "1.0.3")]
[Description("Автоматически находит апартаменты и прописывает точку ТП в NTeleportation. Постоянные попытки до успеха.")]
class ApartmentAutoTP : RustPlugin
{
private readonly Vector3 Offset = new Vector3(-19.98f, 0.12f, 35.18f);
private const string MonumentFilter = "apartment";
private const string CommandKey = "Apartments";
private string ConfigPath => Interface.Oxide.ConfigDirectory + Path.DirectorySeparatorChar + "NTeleportation.json";

private bool isWorking = false;
private bool isSuccess = false; // Флаг, чтобы остановить попытки после успеха

#region Lifecycle

private void OnServerInitialized()
{
Puts("[ApartmentAutoTP] Плагин загружен. Начинаю поиск апартаментов и настройку ТП (буду пытаться до успеха)...");
// Начинаем попытки почти сразу, с крошечной задержкой для стабильности
timer.Once(900f, TryFindAndPatch);
}

#endregion

#region Main Logic

private void TryFindAndPatch()
{
if (isWorking || isSuccess) return;
isWorking = true;

try
{
// 1. Проверка готовности карты
if (TerrainMeta.Path == null || TerrainMeta.Path.Monuments == null)
{
Puts("[ApartmentAutoTP] Карта ещё не загружена (TerrainMeta). Повторная попытка через 10 секунд...");
isWorking = false;
timer.Once(10f, TryFindAndPatch);
return;
}

// 2. Поиск монумента
MonumentInfo foundMonument = null;
foreach (var monument in TerrainMeta.Path.Monuments)
{
if (monument == null) continue;
if (monument.name.ToLower().Contains(MonumentFilter))
{
foundMonument = monument;
break;
}
}

if (foundMonument == null)
{
Puts("[ApartmentAutoTP] Апартаменты пока не найдены. Повторная попытка через 10 секунд...");
isWorking = false;
timer.Once(10f, TryFindAndPatch);
return;
}

// 3. Вычисление координат
Vector3 center = foundMonument.transform.position;
Quaternion rotation = foundMonument.transform.rotation;
Vector3 targetPos = center + (rotation * Offset);
targetPos.y += 1f;

// 4. Попытка записать в конфиг
if (!PatchConfig(targetPos))
{
Puts("[ApartmentAutoTP] Не удалось обновить конфиг (файл отсутствует или повреждён). Повторная попытка через 10 секунд...");
isWorking = false;
timer.Once(10f, TryFindAndPatch);
return;
}

// 5. УСПЕХ! Останавливаем цикл попыток
isSuccess = true;
Puts("[ApartmentAutoTP] Апартаменты найдены и ТП успешно настроен!");
Puts($"[ApartmentAutoTP] Точка телепорта: {targetPos.x} {targetPos.y} {targetPos.z}");

Puts("[ApartmentAutoTP] Перезагружаю NTeleportation через 2 секунды...");
timer.Once(2f, () =>
{
try
{
ConsoleSystem.Run(ConsoleSystem.Option.Server, "oxide.reload NTeleportation");
Puts("[ApartmentAutoTP] ГОТОВО! Команда /apartments работает с актуальной точкой.");
}
catch (Exception ex)
{
Puts($"[ApartmentAutoTP] Ошибка при перезагрузке NTeleportation: {ex.Message}");
}
finally
{
isWorking = false;
}
});
}
catch (Exception ex)
{
Puts($"[ApartmentAutoTP] Произошла ошибка: {ex.Message}. Повторная попытка через 10 секунд...");
isWorking = false;
timer.Once(10f, TryFindAndPatch);
}
}

private bool PatchConfig(Vector3 position)
{
if (!File.Exists(ConfigPath))
{
return false; // Файла нет, вызовем повторную попытку
}

try
{
string json = File.ReadAllText(ConfigPath);
JObject root = JObject.Parse(json);

var apartments = root["Dynamic Commands"]?[CommandKey];
if (apartments == null)
{
Puts($"[ApartmentAutoTP] ВНИМАНИЕ: В конфиге NTeleportation нет блока '{CommandKey}' в 'Dynamic Commands'!");
Puts("[ApartmentAutoTP] Добавьте этот блок вручную, иначе плагин будет пытаться бесконечно.");
return false; // Вызовем повторную попытку
}

apartments["Set Position From Monument Marker Name"] = "";
apartments["Set Position From Monument Marker Name Offset"] = "0 0 0";

string posStr = $"{position.x} {position.y} {position.z}";
apartments["Location"] = posStr;
apartments["Locations"] = new JArray { posStr };
apartments["Teleport To Random Location"] = false;

File.WriteAllText(ConfigPath, root.ToString(Formatting.Indented));
return true;
}
catch (Exception ex)
{
Puts($"[ApartmentAutoTP] Ошибка при чтении/записи конфига: {ex.Message}");
return false;
}
}

#endregion

#region Admin Commands

[ChatCommand("aptfix")]
private void CmdFix(BasePlayer player, string cmd, string[] args)
{
if (!player.IsAdmin)
{
player.ChatMessage("<color=red>Только для админов.</color>");
return;
}

if (isWorking)
{
player.ChatMessage("<color=yellow>Уже выполняется, подождите...</color>");
return;
}

isSuccess = false; // Сбрасываем флаг успеха для ручного перезапуска
player.ChatMessage("<color=green>Запускаю перерасчёт точки апартаментов...</color>");
TryFindAndPatch();
}

[ConsoleCommand("apartmenttp.update")]
private void ConsoleUpdate(ConsoleSystem.Arg arg)
{
if (!arg.IsAdmin) return;
isSuccess = false;
Puts("[ApartmentAutoTP] Ручной запуск через консоль...");
TryFindAndPatch();
}

#endregion
}
}



Merged post

меня точка тут в целом устраивает)

Merged post

Если кому надо, плагин сам прописывает точку /apartment на каждом вайпе.

hi, implemented in the next update :)
it will require an "apartments" command to exist in the config.
if the command is newly added then the position will be automatically set upon creation or reload.
I may add more to this, but this is what is implemented so far.

nivex

hi, implemented in the next update :)
it will require an "apartments" command to exist in the config.
if the command is newly added then the position will be automatically set upon creation or reload.
I may add more to this, but this is what is implemented so far.

Thank you. I’ll be waiting for the update!