Route runtime tuning through checkpoint commits

This commit is contained in:
Meta Vens 2026-06-16 00:01:19 +01:00
commit 21d2071f6e
13 changed files with 152 additions and 20 deletions

View file

@ -526,7 +526,8 @@ public class ActionGameManager : MonoBehaviour
Quality = item is CraftedItemInstance crafted ? crafted.Quality : 1.0,
Durability = item is EquippableItem equippable ? equippable.Durability : 1.0,
Quantity = item is SimpleCommodity commodity ? commodity.Quantity : 1,
Enabled = true
Enabled = true,
OverrideShutdown = item is EquippableItem overrideable && overrideable.OverrideShutdown
};
}
@ -1349,7 +1350,8 @@ public class ActionGameManager : MonoBehaviour
item.Quality,
item.Durability,
item.Quantity,
item.Enabled);
item.Enabled,
item.OverrideShutdown);
}
private static IReadOnlyList<AetheriaRuntimeLoadoutItemSlotSnapshot> CreateRuntimeLoadoutItemSlotSnapshots(
@ -1404,6 +1406,42 @@ public class ActionGameManager : MonoBehaviour
}
}
public void CommitEntityOverrideShutdown(Entity entity, bool enabled)
{
if (entity == null)
return;
entity.OverrideShutdown = enabled;
QueueRunCheckpoint("entity-override-shutdown");
}
public void CommitEquippedItemOverrideShutdown(EquippedItem item, bool enabled)
{
if (item?.EquippableItem == null)
return;
item.EquippableItem.OverrideShutdown = enabled;
QueueRunCheckpoint("item-override-shutdown");
}
public void CommitThermotoggleTargetTemperature(Thermotoggle thermotoggle, float targetTemperature)
{
if (thermotoggle == null)
return;
thermotoggle.TargetTemperature = targetTemperature;
QueueRunCheckpoint("thermotoggle-target-temperature");
}
public void CommitEntityShutdownPerformance(Entity entity, float shutdownPerformance)
{
if (entity?.Settings == null)
return;
entity.Settings.ShutdownPerformance = shutdownPerformance;
QueueRunCheckpoint("entity-shutdown-performance");
}
private void OnDisable()
{
Input.Dispose();
@ -1515,7 +1553,8 @@ public class ActionGameManager : MonoBehaviour
Input.Player.OverrideShutdown.performed += context =>
{
CurrentEntity.OverrideShutdown = !CurrentEntity.OverrideShutdown;
if (CurrentEntity != null)
CommitEntityOverrideShutdown(CurrentEntity, !CurrentEntity.OverrideShutdown);
};
Input.Player.Ping.performed += context =>

View file

@ -163,7 +163,7 @@ public class InventoryMenu : MonoBehaviour
PropertiesPanel.Clear();
PropertiesPanel.AddField("Shutdown Threshold",
() => GameManager.CurrentEntity.Settings.ShutdownPerformance,
f => GameManager.CurrentEntity.Settings.ShutdownPerformance = f,
f => GameManager.CommitEntityShutdownPerformance(GameManager.CurrentEntity, f),
0,
1);
});

View file

@ -622,7 +622,9 @@ public class PropertiesPanel : MonoBehaviour
AddEquippableItemProperties(item.EquippableItem, item.Evaluate);
AddSpacer();
AddField("Override Shutdown", () => item.EquippableItem.OverrideShutdown, b => item.EquippableItem.OverrideShutdown = b);
AddField("Override Shutdown",
() => item.EquippableItem.OverrideShutdown,
b => ActionGameManager.Instance?.CommitEquippedItemOverrideShutdown(item, b));
foreach (var behavior in item.Behaviors)
{
@ -631,7 +633,7 @@ public class PropertiesPanel : MonoBehaviour
case Thermotoggle thermotoggle when thermotoggle.Adjustable:
AddField("Target Temperature",
() => thermotoggle.TargetTemperature,
temp => thermotoggle.TargetTemperature = temp);
temp => ActionGameManager.Instance?.CommitThermotoggleTargetTemperature(thermotoggle, temp));
break;
}
}