UGCProjects/SoldierWar/Script/gamemode/Action_PlayerLeave.lua

17 lines
681 B
Lua
Raw Permalink Normal View History

2025-01-04 23:00:19 +08:00
local Action_PlayerLeave = {
PlayerKey = 0;
}
-- 触发器激活时将执行Action的Execute
function Action_PlayerLeave:Execute(...)
ugcprint(string.format("[Action_PlayerLeave] Start settlement %d", self.PlayerKey));
local TeamID = UGCPlayerStateSystem.GetTeamID(self.PlayerKey);
UGCGameSystem.SendPlayerSettlement(self.PlayerKey);
DefaultSettings.CurrPlayerCount = DefaultSettings.CurrPlayerCount - 1
UGCEventSystem.SendEvent(EventTypes.AddPlayer, self.PlayerKey, TeamID, false);
local IsAllPlayerLogOut, AlivePlayerCount = GameState:PlayerLoginOrLeave(false, self.PlayerKey);
PluginManager:OnPlayerLeave(self.PlayerKey);
return true
end
return Action_PlayerLeave;