mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-26 06:43:25 -04:00
CTF: group by team name in tab list
This commit is contained in:
parent
abddf8ffbe
commit
baa337d225
@ -157,8 +157,8 @@ namespace MCGalaxy.Games {
|
|||||||
Player.Message(p, "No CTF maps were found."); return false;
|
Player.Message(p, "No CTF maps were found."); return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Blue = new CtfTeam2("blue", Colors.blue);
|
Blue = new CtfTeam2("Blue", Colors.blue);
|
||||||
Red = new CtfTeam2("red", Colors.red);
|
Red = new CtfTeam2("Red", Colors.red);
|
||||||
LoadMap(maps[new Random().Next(maps.Count)]);
|
LoadMap(maps[new Random().Next(maps.Count)]);
|
||||||
|
|
||||||
Logger.Log(LogType.GameActivity, "[CTF] Running...");
|
Logger.Log(LogType.GameActivity, "[CTF] Running...");
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
|
using MCGalaxy.Events.EntityEvents;
|
||||||
using MCGalaxy.Events.LevelEvents;
|
using MCGalaxy.Events.LevelEvents;
|
||||||
using MCGalaxy.Events.PlayerEvents;
|
using MCGalaxy.Events.PlayerEvents;
|
||||||
using MCGalaxy.Maths;
|
using MCGalaxy.Maths;
|
||||||
@ -37,6 +38,7 @@ namespace MCGalaxy.Games {
|
|||||||
OnPlayerDisconnectEvent.Register(HandleDisconnect, Priority.High);
|
OnPlayerDisconnectEvent.Register(HandleDisconnect, Priority.High);
|
||||||
OnLevelUnloadEvent.Register(HandleLevelUnload, Priority.High);
|
OnLevelUnloadEvent.Register(HandleLevelUnload, Priority.High);
|
||||||
OnPlayerSpawningEvent.Register(HandlePlayerSpawning, Priority.High);
|
OnPlayerSpawningEvent.Register(HandlePlayerSpawning, Priority.High);
|
||||||
|
OnTabListEntryAddedEvent.Register(HandleTabListEntryAdded, Priority.High);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Unload(bool shutdown) {
|
public override void Unload(bool shutdown) {
|
||||||
@ -47,6 +49,7 @@ namespace MCGalaxy.Games {
|
|||||||
OnPlayerDisconnectEvent.Unregister(HandleDisconnect);
|
OnPlayerDisconnectEvent.Unregister(HandleDisconnect);
|
||||||
OnLevelUnloadEvent.Unregister(HandleLevelUnload);
|
OnLevelUnloadEvent.Unregister(HandleLevelUnload);
|
||||||
OnPlayerSpawningEvent.Unregister(HandlePlayerSpawning);
|
OnPlayerSpawningEvent.Unregister(HandlePlayerSpawning);
|
||||||
|
OnTabListEntryAddedEvent.Unregister(HandleTabListEntryAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,6 +136,21 @@ namespace MCGalaxy.Games {
|
|||||||
|
|
||||||
CtfTeam2 team = Game.TeamOf(p);
|
CtfTeam2 team = Game.TeamOf(p);
|
||||||
if (team != null) pos = team.SpawnPos;
|
if (team != null) pos = team.SpawnPos;
|
||||||
|
if (team != null && respawning) Game.DropFlag(p, team);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleTabListEntryAdded(Entity entity, ref string tabName, ref string tabGroup, Player dst) {
|
||||||
|
Player p = entity as Player;
|
||||||
|
if (p == null || !Game.started || p.level != Game.map) return;
|
||||||
|
CtfTeam2 team = Game.TeamOf(p);
|
||||||
|
|
||||||
|
if (p.Game.Referee) {
|
||||||
|
tabGroup = "&2Referees";
|
||||||
|
} else if (team != null) {
|
||||||
|
tabGroup = team.ColoredName + " &fteam";
|
||||||
|
} else {
|
||||||
|
tabGroup = "&7Spectators";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandlePlayerCommand(Player p, string cmd, string args) {
|
void HandlePlayerCommand(Player p, string cmd, string args) {
|
||||||
|
@ -81,7 +81,6 @@ namespace MCGalaxy {
|
|||||||
public bool backedup;
|
public bool backedup;
|
||||||
public BlockDB BlockDB;
|
public BlockDB BlockDB;
|
||||||
public LevelAccessController VisitAccess, BuildAccess;
|
public LevelAccessController VisitAccess, BuildAccess;
|
||||||
public bool ctfmode;
|
|
||||||
|
|
||||||
// Physics fields and settings
|
// Physics fields and settings
|
||||||
public int physics {
|
public int physics {
|
||||||
|
@ -391,14 +391,7 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Game.team != null && this.level.ctfmode ) {
|
if (PlayingTntWars) {
|
||||||
//if (carryingFlag)
|
|
||||||
//{
|
|
||||||
// level.ctfgame.DropFlag(this, hasflag);
|
|
||||||
//}
|
|
||||||
Game.team.SpawnPlayer(this);
|
|
||||||
//this.health = 100;
|
|
||||||
} else if ( PlayingTntWars ) {
|
|
||||||
TntWarsKillStreak = 0;
|
TntWarsKillStreak = 0;
|
||||||
TntWarsScoreMultiplier = 1f;
|
TntWarsScoreMultiplier = 1f;
|
||||||
} else if ( Server.lava.active && Server.lava.HasPlayer(this) ) {
|
} else if ( Server.lava.active && Server.lava.HasPlayer(this) ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user