1
1
using Essentials . Options ;
2
2
using HardelAPI . CustomRoles ;
3
3
using HardelAPI . Enumerations ;
4
+ using System . Collections . Generic ;
4
5
using System . Linq ;
5
6
using UnityEngine ;
6
7
@@ -12,12 +13,12 @@ public class HotPatatoes : CustomRole<HotPatatoes> {
12
13
public static CustomOptionHeader HotPatatoesHeader = CustomOptionHeader . AddHeader ( "<color=#f5d142ff>Hot Patatoes Options :</color>" ) ;
13
14
public static CustomNumberOption HotPatatoesPercent = CustomOption . AddNumber ( "Hot Patatoes Apparition" , 0f , 0f , 100f , 5f ) ;
14
15
public static CustomNumberOption HotPatatoesCooldwon = CustomOption . AddNumber ( "Hot Patatoes Apparition" , 30f , 10f , 120f , 5f ) ;
15
- public static CustomNumberOption TimeBeforeApparition = CustomOption . AddNumber ( "Time Before First Apparition" , 30f , 10f , 120f , 5f ) ;
16
- public static CustomToggleOption DontParent = CustomOption . AddToggle ( "Don't give the patato to parent" , true ) ;
16
+ public static CustomToggleOption DontParent = CustomOption . AddToggle ( "Dont give the patato to parent" , true ) ;
17
17
18
18
public HotPatatoes ( ) : base ( ) {
19
19
GameOptionFormat ( ) ;
20
20
Side = PlayerSide . Everyone ;
21
+ LooseRole = true ;
21
22
RoleActive = true ;
22
23
ForceExiledReveal = true ;
23
24
GiveTasksAt = Moment . Never ;
@@ -31,16 +32,36 @@ public override void OnInfectedStart() {
31
32
PercentApparition = ( int ) HotPatatoesPercent . GetValue ( ) ;
32
33
}
33
34
35
+ public override void OnUpdate ( PlayerControl Player ) {
36
+ if ( Player . PlayerId == PlayerControl . LocalPlayer . PlayerId ) {
37
+ if ( Player . Data . IsImpostor )
38
+ Color = Palette . ImpostorRed ;
39
+ else
40
+ Color = Palette . White ;
41
+ }
42
+ }
43
+
34
44
public override void OnGameStarted ( ) {
45
+ PatateChaud . Button . button . MaxTimer = ( int ) HotPatatoesCooldwon . GetValue ( ) ;
35
46
PatateChaud . Button . allPlayersTargetable = PlayerControl . AllPlayerControls . ToArray ( ) . ToList ( ) ;
36
47
}
37
48
49
+ public override void OnPlayerDisconnect ( PlayerControl Player ) {
50
+ if ( HasRole ( Player ) ) {
51
+ List < PlayerControl > users = PlayerControl . AllPlayerControls . ToArray ( ) . ToList ( ) . Where ( p => ! p . Data . IsDead && ! p . Data . Disconnected ) . ToList ( ) ;
52
+ PlayerControl newUsers = users [ new System . Random ( ) . Next ( users . Count ) ] ;
53
+ PatateChaud . Button . allPlayersTargetable = PlayerControl . AllPlayerControls . ToArray ( ) . ToList ( ) ;
54
+
55
+ Instance . AllPlayers = new List < PlayerControl > ( ) { newUsers } ;
56
+ Instance . DefineVisibleByWhitelist ( ) ;
57
+ }
58
+ }
59
+
38
60
private void GameOptionFormat ( ) {
39
61
HotPatatoesHeader . HudStringFormat = ( option , name , value ) => $ "\n { name } ";
40
62
41
63
HotPatatoesPercent . ValueStringFormat = ( option , value ) => $ "{ value } %";
42
64
HotPatatoesCooldwon . ValueStringFormat = ( option , value ) => $ "{ value } s";
43
- TimeBeforeApparition . ValueStringFormat = ( option , value ) => $ "{ value } s";
44
65
}
45
66
}
46
67
}
0 commit comments