Add item data assets and building placement foundation
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "AgrarianResourceNode.h"
|
||||
#include "AgrarianGameCharacter.h"
|
||||
#include "AgrarianInventoryComponent.h"
|
||||
#include "AgrarianItemDefinitionAsset.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
|
||||
@@ -45,9 +46,7 @@ void AAgrarianResourceNode::Interact_Implementation(AAgrarianGameCharacter* Inte
|
||||
|
||||
if (UAgrarianInventoryComponent* Inventory = Interactor->GetInventoryComponent())
|
||||
{
|
||||
FAgrarianItemStack Granted = YieldItem;
|
||||
Granted.Quantity = QuantityPerHarvest;
|
||||
|
||||
const FAgrarianItemStack Granted = MakeYieldStack();
|
||||
if (Inventory->AddItem(Granted))
|
||||
{
|
||||
RemainingHarvests--;
|
||||
@@ -61,6 +60,18 @@ void AAgrarianResourceNode::OnRep_RemainingHarvests()
|
||||
UpdateDepletedState();
|
||||
}
|
||||
|
||||
FAgrarianItemStack AAgrarianResourceNode::MakeYieldStack() const
|
||||
{
|
||||
if (YieldItemDefinition)
|
||||
{
|
||||
return YieldItemDefinition->MakeStack(QuantityPerHarvest);
|
||||
}
|
||||
|
||||
FAgrarianItemStack Granted = YieldItem;
|
||||
Granted.Quantity = QuantityPerHarvest;
|
||||
return Granted;
|
||||
}
|
||||
|
||||
void AAgrarianResourceNode::UpdateDepletedState()
|
||||
{
|
||||
if (Mesh)
|
||||
|
||||
Reference in New Issue
Block a user