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

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
+31 -8
View File
@@ -153,29 +153,52 @@ namespace NecromancerTome
float _nextWork;
public bool Stuck;
/// <summary>Дело найдено пробным шагом, дух полетел; выполнить в _actAt (16.10: «делал действие не сразу»).</summary>
bool _pending;
float _actAt;
/// <summary>Работа духа (CinerariumWork): раз в StepSeconds одно дело, только с черепом и только на сервере.</summary>
/// <summary>Работа духа (CinerariumWork): раз в StepSeconds одно дело, только с черепом и только на сервере.
/// Сначала пробный шаг (ничего не меняет) - куда лететь; само дело - когда дух долетел и машет руками. Если за это
/// время что-то поменялось, настоящий шаг сделает то, что нужно на тот момент.</summary>
void Work(World _world)
{
if (!HasSkull || _world == null || !ConnectionManager.Instance.IsServer || Time.time < _nextWork)
if (!HasSkull || _world == null || !ConnectionManager.Instance.IsServer)
{
_pending = false;
return;
}
CinerariumGenieMotion motion = _genie != null ? _genie.GetComponent<CinerariumGenieMotion>() : null;
if (_pending)
{
if (Time.time < _actAt)
{
return;
}
_pending = false;
CinerariumWork.Step(_world, this, out bool _, false);
_nextWork = Time.time + CinerariumWork.StepSeconds;
return;
}
if (Time.time < _nextWork)
{
return;
}
_nextWork = Time.time + CinerariumWork.StepSeconds;
Vector3i? at = CinerariumWork.Step(_world, this, out bool stuck);
Vector3i? at = CinerariumWork.Step(_world, this, out bool stuck, true);
if (stuck != Stuck)
{
Stuck = stuck;
Debug.Log("[NecromancerTome] Cinerarium: дух урны " + ToWorldPos() + (stuck ? " почернел - готовое класть некуда" : " ожил"));
}
CinerariumGenieMotion motion = _genie != null ? _genie.GetComponent<CinerariumGenieMotion>() : null;
if (motion != null)
{
motion.SetStuck(Stuck && at == null);
if (at.HasValue)
{
motion.Visit(World.blockToTransformPos(at.Value) - Origin.position);
}
}
if (at.HasValue)
{
_pending = true;
_actAt = Time.time + (motion != null ? CinerariumGenieMotion.ActDelay : 0f);
motion?.Visit(World.blockToTransformPos(at.Value) - Origin.position);
}
}