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:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -895,7 +895,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (Rectangle trigger in item.prefab.Triggers)
|
||||
{
|
||||
Rectangle transformedTrigger = item.TransformTrigger(trigger);
|
||||
Rectangle transformedTrigger = item.TransformTrigger(trigger, true);
|
||||
|
||||
if (!Submarine.RectContains(transformedTrigger, displayPos)) continue;
|
||||
|
||||
@@ -917,16 +917,16 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (item.prefab.PickDistance == 0.0f) continue;
|
||||
if (Vector2.Distance(position, item.SimPosition) > item.prefab.PickDistance) continue;
|
||||
if (item.prefab.PickDistance == 0.0f) continue;
|
||||
if (Vector2.Distance(displayPos, item.WorldPosition) > item.prefab.PickDistance) continue;
|
||||
|
||||
if (!item.prefab.PickThroughWalls)
|
||||
{
|
||||
Body body = Submarine.CheckVisibility(position, item.SimPosition);
|
||||
Body body = Submarine.CheckVisibility(item.Submarine == null ? position : position - item.Submarine.SimPosition, item.SimPosition);
|
||||
if (body != null && body.UserData as Item != item) continue;
|
||||
}
|
||||
|
||||
dist = Vector2.Distance(pickPosition, item.SimPosition);
|
||||
dist = Vector2.Distance(displayPickPos, item.WorldPosition);
|
||||
if (dist < item.prefab.PickDistance && (closest == null || dist < closestDist))
|
||||
{
|
||||
closest = item;
|
||||
|
||||
@@ -38,12 +38,6 @@ namespace Barotrauma
|
||||
get { return configFile; }
|
||||
}
|
||||
|
||||
public string Description
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public List<string> DeconstructItems
|
||||
{
|
||||
get;
|
||||
@@ -189,7 +183,7 @@ namespace Barotrauma
|
||||
Description = ToolBox.GetAttributeString(element, "description", "");
|
||||
|
||||
pickThroughWalls = ToolBox.GetAttributeBool(element, "pickthroughwalls", false);
|
||||
pickDistance = ConvertUnits.ToSimUnits(ToolBox.GetAttributeFloat(element, "pickdistance", 0.0f));
|
||||
pickDistance = ToolBox.GetAttributeFloat(element, "pickdistance", 0.0f);
|
||||
|
||||
isLinkable = ToolBox.GetAttributeBool(element, "linkable", false);
|
||||
|
||||
@@ -221,7 +215,13 @@ namespace Barotrauma
|
||||
switch (subElement.Name.ToString().ToLower())
|
||||
{
|
||||
case "sprite":
|
||||
sprite = new Sprite(subElement, Path.GetDirectoryName(filePath));
|
||||
string spriteFolder = "";
|
||||
if (!ToolBox.GetAttributeString(subElement, "texture", "").Contains("/"))
|
||||
{
|
||||
spriteFolder = Path.GetDirectoryName(filePath);
|
||||
}
|
||||
|
||||
sprite = new Sprite(subElement, spriteFolder);
|
||||
size = sprite.size;
|
||||
break;
|
||||
case "deconstruct":
|
||||
|
||||
Reference in New Issue
Block a user