Item UI replacements, fabricator bugfix, randomly spawning artifacts, AI can fix leaks, LimbAttacks do damage once (not each frame for the duration of the attack)

This commit is contained in:
Regalis
2016-01-14 21:06:08 +02:00
parent eb20af622d
commit 0fc085c86d
33 changed files with 340 additions and 123 deletions
+66
View File
@@ -0,0 +1,66 @@
using FarseerPhysics;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace Barotrauma
{
class ArtifactEvent : ScriptedEvent
{
private ItemPrefab itemPrefab;
private Item item;
private int state;
public ArtifactEvent(XElement element)
: base(element)
{
string itemName = ToolBox.GetAttributeString(element, "itemname", "");
itemPrefab = ItemPrefab.list.Find(ip => ip.Name == itemName) as ItemPrefab;
if (itemPrefab == null)
{
DebugConsole.ThrowError("Error in SalvageMission: couldn't find an item prefab with the name "+itemName);
}
}
protected override void Start()
{
Vector2 position = Level.Loaded.GetRandomItemPos(30.0f);
item = new Item(itemPrefab, position, null);
item.MoveWithLevel = true;
item.body.FarseerBody.IsKinematic = true;
}
public override void Update(float deltaTime)
{
switch (state)
{
case 0:
Start();
state = 1;
break;
case 1:
//item.body.LinearVelocity = Vector2.Zero;
if (item.Inventory!=null) item.body.FarseerBody.IsKinematic = false;
if (item.CurrentHull == null) return;
state = 2;
break;
case 2:
if (!Submarine.Loaded.AtEndPosition && !Submarine.Loaded.AtStartPosition) return;
Finished();
state = 3;
break;
}
}
}
}
+2 -4
View File
@@ -37,10 +37,8 @@ namespace Barotrauma
{
Vector2 position = (randomWayPoint == null) ? Vector2.Zero : randomWayPoint.Position;
//!!!!!!!!!!!!!!!!!!
if (spawnDeep)
{
position.Y -= Level.Loaded.Size.Y;
}
@@ -70,8 +68,8 @@ namespace Barotrauma
monstersDead = false;
break;
}
if (monstersDead) Finished();
if (monstersDead) Finished();
}
}
}
@@ -39,36 +39,11 @@ namespace Barotrauma
public override void Start(Level level)
{
Vector2 position = Vector2.Zero;
int tries = 0;
do
{
Vector2 tryPos = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
if (Submarine.PickBody(
ConvertUnits.ToSimUnits(tryPos),
ConvertUnits.ToSimUnits(tryPos - Vector2.UnitY*level.Size.Y),
null, Physics.CollisionLevel) != null)
{
position = ConvertUnits.ToDisplayUnits(Submarine.LastPickedPosition);
break;
}
tries++;
if (tries==10)
{
position = level.EndPosition - Vector2.UnitY*300.0f;
}
} while (tries < 10);
Vector2 position = Level.Loaded.GetRandomItemPos(30.0f);
item = new Item(itemPrefab, position, null);
item.MoveWithLevel = true;
item.body.FarseerBody.IsKinematic = true;
//item.MoveWithLevel = true;
}
public override void Update(float deltaTime)