59 lines
1.4 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class BP_ResetHeight_C:AActor
---@field Box UBoxComponent
---@field DefaultSceneRoot USceneComponent
---@field IsDestroyPawn bool
--Edit Below--
local BP_ResetHeight = {
CheckTime = 1;
ActorHeightZ = -2000;
};
function BP_ResetHeight:ReceiveBeginPlay()
self.SuperClass.ReceiveBeginPlay(self);
if UGCGameSystem.IsServer() then
self.ActorHeightZ = self:K2_GetActorLocation().Z
self.CheckPlayerHeightHandle = UGCEventSystem.SetTimerLoop(self, self.CheckPlayerHeight, self.CheckTime)
end
end
function BP_ResetHeight:CheckPlayerHeight()
local AllPawn = UGCGameSystem.GetAllPlayerPawn()
for i, v in pairs(AllPawn) do
if v:K2_GetActorLocation().Z < self.ActorHeightZ and v.PlayerKey and v:IsAlive() then
UGCLogSystem.Log("[BP_ResetHeight_CheckPlayerHeight] PlayerKey:%s", tostring(v.PlayerKey))
if self.IsDestroyPawn then
UGCSystemLibrary.RespawnPlayer(v.PlayerKey)
else
UGCPawnAttrSystem.SetHealth(v, -1)
end
end
end
end
function BP_ResetHeight:ReceiveEndPlay()
if self.CheckPlayerHeightHandle then
UGCEventSystem.StopTimer(self.CheckPlayerHeightHandle)
end
self.SuperClass.ReceiveEndPlay(self);
end
--[[
function BP_ResetHeight:GetReplicatedProperties()
return
end
--]]
--[[
function BP_ResetHeight:GetAvailableServerRPCs()
return
end
--]]
return BP_ResetHeight;