57 lines
1.4 KiB
Lua
Raw Permalink Normal View History

2025-01-18 21:26:02 +08:00
---@class BP_ResetHeight_C:AActor
---@field Box UBoxComponent
---@field DefaultSceneRoot USceneComponent
--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 then
--local PlayerStart = UGCSystemLibrary.GetUniqueInstanceFromPath('/Game/BluePrints/Player/PlayerStart/BP_STPlayerStart.BP_STPlayerStart_C')
--if UE.IsValid(PlayerStart) then
-- v:SetPawnTF(PlayerStart:K2_GetActorLocation(), PlayerStart:K2_GetActorRotation())
--end
UGCPawnAttrSystem.SetHealth(v, -1)
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;