public override void PopulateSlot(ItemSlot toPopulate, PopulationContext context) { var occupation = PopulatorUtils.TryGetOccupation(context); if (occupation == null) { return; } var idObj = Spawn.ServerPrefab(idPrefab).GameObject; var charSettings = context.SpawnInfo.CharacterSettings; var jobType = occupation.JobType; if (jobType == JobType.CAPTAIN) { idObj.GetComponent <IDCard>().Initialize(IDCardType.captain, jobType, occupation.AllowedAccess, charSettings.Name); } else if (jobType == JobType.HOP || jobType == JobType.HOS || jobType == JobType.CMO || jobType == JobType.RD || jobType == JobType.CHIEF_ENGINEER) { idObj.GetComponent <IDCard>().Initialize(IDCardType.command, jobType, occupation.AllowedAccess, charSettings.Name); } else { idObj.GetComponent <IDCard>().Initialize(IDCardType.standard, jobType, occupation.AllowedAccess, charSettings.Name); } Inventory.ServerAdd(idObj, toPopulate); }
public override void PopulateItemStorage(ItemStorage toPopulate, PopulationContext context) { var occupation = PopulatorUtils.TryGetOccupation(context); if (occupation == null) { return; } if (context.SpawnInfo.SpawnItems == false) { return; } Logger.LogTraceFormat("Populating item storage using configured populator for occupation {0}", Category.EntitySpawn, occupation.JobType); occupation.InventoryPopulator.PopulateItemStorage(toPopulate, context); if (StandardPopulator != null) { Logger.LogTraceFormat("Populating item storage using standard populator", Category.EntitySpawn); StandardPopulator.PopulateItemStorage(toPopulate, context); } }