Picking items from outside the sub, replcaed fabricator.png with separate sprites for each machine, descriptions moved from itemprefab to the mapentityprefab base class, editortutorial progress

This commit is contained in:
Regalis
2016-01-15 17:10:21 +02:00
parent 0fc085c86d
commit e3ebc28afb
34 changed files with 203 additions and 78 deletions

View File

@@ -20,6 +20,18 @@ namespace Barotrauma.Items.Components
ConvexHull convexHull;
ConvexHull convexHull2;
private bool isOpen;
private float openState;
private PhysicsBody body;
private Sprite doorSprite, weldedSprite;
private bool isHorizontal;
private bool isStuck;
private float stuck;
public float Stuck
{
@@ -33,8 +45,6 @@ namespace Barotrauma.Items.Components
}
}
private bool isStuck;
Gap LinkedGap
{
get
@@ -53,10 +63,6 @@ namespace Barotrauma.Items.Components
}
}
bool isOpen;
float openState;
[HasDefaultValue("0.0,0.0,0.0,0.0", false)]
public string Window
{
@@ -97,10 +103,6 @@ namespace Barotrauma.Items.Components
UpdateConvexHulls();
}
}
PhysicsBody body;
Sprite doorSprite, weldedSprite;
public Door(Item item, XElement element)
: base(item, element)

View File

@@ -54,7 +54,7 @@ namespace Barotrauma.Items.Components
if (character == null || reloadTimer>0.0f) return false;
if (!character.IsKeyDown(InputType.Aim) || hitting) return false;
user = character;
SetUser(character);
if (hitPos < MathHelper.Pi * 0.69f) return false;
@@ -154,9 +154,36 @@ namespace Barotrauma.Items.Components
hitting = false;
}
}
}
}
private void SetUser(Character character)
{
if (user == character) return;
if (user != null)
{
foreach (Limb limb in user.AnimController.Limbs)
{
try
{
item.body.FarseerBody.RestoreCollisionWith(limb.body.FarseerBody);
}
catch
{
continue;
}
}
}
foreach (Limb limb in character.AnimController.Limbs)
{
item.body.FarseerBody.IgnoreCollisionWith(limb.body.FarseerBody);
}
user = character;
}
private void RestoreCollision()
{

View File

@@ -69,7 +69,7 @@ namespace Barotrauma.Items.Components
if (character == null
|| character.SelectedConstruction != item
|| Vector2.Distance(character.SimPosition, item.SimPosition) > item.PickDistance * 1.5f)
|| Vector2.Distance(character.Position, item.Position) > item.PickDistance * 1.5f)
{
if (character != null)
{