Skip to content

Commit

Permalink
makes reflectionType actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruddygreat committed Jan 3, 2025
1 parent 31f1cb9 commit c62116a
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions Content.Shared/Weapons/Reflect/ReflectSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,37 +50,6 @@ public override void Initialize()
SubscribeLocalEvent<ReflectComponent, GotEquippedHandEvent>(OnReflectHandEquipped);
SubscribeLocalEvent<ReflectComponent, GotUnequippedHandEvent>(OnReflectHandUnequipped);
SubscribeLocalEvent<ReflectComponent, ItemToggledEvent>(OnToggleReflect);

SubscribeLocalEvent<ReflectUserComponent, ProjectileReflectAttemptEvent>(OnReflectUserCollide);
SubscribeLocalEvent<ReflectUserComponent, HitScanReflectAttemptEvent>(OnReflectUserHitscan);
}

private void OnReflectUserHitscan(EntityUid uid, ReflectUserComponent component, ref HitScanReflectAttemptEvent args)
{
if (args.Reflected)
return;

foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(uid, SlotFlags.All & ~SlotFlags.POCKET))
{
if (!TryReflectHitscan(uid, ent, args.Shooter, args.SourceItem, args.Direction, out var dir))
continue;

args.Direction = dir.Value;
args.Reflected = true;
break;
}
}

private void OnReflectUserCollide(EntityUid uid, ReflectUserComponent component, ref ProjectileReflectAttemptEvent args)
{
foreach (var ent in _inventorySystem.GetHandOrInventoryEntities(uid, SlotFlags.All & ~SlotFlags.POCKET))
{
if (!TryReflectProjectile(uid, ent, args.ProjUid))
continue;

args.Cancelled = true;
break;
}
}

private void OnReflectCollide(EntityUid uid, ReflectComponent component, ref ProjectileReflectAttemptEvent args)
Expand Down

0 comments on commit c62116a

Please sign in to comment.