misc UI stuff, gamesession additions, limbs don't have individual health anymore, background music
This commit is contained in:
@@ -175,6 +175,8 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
item.body.Enabled = true;
|
||||
|
||||
Matrix transform = Matrix.CreateRotationZ(item.body.Rotation);
|
||||
|
||||
if (item.body.Dir==-1.0f)
|
||||
@@ -184,9 +186,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
transformedItemPos = Vector2.Transform(transformedItemPos, transform);
|
||||
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
||||
|
||||
|
||||
|
||||
|
||||
transformedItemPos += ConvertUnits.ToDisplayUnits(item.body.Position);
|
||||
|
||||
currentRotation += item.body.Rotation;
|
||||
@@ -230,7 +230,7 @@ namespace Subsurface.Items.Components
|
||||
if (inventory.TryPutItem(item))
|
||||
{
|
||||
isActive = true;
|
||||
if (hideItems) item.body.Enabled = false;
|
||||
if (hideItems || (item.body!=null && !item.body.Enabled)) item.body.Enabled = false;
|
||||
|
||||
item.container = this.item;
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
base.Move(amount);
|
||||
|
||||
linkedGap.Move(amount);
|
||||
LinkedGap.Move(amount);
|
||||
|
||||
body.SetTransform(body.Position + ConvertUnits.ToSimUnits(amount), 0.0f);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using Subsurface.Networking;
|
||||
using Subsurface.Items.Components;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
@@ -17,6 +18,8 @@ namespace Subsurface
|
||||
public readonly Sound sound;
|
||||
public readonly ActionType type;
|
||||
|
||||
public string volumeProperty;
|
||||
|
||||
public readonly float range;
|
||||
|
||||
public ItemSound(Sound sound, ActionType type, float range)
|
||||
@@ -172,8 +175,9 @@ namespace Subsurface
|
||||
Sound sound = Sound.Load(filePath);
|
||||
|
||||
float range = ToolBox.GetAttributeFloat(subElement, "range", 800.0f);
|
||||
|
||||
sounds.Add(new ItemSound(sound, type, range));
|
||||
ItemSound itemSound = new ItemSound(sound, type, range);
|
||||
itemSound.volumeProperty = ToolBox.GetAttributeString(subElement, "volume", "");
|
||||
sounds.Add(itemSound);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -193,16 +197,30 @@ namespace Subsurface
|
||||
int index = Game1.localRandom.Next(matchingSounds.Count);
|
||||
itemSound = sounds[index];
|
||||
|
||||
if (itemSound.volumeProperty != "")
|
||||
{
|
||||
ObjectProperty op = null;
|
||||
if (properties.TryGetValue(itemSound.volumeProperty.ToLower(), out op))
|
||||
{
|
||||
float newVolume = 0.0f;
|
||||
float.TryParse(op.GetValue().ToString(), NumberStyles.Any, CultureInfo.InvariantCulture, out newVolume);
|
||||
volume = MathHelper.Clamp(newVolume, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (loop) loopingSound = itemSound;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (loop)
|
||||
{
|
||||
//if (loopingSound != null && loopingSound.volumeProperty != "") volume = float.Parse(properties[loopingSound.volumeProperty].GetValue().ToString());
|
||||
loopingSoundIndex = loopingSound.sound.Loop(loopingSoundIndex, volume, position, loopingSound.range);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
itemSound.sound.Play(volume, itemSound.range, position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,15 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
PropertyTask powerUpTask;
|
||||
|
||||
float powerDownTimer;
|
||||
|
||||
bool running;
|
||||
|
||||
List<Vent> ventList;
|
||||
|
||||
public bool IsRunning()
|
||||
{
|
||||
return running && item.Condition>0.0f;
|
||||
return (running && item.Condition>0.0f);
|
||||
}
|
||||
|
||||
public OxygenGenerator(Item item, XElement element)
|
||||
@@ -38,13 +40,18 @@ namespace Subsurface.Items.Components
|
||||
|
||||
if (voltage < minVoltage)
|
||||
{
|
||||
powerDownTimer += deltaTime;
|
||||
running = false;
|
||||
if (powerUpTask==null || powerUpTask.IsFinished)
|
||||
if ((powerUpTask==null || powerUpTask.IsFinished) && powerDownTimer>5.0f)
|
||||
{
|
||||
powerUpTask = new PropertyTask(Game1.gameSession.taskManager, item, IsRunning, 30.0f, "Turn on the oxygen generator");
|
||||
powerUpTask = new PropertyTask(item, IsRunning, 50.0f, "Turn on the oxygen generator");
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
powerDownTimer = 0.0f;
|
||||
}
|
||||
|
||||
running = true;
|
||||
|
||||
@@ -53,9 +60,15 @@ namespace Subsurface.Items.Components
|
||||
|
||||
UpdateVents(deltaOxygen);
|
||||
|
||||
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
public override void UpdateBroken(float deltaTime, Camera cam)
|
||||
{
|
||||
powerDownTimer += deltaTime;
|
||||
}
|
||||
|
||||
private void GetVents()
|
||||
{
|
||||
foreach (MapEntity entity in item.linkedTo)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
@@ -62,7 +63,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (connection.name=="power_in")
|
||||
{
|
||||
if (!float.TryParse(signal, out voltage))
|
||||
if (!float.TryParse(signal, NumberStyles.Any, CultureInfo.InvariantCulture, out voltage))
|
||||
{
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
@@ -108,9 +108,8 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
|
||||
|
||||
|
||||
//ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
|
||||
|
||||
fissionRate = Math.Min(fissionRate, AvailableFuel);
|
||||
|
||||
float heat = 100 * fissionRate;
|
||||
@@ -128,7 +127,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (powerUpTask==null || powerUpTask.IsFinished)
|
||||
{
|
||||
powerUpTask = new PropertyTask(Game1.gameSession.taskManager, item, IsRunning, 20.0f, "Power up the reactor");
|
||||
powerUpTask = new PropertyTask(item, IsRunning, 50.0f, "Power up the reactor");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +207,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (item.Condition <= 0.0f) return;
|
||||
|
||||
new RepairTask(Game1.gameSession.taskManager, item, 50.0f, "Reactor meltdown!");
|
||||
new RepairTask(item, 60.0f, "Reactor meltdown!");
|
||||
item.Condition = 0.0f;
|
||||
fissionRate = 0.0f;
|
||||
coolingRate = 0.0f;
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (character.SecondaryKeyDown.State)
|
||||
{
|
||||
targetLimb.Damage -= limbFixAmount;
|
||||
targetLimb.character.Health += limbFixAmount;
|
||||
isActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
Update(deltaTime, cam);
|
||||
}
|
||||
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
if (!item.body.Enabled) return;
|
||||
@@ -68,11 +68,11 @@ namespace Subsurface.Items.Components
|
||||
|
||||
AnimController ac = picker.animController;
|
||||
|
||||
ac.HoldItem(deltaTime, cam, item, handlePos, new Vector2(throwPos, 0.0f), Vector2.Zero, holdAngle);
|
||||
ac.HoldItem(deltaTime, cam, item, handlePos, new Vector2(throwPos, 0.0f), aimPos, holdAngle);
|
||||
|
||||
if (!throwing) return;
|
||||
|
||||
throwPos +=0.1f;
|
||||
throwPos += deltaTime*5.0f;
|
||||
|
||||
Vector2 throwVector = ConvertUnits.ToSimUnits(picker.CursorPosition) - item.body.Position;
|
||||
throwVector = Vector2.Normalize(throwVector);
|
||||
|
||||
Reference in New Issue
Block a user