Progress on tutorial, gap tweaking (water flows faster from room to room), UPnP error messages, input keys in array, underwater aiming tweaking, tons of misc stuff commit more often ffs

This commit is contained in:
Regalis
2015-08-31 19:57:49 +03:00
parent 1e990784b2
commit f739808520
150 changed files with 15933 additions and 588 deletions
@@ -53,7 +53,7 @@ namespace Subsurface.Items.Components
public override bool Use(float deltaTime, Character character = null)
{
if (character == null) return false;
if (!character.SecondaryKeyDown.State || reload > 0.0f) return false;
if (!character.GetInputState(InputType.SecondaryHeld) || reload > 0.0f) return false;
isActive = true;
reload = 1.0f;
@@ -102,7 +102,7 @@ namespace Subsurface.Items.Components
public override bool Use(float deltaTime, Character character = null)
{
if (character == null) return false;
if (!character.SecondaryKeyDown.State) return false;
if (!character.GetInputState(InputType.SecondaryHeld)) return false;
if (DoesUseFail(character)) return false;
@@ -126,9 +126,6 @@ namespace Subsurface.Items.Components
if (targetBody == null || targetBody.UserData == null) return true;
//ApplyStatusEffects(ActionType.OnUse, 1.0f, character);
Structure targetStructure;
Limb targetLimb;
Item targetItem;
@@ -143,10 +140,19 @@ namespace Subsurface.Items.Components
targetStructure.AddDamage(sectionIndex, -structureFixAmount);
//if the next section is small enough, apply the effect to it as well
//(to make it easier to fix a small "left-over" section)
int nextSectionLength = targetStructure.SectionLength(sectionIndex + 1);
if (nextSectionLength > 0 && nextSectionLength < Structure.wallSectionSize * 0.3f)
{
targetStructure.HighLightSection(sectionIndex + 1);
targetStructure.AddDamage(sectionIndex + 1, -structureFixAmount);
}
}
else if ((targetLimb = (targetBody.UserData as Limb)) != null)
{
if (character.SecondaryKeyDown.State)
if (character.GetInputState(InputType.SecondaryHeld))
{
targetLimb.character.Health += limbFixAmount;
//isActive = true;
@@ -28,7 +28,7 @@ namespace Subsurface.Items.Components
public override bool Use(float deltaTime, Character character = null)
{
if (character == null) return false;
if (!character.SecondaryKeyDown.State || throwing) return false;
if (!character.GetInputState(InputType.SecondaryHeld) || throwing) return false;
throwing = true;
@@ -60,7 +60,7 @@ namespace Subsurface.Items.Components
if (!item.body.Enabled) return;
if (!picker.HasSelectedItem(item)) isActive = false;
if (!picker.SecondaryKeyDown.State && !throwing) throwPos = 0.0f;
if (!picker.GetInputState(InputType.SecondaryHeld) && !throwing) throwPos = 0.0f;
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
@@ -223,7 +223,7 @@ namespace Subsurface.Items.Components
case "sound":
string filePath = ToolBox.GetAttributeString(subElement, "file", "");
if (filePath=="") continue;
if (!filePath.Contains("\\")) filePath = Path.GetDirectoryName(item.Prefab.ConfigFile)+"\\"+filePath;
if (!filePath.Contains("/")) filePath = Path.GetDirectoryName(item.Prefab.ConfigFile)+"/"+filePath;
ActionType type;
@@ -594,7 +594,7 @@ namespace Subsurface.Items.Components
try
{
// Get the type of a specified class.
t = Type.GetType("Subsurface.Items.Components." + type + ", Subsurface", false, true);
t = Type.GetType("Subsurface.Items.Components." + type + "", false, true);
if (t == null)
{
if (errorMessages) DebugConsole.ThrowError("Could not find the component ''" + type + "'' (" + file + ")");
@@ -67,17 +67,17 @@ namespace Subsurface.Items.Components
GUI.DrawRectangle(spriteBatch, hullRect, Color.White);
}
foreach (Character c in Character.CharacterList)
{
if (c.AnimController.CurrentHull!=null) continue;
//foreach (Character c in Character.CharacterList)
//{
// if (c.AnimController.CurrentHull!=null) continue;
Rectangle characterRect = new Rectangle(
miniMap.X + (int)((c.Position.X - Submarine.Borders.X) * size),
miniMap.Y - (int)((c.Position.Y - Submarine.Borders.Y) * size),
5, 5);
// Rectangle characterRect = new Rectangle(
// miniMap.X + (int)((c.Position.X - Submarine.Borders.X) * size),
// miniMap.Y - (int)((c.Position.Y - Submarine.Borders.Y) * size),
// 5, 5);
GUI.DrawRectangle(spriteBatch, characterRect, Color.White, true);
}
// GUI.DrawRectangle(spriteBatch, characterRect, Color.White, true);
//}
}
}
@@ -17,7 +17,7 @@ namespace Subsurface.Items.Components
Hull hull1, hull2;
[HasDefaultValue(0.0f, true)]
private float FlowPercentage
public float FlowPercentage
{
get { return flowPercentage; }
set
@@ -116,21 +116,18 @@ namespace Subsurface.Items.Components
item.NewComponentEvent(this, true);
}
spriteBatch.DrawString(GUI.Font, "Flow percentage: " + (int)flowPercentage + " %", new Vector2(x + 20, y + 80), Color.White);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 200, y + 70, 40, 40), "+", false))
{
FlowPercentage += 10.0f;
item.NewComponentEvent(this, true);
}
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 70, 40, 40), "-", false))
spriteBatch.DrawString(GUI.Font, "Pumping speed: " + (int)flowPercentage + " %", new Vector2(x + 20, y + 80), Color.White);
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 200, y + 70, 40, 40), "OUT", false))
{
FlowPercentage -= 10.0f;
item.NewComponentEvent(this, true);
}
if (GUI.DrawButton(spriteBatch, new Rectangle(x + 250, y + 70, 40, 40), "IN", false))
{
FlowPercentage += 10.0f;
item.NewComponentEvent(this, true);
}
}
public override void ReceiveSignal(string signal, Connection connection, Item sender, float power=0.0f)
@@ -10,7 +10,7 @@ using System.Xml.Linq;
namespace Subsurface.Items.Components
{
class Steering : ItemComponent
class Steering : Powered
{
private Vector2 currVelocity;
private Vector2 targetVelocity;
@@ -67,7 +67,9 @@ namespace Subsurface.Items.Components
public override void Update(float deltaTime, Camera cam)
{
base.Update(deltaTime, cam);
//base.Update(deltaTime, cam);
//if (voltage < minVoltage) return;
if (autoPilot)
{
@@ -112,6 +114,8 @@ namespace Subsurface.Items.Components
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{
//if (voltage < minVoltage) return;
int width = GuiFrame.Rect.Width, height = GuiFrame.Rect.Height;
int x = GuiFrame.Rect.X;
int y = GuiFrame.Rect.Y;
+1 -18
View File
@@ -75,7 +75,7 @@ namespace Subsurface.Items.Components
{
isActive = true;
barrelSprite = new Sprite(Path.GetDirectoryName(item.Prefab.ConfigFile) + "\\" +element.Attribute("barrelsprite").Value,
barrelSprite = new Sprite(Path.GetDirectoryName(item.Prefab.ConfigFile) + "/" +element.Attribute("barrelsprite").Value,
ToolBox.GetAttributeVector2(element, "origin", Vector2.Zero));
}
@@ -99,23 +99,8 @@ namespace Subsurface.Items.Components
}
rotation = MathUtils.CurveAngle(rotation, targetRotation, 0.05f);
}
//public override void SecondaryUse(float deltaTime, Character character = null)
//{
// if (character == null) return;
// Vector2 centerPos = new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y);
// if (character == Character.Controlled && cam!=null)
// {
// Lights.LightManager.ViewPos = centerPos;
// cam.TargetPos = new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y);
// }
//}
public override bool Use(float deltaTime, Character character = null)
{
if (reload > 0.0f) return false;
@@ -174,8 +159,6 @@ namespace Subsurface.Items.Components
projectile.body.Enabled = true;
projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y)), -rotation);
//if (useSounds.Count() > 0) useSounds[Game1.localRandom.Next(useSounds.Count())].Play(1.0f, 800.0f, item.body.FarseerBody);
projectileComponent.Use(deltaTime);
item.RemoveContained(projectile);
@@ -50,7 +50,7 @@ namespace Subsurface.Items.Components
}
string spritePath = subElement.Attribute("texture").Value;
spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"\\"+spritePath;
spritePath = Path.GetDirectoryName( item.Prefab.ConfigFile)+"/"+spritePath;
var sprite = new Sprite(subElement, "", spritePath);
wearableSprite[i] = new WearableSprite(sprite, ToolBox.GetAttributeBool(subElement, "hidelimb", false));