v0.2: iteminventory sync bugfix, meleeweapon "reload time", spears can be picked even if they're stuck inside a wall, tutorial bugfixes, "submarine godmode", removed round duration, drag character sync, reliable structure damage messages, job assignment bugfixes, some extra sounds

This commit is contained in:
Regalis
2015-10-17 16:01:42 +03:00
parent 838022fcd5
commit 3c1a66078c
51 changed files with 457 additions and 213 deletions
@@ -2,6 +2,7 @@
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
using Microsoft.Xna.Framework;
using System;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
@@ -18,6 +19,10 @@ namespace Barotrauma.Items.Components
private Character user;
private float reload;
private float reloadTimer;
[HasDefaultValue(0.0f, false)]
public float Range
{
@@ -25,6 +30,13 @@ namespace Barotrauma.Items.Components
set { range = ConvertUnits.ToSimUnits(value); }
}
[HasDefaultValue(0.5f, false)]
public float Reload
{
get { return reload; }
set { reload = Math.Max(0.0f, value); }
}
public MeleeWeapon(Item item, XElement element)
: base(item, element)
{
@@ -35,22 +47,19 @@ namespace Barotrauma.Items.Components
if (subElement.Name.ToString().ToLower() != "attack") continue;
attack = new Attack(subElement);
}
if (attack==null)
{
DebugConsole.ThrowError("Item ''"+item.Name+"'' doesn't have an attack configured");
}
}
public override bool Use(float deltaTime, Character character = null)
{
if (character == null) return false;
if (character == null || reloadTimer>0.0f) return false;
if (!character.GetInputState(InputType.SecondaryHeld) || hitting) return false;
user = character;
if (hitPos < MathHelper.Pi * 0.69f) return false;
reloadTimer = reload;
item.body.FarseerBody.CollisionCategories = Physics.CollisionProjectile;
item.body.FarseerBody.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall;
item.body.FarseerBody.OnCollision += OnCollision;
@@ -95,6 +104,8 @@ namespace Barotrauma.Items.Components
if (!item.body.Enabled) return;
if (!picker.HasSelectedItem(item)) IsActive = false;
reloadTimer -= deltaTime;
if (!picker.GetInputState(InputType.SecondaryHeld) && !hitting) hitPos = 0.0f;
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
@@ -117,8 +128,6 @@ namespace Barotrauma.Items.Components
{
ac.HoldItem(deltaTime, item, handlePos, new Vector2(hitPos, 0.0f), aimPos, false, 0.0f);
}
}
else
{
@@ -174,20 +183,24 @@ namespace Barotrauma.Items.Components
if (limb.character == picker) return false;
target = limb.character;
}
else
{
return false;
}
if (target==null)
if (target == null)
{
target = f2.Body.UserData as IDamageable;
}
if (target == null) return false;
attack.DoDamage(user, target, item.Position, 1.0f);
if (attack!=null) attack.DoDamage(user, target, item.Position, 1.0f);
RestoreCollision();
hitting = false;
ApplyStatusEffects(ActionType.OnUse, 1.0f, picker);
ApplyStatusEffects(ActionType.OnUse, 1.0f, limb.character);
return true;
}
@@ -20,15 +20,15 @@ namespace Barotrauma.Items.Components
float powerPerForce;
[Editable, HasDefaultValue(1.0f, true)]
public float PowerPerForce
{
get { return powerPerForce; }
set
{
powerPerForce = Math.Max(0.0f, value);
}
}
//[Editable, HasDefaultValue(1.0f, true)]
//public float PowerPerForce
//{
// get { return powerPerForce; }
// set
// {
// powerPerForce = Math.Max(0.0f, value);
// }
//}
[Editable, HasDefaultValue(2000.0f, true)]
public float MaxForce
@@ -61,7 +61,7 @@ namespace Barotrauma.Items.Components
{
base.Update(deltaTime, cam);
currPowerConsumption = Math.Abs(targetForce) * powerPerForce;
currPowerConsumption = Math.Abs(targetForce)/100.0f * powerConsumption;
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
if (Force != 0.0f)
@@ -14,10 +14,14 @@ namespace Barotrauma.Items.Components
IsActive = true;
}
bool hasPower;
public override void Update(float deltaTime, Camera cam)
{
currPowerConsumption = powerConsumption;
hasPower = voltage > minVoltage;
voltage = 0.0f;
}
@@ -38,6 +42,8 @@ namespace Barotrauma.Items.Components
GuiFrame.Draw(spriteBatch);
if (!hasPower) return;
//GUI.DrawRectangle(spriteBatch, new Rectangle(x,y,width,height), Color.Black, true);
Rectangle miniMap = new Rectangle(x + 20, y + 40, width - 40, height - 60);
@@ -1,4 +1,5 @@
using System;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
@@ -12,6 +13,8 @@ namespace Barotrauma.Items.Components
bool running;
private float generatedAmount;
List<Vent> ventList;
public bool IsRunning()
@@ -25,6 +28,13 @@ namespace Barotrauma.Items.Components
private set;
}
[Editable, HasDefaultValue(100.0f, true)]
public float GeneratedAmount
{
get { return generatedAmount; }
set { generatedAmount = MathHelper.Clamp(value, -10000.0f, 10000.0f); }
}
public OxygenGenerator(Item item, XElement element)
: base(item, element)
{
@@ -64,7 +74,7 @@ namespace Barotrauma.Items.Components
running = true;
CurrFlow = Math.Min(voltage, 1.0f) * 50000.0f;
CurrFlow = Math.Min(voltage, 1.0f) * generatedAmount * 1000.0f;
item.CurrentHull.Oxygen += CurrFlow * deltaTime;
UpdateVents(CurrFlow);