Урна-логист: фильтр по 22 группам предметов в «Содержимом» (вместо образца); дух засыпает, когда игрок дальше 40 м

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexCube
2026-10-16 20:40:04 +03:00
co-authored by Claude Opus 5.5
parent d8e7c8c66a
commit 0290a73477
11 changed files with 435 additions and 23 deletions
+27 -1
View File
@@ -36,7 +36,7 @@ namespace NecromancerTome
public const int Below = 1;
public const int Above = 4;
public const float KillsPerUrn = 500f;
const byte SaveVersion = 2; // 2 - нити (16.10)
const byte SaveVersion = 3; // 2 - нити, 3 - фильтр логиста (16.10)
public bool HasSkull;
public bool ZoneShown;
@@ -45,6 +45,17 @@ namespace NecromancerTome
public bool HasThreadTo;
public Vector3i ThreadTo;
public bool IsLogist => HasThreadTo || ThreadFrom.Count > 0;
/// <summary>Фильтр логиста: бит на группу CinerariumGroups; по умолчанию все включены.</summary>
public uint GroupMask = CinerariumGroups.All;
public bool GroupOn(int _g) => (GroupMask & (1u << _g)) != 0;
public void ToggleGroup(int _g)
{
GroupMask ^= 1u << _g;
SetModified();
Debug.Log("[NecromancerTome] Cinerarium: фильтр урны " + ToWorldPos() + " - группа " + _g + (GroupOn(_g) ? " включена" : " выключена"));
}
public override void CopyFromInternal(TileEntityComposite _other)
{
@@ -56,6 +67,7 @@ namespace NecromancerTome
ThreadFrom.AddRange(other.ThreadFrom);
HasThreadTo = other.HasThreadTo;
ThreadTo = other.ThreadTo;
GroupMask = other.GroupMask;
_threadsDirty = true;
}
}
@@ -124,6 +136,7 @@ namespace NecromancerTome
t.Add(HasThreadTo ? 1 : 0);
t.Add(ThreadTo.x); t.Add(ThreadTo.y); t.Add(ThreadTo.z);
CinerariumWriteHelper.WriteInts(_bw, t.ToArray());
CinerariumWriteHelper.WriteInts(_bw, new[] { unchecked((int)GroupMask) });
}
public override void Read(PooledBinaryReader _br, StreamModeRead _eStreamMode)
@@ -154,6 +167,19 @@ namespace NecromancerTome
ThreadTo = new Vector3i(v[k + 1], v[k + 2], v[k + 3]);
}
}
GroupMask = CinerariumGroups.All;
if (version >= 3)
{
int n = _br.ReadInt32();
for (int i = 0; i < n; i++)
{
int v = _br.ReadInt32();
if (i == 0)
{
GroupMask = unchecked((uint)v);
}
}
}
_threadsDirty = true;
if (version > SaveVersion)
{