-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMeleeReach.cs
47 lines (35 loc) · 1.49 KB
/
MeleeReach.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
using UnityEngine;
using BrokeProtocolClient.settings;
using BrokeProtocol.Entities;
using ENet;
using BrokeProtocol.Utility.Networking;
namespace BrokeProtocolClient.modules.combat
{
class MeleeReach : Module
{
NumberSetting maxDistance = new NumberSetting("Max reach", 1, 340, 10, 1);
public MeleeReach() : base(Categories.Combat, "Melee Reach", "Allows to edit the reach of melee attacks")
{
addSetting(maxDistance);
}
public void onFire()
{
var local = getClient().ClManager.myPlayer;
if (!local) return;
var hitscan = local.curEquipable as ShHitscan;
if (!hitscan) return;
var hitDir = local.originT.TransformDirection(Quaternion.Euler(hitscan.hitscanOffset.x, hitscan.hitscanOffset.y, 0f) * Vector3.forward);
RaycastHit hit;
if (!Physics.SphereCast(local.FutureOrigin, 0.5f, hitDir, out hit, maxDistance.getValueFloat(), hitscan.HitscanMask)) return;
ShDamageable damageable = hit.collider.GetComponentInParent<ShDamageable>();
if (!damageable) return;
if (damageable == local) return;
getClient().ClManager.SendToServer(PacketFlags.Reliable, SvPacket.CheckHitscan, new object[]
{
damageable.ID,
(byte)0
});
Log($"{damageable.name} {damageable.ID} {hitscan.currentBurst}");
}
}
}