Урна: дух летит к делу лицом, над местом жестикулирует руками, дело - в середине жеста, назад лицом к урне

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexCube
2026-10-16 20:03:53 +03:00
co-authored by Claude Opus 5.5
parent 23587d78e0
commit 7e93e19c5f
3 changed files with 150 additions and 32 deletions
+53 -6
View File
@@ -41,8 +41,25 @@ namespace NecromancerTome
static readonly HashSet<TileEntity> _seen = new HashSet<TileEntity>();
/// <summary>Одно дело. Возвращает, где дух работал (для полёта модели), или null; _stuck - есть что забрать, но некуда.</summary>
public static Vector3i? Step(World _world, TEFeatureCinerarium _urn, out bool _stuck)
/// <summary>Пробный шаг: найти дело и место, ничего не меняя.</summary>
static bool _dry;
/// <summary>Одно дело. Возвращает, где дух работал (для полёта модели), или null; _stuck - есть что забрать, но некуда.
/// _dryRun - только узнать, где будет дело (дух летит туда заранее), ничего не трогая.</summary>
public static Vector3i? Step(World _world, TEFeatureCinerarium _urn, out bool _stuck, bool _dryRun)
{
_dry = _dryRun;
try
{
return DoStep(_world, _urn, out _stuck);
}
finally
{
_dry = false;
}
}
static Vector3i? DoStep(World _world, TEFeatureCinerarium _urn, out bool _stuck)
{
_stuck = false;
Zone z = Scan(_world, _urn);
@@ -51,7 +68,10 @@ namespace NecromancerTome
{
if (Refill(c, c.FuelSlots, c.GetFuelTypes(), false, z) || Refill(c, c.CatalystSlots, c.GetCatalystTypes(), true, z))
{
c.SetModified();
if (!_dry)
{
c.SetModified();
}
return z.Where[c];
}
}
@@ -62,8 +82,11 @@ namespace NecromancerTome
ItemStack[] items = c.Items;
if (Unload(items, z, ref blocked))
{
c.Items = items;
c.SetModified();
if (!_dry)
{
c.Items = items;
c.SetModified();
}
return z.Where[c];
}
}
@@ -72,7 +95,10 @@ namespace NecromancerTome
ItemStack[] output = w.Output;
if (Unload(output, z, ref blocked))
{
w.Output = output;
if (!_dry)
{
w.Output = output;
}
return z.Where[w];
}
}
@@ -151,6 +177,10 @@ namespace NecromancerTome
_blocked = true;
return false;
}
if (_dry)
{
return true;
}
_world.SetBlockRPC(_p, BlockValue.Air);
if (!replant.isair)
{
@@ -232,6 +262,10 @@ namespace NecromancerTome
{
continue;
}
if (_dry)
{
return p;
}
Take(pick.src, pick.slot, 1);
_world.SetBlockRPC(p, bv);
Debug.Log("[NecromancerTome] Cinerarium: дух посадил " + bv.Block.GetBlockName() + " в " + p);
@@ -351,6 +385,10 @@ namespace NecromancerTome
{
continue;
}
if (_dry)
{
return true;
}
if (want == null)
{
_slots[i] = new ItemStack(s.itemValue.Clone(), take);
@@ -382,6 +420,15 @@ namespace NecromancerTome
{
continue;
}
if (_dry)
{
if (HasRoom(s, _z))
{
return true;
}
_blocked = true;
continue;
}
int before = s.count;
// Сначала ящики зоны (к таким же, потом в пустое), они полны - тогда сумка урны (решение 06.10).
Place(s, _z.Boxes);