Open Noobther opened 1 year ago
//var Color = importNamespace('PixelCombats.ScriptingApi.Structures'); //var System = importNamespace('System');
// ��������� var WaitingPlayersTime = 10; var BuildBaseTime = 5; var GameModeTime = 30; var EndOfMatchTime = 5 ;
// ��������� ���� var WaitingStateValue = "Waiting"; var BuildModeStateValue = "BuildMode"; var GameStateValue = "Game"; var EndOfMatchStateValue = "EndOfMatch";
// ���������� ���������� var mainTimer = Timers.GetContext().Get("Main"); var stateProp = Properties.GetContext().Get("State");
// ��������� ��������� �������� ������� Damage.FriendlyFire = GameMode.Parameters.GetBool("FriendlyFire"); Map.Rotation = GameMode.Parameters.GetBool("MapRotation"); BreackGraph.OnlyPlayerBlocksDmg = GameMode.Parameters.GetBool("PartialDesruction"); BreackGraph.WeakBlocks = GameMode.Parameters.GetBool("LoosenBlocks");
// ���� ������ ������ ������ BreackGraph.PlayerBlockBoost = true;
// ��������� ���� Properties.GetContext().GameModeName.Value = "GameModes/Team Dead Match"; TeamsBalancer.IsAutoBalance = true; Ui.GetContext().MainTimerId.Value = mainTimer.Id; // ������� ������� Teams.Add("Blue", "Черные", { o: 1 }); Teams.Add("Red", "зеленые", { g: 1 }); var blueTeam = Teams.Get("Blue"); var redTeam = Teams.Get("Red"); blueTeam.Spawns.SpawnPointsGroups.Add(1); redTeam.Spawns.SpawnPointsGroups.Add(2); blueTeam.Build.BlocksSet.Value = BuildBlocksSet.Blue; redTeam.Build.BlocksSet.Value = BuildBlocksSet.Red;
// ������ ���� ������� ������ var maxDeaths = Players.MaxCount * 5; Teams.Get("Red").Properties.Get("Deaths").Value = maxDeaths; Teams.Get("Blue").Properties.Get("Deaths").Value = maxDeaths; // ������ ��� �������� � ����������� LeaderBoard.PlayerLeaderBoardValues = [ { Value: "Kills", DisplayName: "Statistics/Kills", ShortDisplayName: "Statistics/KillsShort" }, { Value: "Deaths", DisplayName: "Statistics/Deaths", ShortDisplayName: "Statistics/DeathsShort" }, { Value: "Spawns", DisplayName: "Statistics/Spawns", ShortDisplayName: "Statistics/SpawnsShort" }, { Value: "Scores", DisplayName: "Statistics/Scores", ShortDisplayName: "Statistics/ScoresShort" } ]; LeaderBoard.TeamLeaderBoardValue = { Value: "Deaths", DisplayName: "Statistics\Deaths", ShortDisplayName: "Statistics\Deaths" }; // ��� ������� � ���������� LeaderBoard.TeamWeightGetter.Set(function(team) { return team.Properties.Get("Deaths").Value; }); // ��� ������ � ���������� LeaderBoard.PlayersWeightGetter.Set(function(player) { return player.Properties.Get("Kills").Value; });
// ������ ��� �������� ������ Ui.GetContext().TeamProp1.Value = { Team: "Blue", Prop: "Deaths" }; Ui.GetContext().TeamProp2.Value = { Team: "Red", Prop: "Deaths" };
// ��������� ���� � ������� �� ������� Teams.OnRequestJoinTeam.Add(function(player,team){team.Add(player);}); // ����� �� ����� � ������� Teams.OnPlayerChangeTeam.Add(function(player){ player.Spawns.Spawn()});
// ������ ������� ����������� ����� ������ var immortalityTimerName="immortality"; Spawns.GetContext().OnSpawn.Add(function(player){ player.Properties.Immortality.Value=true; timer=player.Timers.Get(immortalityTimerName).Restart(1); }); Timers.OnPlayerTimer.Add(function(timer){ if(timer.Id!=immortalityTimerName) return; timer.Player.Properties.Immortality.Value=false; });
// ����� ������ ������ ������ �������� ���� ������ � ������� Properties.OnPlayerProperty.Add(function(context, value) { if (value.Name !== "Deaths") return; if (context.Player.Team == null) return; context.Player.Team.Properties.Get("Deaths").Value--; }); // ���� � ������� ���������� ������� ���������� �� ��������� ���� Properties.OnTeamProperty.Add(function(context, value) { if (value.Name !== "Deaths") return; if (value.Value <= -50) SetEndOfMatchMode(); });
// ������� ������� Spawns.OnSpawn.Add(function(player) { ++player.Properties.Spawns.Value; }); // ������� ������� Damage.OnDeath.Add(function(player) { ++player.Properties.Deaths.Value; }); // ������� ������� Damage.OnKill.Add(function(player, killed) { if (killed.Team != null && killed.Team != player.Team) { ++player.Properties.Kills.Value; player.Properties.Scores.Value += 999999; } });
// ��������� ������������ ������� mainTimer.OnTimer.Add(function() { switch (stateProp.Value) { case WaitingStateValue: SetBuildMode(); break; case BuildModeStateValue: SetGameMode(); break; case GameStateValue: SetEndOfMatchMode(); break; case EndOfMatchStateValue: RestartGame(); break; } });
// ������ ������ ������� ��������� SetWaitingMode();
// ��������� ���� function SetWaitingMode() { stateProp.Value = WaitingStateValue; Ui.GetContext().Hint.Value = "Hint/WaitingPlayers"; Spawns.GetContext().enable = false; mainTimer.Restart(WaitingPlayersTime); }
function SetBuildMode() { stateProp.Value = BuildModeStateValue; Ui.GetContext().Hint.Value = "Hint/BuildBase"; var inventory = Inventory.GetContext(); inventory.Main.Value = true; inventory.Secondary.Value = true; inventory.Melee.Value = true; inventory.Explosive.Value = true; inventory.BuildInfinity.Value = true;
mainTimer.Restart(BuildBaseTime); Spawns.GetContext().enable = true; SpawnTeams(); } function SetGameMode() { stateProp.Value = GameStateValue; Ui.GetContext().Hint.Value = "Hint/AttackEnemies";
var inventory = Inventory.GetContext(); if (GameMode.Parameters.GetBool("OnlyKnives")) { inventory.Main.Value = true; inventory.Secondary.Value = true; inventory.Melee.Value = true; inventory.Explosive.Value = true; inventory.Build.Value = true; } else { inventory.Main.Value = true; inventory.Secondary.Value = true; inventory.Melee.Value = true; inventory.Explosive.Value = true; inventory.Build.Value = true; }
mainTimer.Restart(GameModeTime); Spawns.GetContext().Despawn(); SpawnTeams(); } function SetEndOfMatchMode() { stateProp.Value = EndOfMatchStateValue; Ui.GetContext().Hint.Value = "Hint/EndOfMatch";
var spawns = Spawns.GetContext(); spawns.enable = false; spawns.Despawn(); Game.GameOver(LeaderBoard.GetTeams()); mainTimer.Restart(EndOfMatchTime); } function RestartGame() { Game.RestartGame(); }
function SpawnTeams() { var e = Teams.GetEnumerator(); while (e.moveNext()) { Spawns.GetContext(e.Current).Spawn(); } }
//var Color = importNamespace('PixelCombats.ScriptingApi.Structures'); //var System = importNamespace('System');
// ��������� var WaitingPlayersTime = 10; var BuildBaseTime = 5; var GameModeTime = 30; var EndOfMatchTime = 5 ;
// ��������� ���� var WaitingStateValue = "Waiting"; var BuildModeStateValue = "BuildMode"; var GameStateValue = "Game"; var EndOfMatchStateValue = "EndOfMatch";
// ���������� ���������� var mainTimer = Timers.GetContext().Get("Main"); var stateProp = Properties.GetContext().Get("State");
// ��������� ��������� �������� ������� Damage.FriendlyFire = GameMode.Parameters.GetBool("FriendlyFire"); Map.Rotation = GameMode.Parameters.GetBool("MapRotation"); BreackGraph.OnlyPlayerBlocksDmg = GameMode.Parameters.GetBool("PartialDesruction"); BreackGraph.WeakBlocks = GameMode.Parameters.GetBool("LoosenBlocks");
// ���� ������ ������ ������ BreackGraph.PlayerBlockBoost = true;
// ��������� ���� Properties.GetContext().GameModeName.Value = "GameModes/Team Dead Match"; TeamsBalancer.IsAutoBalance = true; Ui.GetContext().MainTimerId.Value = mainTimer.Id; // ������� ������� Teams.Add("Blue", "Черные", { o: 1 }); Teams.Add("Red", "зеленые", { g: 1 }); var blueTeam = Teams.Get("Blue"); var redTeam = Teams.Get("Red"); blueTeam.Spawns.SpawnPointsGroups.Add(1); redTeam.Spawns.SpawnPointsGroups.Add(2); blueTeam.Build.BlocksSet.Value = BuildBlocksSet.Blue; redTeam.Build.BlocksSet.Value = BuildBlocksSet.Red;
// ������ ���� ������� ������ var maxDeaths = Players.MaxCount * 5; Teams.Get("Red").Properties.Get("Deaths").Value = maxDeaths; Teams.Get("Blue").Properties.Get("Deaths").Value = maxDeaths; // ������ ��� �������� � ����������� LeaderBoard.PlayerLeaderBoardValues = [ { Value: "Kills", DisplayName: "Statistics/Kills", ShortDisplayName: "Statistics/KillsShort" }, { Value: "Deaths", DisplayName: "Statistics/Deaths", ShortDisplayName: "Statistics/DeathsShort" }, { Value: "Spawns", DisplayName: "Statistics/Spawns", ShortDisplayName: "Statistics/SpawnsShort" }, { Value: "Scores", DisplayName: "Statistics/Scores", ShortDisplayName: "Statistics/ScoresShort" } ]; LeaderBoard.TeamLeaderBoardValue = { Value: "Deaths", DisplayName: "Statistics\Deaths", ShortDisplayName: "Statistics\Deaths" }; // ��� ������� � ���������� LeaderBoard.TeamWeightGetter.Set(function(team) { return team.Properties.Get("Deaths").Value; }); // ��� ������ � ���������� LeaderBoard.PlayersWeightGetter.Set(function(player) { return player.Properties.Get("Kills").Value; });
// ������ ��� �������� ������ Ui.GetContext().TeamProp1.Value = { Team: "Blue", Prop: "Deaths" }; Ui.GetContext().TeamProp2.Value = { Team: "Red", Prop: "Deaths" };
// ��������� ���� � ������� �� ������� Teams.OnRequestJoinTeam.Add(function(player,team){team.Add(player);}); // ����� �� ����� � ������� Teams.OnPlayerChangeTeam.Add(function(player){ player.Spawns.Spawn()});
// ������ ������� ����������� ����� ������ var immortalityTimerName="immortality"; Spawns.GetContext().OnSpawn.Add(function(player){ player.Properties.Immortality.Value=true; timer=player.Timers.Get(immortalityTimerName).Restart(1); }); Timers.OnPlayerTimer.Add(function(timer){ if(timer.Id!=immortalityTimerName) return; timer.Player.Properties.Immortality.Value=false; });
// ����� ������ ������ ������ �������� ���� ������ � ������� Properties.OnPlayerProperty.Add(function(context, value) { if (value.Name !== "Deaths") return; if (context.Player.Team == null) return; context.Player.Team.Properties.Get("Deaths").Value--; }); // ���� � ������� ���������� ������� ���������� �� ��������� ���� Properties.OnTeamProperty.Add(function(context, value) { if (value.Name !== "Deaths") return; if (value.Value <= -50) SetEndOfMatchMode(); });
// ������� ������� Spawns.OnSpawn.Add(function(player) { ++player.Properties.Spawns.Value; }); // ������� ������� Damage.OnDeath.Add(function(player) { ++player.Properties.Deaths.Value; }); // ������� ������� Damage.OnKill.Add(function(player, killed) { if (killed.Team != null && killed.Team != player.Team) { ++player.Properties.Kills.Value; player.Properties.Scores.Value += 999999; } });
// ��������� ������������ ������� mainTimer.OnTimer.Add(function() { switch (stateProp.Value) { case WaitingStateValue: SetBuildMode(); break; case BuildModeStateValue: SetGameMode(); break; case GameStateValue: SetEndOfMatchMode(); break; case EndOfMatchStateValue: RestartGame(); break; } });
// ������ ������ ������� ��������� SetWaitingMode();
// ��������� ���� function SetWaitingMode() { stateProp.Value = WaitingStateValue; Ui.GetContext().Hint.Value = "Hint/WaitingPlayers"; Spawns.GetContext().enable = false; mainTimer.Restart(WaitingPlayersTime); }
function SetBuildMode() { stateProp.Value = BuildModeStateValue; Ui.GetContext().Hint.Value = "Hint/BuildBase"; var inventory = Inventory.GetContext(); inventory.Main.Value = true; inventory.Secondary.Value = true; inventory.Melee.Value = true; inventory.Explosive.Value = true; inventory.BuildInfinity.Value = true;
} function SetGameMode() { stateProp.Value = GameStateValue; Ui.GetContext().Hint.Value = "Hint/AttackEnemies";
} function SetEndOfMatchMode() { stateProp.Value = EndOfMatchStateValue; Ui.GetContext().Hint.Value = "Hint/EndOfMatch";
} function RestartGame() { Game.RestartGame(); }
function SpawnTeams() { var e = Teams.GetEnumerator(); while (e.moveNext()) { Spawns.GetContext(e.Current).Spawn(); } }