Skip to content

Commit 27cd2b8

Browse files
committed
Fixed permissions error
1 parent 83ec11f commit 27cd2b8

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

scp035/EventHandlers.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ partial class EventHandlers
1616
private List<int> ffPlayers = new List<int>();
1717
internal static ReferenceHub scpPlayer;
1818
private bool isHidden;
19+
private bool hasTag;
1920
private bool isRoundStarted;
2021
private bool isRotating;
2122
// Arbitrary number to keep track of items
@@ -37,24 +38,24 @@ public void OnRoundStart()
3738
ffPlayers.Clear();
3839
scpPlayer = null;
3940

40-
coroutines.Add(Timing.RunCoroutine(DelayAction(1f, () => Timing.RunCoroutine(RotatePickup()))));
41+
coroutines.Add(Timing.CallDelayed(1f, () => Timing.RunCoroutine(RotatePickup())));
4142
coroutines.Add(Timing.RunCoroutine(CorrodeUpdate()));
4243
}
4344

4445
public void OnRoundEnd()
4546
{
4647
isRoundStarted = false;
48+
49+
Timing.KillCoroutines(coroutines);
50+
coroutines.Clear();
4751
}
4852

4953
public void OnRoundRestart()
5054
{
5155
// In case the round is force restarted
5256
isRoundStarted = false;
5357

54-
foreach (CoroutineHandle handle in coroutines)
55-
{
56-
Timing.KillCoroutines(handle);
57-
}
58+
Timing.KillCoroutines(coroutines);
5859
coroutines.Clear();
5960
}
6061

scp035/Logic.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,11 @@ private void RefreshItems()
4646

4747
private void KillScp035(bool setRank = true)
4848
{
49-
Plugin.Info("killing 035");
5049
if (setRank)
5150
{
5251
scpPlayer.SetRank("", "default");
53-
scpPlayer.RefreshTag();
54-
if (isHidden)
55-
{
56-
scpPlayer.HideTag();
57-
}
52+
if (hasTag) scpPlayer.RefreshTag();
53+
if (isHidden) scpPlayer.HideTag();
5854
}
5955
scpPlayer = null;
6056
isRotating = true;
@@ -77,8 +73,9 @@ private void InfectPlayer(ReferenceHub player, Pickup pItem)
7773
p035.playerStats.health = Configs.health;
7874
p035.ammoBox.Networkamount = "250:250:250";
7975

80-
isHidden = p035.serverRoles.HiddenBadge != null;
81-
p035.RefreshTag();
76+
hasTag = !string.IsNullOrEmpty(p035.serverRoles.NetworkMyText);
77+
isHidden = !string.IsNullOrEmpty(p035.serverRoles.HiddenBadge);
78+
if (isHidden) p035.RefreshTag();
8279
p035.SetRank("SCP-035", "red");
8380

8481
p035.Broadcast("<size=60>You are <color=\"red\"><b>SCP-035</b></color></size>\nYou have infected a body and have gained control over it, use it to help the other SCPs!", 10);
@@ -104,7 +101,7 @@ private IEnumerator<float> CorrodeHost()
104101
scpPlayer.playerStats.health -= Configs.corrodeHostAmount;
105102
if (scpPlayer.playerStats.health <= 0)
106103
{
107-
scpPlayer.Damage(10000, DamageTypes.Nuke);
104+
scpPlayer.ChangeRole(RoleType.Spectator);
108105
KillScp035();
109106
}
110107
yield return Timing.WaitForSeconds(Configs.corrodeHostInterval);

0 commit comments

Comments
 (0)