wip
This commit is contained in:
parent
a2423c01b0
commit
158dd4e0e6
194
MskGs/Classes/MSKGS.uc
Normal file
194
MskGs/Classes/MSKGS.uc
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
class MSKGS extends Info;
|
||||||
|
|
||||||
|
const LatestVersion = 1;
|
||||||
|
|
||||||
|
const CfgRemoveItems = class'RemoveItems';
|
||||||
|
|
||||||
|
var private config int Version;
|
||||||
|
var private config E_LogLevel LogLevel;
|
||||||
|
|
||||||
|
var private KFGameInfo KFGI;
|
||||||
|
var private KFGameReplicationInfo KFGRI;
|
||||||
|
|
||||||
|
var private Array<MSKGS_RepInfo> RepInfos;
|
||||||
|
|
||||||
|
public simulated function bool SafeDestroy()
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
return (bPendingDelete || bDeleteMe || Destroy());
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PreBeginPlay()
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (WorldInfo.NetMode == NM_Client)
|
||||||
|
{
|
||||||
|
`Log_Fatal("NetMode:" @ WorldInfo.NetMode);
|
||||||
|
SafeDestroy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Super.PreBeginPlay();
|
||||||
|
|
||||||
|
PreInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PostBeginPlay()
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (bPendingDelete || bDeleteMe) return;
|
||||||
|
|
||||||
|
Super.PostBeginPlay();
|
||||||
|
|
||||||
|
PostInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function PreInit()
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (Version == `NO_CONFIG)
|
||||||
|
{
|
||||||
|
LogLevel = LL_Info;
|
||||||
|
SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
CfgRemoveItems.static.InitConfig(Version, LatestVersion);
|
||||||
|
|
||||||
|
switch (Version)
|
||||||
|
{
|
||||||
|
case `NO_CONFIG:
|
||||||
|
`Log_Info("Config created");
|
||||||
|
|
||||||
|
case MaxInt:
|
||||||
|
`Log_Info("Config updated to version" @ LatestVersion);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LatestVersion:
|
||||||
|
`Log_Info("Config is up-to-date");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
`Log_Warn("The config version is higher than the current version (are you using an old mutator?)");
|
||||||
|
`Log_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion);
|
||||||
|
`Log_Warn("The config version will be changed to" @ LatestVersion);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LatestVersion != Version)
|
||||||
|
{
|
||||||
|
Version = LatestVersion;
|
||||||
|
SaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LogLevel == LL_WrongLevel)
|
||||||
|
{
|
||||||
|
LogLevel = LL_Info;
|
||||||
|
`Log_Warn("Wrong 'LogLevel', return to default value");
|
||||||
|
SaveConfig();
|
||||||
|
}
|
||||||
|
`Log_Base("LogLevel:" @ LogLevel);
|
||||||
|
|
||||||
|
RemoveItems = CfgRemoveItems.static.Load(LogLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function PostInit()
|
||||||
|
{
|
||||||
|
local MSKGS_RepInfo RepInfo;
|
||||||
|
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (WorldInfo == None || WorldInfo.Game == None)
|
||||||
|
{
|
||||||
|
SetTimer(1.0f, false, nameof(PostInit));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
KFGI = KFGameInfo(WorldInfo.Game);
|
||||||
|
if (KFGI == None)
|
||||||
|
{
|
||||||
|
`Log_Fatal("Incompatible gamemode:" @ WorldInfo.Game);
|
||||||
|
SafeDestroy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (KFGI.GameReplicationInfo == None)
|
||||||
|
{
|
||||||
|
SetTimer(1.0f, false, nameof(PostInit));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
KFGRI = KFGameReplicationInfo(KFGI.GameReplicationInfo);
|
||||||
|
if (KFGRI == None)
|
||||||
|
{
|
||||||
|
`Log_Fatal("Incompatible Replication info:" @ KFGI.GameReplicationInfo);
|
||||||
|
SafeDestroy();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function NotifyLogin(Controller C)
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (!CreateRepInfo(C))
|
||||||
|
{
|
||||||
|
`Log_Error("Can't create RepInfo for:" @ C);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function NotifyLogout(Controller C)
|
||||||
|
{
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (!DestroyRepInfo(C))
|
||||||
|
{
|
||||||
|
`Log_Error("Can't destroy RepInfo of:" @ C);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bool CreateRepInfo(Controller C)
|
||||||
|
{
|
||||||
|
local MSKGS_RepInfo RepInfo;
|
||||||
|
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (C == None) return false;
|
||||||
|
|
||||||
|
RepInfo = Spawn(class'MSKGS_RepInfo', C);
|
||||||
|
|
||||||
|
if (RepInfo == None) return false;
|
||||||
|
|
||||||
|
RepInfos.AddItem(RepInfo);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function bool DestroyRepInfo(Controller C)
|
||||||
|
{
|
||||||
|
local MSKGS_RepInfo RepInfo;
|
||||||
|
|
||||||
|
`Log_Trace();
|
||||||
|
|
||||||
|
if (C == None) return false;
|
||||||
|
|
||||||
|
foreach RepInfos(RepInfo)
|
||||||
|
{
|
||||||
|
if (RepInfo.Owner == C)
|
||||||
|
{
|
||||||
|
RepInfo.SafeDestroy();
|
||||||
|
RepInfos.RemoveItem(RepInfo);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultProperties
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
class MSKGS_GM_Endless extends KFGameInfo_Endless;
|
class MSKGS_GM_Endless extends KFGameInfo_Endless;
|
||||||
|
|
||||||
const GI = class'MSKGS_GM_GameInfo';
|
const GI = class'MSKGS_GameInfo';
|
||||||
const GIC = "KFGameContent.KFGameInfo_Endless";
|
const GIC = "KFGameContent.KFGameInfo_Endless";
|
||||||
|
|
||||||
var public MSKGS_Mut Mut;
|
var public MSKGS_Mut Mut;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class MSKGS_GM_Objective extends KFGameInfo_Objective;
|
class MSKGS_GM_Objective extends KFGameInfo_Objective;
|
||||||
|
|
||||||
const GI = class'MSKGS_GM_GameInfo';
|
const GI = class'MSKGS_GameInfo';
|
||||||
const GIC = "KFGameContent.KFGameInfo_Objective";
|
const GIC = "KFGameContent.KFGameInfo_Objective";
|
||||||
|
|
||||||
var public MSKGSMut Mut;
|
var public MSKGSMut Mut;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class MSKGS_GM_Survival extends KFGameInfo_Survival;
|
class MSKGS_GM_Survival extends KFGameInfo_Survival;
|
||||||
|
|
||||||
const GI = class'MSKGS_GM_GameInfo';
|
const GI = class'MSKGS_GameInfo';
|
||||||
const GIC = "KFGameContent.KFGameInfo_Survival";
|
const GIC = "KFGameContent.KFGameInfo_Survival";
|
||||||
|
|
||||||
var public MSKGSMut Mut;
|
var public MSKGSMut Mut;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class MSKGS_GM_VersusSurvival extends KFGameInfo_VersusSurvival;
|
class MSKGS_GM_VersusSurvival extends KFGameInfo_VersusSurvival;
|
||||||
|
|
||||||
const GI = class'MSKGS_GM_GameInfo';
|
const GI = class'MSKGS_GameInfo';
|
||||||
const GIC = "KFGameContent.KFGameInfo_VersusSurvival";
|
const GIC = "KFGameContent.KFGameInfo_VersusSurvival";
|
||||||
|
|
||||||
var public MSKGSMut Mut;
|
var public MSKGSMut Mut;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class MSKGS_GM_WeeklySurvival extends KFGameInfo_WeeklySurvival;
|
class MSKGS_GM_WeeklySurvival extends KFGameInfo_WeeklySurvival;
|
||||||
|
|
||||||
const GI = class'MSKGS_GM_GameInfo';
|
const GI = class'MSKGS_GameInfo';
|
||||||
const GIC = "KFGameContent.KFGameInfo_WeeklySurvival";
|
const GIC = "KFGameContent.KFGameInfo_WeeklySurvival";
|
||||||
|
|
||||||
var public MSKGSMut Mut;
|
var public MSKGSMut Mut;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
class MSKGS_GM_GameInfo extends Object;
|
class MSKGS_GameInfo extends Object;
|
||||||
|
|
||||||
public static function UpdateGameSettings(KFGameInfo_Survival KFGI, string GameModeClass, MSKGSMut Mut)
|
public static function UpdateGameSettings(KFGameInfo_Survival KFGI, string GameModeClass, MSKGS_Mut Mut)
|
||||||
{
|
{
|
||||||
local name SessionName;
|
local name SessionName;
|
||||||
local KFOnlineGameSettings KFGameSettings;
|
local KFOnlineGameSettings KFGameSettings;
|
||||||
@ -67,7 +67,7 @@ public static function UpdateGameSettings(KFGameInfo_Survival KFGI, string GameM
|
|||||||
|
|
||||||
KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed;
|
KFGameSettings.NumPublicConnections = KFGI.MaxPlayersAllowed;
|
||||||
KFGameSettings.bRequiresPassword = KFGI.RequiresPassword();
|
KFGameSettings.bRequiresPassword = KFGI.RequiresPassword();
|
||||||
KFGameSettings.bCustom = true;
|
KFGameSettings.bCustom = false;
|
||||||
KFGameSettings.bUsesStats = true;
|
KFGameSettings.bUsesStats = true;
|
||||||
KFGameSettings.NumSpectators = KFGI.NumSpectators;
|
KFGameSettings.NumSpectators = KFGI.NumSpectators;
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ public static function UpdateGameSettings(KFGameInfo_Survival KFGI, string GameM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function class<KFPawn_Monster> PickProxyZed(class<KFPawn_Monster> MonsterClass, MSKGSMut Mut)
|
public static function class<KFPawn_Monster> PickProxyZed(class<KFPawn_Monster> MonsterClass, MSKGS_Mut Mut)
|
||||||
{
|
{
|
||||||
local String SMC;
|
local String SMC;
|
||||||
local Name NMC;
|
local Name NMC;
|
||||||
@ -115,18 +115,18 @@ public static function class<KFPawn_Monster> PickProxyZed(class<KFPawn_Monster>
|
|||||||
|
|
||||||
switch (Boost)
|
switch (Boost)
|
||||||
{
|
{
|
||||||
case 0: return MonsterClass;
|
case 0: return MonsterClass;
|
||||||
case 1: return PickProxyZed010(NMC, MonsterClass);
|
case 10: return PickProxyZed010(NMC, MonsterClass);
|
||||||
case 2: return PickProxyZed020(NMC, MonsterClass);
|
case 20: return PickProxyZed020(NMC, MonsterClass);
|
||||||
case 3: return PickProxyZed030(NMC, MonsterClass);
|
case 30: return PickProxyZed030(NMC, MonsterClass);
|
||||||
case 4: return PickProxyZed040(NMC, MonsterClass);
|
case 40: return PickProxyZed040(NMC, MonsterClass);
|
||||||
case 5: return PickProxyZed050(NMC, MonsterClass);
|
case 50: return PickProxyZed050(NMC, MonsterClass);
|
||||||
case 6: return PickProxyZed060(NMC, MonsterClass);
|
case 60: return PickProxyZed060(NMC, MonsterClass);
|
||||||
case 7: return PickProxyZed070(NMC, MonsterClass);
|
case 70: return PickProxyZed070(NMC, MonsterClass);
|
||||||
case 8: return PickProxyZed080(NMC, MonsterClass);
|
case 80: return PickProxyZed080(NMC, MonsterClass);
|
||||||
case 9: return PickProxyZed090(NMC, MonsterClass);
|
case 90: return PickProxyZed090(NMC, MonsterClass);
|
||||||
case 10: return PickProxyZed100(NMC, MonsterClass);
|
case 100: return PickProxyZed100(NMC, MonsterClass);
|
||||||
default: return PickProxyZed100(NMC, MonsterClass);
|
default: return PickProxyZed100(NMC, MonsterClass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,10 +4,9 @@ class MSKGS_Mut extends KFMutator
|
|||||||
const CurrentVersion = 3;
|
const CurrentVersion = 3;
|
||||||
var config int ConfigVersion;
|
var config int ConfigVersion;
|
||||||
|
|
||||||
var config bool bEnableMapStats; var config string SortStats; var config bool bOfficialNextMapOnly; var config bool bRandomizeNextMap; var config int WeapLifespan;
|
var config int WeapLifespan;
|
||||||
var config int DoshLifespan;
|
var config int DoshLifespan;
|
||||||
|
|
||||||
var config array<string> KickProtectedList;
|
|
||||||
var config array<string> AdminList;
|
var config array<string> AdminList;
|
||||||
var config array<int> PerPlayerMaxMonsters;
|
var config array<int> PerPlayerMaxMonsters;
|
||||||
|
|
||||||
@ -42,10 +41,6 @@ function InitConfig()
|
|||||||
switch (ConfigVersion)
|
switch (ConfigVersion)
|
||||||
{
|
{
|
||||||
case 0: // which means there is no config right now
|
case 0: // which means there is no config right now
|
||||||
bEnableMapStats = True;
|
|
||||||
SortStats = "CounterDesc";
|
|
||||||
bOfficialNextMapOnly = True;
|
|
||||||
bRandomizeNextMap = True;
|
|
||||||
WeapLifespan = 60 * 60;
|
WeapLifespan = 60 * 60;
|
||||||
case 1:
|
case 1:
|
||||||
if (PerPlayerMaxMonsters.Length != 6)
|
if (PerPlayerMaxMonsters.Length != 6)
|
||||||
@ -76,18 +71,6 @@ function InitConfig()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check and correct some values
|
|
||||||
if (!(SortStats ~= "CounterAsc"
|
|
||||||
|| SortStats ~= "CounterDesc"
|
|
||||||
|| SortStats ~= "NameAsc"
|
|
||||||
|| SortStats ~= "NameDesc"
|
|
||||||
|| SortStats ~= "False"))
|
|
||||||
{
|
|
||||||
`log("[MskGsMut] Warn: SortStats value not recognized ("$SortStats$") and will be set to False");
|
|
||||||
`log("[MskGsMut] Warn: Valid values for SortStats: False CounterAsc CounterDesc NameAsc NameDesc");
|
|
||||||
SortStats = "False";
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigVersion = CurrentVersion;
|
ConfigVersion = CurrentVersion;
|
||||||
SaveConfig();
|
SaveConfig();
|
||||||
}
|
}
|
||||||
@ -156,21 +139,6 @@ function Initialize()
|
|||||||
|
|
||||||
steamworks = class'GameEngine'.static.GetOnlineSubsystem();
|
steamworks = class'GameEngine'.static.GetOnlineSubsystem();
|
||||||
|
|
||||||
foreach KickProtectedList(Person)
|
|
||||||
{
|
|
||||||
if (IsUID(Person) && steamworks.StringToUniqueNetId(Person, PersonUID))
|
|
||||||
{
|
|
||||||
if (VoteCollector.KickProtectedList.Find('Uid', PersonUID.Uid) == -1)
|
|
||||||
VoteCollector.KickProtectedList.AddItem(PersonUID);
|
|
||||||
}
|
|
||||||
else if (steamworks.Int64ToUniqueNetId(Person, PersonUID))
|
|
||||||
{
|
|
||||||
if (VoteCollector.KickProtectedList.Find('Uid', PersonUID.Uid) == -1)
|
|
||||||
VoteCollector.KickProtectedList.AddItem(PersonUID);
|
|
||||||
}
|
|
||||||
else `Log("[MskGsMut] WARN: Can't add person:"@Person);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach AdminList(Person)
|
foreach AdminList(Person)
|
||||||
{
|
{
|
||||||
if (IsUID(Person) && steamworks.StringToUniqueNetId(Person, PersonUID))
|
if (IsUID(Person) && steamworks.StringToUniqueNetId(Person, PersonUID))
|
||||||
@ -246,21 +214,6 @@ function bool CheckRelevance(Actor Other)
|
|||||||
return SuperRelevant;
|
return SuperRelevant;
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
|
|
||||||
{
|
|
||||||
local KFWeapon TempWeapon;
|
|
||||||
local KFPawn_Human KFP;
|
|
||||||
|
|
||||||
KFP = KFPawn_Human(Killed);
|
|
||||||
|
|
||||||
if (Role >= ROLE_Authority && KFP != None && KFP.InvManager != none)
|
|
||||||
foreach KFP.InvManager.InventoryActors(class'KFWeapon', TempWeapon)
|
|
||||||
if (TempWeapon != none && TempWeapon.bDropOnDeath && TempWeapon.CanThrow())
|
|
||||||
KFP.TossInventory(TempWeapon);
|
|
||||||
|
|
||||||
return Super.PreventDeath(Killed, Killer, damageType, HitLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
function AddMskGsMember(Controller C)
|
function AddMskGsMember(Controller C)
|
||||||
{
|
{
|
||||||
MskGsMemberList.AddItem(C);
|
MskGsMemberList.AddItem(C);
|
@ -1,345 +0,0 @@
|
|||||||
class MskGsVoteCollector extends KFVoteCollector
|
|
||||||
dependson(MapStats);
|
|
||||||
|
|
||||||
var string SortPolicy;
|
|
||||||
var bool bOfficialNextMapOnly;
|
|
||||||
var bool bRandomizeNextMap;
|
|
||||||
|
|
||||||
var private array<string> ActiveMapCycle;
|
|
||||||
|
|
||||||
var public array<UniqueNetId> KickProtectedList;
|
|
||||||
|
|
||||||
var private array<KFPlayerController> KickWarningList;
|
|
||||||
var private array<KFPlayerController> KickPunishList;
|
|
||||||
|
|
||||||
function NotifyLogout(Controller Exiting)
|
|
||||||
{
|
|
||||||
KickWarningList.RemoveItem(KFPlayerController(Exiting));
|
|
||||||
KickPunishList.RemoveItem(KFPlayerController(Exiting));
|
|
||||||
}
|
|
||||||
|
|
||||||
function PunishmentTick()
|
|
||||||
{
|
|
||||||
local KFGameReplicationInfo KFGRI;
|
|
||||||
local KFGameInfo KFGI;
|
|
||||||
local KFPlayerController KFPC;
|
|
||||||
local KFInventoryManager KFIM;
|
|
||||||
local array<KFPlayerController> LocalKickPunishList;
|
|
||||||
|
|
||||||
if (KickPunishList.Length == 0)
|
|
||||||
{
|
|
||||||
ClearTimer(nameof(PunishmentTick));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
|
|
||||||
KFGI = KFGameInfo(WorldInfo.Game);
|
|
||||||
|
|
||||||
LocalKickPunishList = KickPunishList;
|
|
||||||
foreach LocalKickPunishList(KFPC)
|
|
||||||
{
|
|
||||||
if (KFGRI.bMatchHasBegun)
|
|
||||||
{
|
|
||||||
if (KFPC.Pawn.Health <= 1)
|
|
||||||
{
|
|
||||||
KFPC.Suicide();
|
|
||||||
KickPunishList.RemoveItem(KFPC);
|
|
||||||
KickWarningList.RemoveItem(KFPC);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
KFPC.Pawn.Health--;
|
|
||||||
|
|
||||||
if (KFPawn_Human(KFPC.Pawn).Armor > 0)
|
|
||||||
KFPawn_Human(KFPC.Pawn).Armor--;
|
|
||||||
|
|
||||||
if (KFPC.Pawn.InvManager != None)
|
|
||||||
{
|
|
||||||
KFIM = KFInventoryManager(KFPC.Pawn.InvManager);
|
|
||||||
if (KFIM != None)
|
|
||||||
{
|
|
||||||
KFIM.ThrowMoney();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (KFGI.AccessControl != none)
|
|
||||||
{
|
|
||||||
KickPunishList.RemoveItem(KFPC);
|
|
||||||
KickWarningList.RemoveItem(KFPC);
|
|
||||||
KFAccessControl(KFGI.AccessControl).ForceKickPlayer(KFPC, KFGI.AccessControl.KickedMsg);
|
|
||||||
KFGI.BroadcastLocalized(KFGI, class'KFLocalMessage', LMT_KickVoteSucceeded, CurrentKickVote.PlayerPRI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function bool IsPlayerKickProtected(PlayerReplicationInfo PRI_Kickee)
|
|
||||||
{
|
|
||||||
return (KickProtectedList.Find('Uid', PRI_Kickee.UniqueId.Uid) != -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function bool IsKickerWarned(KFPlayerController KFPC)
|
|
||||||
{
|
|
||||||
return (KickWarningList.Find(KFPC) != -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function bool IsKickerPunishListed(KFPlayerController KFPC)
|
|
||||||
{
|
|
||||||
return (KickPunishList.Find(KFPC) != -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function WarnKicker(PlayerReplicationInfo PRI_Kickee, PlayerReplicationInfo PRI_Kicker)
|
|
||||||
{
|
|
||||||
local KFPlayerController KFPC_Kicker;
|
|
||||||
|
|
||||||
KFPC_Kicker = KFPlayerController(PRI_Kicker.Owner);
|
|
||||||
if (!IsKickerWarned(KFPC_Kicker))
|
|
||||||
{
|
|
||||||
KickWarningList.AddItem(KFPC_Kicker);
|
|
||||||
WorldInfo.Game.Broadcast(KFPC_Kicker, PRI_Kicker.PlayerName@"tried to kick"@PRI_Kickee.PlayerName$". If he tries to do it again, the hand of God will punish him");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function PunishKicker(PlayerReplicationInfo PRI_Kicker)
|
|
||||||
{
|
|
||||||
local KFPlayerController KFPC_Kicker;
|
|
||||||
|
|
||||||
KFPC_Kicker = KFPlayerController(PRI_Kicker.Owner);
|
|
||||||
if (!IsKickerPunishListed(KFPC_Kicker))
|
|
||||||
{
|
|
||||||
KickPunishList.AddItem(KFPC_Kicker);
|
|
||||||
WorldInfo.Game.Broadcast(KFPC_Kicker, PRI_Kicker.PlayerName@"seems to be feeling bad...");
|
|
||||||
if (!IsTimerActive(nameof(PunishmentTick)))
|
|
||||||
{
|
|
||||||
SetTimer(0.5f, true, nameof(PunishmentTick), self);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ServerStartVoteKick(PlayerReplicationInfo PRI_Kickee, PlayerReplicationInfo PRI_Kicker)
|
|
||||||
{
|
|
||||||
local int i;
|
|
||||||
local array<KFPlayerReplicationInfo> PRIs;
|
|
||||||
local KFGameInfo KFGI;
|
|
||||||
local KFPlayerController KFPC, KickeePC;
|
|
||||||
|
|
||||||
KFGI = KFGameInfo(WorldInfo.Game);
|
|
||||||
KFPC = KFPlayerController(PRI_Kicker.Owner);
|
|
||||||
KickeePC = KFPlayerController(PRI_Kickee.Owner);
|
|
||||||
|
|
||||||
if (KFGI.bDisableKickVote) // Kick voting is disabled
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteDisabled);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PRI_Kicker.bOnlySpectator) // Spectators aren't allowed to vote
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteNoSpectators);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (KFGI.NumPlayers <= 2) // Not enough players to start a vote
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteNotEnoughPlayers);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (KickedPlayers >= 2) // Maximum number of players kicked per match has been reached
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteMaxKicksReached);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsPlayerKickProtected(PRI_Kickee)) // Bottling
|
|
||||||
{
|
|
||||||
if (IsKickerWarned(KFPC))
|
|
||||||
{
|
|
||||||
PunishKicker(PRI_Kicker);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WarnKicker(PRI_Kickee, PRI_Kicker);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (KFGI.AccessControl != none) // Can't kick admins
|
|
||||||
{
|
|
||||||
if (KFGI.AccessControl.IsAdmin(KickeePC))
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteAdmin);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bIsFailedVoteTimerActive) // Last vote failed, must wait until failed vote cooldown before starting a new vote
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteRejected);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bIsSkipTraderVoteInProgress || bIsPauseGameVoteInProgress) // A kick vote is not allowed while another vote is active
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_OtherVoteInProgress);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bIsKickVoteInProgress)
|
|
||||||
{
|
|
||||||
// Clear voter array
|
|
||||||
PlayersThatHaveVoted.Length = 0;
|
|
||||||
|
|
||||||
// Cache off these values in case player leaves before vote ends -- no cheating!
|
|
||||||
CurrentKickVote.PlayerID = PRI_Kickee.UniqueId;
|
|
||||||
CurrentKickVote.PlayerPRI = PRI_Kickee;
|
|
||||||
CurrentKickVote.PlayerIPAddress = KickeePC.GetPlayerNetworkAddress();
|
|
||||||
|
|
||||||
bIsKickVoteInProgress = true;
|
|
||||||
|
|
||||||
GetKFPRIArray(PRIs);
|
|
||||||
for (i = 0; i < PRIs.Length; i++)
|
|
||||||
{
|
|
||||||
PRIs[i].ShowKickVote(PRI_Kickee, VoteTime, !(PRIs[i] == PRI_Kicker || PRIs[i] == PRI_Kickee));
|
|
||||||
}
|
|
||||||
KFGI.BroadcastLocalized(KFGI, class'KFLocalMessage', LMT_KickVoteStarted, CurrentKickVote.PlayerPRI);
|
|
||||||
WorldInfo.Game.Broadcast(KFPC, PRI_Kicker.PlayerName@"starts voting for kick"@PRI_Kickee.PlayerName);
|
|
||||||
SetTimer(VoteTime, false, nameof(ConcludeVoteKick), self );
|
|
||||||
// Cast initial vote
|
|
||||||
RecieveVoteKick(PRI_Kicker, true);
|
|
||||||
}
|
|
||||||
else if (PRI_Kickee == CurrentKickVote.PlayerPRI)
|
|
||||||
{
|
|
||||||
RecieveVoteKick(PRI_Kicker, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Can't start a new vote until current one is over
|
|
||||||
KFPlayerController(PRI_Kicker.Owner).ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteInProgress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reliable server function RecieveVoteKick(PlayerReplicationInfo PRI, bool bKick)
|
|
||||||
{
|
|
||||||
local KFPlayerController KFPC;
|
|
||||||
|
|
||||||
if(PlayersThatHaveVoted.Find(PRI) == INDEX_NONE)
|
|
||||||
{
|
|
||||||
//accept their vote
|
|
||||||
PlayersThatHaveVoted.AddItem(PRI);
|
|
||||||
if(bKick)
|
|
||||||
{
|
|
||||||
yesVotes++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
noVotes++;
|
|
||||||
}
|
|
||||||
|
|
||||||
KFPC = KFPlayerController(PRI.Owner);
|
|
||||||
if(KFPC != none)
|
|
||||||
{
|
|
||||||
if(bKick)
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteYesReceived, CurrentKickVote.PlayerPRI);
|
|
||||||
WorldInfo.Game.Broadcast(KFPC, PRI.PlayerName@"vote: Yes");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
KFPC.ReceiveLocalizedMessage(class'KFLocalMessage', LMT_KickVoteNoReceived, CurrentKickVote.PlayerPRI);
|
|
||||||
WorldInfo.Game.Broadcast(KFPC, PRI.PlayerName@"vote: No");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ShouldConcludeKickVote() )
|
|
||||||
{
|
|
||||||
ConcludeVoteKick();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ReplicateKickVotes();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function LoadActiveMapCycle()
|
|
||||||
{
|
|
||||||
local KFGameInfo KFGI;
|
|
||||||
|
|
||||||
if (ActiveMapCycle.Length > 0) return;
|
|
||||||
|
|
||||||
KFGI = KFGameInfo(WorldInfo.Game);
|
|
||||||
if (WorldInfo.NetMode == NM_Standalone)
|
|
||||||
ActiveMapCycle = Maplist;
|
|
||||||
else if (KFGI != None)
|
|
||||||
ActiveMapCycle = KFGI.GameMapCycles[KFGI.ActiveMapCycle].Maps;
|
|
||||||
}
|
|
||||||
|
|
||||||
function bool IsOfficialMap(string MapName)
|
|
||||||
{
|
|
||||||
local KFMapSummary MapData;
|
|
||||||
MapData = class'KFUIDataStore_GameResource'.static.GetMapSummaryFromMapName(MapName);
|
|
||||||
if (MapData == None) return False;
|
|
||||||
return (MapData.MapAssociation != EAI_Custom);
|
|
||||||
}
|
|
||||||
|
|
||||||
function int GetNextMapIndex()
|
|
||||||
{
|
|
||||||
local KFGameInfo KFGI;
|
|
||||||
local array<string> AviableMaps;
|
|
||||||
local string Map;
|
|
||||||
local int CurrentMapIndex;
|
|
||||||
|
|
||||||
KFGI = KFGameInfo(WorldInfo.Game);
|
|
||||||
if (KFGI == None) return INDEX_NONE;
|
|
||||||
|
|
||||||
LoadActiveMapCycle();
|
|
||||||
if (bRandomizeNextMap)
|
|
||||||
{
|
|
||||||
foreach ActiveMapCycle(Map)
|
|
||||||
{
|
|
||||||
if (bOfficialNextMapOnly && !IsOfficialMap(Map))
|
|
||||||
continue;
|
|
||||||
if (KFGI.IsMapAllowedInCycle(Map))
|
|
||||||
AviableMaps.AddItem(Map);
|
|
||||||
}
|
|
||||||
if (AviableMaps.Length > 0)
|
|
||||||
return ActiveMapCycle.Find(AviableMaps[Rand(AviableMaps.Length)]);
|
|
||||||
}
|
|
||||||
else if (ActiveMapCycle.Length > 0)
|
|
||||||
{
|
|
||||||
// I don't use KFGameInfo.GetNextMap() because
|
|
||||||
// it uses and changes global KFGameInfo.MapCycleIndex variable
|
|
||||||
CurrentMapIndex = ActiveMapCycle.Find(WorldInfo.GetMapName(true));
|
|
||||||
if (CurrentMapIndex != INDEX_NONE)
|
|
||||||
{
|
|
||||||
for (CurrentMapIndex++; CurrentMapIndex < ActiveMapCycle.Length; CurrentMapIndex++)
|
|
||||||
{
|
|
||||||
if (bOfficialNextMapOnly && !IsOfficialMap(ActiveMapCycle[CurrentMapIndex]))
|
|
||||||
continue;
|
|
||||||
if (KFGI.IsMapAllowedInCycle(ActiveMapCycle[CurrentMapIndex]))
|
|
||||||
return CurrentMapIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return INDEX_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
function int GetNextMap()
|
|
||||||
{
|
|
||||||
local int MapIndex;
|
|
||||||
|
|
||||||
if (MapVoteList.Length > 0)
|
|
||||||
MapIndex = MapVoteList[0].MapIndex;
|
|
||||||
else
|
|
||||||
MapIndex = GetNextMapIndex();
|
|
||||||
|
|
||||||
return MapIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultProperties
|
|
||||||
{
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
class MskGsGFxMenu_Trader extends KFGFxMenu_Trader
|
|
||||||
dependsOn(MskGsGFxTraderContainer_Store);
|
|
||||||
|
|
||||||
defaultproperties
|
|
||||||
{
|
|
||||||
SubWidgetBindings.Remove((WidgetName="shopContainer",WidgetClass=class'KFGFxTraderContainer_Store'))
|
|
||||||
SubWidgetBindings.Add((WidgetName="shopContainer",WidgetClass=class'MskGsGFxTraderContainer_Store'))
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
class MskGsGFxMoviePlayer_Manager extends KFGFxMoviePlayer_Manager
|
|
||||||
dependsOn(MskGsGFxMenu_Trader);
|
|
||||||
|
|
||||||
defaultproperties
|
|
||||||
{
|
|
||||||
WidgetBindings.Remove((WidgetName="traderMenu",WidgetClass=class'KFGFxMenu_Trader'))
|
|
||||||
WidgetBindings.Add((WidgetName="traderMenu",WidgetClass=class'MskGsGFxMenu_Trader'))
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
class MskGsGFxTraderContainer_Store extends KFGFxTraderContainer_Store;
|
|
||||||
|
|
||||||
/*
|
|
||||||
var bool GroupMember;
|
|
||||||
function Initialize(KFGFxObject_Menu NewParentMenu)
|
|
||||||
{
|
|
||||||
local OnlineSubsystemSteamworks OnlineSub;
|
|
||||||
local UniqueNetId GroupID;
|
|
||||||
|
|
||||||
super.Initialize(NewParentMenu);
|
|
||||||
|
|
||||||
OnlineSub = OnlineSubsystemSteamworks(class'GameEngine'.static.GetOnlineSubsystem());
|
|
||||||
class'OnlineSubsystem'.Static.StringToUniqueNetId("0x017000000223386E", GroupID);
|
|
||||||
GroupMember = OnlineSub.CheckPlayerGroup(GroupID);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
function bool IsItemFiltered(STraderItem Item, optional bool bDebug)
|
|
||||||
{
|
|
||||||
if (KFPC.GetPurchaseHelper().IsInOwnedItemList(Item.ClassName))
|
|
||||||
return true;
|
|
||||||
if (KFPC.GetPurchaseHelper().IsInOwnedItemList(Item.DualClassName))
|
|
||||||
return true;
|
|
||||||
if (!KFPC.GetPurchaseHelper().IsSellable(Item))
|
|
||||||
return true;
|
|
||||||
//if (!GroupMember && Item.WeaponDef.default.SharedUnlockId != SCU_None && !class'KFUnlockManager'.static.IsSharedContentUnlocked(Item.WeaponDef.default.SharedUnlockId))
|
|
||||||
// return true;
|
|
||||||
if (Item.WeaponDef.default.PlatformRestriction != PR_All && class'KFUnlockManager'.static.IsPlatformRestricted(Item.WeaponDef.default.PlatformRestriction))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultproperties
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user