ba303e5fd0
- StructureCatalogAuthoring: WallCostOre -> WallCostBiomass (it bakes a Biomass cost; [FormerlySerializedAs] preserves the scene value). - Harvester/Fabricator authoring: resource-id byte defaults reference ResourceId.Ore/.Charge instead of magic 2/4. - RegionMath.RegionBoundaryX (= ExpeditionOffsetX*0.5) single-sources the region-flip X used by HudSystem + OnboardingSystem (was 500f in 3 places). - CharacterComponent.DefaultGroundedSharpness single-sources the CC sharpness 15f (GetDefault, DashSystem, PlayerDeathStateSystem, PlayerCharacterAuthoring). - InventorySlot [InternalBufferCapacity] references Tuning.InventoryMaxSlots. - ConnectionMode enum -> byte-const class (project convention; removes the latent enum-in-Burst trap); field + one Seed() param become byte. - Tuning.ChargerWindupTicks single-sources the Charger telegraph windup (EnemyBaker + TuningConfig.Defaults; was a bare 30 that could drift). - (TicksPerSecond deliberately NOT added: no seconds->ticks conversion site exists; the tick-count fields are per-authoring designer tunables, so a const would be unreferenced.) 451/451 EditMode tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
36 lines
2.1 KiB
C#
36 lines
2.1 KiB
C#
using Unity.Entities;
|
|
using Unity.NetCode;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>
|
|
/// One (item, count) row in a player's PERSONAL inventory. The per-player DynamicBuffer of these is the
|
|
/// server-authoritative source of what that player is carrying. A structural twin of
|
|
/// <see cref="StatModifier"/>: a [GhostField] buffer with <see cref="SendToOwnerType.All"/> so the owning
|
|
/// (predicting) client receives its own inventory — without it the owner, being the owner, would not get
|
|
/// the owner-typed buffer at all and the HUD would read empty. BOTH fields carry [GhostField]; the
|
|
/// [GhostComponent] attribute alone does NOT auto-replicate fields (an un-annotated field ships as a
|
|
/// silent zero), so the annotations mirror <see cref="StorageEntry"/> field-for-field.
|
|
///
|
|
/// REPLICATION DISCIPLINE — the ONLY writers are server-only: <see cref="ProjectM.Server.ResourceHarvestSystem"/>
|
|
/// (harvest yield) and the deposit-to-base RPC handler, both in the plain server SimulationSystemGroup. So
|
|
/// there is no predicted-loop double-apply and the owner never mispredicts its inventory — it is a pure
|
|
/// server-authored snapshot. NEVER mutate this from a client predicted system (that would reintroduce a
|
|
/// double-apply / mispredict path). ItemId is the same opaque ushort id space as <see cref="StorageEntry"/>
|
|
/// and the <see cref="ItemDatabase"/> catalog.
|
|
///
|
|
/// NOTE: adding this [GhostField] buffer CHANGES the player ghost serialization hash — the player prefab /
|
|
/// subscene MUST be re-baked (consistently in both worlds) or the connect handshake desyncs.
|
|
/// </summary>
|
|
[GhostComponent(OwnerSendType = SendToOwnerType.All)]
|
|
[InternalBufferCapacity(Tuning.InventoryMaxSlots)]
|
|
public struct InventorySlot : IBufferElementData
|
|
{
|
|
/// <summary>Item carried in this slot (0 = empty/unused; aligns with InventoryMath's 0-id no-op).</summary>
|
|
[GhostField] public ushort ItemId;
|
|
|
|
/// <summary>Quantity in this slot (bounded by the item's StackMax when deposited via InventoryMath).</summary>
|
|
[GhostField] public int Count;
|
|
}
|
|
}
|