59 lines
2.1 KiB
Lua
59 lines
2.1 KiB
Lua
|
---@class UGCGameMode_C:BP_UGCGameBase_C
|
||
|
--Edit Below--
|
||
|
---@type UGCGameMode_C
|
||
|
UGCGameSystem.UGCRequire('Script.Global.Global')
|
||
|
|
||
|
local UGCGameMode = {
|
||
|
};
|
||
|
function UGCGameMode:ReceiveBeginPlay()
|
||
|
self.SuperClass.ReceiveBeginPlay(self);
|
||
|
--- 启用滑铲
|
||
|
self.bIsOpenShovelingAbility = true
|
||
|
|
||
|
-- 清除掉落物
|
||
|
if GlobalConfigs.GameSetting.ClearSceneItems then
|
||
|
UGCEventSystem.SetTimerLoop(self, self.RemovePickUpWrapperActor, 2)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
UGCGameMode.SpawnPickUpWrapperActors = {}
|
||
|
|
||
|
function UGCGameMode:RemovePickUpWrapperActor()
|
||
|
local IgnoreActors = {}
|
||
|
for i, v in pairs(self.SpawnPickUpWrapperActors) do
|
||
|
if UE.IsValid(v) then
|
||
|
IgnoreActors[#IgnoreActors + 1] = v:GetPickupWrapper()
|
||
|
end
|
||
|
end
|
||
|
-- 清除掉落物,忽略生成物
|
||
|
UGCSystemLibrary.RemoveActorFromClassName("PickUpWrapperActor", IgnoreActors)
|
||
|
end
|
||
|
|
||
|
function UGCGameMode:UpdatePickUpWrapperActor()
|
||
|
local SpawnPickUpWrapperActorClass = UE.LoadClass(UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneActor/BP_SpawnPickupWrapper.BP_SpawnPickupWrapper_C'))
|
||
|
self.SpawnPickUpWrapperActors = ScriptGameplayStatics.GetActorsOfClass(UGCGameSystem.GameState, SpawnPickUpWrapperActorClass, {})
|
||
|
UGCLogSystem.LogTree("[UGCGameMode_UpdatePickUpWrapperActor]", self.SpawnPickUpWrapperActors)
|
||
|
end
|
||
|
|
||
|
function UGCGameMode:ReceiveTick(DeltaTime)
|
||
|
self.SuperClass.ReceiveTick(self, DeltaTime);
|
||
|
end
|
||
|
|
||
|
function UGCGameMode:ReceiveEndPlay()
|
||
|
self.SuperClass.ReceiveEndPlay(self);
|
||
|
end
|
||
|
|
||
|
|
||
|
function UGCGameMode:Server_RespawnPlayer(RespawnPlayerKey)
|
||
|
UGCGameSystem.GetRespawnComponent():AddRespawnPlayer(RespawnPlayerKey, GlobalConfigs.GameSetting.RespawnTime)
|
||
|
end
|
||
|
|
||
|
function UGCGameMode:LuaModifyDamage(Damage, DamageType, InstigatorPlayerState, VictimPlayerState)
|
||
|
UGCLogSystem.Log("[UGCGameMode_LuaModifyDamage] Damage:%s, DamageType:%s", tostring(Damage), tostring(DamageType))
|
||
|
if DamageType == EDamageType.MeleeDamage and UGCPlayerStateSystem.GetTeamID(InstigatorPlayerState.PlayerKey) == UGCPlayerStateSystem.GetTeamID(VictimPlayerState.PlayerKey) then
|
||
|
return 0
|
||
|
end
|
||
|
return Damage
|
||
|
end
|
||
|
|
||
|
return UGCGameMode;
|