38f1ddb...178a853: v0.8.9.1, removed content folder
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
#if CLIENT
|
||||
using Barotrauma.Sounds;
|
||||
#endif
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
@@ -69,27 +73,15 @@ namespace Barotrauma.Items.Components
|
||||
public Powered(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
#if CLIENT
|
||||
if (powerOnSound == null)
|
||||
{
|
||||
powerOnSound = Sound.Load("Content/Items/Electricity/powerOn.ogg", false);
|
||||
}
|
||||
|
||||
if (sparkSounds == null)
|
||||
{
|
||||
sparkSounds = new Sound[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
sparkSounds[i] = Sound.Load("Content/Items/Electricity/zap" + (i + 1) + ".ogg", false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
InitProjectSpecific(element);
|
||||
}
|
||||
|
||||
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power = 0)
|
||||
partial void InitProjectSpecific(XElement element);
|
||||
|
||||
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item source, Character sender, float power = 0, float signalStrength = 1.0f)
|
||||
{
|
||||
if (currPowerConsumption == 0.0f) voltage = 0.0f;
|
||||
if (connection.IsPower) voltage = power;
|
||||
if (connection.IsPower) voltage = Math.Max(0.0f, power);
|
||||
}
|
||||
|
||||
protected void UpdateOnActiveEffects(float deltaTime)
|
||||
@@ -109,9 +101,9 @@ namespace Barotrauma.Items.Components
|
||||
if (voltage > minVoltage)
|
||||
{
|
||||
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
|
||||
if (!powerOnSoundPlayed)
|
||||
if (!powerOnSoundPlayed && powerOnSound != null)
|
||||
{
|
||||
powerOnSound.Play(1.0f, 600.0f, item.WorldPosition);
|
||||
SoundPlayer.PlaySound(powerOnSound.Sound, powerOnSound.Volume, powerOnSound.Range, item.WorldPosition, item.CurrentHull);
|
||||
powerOnSoundPlayed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user