(23df6915f) Added: Possibility of having a status effect trigger if a requiredItem is missing

This commit is contained in:
Joonas Rikkonen
2019-06-12 16:45:02 +03:00
parent b598459179
commit dce98349ea
16 changed files with 87 additions and 120 deletions
@@ -483,26 +483,6 @@ namespace Barotrauma
{
if (selectedList.Contains(entity)) { return; }
selectedList.Add(entity);
HandleDoorGapLinks(entity,
onGapFound: (door, gap) =>
{
door.RefreshLinkedGap();
if (!selectedList.Contains(gap))
{
selectedList.Add(gap);
}
},
onDoorFound: (door, gap) =>
{
if (!selectedList.Contains(door.Item))
{
selectedList.Add(door.Item);
}
});
}
private static void HandleDoorGapLinks(MapEntity entity, Action<Door, Gap> onGapFound, Action<Door, Gap> onDoorFound)
{
if (entity is Item i)
{
var door = i.GetComponent<Door>();
@@ -511,26 +491,31 @@ namespace Barotrauma
var gap = door.LinkedGap;
if (gap != null)
{
onGapFound(door, gap);
door.RefreshLinkedGap();
if (!selectedList.Contains(gap))
{
selectedList.Add(gap);
}
}
}
}
else if (entity is Gap gap)
{
var door = gap.ConnectedDoor;
if (door != null)
{
onDoorFound(door, gap);
}
}
}
public static void RemoveSelection(MapEntity entity)
{
selectedList.Remove(entity);
HandleDoorGapLinks(entity,
onGapFound: (door, gap) => selectedList.Remove(gap),
onDoorFound: (door, gap) => selectedList.Remove(door.Item));
if (entity is Item i)
{
var door = i.GetComponent<Door>();
if (door != null)
{
var gap = door.LinkedGap;
if (gap != null)
{
selectedList.Remove(gap);
}
}
}
}
static partial void UpdateAllProjSpecific(float deltaTime)
@@ -600,11 +585,12 @@ namespace Barotrauma
public static void UpdateEditor(Camera cam)
{
FilteredSelectedList.Clear();
if (highlightedListBox != null) highlightedListBox.UpdateManually((float)Timing.Step);
if (editingHUD != null)
{
if (FilteredSelectedList.Count == 0 || editingHUD.UserData != FilteredSelectedList[0])
if (selectedList.Count == 0 || editingHUD.UserData != selectedList[0])
{
foreach (GUIComponent component in editingHUD.Children)
{
@@ -615,7 +601,7 @@ namespace Barotrauma
editingHUD = null;
}
}
FilteredSelectedList.Clear();
if (selectedList.Count == 0) return;
foreach (var e in selectedList)
{