(ffa3ddbca) Implemented changing mineral sprites when attached to a wall
This commit is contained in:
@@ -44,7 +44,18 @@ namespace Barotrauma.Items.Components
|
||||
public bool Attached
|
||||
{
|
||||
get { return attached && item.ParentInventory == null; }
|
||||
set { attached = value; }
|
||||
set
|
||||
{
|
||||
attached = value;
|
||||
item.SetActiveSprite();
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(true, true)]
|
||||
public bool Aimable
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[Serialize(true, true)]
|
||||
@@ -167,7 +178,7 @@ namespace Barotrauma.Items.Components
|
||||
if (item.Submarine.Loading)
|
||||
{
|
||||
AttachToWall();
|
||||
attached = false;
|
||||
Attached = false;
|
||||
}
|
||||
else //the submarine is not being loaded, which means we're either in the sub editor or the item has been spawned mid-round
|
||||
{
|
||||
@@ -409,14 +420,14 @@ namespace Barotrauma.Items.Components
|
||||
PickKey = prevPickKey;
|
||||
requiredItems = new Dictionary<RelatedItem.RelationType, List<RelatedItem>>(prevRequiredItems);
|
||||
|
||||
attached = true;
|
||||
Attached = true;
|
||||
}
|
||||
|
||||
public void DeattachFromWall()
|
||||
{
|
||||
if (!attachable) return;
|
||||
|
||||
attached = false;
|
||||
Attached = false;
|
||||
|
||||
//make the item pickable with the default pick key and with no specific tools/items when it's deattached
|
||||
requiredItems.Clear();
|
||||
@@ -529,6 +540,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (item.Submarine != null && item.Submarine.Loading) return;
|
||||
OnMapLoaded();
|
||||
item.SetActiveSprite();
|
||||
}
|
||||
|
||||
public override void OnMapLoaded()
|
||||
|
||||
@@ -11,6 +11,12 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
private float lastSentDeattachTimer;
|
||||
|
||||
private PhysicsBody trigger;
|
||||
|
||||
private Holdable holdable;
|
||||
|
||||
private float deattachTimer;
|
||||
|
||||
[Serialize(1.0f, false)]
|
||||
public float DeattachDuration
|
||||
{
|
||||
@@ -49,13 +55,7 @@ namespace Barotrauma.Items.Components
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private PhysicsBody trigger;
|
||||
|
||||
private Holdable holdable;
|
||||
|
||||
private float deattachTimer;
|
||||
|
||||
|
||||
public LevelResource(Item item, XElement element) : base(item, element)
|
||||
{
|
||||
IsActive = true;
|
||||
|
||||
Reference in New Issue
Block a user