v1.0.7.0 (Full Release)

This commit is contained in:
Regalis11
2023-03-13 10:30:37 +02:00
parent 2c5a7923b0
commit bf73ddb6c3
50 changed files with 504 additions and 193 deletions
@@ -1,6 +1,5 @@
using Microsoft.Xna.Framework;
using System;
using System.Xml.Linq;
using Barotrauma.Networking;
using Barotrauma.Extensions;
#if CLIENT
@@ -13,6 +12,9 @@ namespace Barotrauma.Items.Components
partial class LightComponent : Powered, IServerSerializable, IDrawableComponent
{
private Color lightColor;
/// <summary>
/// The current brightness of the light source, affected by powerconsumption/voltage
/// </summary>
private float lightBrightness;
private float blinkFrequency;
private float pulseFrequency, pulseAmount;
@@ -174,7 +176,7 @@ namespace Barotrauma.Items.Components
#if CLIENT
if (Light != null)
{
Light.Color = IsOn ? lightColor.Multiply(lightBrightness) : Color.Transparent;
Light.Color = IsOn ? lightColor.Multiply(lightColorMultiplier) : Color.Transparent;
}
#endif
}
@@ -214,7 +216,7 @@ namespace Barotrauma.Items.Components
{
if (base.IsActive == value) { return; }
base.IsActive = isOn = value;
SetLightSourceState(value, value ? lightBrightness : 0.0f);
SetLightSourceState(value, value ? lightBrightness : 0.0f);
}
}
@@ -245,7 +247,7 @@ namespace Barotrauma.Items.Components
public override void OnItemLoaded()
{
base.OnItemLoaded();
SetLightSourceState(IsActive);
SetLightSourceState(IsActive, lightBrightness);
turret = item.GetComponent<Turret>();
#if CLIENT
Drawable = AlphaBlend && Light.LightSprite != null;
@@ -279,7 +281,8 @@ namespace Barotrauma.Items.Components
(statusEffectLists == null || !statusEffectLists.ContainsKey(ActionType.OnActive)) &&
(IsActiveConditionals == null || IsActiveConditionals.Count == 0))
{
SetLightSourceState(true);
lightBrightness = 1.0f;
SetLightSourceState(true, lightBrightness);
SetLightSourceTransformProjSpecific();
base.IsActive = false;
isOn = true;
@@ -308,7 +311,8 @@ namespace Barotrauma.Items.Components
#endif
if (item.Container != null && item.GetRootInventoryOwner() is not Character)
{
SetLightSourceState(false);
lightBrightness = 0.0f;
SetLightSourceState(false, 0.0f);
return;
}
@@ -317,7 +321,8 @@ namespace Barotrauma.Items.Components
PhysicsBody body = ParentBody ?? item.body;
if (body != null && !body.Enabled)
{
SetLightSourceState(false);
lightBrightness = 0.0f;
SetLightSourceState(false, 0.0f);
return;
}
@@ -344,7 +349,7 @@ namespace Barotrauma.Items.Components
public override void UpdateBroken(float deltaTime, Camera cam)
{
SetLightSourceState(false);
SetLightSourceState(false, 0.0f);
}
public override bool Use(float deltaTime, Character character = null)
@@ -376,7 +381,7 @@ namespace Barotrauma.Items.Components
{
LightColor = XMLExtensions.ParseColor(signal.value, false);
#if CLIENT
SetLightSourceState(Light.Enabled, lightBrightness);
SetLightSourceState(Light.Enabled, lightColorMultiplier);
#endif
prevColorSignal = signal.value;
}
@@ -394,7 +399,7 @@ namespace Barotrauma.Items.Components
target.SightRange = Math.Max(target.SightRange, target.MaxSightRange * lightBrightness);
}
partial void SetLightSourceState(bool enabled, float? brightness = null);
partial void SetLightSourceState(bool enabled, float brightness);
public void SetLightSourceTransform()
{