Skip to content

Commit

Permalink
Fix color overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Aug 29, 2024
1 parent 1d1a38d commit 65afdde
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 28 deletions.
4 changes: 2 additions & 2 deletions mod/Jailbreak.Rebel/RebelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ private float getRebelTimePercentage(CCSPlayerController player) {
private Color getRebelColor(CCSPlayerController player) {
var percent = getRebelTimePercentage(player);
var percentRgb = 255 - (int)Math.Round(percent * 255.0);
var color = Color.FromArgb(254, 255, percentRgb, percentRgb);
if (percent <= 0) color = Color.FromArgb(254, 255, 255, 255);
var color = Color.FromArgb(255, 255, percentRgb, percentRgb);
if (percent <= 0) color = Color.FromArgb(255, 255, 255, 255);

return color;
}
Expand Down
4 changes: 2 additions & 2 deletions mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ private void endRound() {
Msg.PlayerWon(winner).ToAllChat();

foreach (var loser in losers) {
loser.SetColor(Color.FromArgb(254, Color.White));
loser.SetColor(Color.White);
if (CV_TELEPORT_TYPE.Value == 1)
loser.Teleport(winner);
else if (CV_TELEPORT_TYPE.Value == 2) winner.Teleport(loser);
Expand All @@ -696,7 +696,7 @@ private void endRound() {
if (CV_WINNER_DAMAGEABLE.Value) EnableDamage(winner);

Plugin.DeregisterEventHandler<EventItemPickup>(OnPickup);

foreach (var weapon in CV_LOSERS_WEAPONS.Value.Split(','))
foreach (var loser in losers)
loser.GiveNamedItem(weapon);
Expand Down
27 changes: 5 additions & 22 deletions mod/Jailbreak.Warden/Global/WardenBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,7 @@ public bool TrySetWarden(CCSPlayerController controller) {

HasWarden = true;
Warden = controller;

if (Warden.Pawn.Value != null) {
Warden.Pawn.Value.RenderMode = RenderMode_t.kRenderTransColor;
Warden.Pawn.Value.Render = Color.FromArgb(254, 0, 0, 255);
Utilities.SetStateChanged(Warden.Pawn.Value, "CBaseModelEntity",
"m_clrRender");
}
Warden.SetColor(Color.Blue);

locale.NewWarden(Warden).ToAllChat().ToAllCenter();

Expand Down Expand Up @@ -204,11 +198,8 @@ public bool TryRemoveWarden(bool isPass = false) {
HasWarden = false;

if (Warden != null && Warden.Pawn.Value != null) {
Warden.Clan = "";
Warden.Pawn.Value.RenderMode = RenderMode_t.kRenderTransColor;
Warden.Pawn.Value.Render = Color.FromArgb(254, 255, 255, 255);
Utilities.SetStateChanged(Warden.Pawn.Value, "CBaseModelEntity",
"m_clrRender");
Warden.Clan = "";
Warden.SetColor(Color.White);
Utilities.SetStateChanged(Warden, "CCSPlayerController", "m_szClan");
var ev = new EventNextlevelChanged(true);
ev.FireEvent(false);
Expand Down Expand Up @@ -310,12 +301,8 @@ private void processWardenDeath() {
private void unmarkPrisonersBlue() {
foreach (var player in bluePrisoners) {
if (!player.IsReal()) continue;
var pawn = player.Pawn.Value;
if (pawn == null) continue;
if (ignoreColor(player)) continue;
pawn.RenderMode = RenderMode_t.kRenderNormal;
pawn.Render = Color.FromArgb(254, 255, 255, 255);
Utilities.SetStateChanged(pawn, "CBaseModelEntity", "m_clrRender");
player.SetColor(Color.White);
}

bluePrisoners.Clear();
Expand All @@ -326,11 +313,7 @@ private void markPrisonersBlue() {
if (!player.IsReal() || player.Team != CsTeam.Terrorist) continue;
if (ignoreColor(player)) continue;

var pawn = player.Pawn.Value;
if (pawn == null) continue;
pawn.RenderMode = RenderMode_t.kRenderTransColor;
pawn.Render = Color.FromArgb(254, 0, 0, 255);
Utilities.SetStateChanged(pawn, "CBaseModelEntity", "m_clrRender");
player.SetColor(Color.Blue);

bluePrisoners.Add(player);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ private void setSpecialColor(CCSPlayerController player, bool hasSt) {
if (!player.IsValid || player.Pawn.Value == null) return;

var color = hasSt ?
Color.FromArgb(254, 0, 255, 0) :
Color.FromArgb(254, 255, 255, 255);
Color.FromArgb(255, 0, 255, 0) :
Color.FromArgb(255, 255, 255, 255);

player.Pawn.Value.RenderMode = RenderMode_t.kRenderTransColor;
player.Pawn.Value.Render = color;
Expand Down

0 comments on commit 65afdde

Please sign in to comment.