mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
a bit of stuff
toys, ammo in bottom right kinda, fix lootin speeds, being inaccurate, playlist looting kindof, or some things just not working.
This commit is contained in:
@@ -489,6 +489,34 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
|
||||
return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
|
||||
}
|
||||
|
||||
AActor* AFortPlayerController::SpawnToyInstanceHook(UObject* Context, FFrame* Stack, AActor** Ret)
|
||||
{
|
||||
LOG_INFO(LogDev, "SpawnToyInstance!");
|
||||
|
||||
auto PlayerController = Cast<AFortPlayerController>(Context);
|
||||
|
||||
UClass* ToyClass = nullptr;
|
||||
FTransform SpawnPosition;
|
||||
|
||||
Stack->StepCompiledIn(&ToyClass);
|
||||
Stack->StepCompiledIn(&SpawnPosition);
|
||||
|
||||
SpawnToyInstanceOriginal(Context, Stack, Ret);
|
||||
|
||||
if (!ToyClass)
|
||||
return nullptr;
|
||||
|
||||
FActorSpawnParameters SpawnParameters{};
|
||||
SpawnParameters.Owner = PlayerController;
|
||||
auto NewToy = GetWorld()->SpawnActor<AActor>(ToyClass, SpawnPosition, SpawnParameters);
|
||||
|
||||
static auto ActiveToyInstancesOffset = PlayerController->GetOffset("ActiveToyInstances");
|
||||
|
||||
|
||||
*Ret = NewToy;
|
||||
return *Ret;
|
||||
}
|
||||
|
||||
void AFortPlayerController::DropSpecificItemHook(UObject* Context, FFrame& Stack, void* Ret)
|
||||
{
|
||||
UFortItemDefinition* DropItemDef = nullptr;
|
||||
@@ -546,7 +574,7 @@ void AFortPlayerController::ServerAttemptInventoryDropHook(AFortPlayerController
|
||||
|
||||
bool bShouldUpdate = false;
|
||||
|
||||
if (!WorldInventory->RemoveItem(ItemGuid, &bShouldUpdate, Count))
|
||||
if (!WorldInventory->RemoveItem(ItemGuid, &bShouldUpdate, Count, true))
|
||||
return;
|
||||
|
||||
if (bShouldUpdate)
|
||||
@@ -564,6 +592,7 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe
|
||||
UObject* AbilityToUse = nullptr;
|
||||
|
||||
static auto AthenaSprayItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.AthenaSprayItemDefinition");
|
||||
static auto AthenaToyItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.AthenaToyItemDefinition");
|
||||
|
||||
if (EmoteAsset->IsA(AthenaSprayItemDefinitionClass))
|
||||
{
|
||||
@@ -571,6 +600,21 @@ void AFortPlayerController::ServerPlayEmoteItemHook(AFortPlayerController* Playe
|
||||
AbilityToUse = SprayGameplayAbilityDefault;
|
||||
}
|
||||
|
||||
else if (EmoteAsset->IsA(AthenaToyItemDefinitionClass))
|
||||
{
|
||||
static auto ToySpawnAbilityOffset = EmoteAsset->GetOffset("ToySpawnAbility");
|
||||
auto& ToySpawnAbilitySoft = EmoteAsset->Get<TSoftObjectPtr<UClass>>(ToySpawnAbilityOffset);
|
||||
|
||||
static auto BGAClass = FindObject<UClass>("/Script/Engine.BlueprintGeneratedClass");
|
||||
|
||||
auto ToySpawnAbility = ToySpawnAbilitySoft.Get(BGAClass, true);
|
||||
|
||||
if (ToySpawnAbility)
|
||||
AbilityToUse = ToySpawnAbility->CreateDefaultObject();
|
||||
}
|
||||
|
||||
// LOG_INFO(LogDev, "Before AbilityToUse: {}", AbilityToUse ? AbilityToUse->GetFullName() : "InvalidObject");
|
||||
|
||||
if (!AbilityToUse)
|
||||
{
|
||||
static auto EmoteGameplayAbilityDefault = FindObject("/Game/Abilities/Emotes/GAB_Emote_Generic.Default__GAB_Emote_Generic_C");
|
||||
@@ -767,7 +811,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
|
||||
|
||||
for (auto& Pair : GuidAndCountsToRemove)
|
||||
{
|
||||
WorldInventory->RemoveItem(Pair.first, nullptr, Pair.second);
|
||||
WorldInventory->RemoveItem(Pair.first, nullptr, Pair.second, true);
|
||||
}
|
||||
|
||||
WorldInventory->Update();
|
||||
|
||||
Reference in New Issue
Block a user