Carry item temperature through daemon state refs

This commit is contained in:
Meta Vens 2026-06-21 22:50:14 +01:00
commit be9bffab4d
14 changed files with 81 additions and 29 deletions

View file

@ -334,7 +334,8 @@ public class ActionGameManager : MonoBehaviour
slot.Durability,
slot.Quantity,
slot.Enabled,
slot.OverrideShutdown))))
slot.OverrideShutdown,
slot.Temperature))))
.Where(slot => slot.item != null)
.ToArray();
}
@ -673,7 +674,7 @@ public class ActionGameManager : MonoBehaviour
{
X = slot.Position.x,
Y = slot.Position.y,
Item = ProjectLoadoutItem(slot.EquippableItem)
Item = ProjectLoadoutItem(slot.EquippableItem, slot.Temperature)
})
.ToArray() ?? Array.Empty<AetheriaRuntimeLoadoutItemSlotCommit>();
}
@ -712,7 +713,9 @@ public class ActionGameManager : MonoBehaviour
.ToArray() ?? Array.Empty<AetheriaRuntimeCargoBayLoadoutCommit>();
}
private static AetheriaRuntimeLoadoutItemCommit ProjectLoadoutItem(ItemInstance item)
private static AetheriaRuntimeLoadoutItemCommit ProjectLoadoutItem(
ItemInstance item,
double temperature = 0)
{
if (item == null)
return new AetheriaRuntimeLoadoutItemCommit();
@ -724,7 +727,8 @@ public class ActionGameManager : MonoBehaviour
Durability = item is EquippableItem equippable ? equippable.Durability : 1.0,
Quantity = item is SimpleCommodity commodity ? commodity.Quantity : 1,
Enabled = true,
OverrideShutdown = item is EquippableItem overrideable && overrideable.OverrideShutdown
OverrideShutdown = item is EquippableItem overrideable && overrideable.OverrideShutdown,
Temperature = temperature
};
}
@ -1157,7 +1161,8 @@ public class ActionGameManager : MonoBehaviour
item.Durability,
item.Quantity,
item.Enabled,
item.OverrideShutdown);
item.OverrideShutdown,
item.Temperature);
}
private static IReadOnlyList<AetheriaRuntimeLoadoutItemSlotSnapshot> CreateRuntimeLoadoutItemSlotSnapshots(
@ -2674,7 +2679,8 @@ public class ActionGameManager : MonoBehaviour
slot.Item.Durability,
slot.Item.Quantity,
slot.Item.Enabled,
slot.Item.OverrideShutdown))
slot.Item.OverrideShutdown,
slot.Item.Temperature))
.ToArray();
}
@ -2701,7 +2707,8 @@ public class ActionGameManager : MonoBehaviour
slot.Item.Durability,
slot.Item.Quantity,
slot.Item.Enabled,
slot.Item.OverrideShutdown)))
slot.Item.OverrideShutdown,
slot.Item.Temperature)))
.ToArray();
}

View file

@ -430,7 +430,8 @@ public class DaemonRuntimeDocumentTests
ItemKey = "test-laser",
Quality = 0.5,
Durability = 1.0,
Enabled = true
Enabled = true,
Temperature = 0.5
}
}
}
@ -451,7 +452,7 @@ public class DaemonRuntimeDocumentTests
{
NumberValue(10),
NumberValue(20),
NumberValue(0),
NumberValue(1),
NumberValue(0),
NumberValue(1),
EmptyBehaviorValue("stat-recipe")
@ -479,7 +480,7 @@ public class DaemonRuntimeDocumentTests
catalog,
AetheriaRuntimeDaemonItemStatQueries.ItemStatRef("test-laser", "Weapon", 2, 7),
out var value));
Assert.AreEqual("15", value);
Assert.AreEqual("12.5", value);
}
[Test]