1
1
using Oxide . Core ;
2
+ using Oxide . Core . Plugins ;
2
3
using Oxide . Core . Configuration ;
3
4
using Oxide . Game . Rust . Libraries ;
4
5
using System ;
@@ -13,6 +14,9 @@ namespace Oxide.Plugins
13
14
[ Description ( "Automatically sets the code on code locks when placed." ) ]
14
15
public class AutoCode : RustPlugin
15
16
{
17
+ [ PluginReference ( "NoEscape" ) ]
18
+ private Plugin pluginNoEscape ;
19
+
16
20
private AutoCodeConfig config ;
17
21
private Commands commands ;
18
22
private Data data ;
@@ -93,6 +97,30 @@ private void OnItemDeployed(Deployer deployer, BaseEntity lockable, CodeLock cod
93
97
return ;
94
98
}
95
99
100
+ // NoEscape blocked.
101
+ if ( pluginNoEscape != null )
102
+ {
103
+ if (
104
+ config . Options . PluginIntegration . NoEscape . BlockRaid &&
105
+ pluginNoEscape . Call < bool > ( "HasPerm" , player . UserIDString , "raid.buildblock" ) &&
106
+ pluginNoEscape . Call < bool > ( "IsRaidBlocked" , player . UserIDString )
107
+ )
108
+ {
109
+ Message ( player , lang . GetMessage ( "NoEscape.RaidBlocked" , this , player . UserIDString ) ) ;
110
+ return ;
111
+ }
112
+
113
+ if (
114
+ config . Options . PluginIntegration . NoEscape . BlockCombat &&
115
+ pluginNoEscape . Call < bool > ( "HasPerm" , player . UserIDString , "combat.buildblock" ) &&
116
+ pluginNoEscape . Call < bool > ( "IsCombatBlocked" , player . UserIDString )
117
+ )
118
+ {
119
+ Message ( player , lang . GetMessage ( "NoEscape.CombatBlocked" , this , player . UserIDString ) ) ;
120
+ return ;
121
+ }
122
+ }
123
+
96
124
Data . Structure . PlayerSettings settings = data . Inst . playerSettings [ player . userID ] ;
97
125
98
126
// Player doesn't have a code?
@@ -199,6 +227,8 @@ protected override void LoadDefaultMessages()
199
227
{ "HelpExtendedQuietMode" , "Toggles on/off quiet mode:\n {0}" } ,
200
228
{ "HelpExtendedQuietModeDetails" , "Less messages will be shown and your auto-code will be hidden." } ,
201
229
{ "HelpExtendedHelp" , "Displays this help message:\n {0}" } ,
230
+ { "NoEscape.RaidBlocked" , "Auto-code disbaled due to raid block." } ,
231
+ { "NoEscape.CombatBlocked" , "Auto-code disbaled due to combat block." } ,
202
232
} , this ) ;
203
233
}
204
234
@@ -640,6 +670,8 @@ public class OptionsDef
640
670
public bool DisplayPermissionErrors = true ;
641
671
642
672
public SpamPreventionDef SpamPrevention = new SpamPreventionDef ( ) ;
673
+
674
+ public PluginIntegrationDef PluginIntegration = new PluginIntegrationDef ( ) ;
643
675
644
676
public class SpamPreventionDef
645
677
{
@@ -650,6 +682,17 @@ public class SpamPreventionDef
650
682
public bool UseExponentialLockOutTime = true ;
651
683
public double LockOutResetFactor = 5.0 ;
652
684
} ;
685
+
686
+ public class PluginIntegrationDef
687
+ {
688
+ public NoEscapeDef NoEscape = new NoEscapeDef ( ) ;
689
+
690
+ public class NoEscapeDef
691
+ {
692
+ public bool BlockRaid = false ;
693
+ public bool BlockCombat = false ;
694
+ } ;
695
+ } ;
653
696
} ;
654
697
655
698
/// <summary>
@@ -688,6 +731,10 @@ public void Load()
688
731
) ;
689
732
RemoveConfigValue ( new string [ ] { "Options" , "Spam Prevention" , "Exponential Lock Out Time" } ) ; // Remove deprecated version.
690
733
734
+ // Plugin integration - No Escape.
735
+ Options . PluginIntegration . NoEscape . BlockCombat = GetConfigValue ( new string [ ] { "Options" , "Plugin Integration" , "No Escape" , "Block Combat" } , false ) ;
736
+ Options . PluginIntegration . NoEscape . BlockRaid = GetConfigValue ( new string [ ] { "Options" , "Plugin Integration" , "No Escape" , "Block Raid" } , true ) ;
737
+
691
738
// Commands.
692
739
plugin . commands . Use = GetConfigValue ( new string [ ] { "Commands" , "Use" } , plugin . commands . Use ) ;
693
740
0 commit comments