Fixes to holdable items again: items can be attached outside hulls in the sub editor, but not in-game
This commit is contained in:
@@ -94,17 +94,35 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
canBePicked = true;
|
canBePicked = true;
|
||||||
|
|
||||||
prevRequiredItems = new List<RelatedItem>(requiredItems);
|
|
||||||
|
|
||||||
if (attachable)
|
if (attachable)
|
||||||
{
|
{
|
||||||
prevMsg = Msg;
|
prevMsg = Msg;
|
||||||
prevPickKey = PickKey;
|
prevPickKey = PickKey;
|
||||||
|
prevRequiredItems = new List<RelatedItem>(requiredItems);
|
||||||
|
|
||||||
DeattachFromWall();
|
|
||||||
|
if (item.Submarine != null)
|
||||||
|
{
|
||||||
|
if (item.Submarine.Loading)
|
||||||
|
{
|
||||||
|
AttachToWall();
|
||||||
|
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
|
||||||
|
{
|
||||||
|
if (Screen.Selected == GameMain.EditMapScreen && attachedByDefault)
|
||||||
|
{
|
||||||
|
//in the sub editor, attach
|
||||||
|
AttachToWall();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//spawned mid-round, deattach
|
||||||
|
DeattachFromWall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Screen.Selected == GameMain.EditMapScreen)) Use(1.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Drop(Character dropper)
|
public override void Drop(Character dropper)
|
||||||
@@ -237,7 +255,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item.body.Enabled = false;
|
body.Enabled = false;
|
||||||
item.body = null;
|
item.body = null;
|
||||||
|
|
||||||
Msg = prevMsg;
|
Msg = prevMsg;
|
||||||
@@ -265,6 +283,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (character != null)
|
if (character != null)
|
||||||
{
|
{
|
||||||
if (!character.IsKeyDown(InputType.Aim)) return false;
|
if (!character.IsKeyDown(InputType.Aim)) return false;
|
||||||
|
if (character.CurrentHull == null) return false;
|
||||||
if (character != null && GameMain.Server != null)
|
if (character != null && GameMain.Server != null)
|
||||||
{
|
{
|
||||||
item.CreateServerEvent(this);
|
item.CreateServerEvent(this);
|
||||||
@@ -309,13 +328,11 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
public override void OnMapLoaded()
|
public override void OnMapLoaded()
|
||||||
{
|
{
|
||||||
prevRequiredItems = new List<RelatedItem>(requiredItems);
|
|
||||||
|
|
||||||
if (!attachable) return;
|
if (!attachable) return;
|
||||||
|
|
||||||
if (Attached)
|
if (Attached)
|
||||||
{
|
{
|
||||||
Use(1.0f);
|
AttachToWall();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -327,8 +344,6 @@ namespace Barotrauma.Items.Components
|
|||||||
body.Enabled = false;
|
body.Enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
attached = false;
|
|
||||||
|
|
||||||
DeattachFromWall();
|
DeattachFromWall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user