Skip to content

Commit

Permalink
Code Review problems solved
Browse files Browse the repository at this point in the history
  • Loading branch information
HellCatten committed Aug 22, 2024
1 parent ed79cf6 commit 69c68d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Content.Server/_White/EmpFlashlight/EmpOnHitComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Content.Server._White.EmpFlashlight;
/// Upon being triggered will EMP target.
/// </summary>
[RegisterComponent]
[Access(typeof(EmpHitSystem))]
[Access(typeof(EmpOnHitSystem))]

public sealed partial class EmpOnHitComponent: Component
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
using Content.Server.Power;
using Content.Shared.Emp;
using Robust.Shared.GameObjects;
using Content.Shared.Weapons.Melee.Events;
using Content.Server._White.EmpFlashlight;
using Content.Shared.Weapons.Melee.Events;
using Content.Server.Emp;
using Robust.Shared.IoC;
using Content.Shared.Charges.Systems;
using Content.Shared.Charges.Components;

namespace Content.Server._White.EmpFlashlight;

public sealed class EmpHitSystem : EntitySystem
public sealed class EmpOnHitSystem : EntitySystem
{
[Dependency] private readonly EntityLookupSystem _lookup = default!;

[Dependency] private readonly EmpSystem _emp = default!;
[Dependency] private readonly SharedChargesSystem _charges = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;

public override void Initialize()
{
base.Initialize();
Expand All @@ -23,14 +20,14 @@ public override void Initialize()

public bool TryEmpHit(EntityUid uid, EmpOnHitComponent comp, MeleeHitEvent args)
{
LimitedChargesComponent? charges;
if (!TryComp<LimitedChargesComponent>(uid, out charges))

if (!TryComp<LimitedChargesComponent>(uid, out LimitedChargesComponent? charges))
return false;

if (_charges.IsEmpty(uid, charges))
return false;

if (charges != null && args.HitEntities.Count > 0)
if (args.HitEntities.Count > 0)
{
_charges.UseCharge(uid,charges);
return true;
Expand All @@ -46,7 +43,7 @@ private void HandleEmpHit(EntityUid uid, EmpOnHitComponent comp, MeleeHitEvent a

foreach (var affected in args.HitEntities)
{
_emp.EmpPulse(Transform(affected).MapPosition, comp.Range, comp.EnergyConsumption, comp.DisableDuration);
_emp.EmpPulse(_transform.GetMapCoordinates(affected), comp.Range, comp.EnergyConsumption, comp.DisableDuration);
}

args.Handled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
wideAnimationRotation: -135
damage:
types:
Blunt: 0
Blunt: 12
angle: 60
animation: WeaponArcThrust
- type: EmpOnHit
Expand All @@ -23,4 +23,4 @@
disableDuration: 100
- type: LimitedCharges
- type: AutoRecharge
rechargeDuration: 30
rechargeDuration: 60

0 comments on commit 69c68d8

Please sign in to comment.