Faction Test 100.6.0.0

This commit is contained in:
Markus Isberg
2022-11-25 19:55:45 +02:00
parent c44fb0ad3a
commit 0057f5bfce
130 changed files with 2771 additions and 1509 deletions
@@ -323,7 +323,7 @@ namespace Barotrauma
var characters = GameSession.GetSessionCrewCharacters(CharacterType.Both);
if (characters.Any())
{
price *= 1f + characters.Max(static c => c.GetStatValue(StatTypes.StoreSellMultiplier));
price *= 1f + characters.Max(static c => c.GetStatValue(StatTypes.StoreSellMultiplier, includeSaved: false));
price *= 1f + characters.Max(c => item.Tags.Sum(tag => c.Info.GetSavedStatValue(StatTypes.StoreSellMultiplier, tag)));
}
@@ -675,7 +675,7 @@ namespace Barotrauma
return new Location(position, zone, rand, requireOutpost, forceLocationType, existingLocations);
}
public void ChangeType(CampaignMode campaign, LocationType newType)
public void ChangeType(CampaignMode campaign, LocationType newType, bool createStores = true)
{
if (newType == Type) { return; }
@@ -709,7 +709,10 @@ namespace Barotrauma
UnlockInitialMissions(Rand.RandSync.Unsynced);
CreateStores(force: true);
if (createStores)
{
CreateStores(force: true);
}
}
public void UnlockInitialMissions(Rand.RandSync randSync = Rand.RandSync.ServerAndClient)
@@ -13,8 +13,8 @@ namespace Barotrauma
{
public static readonly PrefabCollection<LocationType> Prefabs = new PrefabCollection<LocationType>();
private readonly List<string> names;
private readonly List<Sprite> portraits = new List<Sprite>();
private readonly ImmutableArray<string> names;
private readonly ImmutableArray<Sprite> portraits;
//<name, commonness>
private readonly ImmutableArray<(Identifier Name, float Commonness)> hireableJobs;
@@ -41,12 +41,6 @@ namespace Barotrauma
public bool IsEnterable { get; private set; }
public bool UsePortraitInMainMenu
{
get;
private set;
}
public bool UsePortraitInRandomLoadingScreens
{
get;
@@ -118,7 +112,6 @@ namespace Barotrauma
BeaconStationChance = element.GetAttributeFloat("beaconstationchance", 0.0f);
UsePortraitInMainMenu = element.GetAttributeBool(nameof(UsePortraitInMainMenu), element.GetAttributeBool("useinmainmenu", false));
UsePortraitInRandomLoadingScreens = element.GetAttributeBool(nameof(UsePortraitInRandomLoadingScreens), true);
HasOutpost = element.GetAttributeBool("hasoutpost", true);
IsEnterable = element.GetAttributeBool("isenterable", HasOutpost);
@@ -146,7 +139,7 @@ namespace Barotrauma
else
{
string[] rawNamePaths = element.GetAttributeStringArray("namefile", new string[] { "Content/Map/locationNames.txt" });
names = new List<string>();
var names = new List<string>();
foreach (string rawPath in rawNamePaths)
{
try
@@ -163,6 +156,7 @@ namespace Barotrauma
{
names.Add("ERROR: No names found");
}
this.names = names.ToImmutableArray();
}
string[] commonnessPerZoneStrs = element.GetAttributeStringArray("commonnessperzone", Array.Empty<string>());
@@ -192,7 +186,7 @@ namespace Barotrauma
}
MinCountPerZone[zoneIndex] = minCount;
}
var portraits = new List<Sprite>();
var hireableJobs = new List<(Identifier, float)>();
foreach (var subElement in element.Elements())
{
@@ -233,6 +227,7 @@ namespace Barotrauma
break;
}
}
this.portraits = portraits.ToImmutableArray();
this.hireableJobs = hireableJobs.ToImmutableArray();
}
@@ -249,10 +244,10 @@ namespace Barotrauma
return null;
}
public Sprite GetPortrait(int portraitId)
public Sprite GetPortrait(int randomSeed)
{
if (portraits.Count == 0) { return null; }
return portraits[Math.Abs(portraitId) % portraits.Count];
if (portraits.Length == 0) { return null; }
return portraits[Math.Abs(randomSeed) % portraits.Length];
}
public string GetRandomName(Random rand, IEnumerable<Location> existingLocations)
@@ -265,7 +260,7 @@ namespace Barotrauma
return unusedNames[rand.Next() % unusedNames.Count];
}
}
return names[rand.Next() % names.Count];
return names[rand.Next() % names.Length];
}
public static LocationType Random(Random rand, int? zone = null, bool requireOutpost = false)
@@ -622,7 +622,8 @@ namespace Barotrauma
{
leftMostLocation.ChangeType(
campaign,
LocationType.Prefabs.OrderBy(lt => lt.Identifier).First(lt => lt.HasOutpost && lt.Identifier != "abandoned"));
LocationType.Prefabs.OrderBy(lt => lt.Identifier).First(lt => lt.HasOutpost && lt.Identifier != "abandoned"),
createStores: false);
}
leftMostLocation.IsGateBetweenBiomes = true;
Connections[i].Locked = true;
@@ -706,6 +707,7 @@ namespace Barotrauma
location.Faction ??= campaign.GetRandomFaction(Rand.RandSync.ServerAndClient);
location.SecondaryFaction ??= campaign.GetRandomSecondaryFaction(Rand.RandSync.ServerAndClient);
}
location.CreateStores(force: true);
}
foreach (LocationConnection connection in Connections)
@@ -837,7 +839,7 @@ namespace Barotrauma
if (LocationType.Prefabs.TryGet("none", out LocationType locationType))
{
previousToEndLocation.ChangeType(campaign, locationType);
previousToEndLocation.ChangeType(campaign, locationType, createStores: false);
}
//remove all locations from the end biome except the end location