From 182f54a3c888a336127ecaf8eefdc9a39ab21156 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sat, 4 Feb 2023 17:39:12 +0000 Subject: [PATCH 1/5] Updated TempCharacter.cpp Added boolean to make inventory not open when in shop --- Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 3 +++ Source/the_twilight_abyss/PlayerTemp/TempCharacter.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index bfdfe06..aed31e5 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -85,6 +85,7 @@ void ATempCharacter::LineTraceLogic() } if(OutHit.GetActor()->FindComponentByClass()) { + UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); auto ItemArray = OutHit.GetActor()->FindComponentByClass()->GetItem(0); if(GoldBalance >= ItemArray->ItemCostPrice) { @@ -139,6 +140,7 @@ void ATempCharacter::LineTraceLogic() void ATempCharacter::InputDisabler() { UE_LOG(LogTemp, Display, TEXT("Disabling playermovement")); + disableTab = true; //GetWorld()->GetFirstPlayerController()->InputComponent->RemoveActionBinding("Interact", IE_Pressed); GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(true); GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(true); @@ -163,6 +165,7 @@ void ATempCharacter::InputDisabler() void ATempCharacter::InputEnabler() { UE_LOG(LogTemp, Display, TEXT("Enabling Inputs")); + disableTab = true; GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false); GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(false); GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false; diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 928b8df..510587b 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -77,5 +77,8 @@ public: void BuyItem(); bool bShopKeeperText = false; + + UPROPERTY(BlueprintReadWrite) + bool disableTab = false; }; From f4e0511f5c497a938054876fb0e6ce2c5356a9df Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sat, 4 Feb 2023 17:41:09 +0000 Subject: [PATCH 2/5] Updated TempCharacter blueprint Added a check to make sure the player is not in the shop when opening inventory --- Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset | 4 ++-- Content/Blueprints/Player/BP_MyTempCharacter.uasset | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset b/Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset index d2d7739..138ec00 100644 --- a/Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset +++ b/Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4177a97bce273fa21e43e1d37185390f84f3055fe4af730ea21754e8f3715246 -size 108778 +oid sha256:6077e113d99db0e0e7e66e52dc856fe1cf0473f23377f7d00f4e9ca187069ee1 +size 111320 diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index d369a35..68f202b 100644 --- a/Content/Blueprints/Player/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/Player/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0954984bc9728f0b7488017e75a199b474190a8b9ff5412cc7869aece4c93b46 -size 54779 +oid sha256:df9e97f92efc6e557cb50693743a5db37bb9b97703afeccf8d1452b5886931ea +size 66442 From 5364f92edb04f1d481188eaa58d01ca68be2c98a Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sat, 4 Feb 2023 17:49:17 +0000 Subject: [PATCH 3/5] Updated WBP_ItemDisplay Item_Stack now changes to however many stacks the player has bought of the item --- Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset b/Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset index 3980322..708a5d3 100644 --- a/Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset +++ b/Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:48426ed97184a867232380e93324520aeef1c39e773c7155c7caab764aa7f54a -size 86683 +oid sha256:1d2dacba46200972bd3ed39b2e006c6f815eed957e4cb57009fd850d3565dd6f +size 99076 From 81d926ffb37e3c78055e730378565144c11e416b Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sat, 4 Feb 2023 17:56:25 +0000 Subject: [PATCH 4/5] Updated EatableItems.cpp Made it so when the players health is above 100 they cant heal anymore. (Removed healing stacking) --- .../BaseItems/Items/EatableItems.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index cc2c535..ceae474 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -18,11 +18,17 @@ void UEatableItems::Use(ATempCharacter* Character) { if(isHealingItem == true) { - Character->Health += 10; - UE_LOG(LogTemp, Display, TEXT("Healed")); - //delete itself - Character->Inventory->RemoveItem(this); - + if (Character->Health < 100) + { + Character->Health += 10; + UE_LOG(LogTemp, Display, TEXT("Healed")); + //delete itself + Character->Inventory->RemoveItem(this); + } + else if (Character->Health >= 100) + { + UE_LOG(LogTemp, Display, TEXT("Health is full")); + } } if(isDamageBuffItem == true) { From 14c7d6b6d7860e5820adfc4dc9fa04942cbeb241 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sat, 4 Feb 2023 18:34:53 +0000 Subject: [PATCH 5/5] Updated TempCharacter.cpp Cached the camera reference isntead of constantly casting for it --- Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index aed31e5..f6c743b 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -24,6 +24,7 @@ void ATempCharacter::BeginPlay() { Super::BeginPlay(); Health = 100; + ThisCamera = Cast(this->FindComponentByClass()); } //Binds the input we made in the setup player component to the forward vector @@ -147,7 +148,6 @@ void ATempCharacter::InputDisabler() GetWorld()->GetFirstPlayerController()->bShowMouseCursor = true; GetWorld()->GetFirstPlayerController()->bEnableClickEvents = true; GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = true; - ThisCamera = Cast(this->FindComponentByClass()); if (ThisCamera == nullptr) { return; @@ -173,7 +173,6 @@ void ATempCharacter::InputEnabler() GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false; //GetWorld()->GetFirstPlayerController()->InputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed); TraceDistance = 300; - ThisCamera = Cast(this->FindComponentByClass()); if (ThisCamera == nullptr) { return;