mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -04:00
minor game bugfixes
This commit is contained in:
parent
fe6de91ac5
commit
4deb62d8b8
@ -91,7 +91,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
} else if (prop.CaselessEq("tnt")) {
|
||||
int amount = 1;
|
||||
if (!CommandParser.GetInt(p, value, "TNT at a time", ref amount, 0)) return;
|
||||
cfg.MaxPlayerActiveTnt = amount;
|
||||
cfg.MaxActiveTnt = amount;
|
||||
|
||||
Player.Message(p, "TNT Wars: Number of TNTs placeable by a player at a time is now {0}",
|
||||
amount == 0 ? "unlimited" : value);
|
||||
@ -152,7 +152,7 @@ namespace MCGalaxy.Commands.Fun {
|
||||
Player.Message(p, "Gamemode: &a{0} %Sat difficulty &a{1}",
|
||||
gameCfg.Mode, gameCfg.Difficulty);
|
||||
Player.Message(p, "TNT per player at a time: &a{0}",
|
||||
cfg.MaxPlayerActiveTnt == 0 ? "unlimited" : cfg.MaxPlayerActiveTnt.ToString());
|
||||
cfg.MaxActiveTnt == 0 ? "unlimited" : cfg.MaxActiveTnt.ToString());
|
||||
Player.Message(p, "Grace period: {0} %S(for {1} seconds)",
|
||||
GetBool(cfg.InitialGracePeriod), cfg.GracePeriodSeconds);
|
||||
Player.Message(p, "Team balancing: {0}%S, Team killing: {1}",
|
||||
|
@ -83,8 +83,20 @@ namespace MCGalaxy.Games {
|
||||
|
||||
string msg = status == CpeMessageType.Status1 ? FormatStatus1(p) :
|
||||
(status == CpeMessageType.Status2 ? FormatStatus2(p) : FormatStatus3(p));
|
||||
p.SendCpeMessage(CpeMessageType.Status1, msg);
|
||||
p.SendCpeMessage(status, msg);
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdateStatus1(Player p) {
|
||||
p.SendCpeMessage(CpeMessageType.Status1, FormatStatus1(p));
|
||||
}
|
||||
|
||||
protected void UpdateStatus2(Player p) {
|
||||
p.SendCpeMessage(CpeMessageType.Status2, FormatStatus2(p));
|
||||
}
|
||||
|
||||
protected void UpdateStatus3(Player p) {
|
||||
p.SendCpeMessage(CpeMessageType.Status3, FormatStatus3(p));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,9 +60,7 @@ namespace MCGalaxy.Games {
|
||||
PlayerLeftGame(p);
|
||||
} else if (level == Map) {
|
||||
if (Picker.Voting) Picker.SendVoteMessage(p);
|
||||
p.SendCpeMessage(CpeMessageType.Status1, FormatStatus1(p));
|
||||
p.SendCpeMessage(CpeMessageType.Status2, FormatStatus2(p));
|
||||
p.SendCpeMessage(CpeMessageType.Status3, FormatStatus3(p));
|
||||
UpdateStatus1(p); UpdateStatus2(p); UpdateStatus3(p);
|
||||
}
|
||||
|
||||
if (level != Map) return;
|
||||
|
@ -201,6 +201,7 @@ namespace MCGalaxy.Games {
|
||||
if (pl.level != Map) continue;
|
||||
pl.Game.RatedMap = false;
|
||||
pl.Game.PledgeSurvive = false;
|
||||
PlayerLeftGame(pl);
|
||||
|
||||
TabList.Update(pl, true);
|
||||
ResetStatus(pl);
|
||||
|
@ -45,7 +45,7 @@ namespace MCGalaxy.Games {
|
||||
public int GracePeriodSeconds = 30;
|
||||
|
||||
[ConfigInt("max-active-tnt", null, 1)]
|
||||
public int MaxPlayerActiveTnt = 1;
|
||||
public int MaxActiveTnt = 1;
|
||||
|
||||
[ConfigBool("team-balance", null, true)]
|
||||
public bool BalanceTeams = true;
|
||||
|
@ -115,12 +115,12 @@ namespace MCGalaxy.Games {
|
||||
if (InZone(x, y, z, tntFreeZones)) {
|
||||
Player.Message(p, "TNT cannot be placed in this area"); return false;
|
||||
}
|
||||
if (data.TNTCounter == 0) return false;
|
||||
if (cfg.MaxActiveTnt == 0) return true;
|
||||
|
||||
if (data.TNTCounter == cfg.MaxPlayerActiveTnt) {
|
||||
if (data.TNTCounter == cfg.MaxActiveTnt) {
|
||||
Player.Message(p, "TNT Wars: Maximum amount of TNT placed"); return false;
|
||||
}
|
||||
if (data.TNTCounter > cfg.MaxPlayerActiveTnt) {
|
||||
if (data.TNTCounter > cfg.MaxActiveTnt) {
|
||||
Player.Message(p, "TNT Wars: You are past the maximum amount of TNT that can be placed!"); return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -53,6 +53,10 @@ namespace MCGalaxy.Games {
|
||||
PlayerActions.Respawn(p);
|
||||
}
|
||||
|
||||
Red.Score = 0; Blue.Score = 0;
|
||||
UpdateAllStatus1();
|
||||
UpdateAllStatus2();
|
||||
|
||||
//Announcing Etc.
|
||||
// TODO: tidy up
|
||||
string Gamemode = "Free For All";
|
||||
@ -90,7 +94,7 @@ namespace MCGalaxy.Games {
|
||||
Chat.MessageGlobal("&cTNT Wars %Son " + Map.ColoredName + " %Shas started &3" + Gamemode + " %Swith a difficulty of &3" +
|
||||
difficulty + " %S(&3" + HitsToDie + " %Shits to die, a &3" + explosiontime +
|
||||
" %Sexplosion delay and with a &3" + explosionsize + " %Sexplosion size)" +
|
||||
", team killing is &3" + teamkillling + " %Sand you can place &3" + cfg.MaxPlayerActiveTnt
|
||||
", team killing is &3" + teamkillling + " %Sand you can place &3" + cfg.MaxActiveTnt
|
||||
+ " %STNT at a time and there is a score limit of &3" + cfg.ScoreRequired + "%S!!");
|
||||
|
||||
if (Config.Mode == TWGameMode.TDM) {
|
||||
|
@ -112,6 +112,10 @@ namespace MCGalaxy.Games {
|
||||
this.cfg = cfg;
|
||||
Red.SpawnPos = cfg.RedSpawn;
|
||||
Blue.SpawnPos = cfg.BlueSpawn;
|
||||
|
||||
if (!Running) return;
|
||||
UpdateAllStatus1();
|
||||
UpdateAllStatus2();
|
||||
}
|
||||
|
||||
protected override List<Player> GetPlayers() {
|
||||
@ -283,14 +287,31 @@ namespace MCGalaxy.Games {
|
||||
|
||||
public void ChangeScore(Player p, int amount) {
|
||||
Get(p).Score += amount;
|
||||
if (Config.Mode != TWGameMode.TDM) return;
|
||||
UpdateStatus2(p);
|
||||
|
||||
if (Config.Mode != TWGameMode.TDM) return;
|
||||
TWTeam team = TeamOf(p);
|
||||
if (team != null) team.Score += amount;
|
||||
if (team == null) return;
|
||||
|
||||
team.Score += amount;
|
||||
UpdateAllStatus1();
|
||||
}
|
||||
|
||||
public bool TeamKill(Player p1, Player p2) {
|
||||
return Config.Mode == TWGameMode.TDM && TeamOf(p1) == TeamOf(p2);
|
||||
}
|
||||
|
||||
protected override string FormatStatus1(Player p) {
|
||||
if (Config.Mode != TWGameMode.TDM) return "";
|
||||
|
||||
return Red.ColoredName + ": &f" + Red.Score + "/" + cfg.ScoreRequired + ", "
|
||||
+ Blue.ColoredName + ": &f" + Blue.Score + "/" + cfg.ScoreRequired;
|
||||
}
|
||||
|
||||
protected override string FormatStatus2(Player p) {
|
||||
TWData data = Get(p);
|
||||
return "&aHealth: &f" + data.Health + " HP, &eScore: &f"
|
||||
+ data.Score + "/" + cfg.ScoreRequired + " points";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ namespace MCGalaxy.Games {
|
||||
OnTabListEntryAddedEvent.Register(HandleTabListEntryAdded, Priority.High);
|
||||
OnMoneyChangedEvent.Register(HandleMoneyChanged, Priority.High);
|
||||
OnBlockChangeEvent.Register(HandleBlockChange, Priority.High);
|
||||
OnSendingHeartbeatEvent.Register(HandleSendingHeartbeat, Priority.High);
|
||||
|
||||
OnPlayerConnectEvent.Register(HandlePlayerConnect, Priority.High);
|
||||
OnPlayerMoveEvent.Register(HandlePlayerMove, Priority.High);
|
||||
@ -82,7 +81,7 @@ namespace MCGalaxy.Games {
|
||||
|
||||
void HandleMoneyChanged(Player p) {
|
||||
if (p.level != Map) return;
|
||||
p.SendCpeMessage(CpeMessageType.Status3, FormatStatus3(p));
|
||||
UpdateStatus3(p);
|
||||
}
|
||||
|
||||
void HandleEntitySpawned(Entity entity, ref string name, ref string skin, ref string model, Player dst) {
|
||||
|
@ -308,7 +308,7 @@ namespace MCGalaxy.Games {
|
||||
}
|
||||
|
||||
RespawnPlayer(pl);
|
||||
pl.SendCpeMessage(CpeMessageType.Status3, FormatStatus3(pl));
|
||||
UpdateStatus3(pl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace MCGalaxy.Games {
|
||||
|
||||
ResetInvisibility(p, data);
|
||||
UpdateAllStatus1();
|
||||
p.SendCpeMessage(CpeMessageType.Status3, FormatStatus3(p));
|
||||
UpdateStatus3(p);
|
||||
}
|
||||
|
||||
void ResetInvisibility(Player p, ZSData data) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user