Faction Test 100.4.0.0

This commit is contained in:
Markus Isberg
2022-11-14 18:28:28 +02:00
parent 87426b68b2
commit c772b61fc1
412 changed files with 16984 additions and 5530 deletions
@@ -8,7 +8,7 @@ namespace Barotrauma
public List<CharacterInfo> AvailableCharacters { get; set; }
public List<CharacterInfo> PendingHires = new List<CharacterInfo>();
public const int MaxAvailableCharacters = 10;
public const int MaxAvailableCharacters = 6;
public HireManager()
{
@@ -32,6 +32,24 @@ namespace Barotrauma
var variant = Rand.Range(0, job.Variants, Rand.RandSync.ServerAndClient);
AvailableCharacters.Add(new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: job, variant: variant));
}
if (location.Faction != null) { GenerateFactionCharacters(location.Faction.Prefab); }
if (location.SecondaryFaction != null) { GenerateFactionCharacters(location.SecondaryFaction.Prefab); }
}
private void GenerateFactionCharacters(FactionPrefab faction)
{
foreach (var character in faction.HireableCharacters)
{
HumanPrefab humanPrefab = NPCSet.Get(character.NPCSetIdentifier, character.NPCIdentifier);
if (humanPrefab == null)
{
DebugConsole.ThrowError($"Couldn't create a hireable for the location: character prefab \"{character.NPCIdentifier}\" not found in the NPC set \"{character.NPCSetIdentifier}\".");
continue;
}
var characterInfo = humanPrefab.CreateCharacterInfo(Rand.RandSync.ServerAndClient);
characterInfo.MinReputationToHire = (faction.Identifier, character.MinReputation);
AvailableCharacters.Add(characterInfo);
}
}
public void Remove()