necroheld hold N - смена хвата предмета в руке на лету; дух не собирает список рендереров каждые 0.5 с
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f4ae9cbcb8
commit
17a4ab2e96
@@ -437,6 +437,7 @@ namespace NecromancerTome
|
||||
|
||||
float _nextSleepCheck;
|
||||
bool _asleep;
|
||||
bool _hiddenApplied;
|
||||
|
||||
void Update()
|
||||
{
|
||||
@@ -451,9 +452,14 @@ namespace NecromancerTome
|
||||
transform.localPosition = Home();
|
||||
}
|
||||
_asleep = asleep;
|
||||
foreach (Renderer r in GetComponentsInChildren<Renderer>(true))
|
||||
if (_hiddenApplied != CinerariumGenie.Hidden)
|
||||
{
|
||||
r.enabled = !CinerariumGenie.Hidden;
|
||||
// Только при смене (16.10, проверка на утечки: раньше список рендереров собирался каждые 0.5 с - мусор для GC).
|
||||
_hiddenApplied = CinerariumGenie.Hidden;
|
||||
foreach (Renderer r in GetComponentsInChildren<Renderer>(true))
|
||||
{
|
||||
r.enabled = !_hiddenApplied;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_stuck || _asleep)
|
||||
|
||||
+33
-2
@@ -72,19 +72,44 @@ namespace NecromancerTome
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Сменить хват (HoldType) предмета в руке и пересобрать его в руке, как BloodTide (16.10: «давай попробуем в
|
||||
/// режиме нитей разные хваты. Ты будешь перебирать их по моей просьбе»). Меняется класс предмета - до перезапуска
|
||||
/// игры или следующей команды; итог переносится в items.xml.</summary>
|
||||
public static string SetHold(int _hold)
|
||||
{
|
||||
EntityPlayerLocal pl = GameManager.Instance?.World?.GetPrimaryPlayer();
|
||||
Inventory inv = pl?.inventory;
|
||||
ItemInventoryData held = inv?.holdingItemData;
|
||||
if (held?.item == null)
|
||||
{
|
||||
return "в руке ничего";
|
||||
}
|
||||
if (pl.Hand != null && pl.Hand.isSwitching || inv.IsHoldingItemActionRunning())
|
||||
{
|
||||
return "рука занята - повторите";
|
||||
}
|
||||
int was = held.item.HoldType.Value;
|
||||
held.item.HoldType.Value = _hold;
|
||||
ItemValue pv = (held.physicalItemValue ?? held.itemValue).Clone();
|
||||
pv.Seed = (ushort)(pv.Seed + 1); // «собранный» предмет устарел - соберётся заново (NeedsRebuild)
|
||||
held.physicalItemValue = pv;
|
||||
inv.SetHoldingItemIdx(inv.holdingItemIdx);
|
||||
return held.item.Name + ": хват " + was + " -> " + _hold;
|
||||
}
|
||||
|
||||
public static string F(float _v) => _v.ToString("0.###", CultureInfo.InvariantCulture);
|
||||
public static string F(Vector3 _v) => F(_v.x) + " " + F(_v.y) + " " + F(_v.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// necroheld - посадка модели в руке:
|
||||
/// pos x y z (см) | add x y z (см) | rot x y z (градусы) | scale s | off | show
|
||||
/// pos x y z (см) | add x y z (см) | rot x y z (градусы) | scale s | hold N (хват, HoldType) | off | show
|
||||
/// </summary>
|
||||
[Preserve]
|
||||
public class ConsoleCmdNecroHeld : ConsoleCmdAbstract
|
||||
{
|
||||
public override string[] getCommands() => new[] { "necroheld" };
|
||||
public override string getDescription() => "NecromancerTome: посадка модели в руке - pos x y z (см)|add x y z (см)|rot x y z|scale s|off|show";
|
||||
public override string getDescription() => "NecromancerTome: посадка модели в руке - pos x y z (см)|add x y z (см)|rot x y z|scale s|hold N|off|show";
|
||||
|
||||
static bool Num(List<string> _p, int _i, out float _v)
|
||||
{
|
||||
@@ -117,6 +142,12 @@ namespace NecromancerTome
|
||||
case "scale" when Num(_params, 1, out float s) && s > 0f:
|
||||
HeldTweak.Scale = s;
|
||||
break;
|
||||
case "hold" when Num(_params, 1, out float h):
|
||||
Out(HeldTweak.SetHold((int)h));
|
||||
return;
|
||||
case "hold":
|
||||
Out("хват предмета в руке: " + (GameManager.Instance?.World?.GetPrimaryPlayer()?.inventory?.holdingItem?.HoldType.Value.ToString() ?? "нет"));
|
||||
return;
|
||||
case "off":
|
||||
HeldTweak.Enabled = false;
|
||||
HeldTweak.Pos = Vector3.zero;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user