Spectating, fire, damaged limb sprites, water detector, engineer jumpsuit, new signal comp sprites, resharper cleanup (god knows what else, commit more often)

This commit is contained in:
Regalis
2015-11-10 22:22:26 +02:00
parent cd48d12be6
commit 4d949e3be1
89 changed files with 977 additions and 622 deletions
+1 -1
View File
@@ -336,7 +336,7 @@ namespace Barotrauma.Items.Components
}
//opening a partially stuck door makes it less stuck
if (isOpen) stuck = MathHelper.Clamp(stuck-30.0f, 0.0f, 100.0f); ;
if (isOpen) stuck = MathHelper.Clamp(stuck-30.0f, 0.0f, 100.0f);
}
}
}
@@ -7,7 +7,7 @@ namespace Barotrauma.Items.Components
{
class Holdable : Pickable
{
//the position(s) in the item that the character grabs
//the position(s) in the item that the Character grabs
protected Vector2[] handlePos;
private List<RelatedItem> prevRequiredItems;
@@ -24,7 +24,7 @@ namespace Barotrauma.Items.Components
private bool attachable, attached, attachedByDefault;
private PhysicsBody body;
//the angle in which the character holds the item
//the angle in which the Character holds the item
protected float holdAngle;
[HasDefaultValue(false, true)]
@@ -115,13 +115,11 @@ namespace Barotrauma.Items.Components
AnimController ac = picker.AnimController;
Limb rightHand = ac.GetLimb(LimbType.RightHand);
if (!hitting)
{
if (picker.IsKeyDown(InputType.Aim))
{
hitPos = (float)System.Math.Min(hitPos+deltaTime*5.0f, MathHelper.Pi*0.7f);
hitPos = Math.Min(hitPos+deltaTime*5.0f, MathHelper.Pi*0.7f);
ac.HoldItem(deltaTime, item, handlePos, new Vector2(0.6f, -0.1f), new Vector2(-0.3f, 0.2f), false, hitPos);
}
@@ -104,7 +104,7 @@ namespace Barotrauma.Items.Components
if (character == null) return false;
if (!character.IsKeyDown(InputType.Aim)) return false;
//if (DoesUseFail(character)) return false;
//if (DoesUseFail(Character)) return false;
IsActive = true;
@@ -181,7 +181,7 @@ namespace Barotrauma.Items.Components
//ApplyStatusEffects(ActionType.OnUse, 1.0f, null, targ);
}
//if (character.SecondaryKeyDown.State)
//if (Character.SecondaryKeyDown.State)
//{
// IPropertyObject propertyObject = targetBody.UserData as IPropertyObject;
// if (propertyObject!=null) ApplyStatusEffects(ActionType.OnUse, 1.0f, item.SimPosition, propertyObject);
@@ -30,18 +30,18 @@ namespace Barotrauma.Items.Components
if (character == null) return false;
if (!character.IsKeyDown(InputType.Aim) || throwing) return false;
//Vector2 diff = Vector2.Normalize(character.CursorPosition - character.AnimController.RefLimb.Position);
//Vector2 diff = Vector2.Normalize(Character.CursorPosition - Character.AnimController.RefLimb.Position);
//if (character.SelectedItems[1]==item)
//if (Character.SelectedItems[1]==item)
//{
// Limb leftHand = character.AnimController.GetLimb(LimbType.LeftHand);
// Limb leftHand = Character.AnimController.GetLimb(LimbType.LeftHand);
// leftHand.body.ApplyLinearImpulse(diff * 20.0f);
// leftHand.Disabled = true;
//}
//if (character.SelectedItems[0] == item)
//if (Character.SelectedItems[0] == item)
//{
// Limb rightHand = character.AnimController.GetLimb(LimbType.RightHand);
// Limb rightHand = Character.AnimController.GetLimb(LimbType.RightHand);
// rightHand.body.ApplyLinearImpulse(diff * 20.0f);
// rightHand.Disabled = true;
//}
@@ -373,7 +373,7 @@ namespace Barotrauma.Items.Components
public virtual void Move(Vector2 amount) { }
/// <summary>a character has picked the item</summary>
/// <summary>a Character has picked the item</summary>
public virtual bool Pick(Character picker)
{
return false;
@@ -384,7 +384,7 @@ namespace Barotrauma.Items.Components
return CanBeSelected;
}
/// <summary>a character has dropped the item</summary>
/// <summary>a Character has dropped the item</summary>
public virtual void Drop(Character dropper) { }
public virtual void Draw(SpriteBatch spriteBatch, bool editing = false) { }
@@ -475,7 +475,7 @@ namespace Barotrauma.Items.Components
}
/// <summary>
/// Returns 0.0f-1.0f based on how well the character can use the itemcomponent
/// Returns 0.0f-1.0f based on how well the Character can use the itemcomponent
/// </summary>
/// <returns>0.5f if all the skills meet the skill requirements exactly, 1.0f if they're way above and 0.0f if way less</returns>
protected float DegreeOfSuccess(Character character)
@@ -496,14 +496,14 @@ namespace Barotrauma.Items.Components
return (average+100.0f)/2.0f;
}
//public bool CheckFailure(Character character)
//public bool CheckFailure(Character Character)
//{
// foreach (Skill skill in requiredSkills)
// {
// int characterLevel = character.GetSkillLevel(skill.Name);
// int characterLevel = Character.GetSkillLevel(skill.Name);
// if (characterLevel > skill.Level) continue;
// item.ApplyStatusEffects(ActionType.OnFailure, 1.0f, character);
// item.ApplyStatusEffects(ActionType.OnFailure, 1.0f, Character);
// //Item.ApplyStatusEffects();
// return true;
+4 -4
View File
@@ -30,7 +30,7 @@
// }
// public override bool Select(Character character)
// public override bool Select(Character Character)
// {
// if (textBox == null)
// {
@@ -47,10 +47,10 @@
// textBox.Select();
// return base.Select(character);
// return base.Select(Character);
// }
// public override void DrawHUD(SpriteBatch spriteBatch, Character character)
// public override void DrawHUD(SpriteBatch spriteBatch, Character Character)
// {
// //isActive = true;
// GuiFrame.Update((float)Physics.step);
@@ -61,7 +61,7 @@
// //int y = Game1.GraphicsHeight / 2 - height / 2 - 50;
// //GUI.DrawRectangle(spriteBatch, new Rectangle(x, y, width, height), Color.Black, true);
// if (!textBox.Selected) character.SelectedConstruction = null;
// if (!textBox.Selected) Character.SelectedConstruction = null;
// }
// private bool TextChanged(GUITextBox textBox, string text)
@@ -42,8 +42,7 @@ namespace Barotrauma.Items.Components
ventList = new List<Vent>();
item.linkedTo.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{ GetVents(); };
item.linkedTo.CollectionChanged += delegate { GetVents(); };
}
public override void Update(float deltaTime, Camera cam)
@@ -78,9 +78,8 @@ namespace Barotrauma.Items.Components
return (pingState > 1.0f);
}
public override void DrawHUD(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Character character)
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
@@ -120,7 +119,6 @@ namespace Barotrauma.Items.Components
if (Level.Loaded != null)
{
List<VoronoiCell> cells = Level.Loaded.GetCells(-Level.Loaded.Position, 7);
Vector2 offset = Vector2.Zero;
foreach (VoronoiCell cell in cells)
{
@@ -174,7 +172,6 @@ namespace Barotrauma.Items.Components
end.Y = -end.Y;
Vector2 diff = end - start;
Vector2 normalizedDiff = Vector2.Normalize(diff);
for (float x = 0; x < diff.Length(); x+=4.0f )
{
GUI.DrawLine(spriteBatch, center + start, center + end, Color.Green);
@@ -141,7 +141,6 @@ namespace Barotrauma.Items.Components
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
@@ -79,7 +79,7 @@ namespace Barotrauma.Items.Components
{
if (character != null && !characterUsable) return false;
//ApplyStatusEffects(ActionType.OnUse, 1.0f, character);
//ApplyStatusEffects(ActionType.OnUse, 1.0f, Character);
Launch(new Vector2(
(float)Math.Cos(item.body.Rotation),
@@ -191,7 +191,7 @@ namespace Barotrauma.Items.Components
bool mouseInRect = panelRect.Contains(PlayerInput.MousePosition);
Wire equippedWire = null;
//if the character using the panel has a wire item equipped
//if the Character using the panel has a wire item equipped
//and the wire hasn't been connected yet, draw it on the panel
for (int i = 0; i < character.SelectedItems.Length; i++)
{
@@ -246,7 +246,7 @@ namespace Barotrauma.Items.Components
}
}
//if the character using the panel has a wire item equipped
//if the Character using the panel has a wire item equipped
//and the wire hasn't been connected yet, draw it on the panel
if (equippedWire!=null)
{
@@ -262,9 +262,9 @@ namespace Barotrauma.Items.Components
}
}
//for (int i = 0; i < character.SelectedItems.Length; i++ )
//for (int i = 0; i < Character.SelectedItems.Length; i++ )
//{
// Item selectedItem = character.SelectedItems[i];
// Item selectedItem = Character.SelectedItems[i];
// if (selectedItem == null) continue;
@@ -281,7 +281,7 @@ namespace Barotrauma.Items.Components
if (!PlayerInput.LeftButtonDown())
{
panel.Item.NewComponentEvent(panel, true, true);
//draggingConnected.Drop(character);
//draggingConnected.Drop(Character);
draggingConnected = null;
}
}
@@ -0,0 +1,38 @@
using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
class WaterDetector : ItemComponent
{
private Hull hull;
public WaterDetector(Item item, XElement element)
: base (item, element)
{
hull = Hull.FindHull(item.Position);
IsActive = true;
}
public override void OnMapLoaded()
{
hull = Hull.FindHull(item.Position);
}
public override void Move(Microsoft.Xna.Framework.Vector2 amount)
{
hull = Hull.FindHull(item.Position);
}
public override void Update(float deltaTime, Camera cam)
{
if (hull == null) return;
float waterDepth = hull.Volume / hull.Size.X;
bool underWater = (hull.Rect.Y-hull.Rect.Height + waterDepth)>item.Position.Y;
item.SendSignal(underWater ? "1" : "0", "signal_out");
}
}
}
@@ -41,7 +41,7 @@ namespace Barotrauma.Items.Components
public override void Move(Vector2 amount)
{
amount = FarseerPhysics.ConvertUnits.ToDisplayUnits(amount);
//amount = FarseerPhysics.ConvertUnits.ToDisplayUnits(amount);
//for (int i = 0; i<Nodes.Count; i++)
//{
// Nodes[i] += amount;