Implement timed Invisible gadget and shared energy warnings

This commit is contained in:
UnixNight committed 2026-11-02 09:21:56 -05:00
1 parent 3527d33810
commit 1897dd2b90
44 files changed
+2466 -39

No files matched your search

+17 -1
View File
@@ -14,6 +14,10 @@ public sealed class DirectorActor
public Vector3 Rotation { get; internal set; }
public bool Visible { get; internal set; }
public bool Active { get; internal set; }
//Source body integration and movement-enable flags are separate from AI
//activation. Only the bounded companion gadget consumer writes them here.
public bool BodyEnabled { get; internal set; } = true;
public bool MovementEnabled { get; internal set; } = true;
public string Animation { get; internal set; } = "STOP";
public int AIstate { get; internal set; }
public float Speed { get; internal set; }
@@ -93,6 +97,7 @@ public sealed class SceneDirector
public event Action? MusicRestarted;
public event Action<DirectorActor>? ActorChanged;
public event Action<DirectorActor, ScriptPreparation>? ActorPreparing;
public event Action<DirectorActor>? GadgetReleaseRequested;
public event Action<DirectorActor>? AuthoredTransformChanged;
public event Action<string, string>? Unsupported;
@@ -138,6 +143,7 @@ public sealed class SceneDirector
var initial = new DirectorActor(source, actor.Tag, actor.Kind, source.Position);
actor.Position = initial.Position; actor.Rotation = initial.Rotation;
actor.Visible = initial.Visible; actor.Active = initial.Active;
actor.BodyEnabled = initial.BodyEnabled; actor.MovementEnabled = initial.MovementEnabled;
actor.Animation = initial.Animation; actor.AIstate = initial.AIstate;
actor.Speed = initial.Speed; actor.Patrol = initial.Patrol;
actor.SpritePlaying = initial.SpritePlaying; actor.SpriteRevision++;
@@ -336,6 +342,7 @@ public sealed class SceneDirector
private void StartMulti(GamEntity entity)
{
DeactivateInvention(entity); //43129A: explicit Jimmy lookup, before first target check.
// MCA's PlayerControlled is its completion target (4311F0), not an
// activation grant. Only initial activation clears control; later shots
//use431750 without repeating431502..4315A7 preparation.
@@ -353,11 +360,12 @@ public sealed class SceneDirector
{
if (applyCommon)
{
DeactivateInvention(entity); //4165B7, distinct from raw-owner preparation.
if (Equal(entity.Text("PlayerControlled"), "NULL"))
PrepareOwner(ScriptPreparation.ReleaseGadget, ScriptPreparation.StopMotion, ScriptPreparation.FlattenOrientation);
SetControl(entity); Toggle(entity);
}
if (entity.Integer("DeactivateInv") != 0) InventoryEnabled = false;
if (entity.Integer("DeactivateInv", 1) != 0) InventoryEnabled = false;
if (skipping)
{
if (index >= 0) FinishMulti(entity);
@@ -512,6 +520,14 @@ public sealed class SceneDirector
}
}
private void DeactivateInvention(GamEntity source)
{
//Both CAM/MCA constructors default this property to true. The source
//explicitly looks up Jimmy even when a different actor owns control.
if (source.Integer("DeactivateInv", 1) != 0 && actors.TryGetValue("JIM1", out var jimmy))
GadgetReleaseRequested?.Invoke(jimmy);
}
private void SetControl(GamEntity entity, bool prepareOwner = false)
{
var control = entity.Text("PlayerControlled");