Merge branch 'master' of https://bitbucket.org/Regalis11/repo
This commit is contained in:
@@ -331,7 +331,7 @@ namespace Subsurface
|
||||
|
||||
selectedTarget = null;
|
||||
selectedTargetMemory = null;
|
||||
this.targetValue = 0.0f;
|
||||
targetValue = 0.0f;
|
||||
|
||||
UpdateTargetMemories();
|
||||
|
||||
@@ -372,7 +372,7 @@ namespace Subsurface
|
||||
valueModifier = valueModifier * targetMemory.Priority / dist;
|
||||
//dist -= targetMemory.Priority;
|
||||
|
||||
if (Math.Abs(valueModifier) > Math.Abs(this.targetValue) && (dist < target.SightRange * sight || dist < target.SoundRange * hearing))
|
||||
if (Math.Abs(valueModifier) > Math.Abs(targetValue) && (dist < target.SightRange * sight || dist < target.SoundRange * hearing))
|
||||
{
|
||||
Vector2 rayStart = character.animController.limbs[0].SimPosition;
|
||||
Vector2 rayEnd = target.Position;
|
||||
@@ -408,12 +408,12 @@ namespace Subsurface
|
||||
|
||||
|
||||
//float newTargetValue = valueModifier/dist;
|
||||
if (selectedTarget == null || Math.Abs(valueModifier) > Math.Abs(this.targetValue))
|
||||
if (selectedTarget == null || Math.Abs(valueModifier) > Math.Abs(targetValue))
|
||||
{
|
||||
selectedTarget = target;
|
||||
selectedTargetMemory = targetMemory;
|
||||
|
||||
this.targetValue = valueModifier;
|
||||
targetValue = valueModifier;
|
||||
Debug.WriteLine(selectedTarget.entity+": "+targetValue);
|
||||
}
|
||||
}
|
||||
@@ -479,18 +479,13 @@ namespace Subsurface
|
||||
wallAttackPos.X = message.ReadFloat();
|
||||
wallAttackPos.Y = message.ReadFloat();
|
||||
|
||||
float wanderAngle = message.ReadFloat();
|
||||
float updateTargetsTimer = message.ReadFloat();
|
||||
float raycastTimer = message.ReadFloat();
|
||||
float coolDownTimer = message.ReadFloat();
|
||||
steeringManager.WanderAngle = message.ReadFloat();
|
||||
updateTargetsTimer = message.ReadFloat();
|
||||
raycastTimer = message.ReadFloat();
|
||||
coolDownTimer = message.ReadFloat();
|
||||
|
||||
int targetID = message.ReadInt32();
|
||||
|
||||
steeringManager.WanderAngle = wanderAngle;
|
||||
this.updateTargetsTimer = updateTargetsTimer;
|
||||
this.raycastTimer = raycastTimer;
|
||||
this.coolDownTimer = coolDownTimer;
|
||||
|
||||
|
||||
if (targetID>-1)
|
||||
targetEntity = Entity.FindEntityByID(targetID) as IDamageable;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Subsurface
|
||||
public Vector2 GetNode(Vector2 pos)
|
||||
{
|
||||
if (nodes.Count == 0) return Vector2.Zero;
|
||||
if (currentNode==null || currentNode==Vector2.Zero || Vector2.Distance(pos, currentNode)<minDistance) currentNode = nodes.Dequeue();
|
||||
if (currentNode==Vector2.Zero || Vector2.Distance(pos, currentNode)<minDistance) currentNode = nodes.Dequeue();
|
||||
|
||||
return currentNode;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
@@ -307,8 +306,8 @@ namespace Subsurface
|
||||
|
||||
soundInterval = ToolBox.GetAttributeFloat(doc.Root, "soundinterval", 10.0f);
|
||||
|
||||
var xSounds = doc.Root.Elements("sound");
|
||||
if (xSounds.Count() > 0)
|
||||
var xSounds = doc.Root.Elements("sound").ToList();
|
||||
if (xSounds.Any())
|
||||
{
|
||||
sounds = new Sound[xSounds.Count()];
|
||||
soundStates = new AIController.AiState[xSounds.Count()];
|
||||
@@ -332,9 +331,9 @@ namespace Subsurface
|
||||
|
||||
animController.FindHull();
|
||||
|
||||
if (this.info.ID >= 0)
|
||||
if (info.ID >= 0)
|
||||
{
|
||||
ID = this.info.ID;
|
||||
ID = info.ID;
|
||||
}
|
||||
|
||||
characterList.Add(this);
|
||||
@@ -597,12 +596,12 @@ namespace Subsurface
|
||||
drowningBar = new GUIProgressBar(new Rectangle(Game1.GraphicsWidth / 2 - width / 2, 20, width, height), Color.Blue, 1.0f);
|
||||
}
|
||||
|
||||
drowningBar.BarSize = Character.Controlled.Oxygen / 100.0f;
|
||||
drowningBar.BarSize = Controlled.Oxygen / 100.0f;
|
||||
if (drowningBar.BarSize < 1.0f)
|
||||
drowningBar.Draw(spriteBatch);
|
||||
|
||||
if (Character.Controlled.Inventory != null)
|
||||
Character.Controlled.Inventory.Draw(spriteBatch);
|
||||
if (Controlled.Inventory != null)
|
||||
Controlled.Inventory.Draw(spriteBatch);
|
||||
|
||||
if (closestItem!=null)
|
||||
{
|
||||
@@ -634,7 +633,7 @@ namespace Subsurface
|
||||
|
||||
public void PlaySound(AIController.AiState state)
|
||||
{
|
||||
if (sounds == null || sounds.Count()==0) return;
|
||||
if (sounds == null || !sounds.Any()) return;
|
||||
var matchingSoundStates = soundStates.Where(x => x == state).ToList();
|
||||
|
||||
int selectedSound = Game1.localRandom.Next(matchingSoundStates.Count());
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface
|
||||
@@ -39,7 +36,7 @@ namespace Subsurface
|
||||
this.character = character;
|
||||
this.limb = limb;
|
||||
|
||||
this.timer = delay;
|
||||
timer = delay;
|
||||
|
||||
list.Add(this);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using FarseerPhysics;
|
||||
@@ -33,7 +32,7 @@ namespace Subsurface
|
||||
{
|
||||
case Physics.CollisionStairs:
|
||||
Structure structure = fixture.Body.UserData as Structure;
|
||||
if (stairs == null && (!inWater || TargetMovement.Y>0.0f))
|
||||
if (stairs == null && (!inWater || TargetMovement.Y>0.0f) && structure!=null)
|
||||
{
|
||||
if (LowestLimb.SimPosition.Y<structure.SimPosition.Y)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface
|
||||
@@ -47,6 +44,7 @@ namespace Subsurface
|
||||
jobList = new List<Job>();
|
||||
|
||||
XDocument doc = ToolBox.TryLoadXml(filePath);
|
||||
if (doc == null) return;
|
||||
|
||||
foreach (XElement element in doc.Root.Elements())
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using FarseerPhysics;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
@@ -9,8 +7,6 @@ namespace Subsurface
|
||||
{
|
||||
class StatusEffect
|
||||
{
|
||||
|
||||
|
||||
[Flags]
|
||||
public enum Target
|
||||
{
|
||||
|
||||
@@ -48,13 +48,13 @@ namespace Subsurface
|
||||
set { lifeTime = value; }
|
||||
}
|
||||
|
||||
public GUIMessage(string text, Color color, Vector2 pos, float lifeTime)
|
||||
public GUIMessage(string text, Color color, Vector2 position, float lifeTime)
|
||||
{
|
||||
this.coloredText = new ColoredText(text, color);
|
||||
this.pos = pos;
|
||||
coloredText = new ColoredText(text, color);
|
||||
pos = position;
|
||||
this.lifeTime = lifeTime;
|
||||
|
||||
this.size = GUI.font.MeasureString(text);
|
||||
size = GUI.font.MeasureString(text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Subsurface
|
||||
if (parent != null)
|
||||
parent.AddChild(this);
|
||||
|
||||
this.textBlock = new GUITextBlock(new Rectangle(0,0,0,0), text, Color.Transparent, Color.Black, (Alignment.CenterX | Alignment.CenterY), this);
|
||||
textBlock = new GUITextBlock(new Rectangle(0,0,0,0), text, Color.Transparent, Color.Black, (Alignment.CenterX | Alignment.CenterY), this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
@@ -31,6 +28,7 @@ namespace Subsurface
|
||||
if (buttons == null || buttons.Length == 0)
|
||||
{
|
||||
DebugConsole.ThrowError("Creating a message box with no buttons isn't allowed");
|
||||
return;
|
||||
}
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 5, 0, 30), header, Color.Transparent, Color.White, textAlignment, frame, true);
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace Subsurface
|
||||
if (wrap && rect.Width>0)
|
||||
{
|
||||
text = text.Replace("\n"," ");
|
||||
this.text = ToolBox.WrapText(this.text, rect.Width);
|
||||
text = ToolBox.WrapText(text, rect.Width);
|
||||
|
||||
Vector2 newSize = MeasureText();
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using Subsurface.Networking;
|
||||
using Subsurface.Particles;
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Subsurface
|
||||
frame);
|
||||
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
|
||||
|
||||
GUIImage face = new GUIImage(new Rectangle(-10,-10,0,0), character.animController.limbs[0].sprite, Alignment.Left, frame);
|
||||
new GUIImage(new Rectangle(-10,-10,0,0), character.animController.limbs[0].sprite, Alignment.Left, frame);
|
||||
}
|
||||
|
||||
public void KillCharacter(Character killedCharacter)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Linq;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics.Joints;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Subsurface.Items.Components
|
||||
Vector2[] corners = GetConvexHullCorners(doorRect);
|
||||
|
||||
convexHull = new ConvexHull(corners, Color.Black);
|
||||
if (window!=null && window!=Rectangle.Empty) convexHull2 = new ConvexHull(corners, Color.Black);
|
||||
if (window!=Rectangle.Empty) convexHull2 = new ConvexHull(corners, Color.Black);
|
||||
|
||||
UpdateConvexHulls();
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Linq;
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
@@ -62,7 +61,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
|
||||
[HasDefaultValue(0.0f, false)]
|
||||
private float HoldAngle
|
||||
public float HoldAngle
|
||||
{
|
||||
get { return MathHelper.ToDegrees(holdAngle); }
|
||||
set { holdAngle = MathHelper.ToRadians(value); }
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Xml.Linq;
|
||||
@@ -277,10 +276,10 @@ namespace Subsurface
|
||||
|
||||
public bool HasRequiredContainedItems(bool addMessage)
|
||||
{
|
||||
if (requiredItems.Count() == 0) return true;
|
||||
if (!requiredItems.Any()) return true;
|
||||
|
||||
Item[] containedItems = item.ContainedItems;
|
||||
if (containedItems == null || containedItems.Count() == 0) return false;
|
||||
if (containedItems == null || !containedItems.Any()) return false;
|
||||
|
||||
foreach (RelatedItem ri in requiredItems)
|
||||
{
|
||||
@@ -298,7 +297,7 @@ namespace Subsurface
|
||||
|
||||
public bool HasRequiredEquippedItems(Character character, bool addMessage)
|
||||
{
|
||||
if (requiredItems.Count() == 0) return true;
|
||||
if (!requiredItems.Any()) return true;
|
||||
|
||||
foreach (RelatedItem ri in requiredItems)
|
||||
{
|
||||
@@ -325,10 +324,6 @@ namespace Subsurface
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -24,10 +24,8 @@ namespace Subsurface.Items.Components
|
||||
|
||||
ventList = new List<Vent>();
|
||||
|
||||
item.linkedTo.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(
|
||||
delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{ GetVents(); }
|
||||
);
|
||||
item.linkedTo.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{ GetVents(); };
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Xml.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
@@ -48,7 +49,9 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
pt.powerLoad += (fullLoad - pt.powerLoad) / inertia;
|
||||
pt.currPowerConsumption += (-fullPower - pt.currPowerConsumption) / inertia;
|
||||
pt.Item.SendSignal((fullPower / Math.Max(fullLoad,1.0f)).ToString(), "power_out");
|
||||
pt.Item.SendSignal(
|
||||
(fullPower / Math.Max(fullLoad,1.0f)).ToString(CultureInfo.InvariantCulture),
|
||||
"power_out");
|
||||
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Specialized;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
@@ -29,10 +24,8 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
//maxFlow = ToolBox.GetAttributeFloat(element, "maxflow", 100.0f);
|
||||
|
||||
item.linkedTo.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(
|
||||
delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{ GetHulls(); }
|
||||
);
|
||||
item.linkedTo.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{ GetHulls(); };
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
|
||||
Item[] containedItems = item.ContainedItems;
|
||||
if (containedItems == null || containedItems.Count()==0) return false;
|
||||
if (containedItems == null || !containedItems.Any()) return false;
|
||||
|
||||
foreach (Item projectile in containedItems)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@ using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Subsurface.Networking;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
|
||||
@@ -19,20 +19,23 @@ namespace Subsurface.Items.Components
|
||||
float structureFixAmount, limbFixAmount;
|
||||
|
||||
[HasDefaultValue(100.0f, false)]
|
||||
private float Range
|
||||
public float Range
|
||||
{
|
||||
get { return ConvertUnits.ToDisplayUnits(range); }
|
||||
set { range = ConvertUnits.ToSimUnits(value); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(1.0f, false)]
|
||||
private float StructureFixAmount
|
||||
public float StructureFixAmount
|
||||
{
|
||||
get { return structureFixAmount; }
|
||||
set { structureFixAmount = value; }
|
||||
}
|
||||
|
||||
[HasDefaultValue(1.0f, false)]
|
||||
private float LimbFixAmount
|
||||
public float LimbFixAmount
|
||||
{
|
||||
get { return limbFixAmount; }
|
||||
set { limbFixAmount = value; }
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace Subsurface.Items.Components
|
||||
isActive = true;
|
||||
|
||||
this.projectile = projectile;
|
||||
Projectile projectileComponent = projectile.GetComponent<Projectile>();
|
||||
//Projectile projectileComponent = projectile.GetComponent<Projectile>();
|
||||
|
||||
foreach (PhysicsBody b in ropeBodies)
|
||||
{
|
||||
@@ -313,7 +313,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
float rotation = (item.body.Dir == -1.0f) ? item.body.Rotation - MathHelper.Pi : item.body.Rotation;
|
||||
body.SetTransform(TransformedBarrelPos, rotation);
|
||||
Vector2 axis = new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation));
|
||||
//Vector2 axis = new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation));
|
||||
|
||||
if (gunJoint != null) Game1.world.RemoveJoint(gunJoint);
|
||||
gunJoint = new DistanceJoint(item.body.FarseerBody, body, BarrelPos,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
|
||||
@@ -3,7 +3,6 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
@@ -409,7 +408,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (wires[i] == null) continue;
|
||||
|
||||
Connection recipient = wires[i].OtherConnection(this);
|
||||
//Connection recipient = wires[i].OtherConnection(this);
|
||||
|
||||
//int connectionIndex = recipient.item.Connections.FindIndex(x => x == recipient);
|
||||
newElement.Add(new XElement("link",
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
@@ -50,7 +46,7 @@ namespace Subsurface.Items.Components
|
||||
isActive = !isActive;
|
||||
break;
|
||||
case "set_state":
|
||||
isActive = (signal == "0") ? false : true;
|
||||
isActive = (signal != "0");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
|
||||
@@ -48,14 +48,7 @@ namespace Subsurface.Items.Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (success)
|
||||
{
|
||||
item.SendSignal(output, "signal_out", item);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.SendSignal("0", "signal_out", item);
|
||||
}
|
||||
item.SendSignal(success ? output : "0", "signal_out", item);
|
||||
|
||||
break;
|
||||
case "set_output":
|
||||
|
||||
@@ -4,7 +4,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using FarseerPhysics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
@@ -98,8 +94,6 @@ namespace Subsurface.Items.Components
|
||||
item.Drop();
|
||||
item.body.ApplyLinearImpulse(throwVector * throwForce * item.body.Mass * 3.0f);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
@@ -152,7 +151,7 @@ namespace Subsurface.Items.Components
|
||||
currPowerConsumption = powerConsumption;
|
||||
|
||||
float availablePower = 0.0f;
|
||||
List<PowerContainer> batteries = new List<PowerContainer>();
|
||||
//List<PowerContainer> batteries = new List<PowerContainer>();
|
||||
foreach (MapEntity e in item.linkedTo)
|
||||
{
|
||||
Item battery = e as Item;
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Subsurface.Items.Components
|
||||
{
|
||||
|
||||
@@ -437,7 +437,7 @@ namespace Subsurface
|
||||
body.ResetDynamics();
|
||||
if (body.Position.Length() > 1000.0f)
|
||||
{
|
||||
this.Remove();
|
||||
Remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -955,7 +955,7 @@ namespace Subsurface
|
||||
{
|
||||
int index = components.IndexOf(ic);
|
||||
|
||||
new NetworkEvent(NetworkEventType.UpdateComponent, this.ID, isClient, index);
|
||||
new NetworkEvent(NetworkEventType.UpdateComponent, ID, isClient, index);
|
||||
}
|
||||
|
||||
public override void FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data)
|
||||
@@ -969,8 +969,6 @@ namespace Subsurface
|
||||
message.Write((int)data);
|
||||
components[(int)data].FillNetworkData(type, message);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -987,8 +985,6 @@ namespace Subsurface
|
||||
if (componentIndex < 0 || componentIndex > components.Count - 1) return;
|
||||
components[componentIndex].ReadNetworkData(type, message);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Subsurface
|
||||
|
||||
public virtual void Remove()
|
||||
{
|
||||
dictionary.Remove(this.ID);
|
||||
dictionary.Remove(ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace Subsurface
|
||||
|
||||
GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), clr);
|
||||
|
||||
if (isSelected && editing)
|
||||
if (isSelected)
|
||||
{
|
||||
GUI.DrawRectangle(sb,
|
||||
new Vector2(rect.X - 5, -rect.Y - 5),
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Subsurface
|
||||
|
||||
OxygenPercentage = (float)(Game1.random.NextDouble() * 100.0);
|
||||
|
||||
properties = TypeDescriptor.GetProperties(this.GetType())
|
||||
properties = TypeDescriptor.GetProperties(GetType())
|
||||
.Cast<PropertyDescriptor>()
|
||||
.ToDictionary(pr => pr.Name);
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace Subsurface
|
||||
{
|
||||
if (PlayerInput.LeftButtonDown())
|
||||
{
|
||||
waveY[(int)(position.X - rect.X) / Hull.WaveWidth] = 100.0f;
|
||||
waveY[(int)(position.X - rect.X) / WaveWidth] = 100.0f;
|
||||
Volume = Volume + 1500.0f;
|
||||
}
|
||||
else if (PlayerInput.GetMouseState.RightButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
|
||||
@@ -290,8 +290,8 @@ namespace Subsurface
|
||||
|
||||
spriteBatch.DrawString(GUI.font, "Pressure: " + ((int)pressure - rect.Y).ToString() +
|
||||
" - Lethality: " + lethalPressure +
|
||||
" - Oxygen: "+((int)OxygenPercentage).ToString(), new Vector2(rect.X+10, -rect.Y+10), Color.Black);
|
||||
spriteBatch.DrawString(GUI.font, volume.ToString() +" / "+ FullVolume.ToString(), new Vector2(rect.X+10, -rect.Y+30), Color.Black);
|
||||
" - Oxygen: "+((int)OxygenPercentage), new Vector2(rect.X+10, -rect.Y+10), Color.Black);
|
||||
spriteBatch.DrawString(GUI.font, volume +" / "+ FullVolume, new Vector2(rect.X+10, -rect.Y+30), Color.Black);
|
||||
|
||||
if (isSelected && editing)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Subsurface.Lights
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Subsurface.Lights
|
||||
{
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace Subsurface
|
||||
|
||||
public static bool InsideWall(Vector2 point)
|
||||
{
|
||||
Body foundBody = Map.PickBody(point);
|
||||
Body foundBody = PickBody(point);
|
||||
if (foundBody==null) return false;
|
||||
|
||||
Structure wall = foundBody.UserData as Structure;
|
||||
@@ -286,7 +286,7 @@ namespace Subsurface
|
||||
|
||||
try
|
||||
{
|
||||
string docString = doc.ToString();
|
||||
//string docString = doc.ToString();
|
||||
ToolBox.CompressStringToFile(filePath+".gz", doc.ToString());
|
||||
}
|
||||
catch
|
||||
@@ -342,7 +342,7 @@ namespace Subsurface
|
||||
public Map(string filePath, string mapHash="")
|
||||
{
|
||||
this.filePath = filePath;
|
||||
this.name = Path.GetFileNameWithoutExtension(filePath);
|
||||
name = Path.GetFileNameWithoutExtension(filePath);
|
||||
|
||||
if (mapHash != "")
|
||||
{
|
||||
|
||||
@@ -393,7 +393,7 @@ namespace Subsurface
|
||||
|
||||
public virtual XElement Save(XDocument doc)
|
||||
{
|
||||
DebugConsole.ThrowError("Saving entity " + this.GetType() + " failed.");
|
||||
DebugConsole.ThrowError("Saving entity " + GetType() + " failed.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Subsurface
|
||||
{
|
||||
Vector2 placeSize = Map.gridSize;
|
||||
|
||||
if (placePosition == null || placePosition == Vector2.Zero)
|
||||
if (placePosition == Vector2.Zero)
|
||||
{
|
||||
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
|
||||
placePosition = Map.MouseToWorldGrid(cam);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Subsurface
|
||||
|
||||
public void TransformTexCoord(Matrix transform)
|
||||
{
|
||||
this.texCoord = Vector2.Transform(this.texCoord, transform);
|
||||
texCoord = Vector2.Transform(texCoord, transform);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Subsurface
|
||||
wayPoints.Add(wayPoint);
|
||||
}
|
||||
|
||||
if (wayPoints.Count() == 0) return null;
|
||||
if (!wayPoints.Any()) return null;
|
||||
|
||||
return wayPoints[Game1.random.Next(wayPoints.Count())];
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ namespace Subsurface.Networking
|
||||
}
|
||||
}
|
||||
|
||||
public GameClient(string name)
|
||||
public GameClient(string newName)
|
||||
{
|
||||
this.name = name;
|
||||
name = newName;
|
||||
|
||||
this.characterInfo = new CharacterInfo("Content/Characters/Human/human.xml", name);
|
||||
characterInfo = new CharacterInfo("Content/Characters/Human/human.xml", name);
|
||||
}
|
||||
|
||||
public bool ConnectToServer(string hostIP)
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Subsurface.Networking
|
||||
if (Game1.server == null) return;
|
||||
}
|
||||
|
||||
this.eventType = type;
|
||||
eventType = type;
|
||||
|
||||
foreach (NetworkEvent e in events)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace Subsurface.Networking
|
||||
}
|
||||
|
||||
this.id = id;
|
||||
this.isClientEvent = isClient;
|
||||
isClientEvent = isClient;
|
||||
|
||||
this.data = data;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.Linq;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics;
|
||||
using FarseerPhysics.Factories;
|
||||
@@ -190,7 +189,7 @@ namespace Subsurface
|
||||
else if (radius != 0.0f)
|
||||
{
|
||||
body = BodyFactory.CreateCircle(Game1.world, radius, density);
|
||||
bodyShape = Shape.Circle; ;
|
||||
bodyShape = Shape.Circle;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Subsurface
|
||||
@@ -93,7 +92,7 @@ namespace Subsurface
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError("Failed to set the value of the property ''" + Name + "'' of ''" + obj.ToString() + "'' to " + value.ToString());
|
||||
DebugConsole.ThrowError("Failed to set the value of the property ''" + Name + "'' of ''" + obj + "'' to " + value);
|
||||
DebugConsole.ThrowError("(Type not implemented)");
|
||||
|
||||
return false;
|
||||
@@ -146,7 +145,7 @@ namespace Subsurface
|
||||
|
||||
foreach (var property in obj.ObjectProperties.Values)
|
||||
{
|
||||
if (property.Attributes.OfType<T>().Count() > 0) editableProperties.Add(property);
|
||||
if (property.Attributes.OfType<T>().Any()) editableProperties.Add(property);
|
||||
}
|
||||
|
||||
return editableProperties;
|
||||
@@ -200,7 +199,7 @@ namespace Subsurface
|
||||
|
||||
public static void SaveProperties(IPropertyObject obj, XElement element)
|
||||
{
|
||||
var saveProperties = ObjectProperty.GetProperties<HasDefaultValue>(obj);
|
||||
var saveProperties = GetProperties<HasDefaultValue>(obj);
|
||||
foreach (var property in saveProperties)
|
||||
{
|
||||
object value = property.GetValue();
|
||||
@@ -220,7 +219,7 @@ namespace Subsurface
|
||||
if (dontSave) continue;
|
||||
|
||||
string stringValue;
|
||||
if (value.GetType() == typeof(float))
|
||||
if (value is float)
|
||||
{
|
||||
//do this to make sure the decimal point isn't converted to a comma or anything like that
|
||||
stringValue = ((float)value).ToString("G", CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -34,13 +34,7 @@ namespace Subsurface
|
||||
{
|
||||
get { return cam; }
|
||||
}
|
||||
|
||||
public EditCharacterScreen()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override void Select()
|
||||
{
|
||||
base.Select();
|
||||
|
||||
@@ -3,7 +3,6 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using Subsurface.Lights;
|
||||
using FarseerPhysics;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Subsurface.Networking;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
@@ -128,8 +126,8 @@ namespace Subsurface
|
||||
|
||||
textBox.Select();
|
||||
|
||||
int oldMapIndex = 0;
|
||||
if (mapList != null && mapList.SelectedData != null) oldMapIndex = mapList.SelectedIndex;
|
||||
//int oldMapIndex = 0;
|
||||
//if (mapList != null && mapList.SelectedData != null) oldMapIndex = mapList.SelectedIndex;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Selected map:", Color.Transparent, Color.Black, Alignment.Left, infoFrame);
|
||||
mapList = new GUIListBox(new Rectangle(0, 60, 200, 200), Color.White, infoFrame);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
|
||||
@@ -35,8 +35,6 @@ namespace Subsurface
|
||||
|
||||
static class AmbientSoundManager
|
||||
{
|
||||
private static Sound[] music = new Sound[4];
|
||||
|
||||
public static Sound[] flowSounds = new Sound[3];
|
||||
|
||||
private static Sound waterAmbience;
|
||||
@@ -57,9 +55,9 @@ namespace Subsurface
|
||||
XDocument doc = ToolBox.TryLoadXml(filePath);
|
||||
if (doc == null) return;
|
||||
|
||||
var xDamageSounds = doc.Root.Elements("damagesound");
|
||||
|
||||
if (xDamageSounds.Count()>0)
|
||||
var xDamageSounds = doc.Root.Elements("damagesound").ToList();
|
||||
|
||||
if (!xDamageSounds.Any())
|
||||
{
|
||||
damageSounds = new DamageSound[xDamageSounds.Count()];
|
||||
int i = 0;
|
||||
@@ -124,7 +122,7 @@ namespace Subsurface
|
||||
{
|
||||
damage = MathHelper.Clamp(damage, 0.0f, 100.0f);
|
||||
var sounds = damageSounds.Where(x => damage >= x.damageRange.X && damage <= x.damageRange.Y && x.damageType == damageType).ToList();
|
||||
if (sounds.Count() == 0) return;
|
||||
if (!sounds.Any()) return;
|
||||
|
||||
int selectedSound = Game1.localRandom.Next(sounds.Count());
|
||||
|
||||
|
||||
@@ -204,14 +204,14 @@ namespace Subsurface
|
||||
{
|
||||
loadedSounds.Remove(this);
|
||||
|
||||
System.Diagnostics.Debug.WriteLine(this.AlBufferId);
|
||||
System.Diagnostics.Debug.WriteLine(AlBufferId);
|
||||
|
||||
foreach (Sound s in loadedSounds)
|
||||
{
|
||||
if (s.oggSound == oggSound) return;
|
||||
}
|
||||
|
||||
SoundManager.ClearAlSource(this.AlBufferId);
|
||||
SoundManager.ClearAlSource(AlBufferId);
|
||||
oggSound.Dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +126,9 @@ namespace Subsurface
|
||||
{
|
||||
this.texture = texture;
|
||||
|
||||
sourceRect = (sourceRectangle == null) ? new Rectangle(1, 1, texture.Width, texture.Height) : (Rectangle)sourceRectangle;
|
||||
sourceRect = sourceRectangle ?? new Rectangle(1, 1, texture.Width, texture.Height);
|
||||
|
||||
offset = (newOffset == null) ? Vector2.Zero : (Vector2)newOffset;
|
||||
offset = newOffset ?? Vector2.Zero;
|
||||
|
||||
size = new Vector2(sourceRect.Width, sourceRect.Height);
|
||||
|
||||
@@ -145,10 +145,10 @@ namespace Subsurface
|
||||
{
|
||||
file = newFile;
|
||||
texture = LoadTexture(file);
|
||||
|
||||
sourceRect = sourceRectangle ?? new Rectangle(1, 1, texture.Width, texture.Height);
|
||||
|
||||
sourceRect = (sourceRectangle == null) ? new Rectangle(1,1,texture.Width,texture.Height) : (Rectangle)sourceRectangle;
|
||||
|
||||
offset = (newOffset == null) ? Vector2.Zero : (Vector2)newOffset;
|
||||
offset = newOffset ?? Vector2.Zero;
|
||||
|
||||
size = new Vector2(sourceRect.Width, sourceRect.Height);
|
||||
|
||||
|
||||
@@ -444,7 +444,7 @@ namespace Subsurface
|
||||
string randomLine = "";
|
||||
StreamReader file = new StreamReader(filePath);
|
||||
|
||||
var lines = File.ReadLines(filePath);
|
||||
var lines = File.ReadLines(filePath).ToList();
|
||||
int lineCount = lines.Count();
|
||||
|
||||
if (lineCount == 0)
|
||||
|
||||
Reference in New Issue
Block a user