(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:
@@ -140,7 +140,10 @@ namespace Barotrauma
|
||||
{
|
||||
if (UseController)
|
||||
{
|
||||
ConnectedController = targetItem.Item.GetConnectedComponents<Controller>().FirstOrDefault();
|
||||
//try finding the controller with the simpler non-recursive method first
|
||||
ConnectedController =
|
||||
targetItem.Item.GetConnectedComponents<Controller>().FirstOrDefault() ??
|
||||
targetItem.Item.GetConnectedComponents<Controller>(recursive: true).FirstOrDefault();
|
||||
}
|
||||
TargetEntity = targetItem.Item;
|
||||
TargetItemComponent = targetItem;
|
||||
|
||||
Reference in New Issue
Block a user