Unstable 0.17.7.0

This commit is contained in:
Markus Isberg
2022-04-08 00:34:17 +09:00
parent 95764d1fa8
commit 164d72ae3a
82 changed files with 852 additions and 385 deletions
@@ -133,6 +133,7 @@ namespace Barotrauma
{
displayRange *= 1.0f + sourceItem.GetQualityModifier(Quality.StatType.ExplosionRadius);
Attack.DamageMultiplier *= 1.0f + sourceItem.GetQualityModifier(Quality.StatType.ExplosionDamage);
Attack.SourceItem ??= sourceItem;
}
Vector2 cameraPos = GameMain.GameScreen.Cam.Position;
@@ -337,11 +338,17 @@ namespace Barotrauma
}
}
AbilityAttackData attackData = new AbilityAttackData(Attack, c, attacker);
if (attackData.Afflictions != null)
{
modifiedAfflictions.AddRange(attackData.Afflictions);
}
//use a position slightly from the limb's position towards the explosion
//ensures that the attack hits the correct limb and that the direction of the hit can be determined correctly in the AddDamage methods
Vector2 dir = worldPosition - limb.WorldPosition;
Vector2 hitPos = limb.WorldPosition + (dir.LengthSquared() <= 0.001f ? Rand.Vector(1.0f) : Vector2.Normalize(dir)) * 0.01f;
AttackResult attackResult = c.AddDamage(hitPos, modifiedAfflictions, attack.Stun * distFactor, false, attacker: attacker, damageMultiplier: attack.DamageMultiplier);
AttackResult attackResult = c.AddDamage(hitPos, modifiedAfflictions, attack.Stun * distFactor, false, attacker: attacker, damageMultiplier: attack.DamageMultiplier * attackData.DamageMultiplier);
damages.Add(limb, attackResult.Damage);
if (attack.StatusEffects != null && attack.StatusEffects.Any())
@@ -23,6 +23,10 @@ namespace Barotrauma
public readonly Vector2 Noise;
public readonly Color DirtColor;
#if CLIENT
public Sprite GrimeSprite;
#endif
public float ColorStrength
{
get;
@@ -51,6 +55,9 @@ namespace Barotrauma
PerlinNoise.GetPerlin(Rect.Y / 1000.0f + 0.5f, Rect.X / 1000.0f + 0.5f));
Color = DirtColor = Color.Lerp(new Color(10, 10, 10, 100), new Color(54, 57, 28, 200), Noise.X);
#if CLIENT
GrimeSprite = DecalManager.GrimeSprites[$"{nameof(GrimeSprite)}{index % DecalManager.GrimeSpriteCount}"].Sprite;
#endif
}
public BackgroundSection(Rectangle rect, ushort index, float colorStrength, Color color, ushort rowIndex)
@@ -68,6 +75,9 @@ namespace Barotrauma
PerlinNoise.GetPerlin(Rect.Y / 1000.0f + 0.5f, Rect.X / 1000.0f + 0.5f));
DirtColor = Color.Lerp(new Color(10, 10, 10, 100), new Color(54, 57, 28, 200), Noise.X);
#if CLIENT
GrimeSprite = DecalManager.GrimeSprites[$"{nameof(GrimeSprite)}{index % DecalManager.GrimeSpriteCount}"].Sprite;
#endif
}
public bool SetColor(Color color)
@@ -274,33 +284,17 @@ namespace Barotrauma
get { return Submarine == null ? surface : surface + Submarine.Position.Y; }
}
private float dirtiedVolume = 0.0f;
public float WaterVolume
{
get { return waterVolume; }
set
{
if (!MathUtils.IsValid(value)) return;
if (!MathUtils.IsValid(value)) { return; }
waterVolume = MathHelper.Clamp(value, 0.0f, Volume * MaxCompress);
if (waterVolume < Volume) { Pressure = rect.Y - rect.Height + waterVolume / rect.Width; }
if (waterVolume > 0.0f)
{
update = true;
if (BackgroundSections != null)
{
float volumeMultiplier = Math.Clamp(waterVolume / Volume, 0f, 1f);
if (Math.Abs(volumeMultiplier - dirtiedVolume) > 0.075f)
{
RefreshSubmergedSections(new Rectangle(new Point(0, -rect.Height), new Point(rect.Width, (int)(rect.Height * volumeMultiplier))));
dirtiedVolume = volumeMultiplier;
}
}
}
else
{
submergedSections.Clear();
dirtiedVolume = 0.0f;
}
}
}
@@ -391,8 +385,6 @@ namespace Barotrauma
private readonly HashSet<int> pendingSectionUpdates = new HashSet<int>();
private readonly List<BackgroundSection> submergedSections = new List<BackgroundSection>();
public int xBackgroundMax, yBackgroundMax;
public bool SupportsPaintedColors
@@ -664,7 +656,6 @@ namespace Barotrauma
}
BackgroundSections?.Clear();
submergedSections?.Clear();
List<FireSource> fireSourcesToRemove = new List<FireSource>(FireSources);
foreach (FireSource fireSource in fireSourcesToRemove)
@@ -973,12 +964,6 @@ namespace Barotrauma
}
}
//0.016 increase every ~2000 frames = reaches full dirtiness in ~35 minutes
if (submergedSections.Count > 0 && Submarine != null && Submarine.Info.Type == SubmarineType.Player && Rand.Int(2000) == 1)
{
DirtySections(submergedSections, deltaTime);
}
if (waterVolume < Volume)
{
LethalPressure -= 10.0f * deltaTime;
@@ -1451,17 +1436,6 @@ namespace Barotrauma
}
}
public void RefreshSubmergedSections(Rectangle waterArea)
{
if (BackgroundSections == null) { return; }
submergedSections.Clear();
foreach (var section in GetBackgroundSectionsViaContaining(waterArea))
{
submergedSections.Add(section);
}
}
public bool DoesSectionMatch(int index, int row)
{
return index >= 0 && row >= 0 && BackgroundSections.Count > index && BackgroundSections[index] != null && BackgroundSections[index].RowIndex == row;
@@ -1528,15 +1502,6 @@ namespace Barotrauma
}
}
public void DirtySections(List<BackgroundSection> sections, float dirtyVal)
{
if (sections == null) { return; }
for (int i = 0; i < sections.Count; i++)
{
IncreaseSectionColorOrStrength(sections[i], sections[i].DirtColor, dirtyVal, false, false);
}
}
public void CleanSection(BackgroundSection section, float cleanVal, bool updateRequired)
{
bool decalsCleaned = false;
@@ -37,10 +37,14 @@ namespace Barotrauma.RuinGeneration
Indent = true,
NewLineOnAttributes = true
};
IEnumerable<ContentPackage> packages = ContentPackageManager.LocalPackages;
#if DEBUG
packages = packages.Union(ContentPackageManager.VanillaCorePackage.ToEnumerable());
#endif
foreach (RuinGenerationParams generationParams in RuinParams)
{
foreach (RuinConfigFile configFile in ContentPackageManager.AllPackages.SelectMany(p => p.GetFiles<RuinConfigFile>()))
foreach (RuinConfigFile configFile in packages.SelectMany(p => p.GetFiles<RuinConfigFile>()))
{
if (configFile.Path != generationParams.ContentFile.Path) { continue; }
@@ -3,8 +3,6 @@ using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Reflection;
using System.Xml.Linq;
using Barotrauma.Extensions;
namespace Barotrauma
@@ -13,16 +11,20 @@ namespace Barotrauma
enum MapEntityCategory
{
Structure = 1,
Decorative = 2,
Machine = 4,
Equipment = 8,
Electrical = 16,
Material = 32,
Misc = 64,
Alien = 128,
Wrecked = 256,
ItemAssembly = 512,
Legacy = 1024
Decorative = 2,
Machine = 4,
Medical = 8,
Weapon = 16,
Diving = 32,
Equipment = 64,
Fuel = 128,
Electrical = 256,
Material = 1024,
Alien = 2048,
Wrecked = 4096,
ItemAssembly = 8192,
Legacy = 16384,
Misc = 32768
}
abstract partial class MapEntityPrefab : PrefabWithUintIdentifier
@@ -1540,8 +1540,10 @@ namespace Barotrauma
List<HumanPrefab> killedCharacters = new List<HumanPrefab>();
List<(HumanPrefab HumanPrefab, CharacterInfo CharacterInfo)> selectedCharacters
= new List<(HumanPrefab HumanPrefab, CharacterInfo CharacterInfo)>();
foreach (HumanPrefab humanPrefab in outpost.Info.OutpostGenerationParams.GetHumanPrefabs(Rand.RandSync.ServerAndClient))
var humanPrefabs = outpost.Info.OutpostGenerationParams.GetHumanPrefabs(Rand.RandSync.ServerAndClient);
foreach (HumanPrefab humanPrefab in humanPrefabs)
{
if (humanPrefab is null) { continue; }
var characterInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, jobOrJobPrefab: humanPrefab.GetJobPrefab(Rand.RandSync.ServerAndClient), randSync: Rand.RandSync.ServerAndClient);
if (location != null && location.KilledCharacterIdentifiers.Contains(characterInfo.GetIdentifier()))
{
@@ -153,6 +153,7 @@ namespace Barotrauma
{
Name = TextManager.GetWithVariable("wreckeditemformat", "[name]", Name);
}
Name = Name.Fallback(OriginalName);
var tags = new HashSet<Identifier>();
string joinedTags = element.GetAttributeString("tags", "");