Skip to content

Commit 50ce994

Browse files
committed
Add OnNpcTarget for WildlifeHazard & BoatAI
1 parent dd6eca3 commit 50ce994

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

‎resources/Rust.opj‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21091,6 +21091,56 @@
2109121091
"HookCategory": "NPC"
2109221092
}
2109321093
},
21094+
{
21095+
"Type": "Simple",
21096+
"Hook": {
21097+
"InjectionIndex": 51,
21098+
"ReturnBehavior": 1,
21099+
"ArgumentBehavior": 4,
21100+
"ArgumentString": "this, a0",
21101+
"HookTypeName": "Simple",
21102+
"Name": "IOnNpcTarget [WildlifeHazard]",
21103+
"HookName": "IOnNpcTarget",
21104+
"AssemblyName": "Assembly-CSharp.dll",
21105+
"TypeName": "WildlifeHazard",
21106+
"Flagged": false,
21107+
"Signature": {
21108+
"Exposure": 1,
21109+
"Name": "ShouldStartHazard",
21110+
"ReturnType": "System.Boolean",
21111+
"Parameters": [
21112+
"BasePlayer"
21113+
]
21114+
},
21115+
"MSILHash": "2Tm6bsdxnSPmfBw+lRt+ur82CIPX88ltE+llP55BM+0=",
21116+
"HookCategory": "NPC"
21117+
}
21118+
},
21119+
{
21120+
"Type": "Simple",
21121+
"Hook": {
21122+
"InjectionIndex": 48,
21123+
"ReturnBehavior": 1,
21124+
"ArgumentBehavior": 4,
21125+
"ArgumentString": "this, a0",
21126+
"HookTypeName": "Simple",
21127+
"Name": "IOnNpcTarget [BoatAI]",
21128+
"HookName": "IOnNpcTarget",
21129+
"AssemblyName": "Assembly-CSharp.dll",
21130+
"TypeName": "BoatAI",
21131+
"Flagged": false,
21132+
"Signature": {
21133+
"Exposure": 2,
21134+
"Name": "IsPlayerTargetValid",
21135+
"ReturnType": "System.Boolean",
21136+
"Parameters": [
21137+
"BasePlayer"
21138+
]
21139+
},
21140+
"MSILHash": "oBKL0Nj3Q7HxHT6/ohDwEu/HsBkUemnI5CEcRM9MQUk=",
21141+
"HookCategory": "NPC"
21142+
}
21143+
},
2109421144
{
2109521145
"Type": "Simple",
2109621146
"Hook": {

‎src/RustHooks.cs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,30 @@ private object IOnNpcTarget(SenseComponent sense, BaseEntity target)
104104
return null;
105105
}
106106

107+
/// <summary>
108+
/// Called when a wildlife hazard (e.g. a snake) is about to start its hazard on a player
109+
/// </summary>
110+
/// <param name="hazard"></param>
111+
/// <param name="player"></param>
112+
/// <returns></returns>
113+
[HookMethod("IOnNpcTarget")]
114+
private object IOnNpcTarget(WildlifeHazard hazard, BasePlayer player)
115+
{
116+
return Interface.CallHook("OnNpcTarget", hazard, player) != null ? (object)false : null;
117+
}
118+
119+
/// <summary>
120+
/// Called when boat AI checks whether a player is a valid target
121+
/// </summary>
122+
/// <param name="boatAI"></param>
123+
/// <param name="player"></param>
124+
/// <returns></returns>
125+
[HookMethod("IOnNpcTarget")]
126+
private object IOnNpcTarget(BoatAI boatAI, BasePlayer player)
127+
{
128+
return Interface.CallHook("OnNpcTarget", boatAI, player) != null ? (object)false : null;
129+
}
130+
107131
/// <summary>
108132
/// Called after a BaseNetworkable has been saved into a ProtoBuf object that is about to
109133
/// be serialized for a network connection or cache

0 commit comments

Comments
 (0)