Lighting improvements: lightmap is drawn over all structures and blurred, flashlight item, OnContained statuseffects are also applied when the item is contained in a characterinventory
This commit is contained in:
@@ -90,8 +90,9 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
set
|
||||
{
|
||||
if (base.IsActive == value) return;
|
||||
base.IsActive = value;
|
||||
|
||||
if (light == null) return;
|
||||
light.Color = value ? lightColor : Color.Transparent;
|
||||
if (!value) lightBrightness = 0.0f;
|
||||
}
|
||||
@@ -105,7 +106,7 @@ namespace Barotrauma.Items.Components
|
||||
light.Position = item.Position;
|
||||
light.CastShadows = castShadows;
|
||||
|
||||
IsActive = true;
|
||||
IsActive = IsOn;
|
||||
|
||||
//foreach (XElement subElement in element.Elements())
|
||||
//{
|
||||
@@ -157,6 +158,8 @@ namespace Barotrauma.Items.Components
|
||||
else
|
||||
{
|
||||
lightBrightness = MathHelper.Lerp(lightBrightness, Math.Min(voltage, 1.0f), 0.1f);
|
||||
|
||||
ApplyStatusEffects(ActionType.OnActive, deltaTime);
|
||||
}
|
||||
|
||||
light.Color = lightColor * lightBrightness * (1.0f-Rand.Range(0.0f,Flicker));
|
||||
@@ -165,6 +168,11 @@ namespace Barotrauma.Items.Components
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
public override bool Use(float deltaTime, Character character = null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, bool editing = false)
|
||||
{
|
||||
if (light.LightSprite != null && (item.body == null || item.body.Enabled))
|
||||
|
||||
Reference in New Issue
Block a user