-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuickScopeOreShot.cs
48 lines (40 loc) · 1.39 KB
/
QuickScopeOreShot.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using HarmonyLib;
namespace Carbon.Plugins;
[Info("QuickScopeOreShot", "bogdannbv", "0.1.0")]
[Description("Allows players to 360NoScope HotSpots/Markers on Ores and Trees all the time, every time (cue the MLG montage)")]
public class QuickScopeOreShot : CarbonPlugin
{
public override bool AutoPatch => true;
#region Patches
[HarmonyPatch(typeof(TreeEntity), "DidHitMarker", typeof(HitInfo))]
public class TreeEntityDidHitMarker
{
public static bool Prefix(HitInfo info, ref bool __result)
{
if (info == null)
{
return true;
}
__result = true;
return false;
}
}
[HarmonyPatch(typeof(OreResourceEntity), "OnAttacked", typeof(HitInfo))]
public class OreResourceEntityOnAttacked
{
public static void Prefix(OreResourceEntity __instance, HitInfo info)
{
if (__instance == null || info is not { CanGather: true })
{
return;
}
if (__instance._hotSpot == null)
{
__instance._hotSpot = __instance.SpawnBonusSpot(info.HitPositionWorld);
}
__instance._hotSpot.transform.position = info.HitPositionWorld;
__instance._hotSpot.SendNetworkUpdateImmediate();
}
}
#endregion
}