Code/Demos/TarkovInventory/AvatarOutfit.cs
using System.Collections.Generic;
namespace Sandbox.TarkovInventory;
// pure mapping from equip-slot ids to clothing resource paths; Resolve() returns the set to wear; engine-free, unit-tested. only "helmet" is mapped; "weapon" is intentionally absent (decoupled from the avatar).
public sealed class AvatarOutfit
{
readonly Dictionary<string, string> _slotToClothing;
public AvatarOutfit( IReadOnlyDictionary<string, string> slotToClothing )
{
_slotToClothing = new Dictionary<string, string>( slotToClothing );
}
// The set of clothing resource paths that should be worn given the current equip state:
// for each mapped slot whose Occupant is non-null, its clothing path.
public IReadOnlySet<string> Resolve( Loadout gear )
{
var worn = new HashSet<string>();
foreach ( var (slotId, clothingPath) in _slotToClothing )
if ( gear.Occupant( slotId ) is not null )
worn.Add( clothingPath );
return worn;
}
}