Skip to content

Commit

Permalink
ObjectTravelInfo: Set the names of SelectedItem and Weapon to None
Browse files Browse the repository at this point in the history
  • Loading branch information
LupertEverett authored and dpjudas committed May 12, 2024
1 parent 9a95730 commit a2d58b1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions SurrealEngine/UObject/ObjectTravelInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ ObjectTravelInfo::ObjectTravelInfo(UActor* travelActor)
for (UProperty* property : allProperties)
Properties[property->Name.ToString()] = travelActor->GetPropertyAsString(property->Name);
}

if (isPlayerPawn)
{
// Hacky workaround for selected Weapon and Inventory
auto playerActor = UObject::Cast<UPlayerPawn>(travelActor);
auto selectedInventory = UObject::Cast<UInventory>(playerActor->GetUObject("SelectedItem"));
if (selectedInventory)
Properties["SelectedItem"] = "{ name=None, class=" + UObject::GetUClassFullName(selectedInventory).ToString() + " }";

auto selectedWeapon = UObject::Cast<UInventory>(playerActor->GetUObject("Weapon"));
if (selectedWeapon)
Properties["Weapon"] = "{ name=None, class=" + UObject::GetUClassFullName(selectedWeapon).ToString() + " }";
}
}

std::vector<ObjectTravelInfo> ObjectTravelInfo::Parse(const std::string& text)
Expand Down

0 comments on commit a2d58b1

Please sign in to comment.