Button&door sounds, sound looping bugfixes, positional sound bugfixes + low pass filter on distant sounds, submarine collision improvements, controller trigger bugfix, humans walk/run more slowly in water
This commit is contained in:
@@ -59,7 +59,7 @@ namespace Subsurface.Items.Components
|
||||
limbPositions.Add(lp);
|
||||
}
|
||||
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
@@ -76,7 +76,7 @@ namespace Subsurface.Items.Components
|
||||
character.AnimController.Anim = AnimController.Animation.None;
|
||||
character = null;
|
||||
}
|
||||
isActive = false;
|
||||
IsActive = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,9 +131,9 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override bool Use(float deltaTime, Character activator = null)
|
||||
{
|
||||
if (activator.SelectedConstruction != item)
|
||||
if (character==null || activator!=character || character.SelectedConstruction != item)
|
||||
{
|
||||
activator = null;
|
||||
character = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,8 +146,7 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override void SecondaryUse(float deltaTime, Character character = null)
|
||||
{
|
||||
if (character == null) return;
|
||||
if (character.SelectedConstruction!=item)
|
||||
if (this.character == null || this.character!=character || this.character.SelectedConstruction!=item)
|
||||
{
|
||||
character = null;
|
||||
return;
|
||||
@@ -186,6 +185,9 @@ namespace Subsurface.Items.Components
|
||||
public override bool Pick(Character picker)
|
||||
{
|
||||
item.SendSignal("1", "signal_out");
|
||||
|
||||
PlaySound(ActionType.OnUse, item.Position);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -194,7 +196,7 @@ namespace Subsurface.Items.Components
|
||||
if (character!=null && character.SelectedConstruction == item)
|
||||
{
|
||||
character = null;
|
||||
isActive = false;
|
||||
IsActive = false;
|
||||
if (activator != null) activator.AnimController.Anim = AnimController.Animation.None;
|
||||
|
||||
return false;
|
||||
@@ -204,7 +206,7 @@ namespace Subsurface.Items.Components
|
||||
character = activator;
|
||||
if (activator == null) return false;
|
||||
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
item.SendSignal("1", "signal_out");
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Subsurface.Items.Components
|
||||
public Engine(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
public float CurrentVolume
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Subsurface.Items.Components
|
||||
itemList.Enabled = false;
|
||||
|
||||
fabricatedItem = obj as FabricableItem;
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
|
||||
timeUntilReady = fabricatedItem.RequiredTime;
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Subsurface.Items.Components
|
||||
|
||||
new Item(fabricatedItem.TargetItem, item.Position);
|
||||
|
||||
isActive = false;
|
||||
IsActive = false;
|
||||
fabricatedItem = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Subsurface.Items.Components
|
||||
public MiniMap(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
|
||||
@@ -19,10 +19,16 @@ namespace Subsurface.Items.Components
|
||||
return (running && item.Condition>0.0f);
|
||||
}
|
||||
|
||||
public float CurrFlow
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public OxygenGenerator(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
|
||||
ventList = new List<Vent>();
|
||||
|
||||
@@ -34,6 +40,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
base.Update(deltaTime, cam);
|
||||
|
||||
CurrFlow = 0.0f;
|
||||
currPowerConsumption = powerConsumption;
|
||||
|
||||
if (item.CurrentHull == null) return;
|
||||
@@ -54,11 +61,11 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
|
||||
running = true;
|
||||
|
||||
float deltaOxygen = Math.Min(voltage, 1.0f) * 50000.0f;
|
||||
item.CurrentHull.Oxygen += deltaOxygen * deltaTime;
|
||||
|
||||
UpdateVents(deltaOxygen);
|
||||
CurrFlow = Math.Min(voltage, 1.0f) * 50000.0f;
|
||||
item.CurrentHull.Oxygen += CurrFlow * deltaTime;
|
||||
|
||||
UpdateVents(CurrFlow);
|
||||
|
||||
|
||||
voltage = 0.0f;
|
||||
|
||||
@@ -35,6 +35,16 @@ namespace Subsurface.Items.Components
|
||||
set { maxFlow = value; }
|
||||
}
|
||||
|
||||
float currFlow;
|
||||
public float CurrFlow
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsActive) return 0.0f;
|
||||
return Math.Abs(currFlow);
|
||||
}
|
||||
}
|
||||
|
||||
public Pump(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
@@ -55,6 +65,8 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
currFlow = 0.0f;
|
||||
|
||||
if (targetLevel != null)
|
||||
{
|
||||
float hullPercentage = 0.0f;
|
||||
@@ -71,14 +83,14 @@ namespace Subsurface.Items.Components
|
||||
float powerFactor = (currPowerConsumption==0.0f) ? 1.0f : voltage;
|
||||
//flowPercentage = maxFlow * powerFactor;
|
||||
|
||||
float deltaVolume = (flowPercentage/100.0f) * maxFlow * powerFactor;
|
||||
|
||||
hull1.Volume += deltaVolume;
|
||||
currFlow = (flowPercentage / 100.0f) * maxFlow * powerFactor;
|
||||
|
||||
hull1.Volume += currFlow;
|
||||
if (hull1.Volume > hull1.FullVolume) hull1.Pressure += 0.5f;
|
||||
|
||||
if (hull2 != null)
|
||||
{
|
||||
hull2.Volume -= deltaVolume;
|
||||
hull2.Volume -= currFlow;
|
||||
if (hull2.Volume > hull1.FullVolume) hull2.Pressure += 0.5f;
|
||||
}
|
||||
|
||||
@@ -90,28 +102,6 @@ namespace Subsurface.Items.Components
|
||||
hull1 = Hull.FindHull(item.Position, item.CurrentHull);
|
||||
}
|
||||
|
||||
//private void GetHulls()
|
||||
//{
|
||||
// hull1 = null;
|
||||
// hull2 = null;
|
||||
|
||||
// foreach (MapEntity e in item.linkedTo)
|
||||
// {
|
||||
// Hull hull = e as Hull;
|
||||
// if (hull == null) continue;
|
||||
|
||||
// if (hull1 == null)
|
||||
// {
|
||||
// hull1 = hull;
|
||||
// }
|
||||
// else if (hull2 == null && hull != hull1)
|
||||
// {
|
||||
// hull2 = hull;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
|
||||
@@ -120,11 +110,11 @@ namespace Subsurface.Items.Components
|
||||
|
||||
GuiFrame.Draw(spriteBatch);
|
||||
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 20, y + 20, 100, 40), ((isActive) ? "TURN OFF" : "TURN ON")))
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 20, y + 20, 100, 40), ((IsActive) ? "TURN OFF" : "TURN ON")))
|
||||
{
|
||||
targetLevel = null;
|
||||
isActive = !isActive;
|
||||
if (!isActive) currPowerConsumption = 0.0f;
|
||||
IsActive = !IsActive;
|
||||
if (!IsActive) currPowerConsumption = 0.0f;
|
||||
item.NewComponentEvent(this, true);
|
||||
}
|
||||
|
||||
@@ -148,11 +138,11 @@ namespace Subsurface.Items.Components
|
||||
|
||||
if (connection.Name == "toggle")
|
||||
{
|
||||
isActive = !isActive;
|
||||
IsActive = !IsActive;
|
||||
}
|
||||
else if (connection.Name == "set_active")
|
||||
{
|
||||
isActive = (signal != "0");
|
||||
IsActive = (signal != "0");
|
||||
}
|
||||
else if (connection.Name == "set_speed")
|
||||
{
|
||||
@@ -171,13 +161,13 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (!isActive) currPowerConsumption = 0.0f;
|
||||
if (!IsActive) currPowerConsumption = 0.0f;
|
||||
}
|
||||
|
||||
public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message)
|
||||
{
|
||||
message.Write(Convert.ToByte(flowPercentage+100));
|
||||
message.Write(isActive);
|
||||
message.Write(IsActive);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message)
|
||||
@@ -200,7 +190,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
|
||||
FlowPercentage = newFlow;
|
||||
isActive = newActive;
|
||||
IsActive = newActive;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Subsurface.Items.Components
|
||||
|
||||
if (voltage < minVoltage) return;
|
||||
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x+20, y+20, 200, 30), "Activate Radar")) isActive = !isActive;
|
||||
if (GUI.DrawButton(spriteBatch, new Rectangle(x+20, y+20, 200, 30), "Activate Radar")) IsActive = !IsActive;
|
||||
|
||||
int radius = GuiFrame.Rect.Height / 2 - 10;
|
||||
DrawRadar(spriteBatch, new Rectangle((int)GuiFrame.Center.X - radius, (int)GuiFrame.Center.Y - radius, radius * 2, radius * 2));
|
||||
@@ -92,7 +92,7 @@ namespace Subsurface.Items.Components
|
||||
//lineEnd += new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * Math.Min(width, height) / 2.0f;
|
||||
//GUI.DrawLine(spriteBatch, GuiFrame.Center, lineEnd, Color.Green);
|
||||
|
||||
if (!isActive) return;
|
||||
if (!IsActive) return;
|
||||
|
||||
if (pingCircle!=null)
|
||||
{
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace Subsurface.Items.Components
|
||||
|
||||
powerPerTemp = 1.0f;
|
||||
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
@@ -288,7 +288,7 @@ namespace Subsurface.Items.Components
|
||||
bool valueChanged = false;
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
|
||||
|
||||
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Subsurface.Items.Components
|
||||
public Steering(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
isActive = true;
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
|
||||
Reference in New Issue
Block a user