Unstable 1.1.14.0
This commit is contained in:
@@ -69,9 +69,11 @@ namespace Barotrauma
|
||||
public int LocationTypeChangeCooldown;
|
||||
|
||||
/// <summary>
|
||||
/// Is some mission blocking this location from changing its type?
|
||||
/// Is some mission blocking this location from changing its type, or have location type changes been forcibly disabled on the location?
|
||||
/// </summary>
|
||||
public bool LocationTypeChangesBlocked => availableMissions.Any(m => m.Prefab.BlockLocationTypeChanges);
|
||||
public bool LocationTypeChangesBlocked => DisallowLocationTypeChanges || availableMissions.Any(m => m.Prefab.BlockLocationTypeChanges);
|
||||
|
||||
public bool DisallowLocationTypeChanges;
|
||||
|
||||
public string BaseName { get => baseName; }
|
||||
|
||||
@@ -1146,6 +1148,7 @@ namespace Barotrauma
|
||||
foreach (Item item in items)
|
||||
{
|
||||
if (takenItems.Any(it => it.Matches(item) && it.OriginalID == item.ID)) { continue; }
|
||||
if (item.IsSalvageMissionItem) { continue; }
|
||||
if (item.OriginalModuleIndex < 0)
|
||||
{
|
||||
DebugConsole.ThrowError("Tried to register a non-outpost item as being taken from the outpost.");
|
||||
@@ -1417,7 +1420,7 @@ namespace Barotrauma
|
||||
|
||||
public void Reset(CampaignMode campaign)
|
||||
{
|
||||
if (Type != OriginalType)
|
||||
if (Type != OriginalType && !DisallowLocationTypeChanges)
|
||||
{
|
||||
ChangeType(campaign, OriginalType);
|
||||
PendingLocationTypeChange = null;
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace Barotrauma
|
||||
|
||||
public bool IsEnterable { get; private set; }
|
||||
|
||||
public bool AllowAsBiomeGate { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Can this location type be used in the random, non-campaign levels that don't take place in any specific zone
|
||||
/// </summary>
|
||||
@@ -120,6 +122,7 @@ namespace Barotrauma
|
||||
UsePortraitInRandomLoadingScreens = element.GetAttributeBool(nameof(UsePortraitInRandomLoadingScreens), true);
|
||||
HasOutpost = element.GetAttributeBool("hasoutpost", true);
|
||||
IsEnterable = element.GetAttributeBool("isenterable", HasOutpost);
|
||||
AllowAsBiomeGate = element.GetAttributeBool(nameof(AllowAsBiomeGate), true);
|
||||
AllowInRandomLevels = element.GetAttributeBool(nameof(AllowInRandomLevels), true);
|
||||
|
||||
ShowSonarMarker = element.GetAttributeBool("showsonarmarker", true);
|
||||
|
||||
@@ -614,13 +614,20 @@ namespace Barotrauma
|
||||
Connections[i].Locations[0].MapPosition.X < Connections[i].Locations[1].MapPosition.X ?
|
||||
Connections[i].Locations[0] :
|
||||
Connections[i].Locations[1];
|
||||
if (!leftMostLocation.Type.HasOutpost || leftMostLocation.Type.Identifier == "abandoned")
|
||||
if (!AllowAsBiomeGate(leftMostLocation.Type))
|
||||
{
|
||||
leftMostLocation.ChangeType(
|
||||
campaign,
|
||||
LocationType.Prefabs.OrderBy(lt => lt.Identifier).First(lt => lt.HasOutpost && lt.Identifier != "abandoned"),
|
||||
LocationType.Prefabs.OrderBy(lt => lt.Identifier).First(lt => AllowAsBiomeGate(lt)),
|
||||
createStores: false);
|
||||
}
|
||||
static bool AllowAsBiomeGate(LocationType lt)
|
||||
{
|
||||
//checking for "abandoned" is not strictly necessary here because it's now configured to not be allowed as a biome gate
|
||||
//but might be better to keep it for backwards compatibility (previously we relied only on that check)
|
||||
return lt.HasOutpost && lt.Identifier != "abandoned" && lt.AllowAsBiomeGate;
|
||||
}
|
||||
|
||||
leftMostLocation.IsGateBetweenBiomes = true;
|
||||
Connections[i].Locked = true;
|
||||
|
||||
@@ -784,6 +791,28 @@ namespace Barotrauma
|
||||
System.Diagnostics.Debug.Assert(Connections.All(c => c.Biome != null));
|
||||
}
|
||||
|
||||
private Location GetPreviousToEndLocation()
|
||||
{
|
||||
Location previousToEndLocation = null;
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
if (!location.Biome.IsEndBiome && (previousToEndLocation == null || location.MapPosition.X > previousToEndLocation.MapPosition.X))
|
||||
{
|
||||
previousToEndLocation = location;
|
||||
}
|
||||
}
|
||||
return previousToEndLocation;
|
||||
}
|
||||
|
||||
private void ForceLocationTypeToNone(CampaignMode campaign, Location location)
|
||||
{
|
||||
if (LocationType.Prefabs.TryGet("none", out LocationType locationType))
|
||||
{
|
||||
location.ChangeType(campaign, locationType, createStores: false);
|
||||
}
|
||||
location.DisallowLocationTypeChanges = true;
|
||||
}
|
||||
|
||||
private void CreateEndLocation(CampaignMode campaign)
|
||||
{
|
||||
float zoneWidth = Width / generationParams.DifficultyZones;
|
||||
@@ -800,15 +829,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
Location previousToEndLocation = null;
|
||||
foreach (Location location in Locations)
|
||||
{
|
||||
if (!location.Biome.IsEndBiome && (previousToEndLocation == null || location.MapPosition.X > previousToEndLocation.MapPosition.X))
|
||||
{
|
||||
previousToEndLocation = location;
|
||||
}
|
||||
}
|
||||
|
||||
var previousToEndLocation = GetPreviousToEndLocation();
|
||||
if (endLocation == null || previousToEndLocation == null) { return; }
|
||||
|
||||
endLocations = new List<Location>() { endLocation };
|
||||
@@ -833,10 +854,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (LocationType.Prefabs.TryGet("none", out LocationType locationType))
|
||||
{
|
||||
previousToEndLocation.ChangeType(campaign, locationType, createStores: false);
|
||||
}
|
||||
ForceLocationTypeToNone(campaign, previousToEndLocation);
|
||||
|
||||
//remove all locations from the end biome except the end location
|
||||
for (int i = Locations.Count - 1; i >= 0; i--)
|
||||
@@ -1555,6 +1573,7 @@ namespace Barotrauma
|
||||
if (index < 0) { return null; }
|
||||
return Locations[index];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Discover(Location location)
|
||||
@@ -1604,6 +1623,12 @@ namespace Barotrauma
|
||||
SelectLocation(CurrentLocation.Connections[0].OtherLocation(CurrentLocation));
|
||||
}
|
||||
}
|
||||
|
||||
var previousToEndLocation = GetPreviousToEndLocation();
|
||||
if (previousToEndLocation != null)
|
||||
{
|
||||
ForceLocationTypeToNone(campaign, previousToEndLocation);
|
||||
}
|
||||
}
|
||||
|
||||
public void Save(XElement element)
|
||||
|
||||
@@ -110,7 +110,13 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
radiationAffliction ??= new Affliction(AfflictionPrefab.RadiationSickness, Params.RadiationDamageAmount);
|
||||
if (radiationAffliction == null)
|
||||
{
|
||||
float radiationStrengthChange = AfflictionPrefab.RadiationSickness.Effects.FirstOrDefault()?.StrengthChange ?? 0.0f;
|
||||
radiationAffliction = new Affliction(
|
||||
AfflictionPrefab.RadiationSickness,
|
||||
(Params.RadiationDamageAmount - radiationStrengthChange) * Params.RadiationDamageDelay);
|
||||
}
|
||||
|
||||
radiationTimer = Params.RadiationDamageDelay;
|
||||
|
||||
@@ -120,11 +126,9 @@ namespace Barotrauma
|
||||
|
||||
if (IsEntityRadiated(character))
|
||||
{
|
||||
foreach (Limb limb in character.AnimController.Limbs)
|
||||
{
|
||||
AttackResult attackResult = limb.AddDamage(limb.SimPosition, radiationAffliction.ToEnumerable(), playSound: false);
|
||||
character.CharacterHealth.ApplyDamage(limb, attackResult);
|
||||
}
|
||||
var limb = character.AnimController.MainLimb;
|
||||
AttackResult attackResult = limb.AddDamage(limb.SimPosition, radiationAffliction.ToEnumerable(), playSound: false);
|
||||
character.CharacterHealth.ApplyDamage(limb, attackResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user