(067f4d694) The recursive version of GetConnectedComponents can traverse between wifi components, use recursive GetConnectedComponents when finding the controller used to operate some item (-> AI characters can now figure out how to operate a turret that's connected to a periscope through wifi components, relays, etc)

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:41:41 +03:00
parent 1d5de494cd
commit 5b2bf67d66
14 changed files with 458 additions and 100 deletions
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
@@ -74,9 +75,9 @@ namespace Barotrauma.Items.Components
return HasRequiredContainedItems(true);
}
private List<WifiComponent> GetReceiversInRange()
public IEnumerable<WifiComponent> GetReceiversInRange()
{
return list.FindAll(w => w != this && w.CanReceive(this));
return list.Where(w => w != this && w.CanReceive(this));
}
public bool CanReceive(WifiComponent sender)