Commit a20cbe14 authored by Kyrium's avatar Kyrium
Browse files

add a check to PullBelt & PullPipe if the item has allready an item to pull this.

parent 92c19be0
......@@ -215,6 +215,16 @@ void UKBFLCppInventoryHelper::PullPipe(UFGInventoryComponent* Inventory, int Inv
void UKBFLCppInventoryHelper::PullPipe(UFGInventoryComponent* Inventory, int InventoryIndex, float dt, TArray<TSubclassOf<UFGItemDescriptor>> AllowedItem,
UFGPipeConnectionFactory* PipeInputComp, int PullAmount)
{
// look if the inventory has already an item on index and pull only this.
FInventoryStack Stack;
Inventory->GetStackFromIndex(InventoryIndex, Stack);
if(Stack.HasItems())
{
if(AllowedItem.Contains(Stack.Item.ItemClass))
PullPipe(Inventory, InventoryIndex, dt, Stack.Item.ItemClass, PipeInputComp, PullAmount);
return;
}
for (const auto ItemClass : AllowedItem)
{
PullPipe(Inventory, InventoryIndex, dt, ItemClass, PipeInputComp, PullAmount);
......@@ -244,6 +254,16 @@ void UKBFLCppInventoryHelper::PullBelt(UFGInventoryComponent* Inventory, int Inv
void UKBFLCppInventoryHelper::PullBelt(UFGInventoryComponent* Inventory, int InventoryIndex, float dt, TArray<TSubclassOf<UFGItemDescriptor>> AllowedItem, UFGFactoryConnectionComponent* BeltInput)
{
// look if the inventory has already an item on index and pull only this.
FInventoryStack Stack;
Inventory->GetStackFromIndex(InventoryIndex, Stack);
if(Stack.HasItems())
{
if(AllowedItem.Contains(Stack.Item.ItemClass))
PullBelt(Inventory, InventoryIndex, dt, Stack.Item.ItemClass, BeltInput);
return;
}
for (auto Item : AllowedItem)
{
PullBelt(Inventory, InventoryIndex, dt, Item, BeltInput);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment