Add MVP respawn command
This commit is contained in:
@@ -169,6 +169,11 @@ void AAgrarianGamePlayerController::AgrarianHeal()
|
||||
ServerAgrarianHeal();
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::AgrarianRespawn()
|
||||
{
|
||||
ServerAgrarianRespawn();
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::AgrarianDropItem(FName ItemId, int32 Quantity)
|
||||
{
|
||||
if (ItemId == NAME_None || Quantity <= 0)
|
||||
@@ -333,6 +338,40 @@ void AAgrarianGamePlayerController::ServerAgrarianHeal_Implementation()
|
||||
ClientMessage(TEXT("Agrarian survival restored."));
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::ServerAgrarianRespawn_Implementation()
|
||||
{
|
||||
AAgrarianGameCharacter* AgrarianCharacter = GetPawn<AAgrarianGameCharacter>();
|
||||
UAgrarianSurvivalComponent* SurvivalComponent = AgrarianCharacter ? AgrarianCharacter->GetSurvivalComponent() : nullptr;
|
||||
if (!AgrarianCharacter || !SurvivalComponent)
|
||||
{
|
||||
ClientMessage(TEXT("No Agrarian character/survival component found."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SurvivalComponent->IsDead())
|
||||
{
|
||||
ClientMessage(TEXT("AgrarianRespawn is only available after death. Use AgrarianHeal for admin recovery."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (UCharacterMovementComponent* MovementComponent = AgrarianCharacter->GetCharacterMovement())
|
||||
{
|
||||
MovementComponent->StopMovementImmediately();
|
||||
}
|
||||
|
||||
AgrarianCharacter->SetActorLocation(GroundZeroDeveloperTravelHomeLocation, false, nullptr, ETeleportType::TeleportPhysics);
|
||||
SurvivalComponent->Revive(60.0f);
|
||||
SurvivalComponent->AddFood(35.0f);
|
||||
SurvivalComponent->AddWater(35.0f);
|
||||
SurvivalComponent->ReduceExhaustion(100.0f);
|
||||
SurvivalComponent->ReduceInjury(100.0f);
|
||||
SurvivalComponent->ReduceBleeding(100.0f);
|
||||
SurvivalComponent->ReduceSprain(100.0f);
|
||||
SurvivalComponent->ReduceSickness(100.0f);
|
||||
SurvivalComponent->AddWarmth(37.0f - SurvivalComponent->Survival.BodyTemperature);
|
||||
ClientMessage(TEXT("Agrarian MVP respawn complete: returned to Ground Zero with acute conditions stabilized."));
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::ServerAgrarianDropItem_Implementation(FName ItemId, int32 Quantity)
|
||||
{
|
||||
AAgrarianGameCharacter* AgrarianCharacter = GetPawn<AAgrarianGameCharacter>();
|
||||
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
UFUNCTION(Exec)
|
||||
void AgrarianHeal();
|
||||
|
||||
UFUNCTION(Exec)
|
||||
void AgrarianRespawn();
|
||||
|
||||
UFUNCTION(Exec)
|
||||
void AgrarianDropItem(FName ItemId, int32 Quantity);
|
||||
|
||||
@@ -100,6 +103,9 @@ protected:
|
||||
UFUNCTION(Server, Reliable)
|
||||
void ServerAgrarianHeal();
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
void ServerAgrarianRespawn();
|
||||
|
||||
UFUNCTION(Server, Reliable)
|
||||
void ServerAgrarianDropItem(FName ItemId, int32 Quantity);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user