This commit is contained in:
Evil Factory
2022-02-24 14:30:39 -03:00
364 changed files with 10838 additions and 3966 deletions
@@ -67,6 +67,9 @@ namespace Barotrauma
public Affliction(AfflictionPrefab prefab, float strength)
{
#if CLIENT
prefab?.ReloadSoundsIfNeeded();
#endif
Prefab = prefab;
PendingAdditionStrength = Prefab.GrainBurst;
_strength = strength;
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Barotrauma
namespace Barotrauma
{
class AfflictionBleeding : Affliction
{
@@ -15,6 +11,10 @@ namespace Barotrauma
{
base.Update(characterHealth, targetLimb, deltaTime);
characterHealth.BloodlossAmount += Strength * (1.0f / 60.0f) * deltaTime;
if (Source != null)
{
characterHealth.BloodlossAffliction.Source = Source;
}
}
}
}
@@ -52,10 +52,6 @@ namespace Barotrauma
{
if (state == value) { return; }
state = value;
if (character != null && character == Character.Controlled)
{
UpdateMessages();
}
}
}
@@ -81,6 +77,9 @@ namespace Barotrauma
base.Update(characterHealth, targetLimb, deltaTime);
character = characterHealth.Character;
if (character == null) { return; }
UpdateMessages();
if (!subscribedToDeathEvent)
{
character.OnDeath += CharacterDead;
@@ -107,7 +106,7 @@ namespace Barotrauma
{
if (State != InfectionState.Active && stun)
{
character.SetStun(Rand.Range(2, 4));
character.SetStun(Rand.Range(2f, 3f));
}
State = InfectionState.Active;
ActivateHusk();
@@ -247,7 +246,7 @@ namespace Barotrauma
if (huskPrefab.ControlHusk || GameMain.Lua.game.enableControlHusk)
{
#if SERVER
var client = GameMain.Server?.ConnectedClients.FirstOrDefault(c => c.CharacterInfo.Character == character);
var client = GameMain.Server?.ConnectedClients.FirstOrDefault(c => c.Character == character);
if (client != null)
{
GameMain.Server.SetClientCharacter(client, husk);
@@ -363,6 +363,9 @@ namespace Barotrauma
public readonly string Name, Description;
public readonly string TranslationOverride;
public readonly bool IsBuff;
public readonly bool HealableInMedicalClinic;
public readonly float HealCostMultiplier;
public readonly int BaseHealCost;
public readonly string CauseOfDeathDescription, SelfCauseOfDeathDescription;
@@ -656,6 +659,13 @@ namespace Barotrauma
Description = TextManager.Get("AfflictionDescription." + translationId, true) ?? element.GetAttributeString("description", "");
IsBuff = element.GetAttributeBool("isbuff", false);
HealableInMedicalClinic = element.GetAttributeBool("healableinmedicalclinic",
!IsBuff &&
!AfflictionType.Equals("geneticmaterialbuff", StringComparison.OrdinalIgnoreCase) &&
!AfflictionType.Equals("geneticmaterialdebuff", StringComparison.OrdinalIgnoreCase));
HealCostMultiplier = element.GetAttributeFloat(nameof(HealCostMultiplier).ToLowerInvariant(), 1f);
BaseHealCost = element.GetAttributeInt(nameof(BaseHealCost).ToLowerInvariant(), 0);
if (element.Attribute("nameidentifier") != null)
{
Name = TextManager.Get(element.GetAttributeString("nameidentifier", string.Empty), returnNull: true) ?? Name;
@@ -677,7 +687,7 @@ namespace Barotrauma
MaxStrength = element.GetAttributeFloat("maxstrength", 100.0f);
GrainBurst = element.GetAttributeFloat(nameof(GrainBurst).ToLowerInvariant(), 0.0f);
ShowInHealthScannerThreshold = element.GetAttributeFloat("showinhealthscannerthreshold", Math.Max(ActivationThreshold, 0.05f));
ShowInHealthScannerThreshold = element.GetAttributeFloat("showinhealthscannerthreshold", Math.Max(ActivationThreshold, AfflictionType == "talentbuff" ? float.MaxValue : 0.05f));
TreatmentThreshold = element.GetAttributeFloat("treatmentthreshold", Math.Max(ActivationThreshold, 5.0f));
DamageOverlayAlpha = element.GetAttributeFloat("damageoverlayalpha", 0.0f);
@@ -751,6 +761,32 @@ namespace Barotrauma
}
}
#if CLIENT
public void ReloadSoundsIfNeeded()
{
foreach (var effect in effects)
{
foreach (var statusEffect in effect.StatusEffects)
{
foreach (var sound in statusEffect.Sounds)
{
if (sound.Sound == null) { Submarine.ReloadRoundSound(sound); }
}
}
}
foreach (var periodicEffect in periodicEffects)
{
foreach (var statusEffect in periodicEffect.StatusEffects)
{
foreach (var sound in statusEffect.Sounds)
{
if (sound.Sound == null) { Submarine.ReloadRoundSound(sound); }
}
}
}
}
#endif
public override string ToString()
{
return "AfflictionPrefab (" + Name + ")";