File tree Expand file tree Collapse file tree
MonkeyLoader.GamePacks.ResoniteModLoader Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434 </ItemGroup >
3535
3636 <ItemGroup >
37- <PackageReference Include =" MonkeyLoader.GamePacks.Resonite" Version =" 0.20 .0-beta" GeneratePathProperty =" true" />
37+ <PackageReference Include =" MonkeyLoader.GamePacks.Resonite" Version =" 0.21 .0-beta" GeneratePathProperty =" true" />
3838 <PackageReference Include =" PolySharp" Version =" 1.15.0" >
3939 <PrivateAssets >all</PrivateAssets >
4040 <IncludeAssets >runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets >
Original file line number Diff line number Diff line change @@ -30,18 +30,32 @@ public abstract class ResoniteModBase : IMonkey
3030 public abstract string Author { get ; }
3131
3232 /// <inheritdoc/>
33- public bool CanBeDisabled => false ;
33+ [ MemberNotNullWhen ( true , nameof ( EnabledToggle ) ) ]
34+ public bool CanBeDisabled => EnabledToggle is not null ;
3435
3536 /// <inheritdoc/>
3637 public Config Config => Mod . Config ;
3738
3839 /// <inheritdoc/>
3940 public bool Enabled
4041 {
41- get => true ;
42- set { }
42+ get => ! CanBeDisabled || EnabledToggle . GetValue ( ) ;
43+ set
44+ {
45+ if ( CanBeDisabled )
46+ {
47+ EnabledToggle . SetValue ( value , "SetMonkeyEnabled" ) ;
48+ return ;
49+ }
50+
51+ if ( ! value )
52+ throw new NotSupportedException ( "This monkey can't be disabled!" ) ;
53+ }
4354 }
4455
56+ /// <inheritdoc/>
57+ public IDefiningConfigKey < bool > ? EnabledToggle { get ; }
58+
4559 /// <inheritdoc/>
4660 public bool Failed { get ; private set ; }
4761
You can’t perform that action at this time.
0 commit comments