File tree Expand file tree Collapse file tree 2 files changed +55
-0
lines changed
Expand file tree Collapse file tree 2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 2127221272 "BaseHookName": "OnItemSubmit",
2127321273 "HookCategory": "Item"
2127421274 }
21275+ },
21276+ {
21277+ "Type": "Simple",
21278+ "Hook": {
21279+ "InjectionIndex": 65,
21280+ "ReturnBehavior": 1,
21281+ "ArgumentBehavior": 3,
21282+ "ArgumentString": null,
21283+ "HookTypeName": "Simple",
21284+ "Name": "IOnNpcTarget [SenseComponent]",
21285+ "HookName": "IOnNpcTarget",
21286+ "AssemblyName": "Assembly-CSharp.dll",
21287+ "TypeName": "Rust.Ai.Gen2.SenseComponent",
21288+ "Flagged": false,
21289+ "Signature": {
21290+ "Exposure": 2,
21291+ "Name": "CanTarget",
21292+ "ReturnType": "System.Boolean",
21293+ "Parameters": [
21294+ "BaseEntity"
21295+ ]
21296+ },
21297+ "MSILHash": "1IFiFqiPi/UAOwFf2XHRsTyhryQEa4oAooUITmm0s6k=",
21298+ "BaseHookName": null,
21299+ "HookCategory": "NPC"
21300+ }
2127521301 }
2127621302 ],
2127721303 "Modifiers": [
Original file line number Diff line number Diff line change 66using Oxide . Core . Plugins ;
77using Oxide . Core . RemoteConsole ;
88using Oxide . Game . Rust . Libraries . Covalence ;
9+ using Rust . Ai . Gen2 ;
910using Steamworks ;
1011using System ;
1112using System . Collections . Generic ;
@@ -68,6 +69,34 @@ private object IOnNpcTarget(BaseNpc npc, BaseEntity target)
6869 return null ;
6970 }
7071
72+ /// <summary>
73+ /// Called when an NPC tries to target an entity
74+ /// </summary>
75+ /// <param name="sense"></param>
76+ /// <param name="target"></param>
77+ /// <returns></returns>
78+ [ HookMethod ( "IOnNpcTarget" ) ]
79+ private object IOnNpcTarget ( SenseComponent sense , BaseEntity target )
80+ {
81+ if ( ! sense || ! target )
82+ {
83+ return null ;
84+ }
85+
86+ BaseEntity baseEntity = sense . baseEntity ;
87+ if ( ! baseEntity )
88+ {
89+ return null ;
90+ }
91+
92+ if ( Interface . CallHook ( "OnNpcTarget" , baseEntity , target ) != null )
93+ {
94+ return false ;
95+ }
96+
97+ return null ;
98+ }
99+
71100 /// <summary>
72101 /// Called after a BaseNetworkable has been saved into a ProtoBuf object that is about to
73102 /// be serialized for a network connection or cache
You can’t perform that action at this time.
0 commit comments