Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Kyrium
KBFL
Commits
a20cbe14
Commit
a20cbe14
authored
Jan 07, 2022
by
Kyrium
Browse files
add a check to PullBelt & PullPipe if the item has allready an item to pull this.
parent
92c19be0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Source/KBFL/Private/C++/KBFLCppInventoryHelper.cpp
View file @
a20cbe14
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment