Files
Project-M/Assets/_Project/Scripts/Simulation/Items/EquipRequest.cs
T
kronic 43f355c06b Equipment: weapon-granted abilities + gear mods (DR-027 Phase 1)
Equipment slots reusing the AbilityRef/StatModifier machinery: EquipmentSlot [GhostField] buffer (index=slot), server-only event-driven EquipSystem (RPC). Weapon -> AbilityRef.Id swaps the attack (prefab + base stats, prediction-correct); gear -> StatModifiers tagged a reserved per-slot EquipSourceId, stripped target-agnostically via RemoveBySourceId. Item mods are INLINE on ItemDefBlob (a nested BlobArray reads empty under the by-value TryGetItem copy). Atomic equip-over swap (no item loss); DefaultAbility restores the unarmed ability on weapon-unequip. Client keys + build-safe hooks; HUD equipment panel + click-to-equip. 4 catalog weapon/gear items wired + re-baked.

Play-validated host+client: weapon equip swaps AbilityRef on both worlds, gear folds into EffectiveCharacterStats, unequip reverses + restores DefaultAbility, all replicated to the owner. See DR-027.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 11:09:25 -07:00

28 lines
1.2 KiB
C#

using Unity.NetCode;
namespace ProjectM.Simulation
{
/// <summary>
/// Client -&gt; server request to equip an item from the sender's personal inventory into the slot the
/// catalog assigns it (<see cref="ItemDefBlob.EquipSlot"/>). A one-off action, so it is an RPC (not a
/// per-tick predicted input); applied exactly once server-only in the plain SimulationSystemGroup. Carries
/// only the ItemId — the server derives the target slot from the catalog, so a client can't force a weapon
/// into the armor slot. Unconditional wire type (no #if); the server resolves the sender via SourceConnection.
/// </summary>
public struct EquipRequest : IRpcCommand
{
/// <summary>The inventory item to equip; the server resolves its slot + effects from the catalog.</summary>
public ushort ItemId;
}
/// <summary>
/// Client -&gt; server request to unequip whatever occupies <see cref="Slot"/> (an <see cref="EquipSlotId"/>),
/// returning the item to the personal inventory and stripping its effects. Unconditional wire type.
/// </summary>
public struct UnequipRequest : IRpcCommand
{
/// <summary>The <see cref="EquipSlotId"/> to clear.</summary>
public byte Slot;
}
}