Урны: в лимит входят все урны; блок «всего / доступно / до следующей» в «Содержимом» (#65)
Лимит считает урны любого рода (сборщик, логист, рабочий, ремонтник, лутер, старатель); пересечение зон - только у сборщика. Блок справа от ячеек урны (windowBagStorage, CinerariumLimitPanel.cs). Тексты описаний урн и отказа по лимиту - на 13 языках. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
108ff82914
commit
aa26e97b71
+26
-24
@@ -1125,30 +1125,34 @@ namespace NecromancerTome
|
||||
int d = Math.Max(Math.Abs(other.x - _pos.x), Math.Abs(other.z - _pos.z));
|
||||
return string.Format(Localization.Get("necroCinerariumOverlap"), d, HalfWidth * 2 + 1);
|
||||
}
|
||||
if (IsZonelessBlock(_placing))
|
||||
// 20.10 (#65, пользователь): в лимит входят ВСЕ урны - сборщик, логист, рабочий, ремонтник, лутер, старатель; пересечение
|
||||
// зон проверяется только у сборщика (выше). Череп-декор урной не считается.
|
||||
if (LimitNumbers(out int have, out int limit, out int kills, out int next) && have >= limit)
|
||||
{
|
||||
return null; // логисты и рабочие в лимит не входят (16.10, 17.10 - пользователь)
|
||||
}
|
||||
World world = GameManager.Instance?.World;
|
||||
EntityPlayerLocal player = world?.GetPrimaryPlayer();
|
||||
// Реестр живёт на сервере; клиент в сети лимит не проверяет (мультиплеер поддержан не полностью).
|
||||
if (player != null && world != null && !world.IsRemote())
|
||||
{
|
||||
PlatformUserIdentifierAbs me = PlatformManager.InternalLocalUserIdentifier;
|
||||
int have = CinerariumRegistry.CountFor(me), limit = UrnLimit(player);
|
||||
if (have >= limit)
|
||||
{
|
||||
float kills = player.Buffs != null ? player.Buffs.GetCustomVar(Patch_EntityPlayer_AddKillXP_NecromancyCount.KillsCVarName) : 0f;
|
||||
int next = Mathf.CeilToInt((limit + 1) * KillsPerUrn - kills);
|
||||
if (kills <= 0f)
|
||||
{
|
||||
next = Mathf.CeilToInt(KillsPerUrn);
|
||||
}
|
||||
return string.Format(Localization.Get("necroCinerariumLimit"), have, limit, (int)KillsPerUrn, (int)kills, Math.Max(1, next));
|
||||
}
|
||||
return string.Format(Localization.Get("necroCinerariumLimit"), have, limit, (int)KillsPerUrn, kills, next);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Урн поставлено, сколько можно, упокоено и сколько ещё упокоить до следующей урны. false - нет игрока или
|
||||
/// клиент в сети (реестр живёт на сервере; мультиплеер поддержан не полностью).</summary>
|
||||
public static bool LimitNumbers(out int _have, out int _limit, out int _kills, out int _next)
|
||||
{
|
||||
_have = _limit = _kills = _next = 0;
|
||||
World world = GameManager.Instance?.World;
|
||||
EntityPlayerLocal player = world?.GetPrimaryPlayer();
|
||||
if (player == null || world.IsRemote())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_have = CinerariumRegistry.CountFor(PlatformManager.InternalLocalUserIdentifier);
|
||||
_limit = UrnLimit(player);
|
||||
float kills = player.Buffs != null ? player.Buffs.GetCustomVar(Patch_EntityPlayer_AddKillXP_NecromancyCount.KillsCVarName) : 0f;
|
||||
_kills = (int)kills;
|
||||
_next = kills <= 0f ? Mathf.CeilToInt(KillsPerUrn) : Math.Max(1, Mathf.CeilToInt((_limit + 1) * KillsPerUrn - kills));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>Все урны сейва: позиция и владелец, файл в папке сейва (как сумка волка). Сервер.</summary>
|
||||
@@ -1247,14 +1251,12 @@ namespace NecromancerTome
|
||||
|
||||
public static int CountFor(PlatformUserIdentifierAbs _owner)
|
||||
{
|
||||
// 20.10 (#65): считаются все урны владельца, любого рода (метка «L» в реестре для лимита больше не нужна).
|
||||
string id = _owner != null ? _owner.CombinedString : "";
|
||||
int n = 0;
|
||||
World world = GameManager.Instance?.World;
|
||||
foreach (KeyValuePair<Vector3i, string> kv in Urns())
|
||||
{
|
||||
// Логисты не считаются; записанные до метки «L» узнаются по блоку в мире (чанк рядом загружен).
|
||||
if (kv.Value == id && !_logists.Contains(kv.Key) &&
|
||||
!(world != null && TEFeatureCinerarium.IsZonelessBlock(world.GetBlock(kv.Key).Block)))
|
||||
if (kv.Value == id)
|
||||
{
|
||||
n++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user