Repository navigation
Expand file tree
/
Copy pathNoSpread.cs
More file actions
60 lines (46 loc) · 1.6 KB
/
Copy pathNoSpread.cs
File metadata and controls
60 lines (46 loc) · 1.6 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
using BrokeProtocol.Entities;
using BrokeProtocolClient.settings;
using BrokeProtocolClient.utils;
using UnityEngine;
namespace BrokeProtocolClient.modules.combat
{
class NoSpread : Module
{
ActionSetting dumpVectors;
public Quaternion originalRotation;
public NoSpread() : base(Categories.Combat, "No Spread", "Makes weapons have no bullet spread")
{
dumpVectors = new ActionSetting("Dump vectors", DumpVectors);
addSetting(dumpVectors);
}
public void PreCancelSpread()
{
var local = getClient().ClManager.myPlayer;
if (!local) return;
ShGun gun = local.curEquipable as ShGun;
if (!gun) return;
var negatedSpreadVector = local.originT.forward + (local.originT.forward - gun.NextFireVector().normalized);
Quaternion bestRotation = Quaternion.LookRotation(negatedSpreadVector);
originalRotation = local.GetRotation;
local.SetRotation(bestRotation);
}
public void PostCancelSpread()
{
var local = getClient().ClManager.myPlayer;
if (!local) return;
ShGun gun = local.curEquipable as ShGun;
if (!gun) return;
local.SetRotation(originalRotation);
}
void DumpVectors()
{
int index = 0;
foreach (var vec in getClient().ShManager.randomVector)
{
Log($"{index} {vec}");
index++;
}
}
}
}