-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description Ports WWhiteDreamProject/wwdpublic#5 # Changelog :cl: - add: Added the EMP Flashlight to Syndicate Uplinks. --------- Co-authored-by: Ivan <[email protected]>
- Loading branch information
1 parent
cbc76ef
commit 7c0c16e
Showing
7 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
namespace Content.Server.EmpFlashlight; | ||
|
||
/// <summary> | ||
/// Upon being triggered will EMP target. | ||
/// </summary> | ||
[RegisterComponent] | ||
[Access(typeof(EmpOnHitSystem))] | ||
|
||
public sealed partial class EmpOnHitComponent : Component | ||
{ | ||
[DataField] | ||
public float Range = 1.0f; | ||
|
||
[DataField] | ||
public float EnergyConsumption; | ||
|
||
[DataField] | ||
public float DisableDuration = 60f; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Content.Shared.Weapons.Melee.Events; | ||
using Content.Server.Emp; | ||
using Content.Shared.Charges.Systems; | ||
using Content.Shared.Charges.Components; | ||
|
||
namespace Content.Server.EmpFlashlight; | ||
|
||
public sealed class EmpOnHitSystem : EntitySystem | ||
{ | ||
|
||
[Dependency] private readonly EmpSystem _emp = default!; | ||
[Dependency] private readonly SharedChargesSystem _charges = default!; | ||
[Dependency] private readonly SharedTransformSystem _transform = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
SubscribeLocalEvent<EmpOnHitComponent, MeleeHitEvent>(HandleEmpHit); | ||
} | ||
|
||
public bool TryEmpHit(EntityUid uid, EmpOnHitComponent comp, MeleeHitEvent args) | ||
{ | ||
|
||
if (!TryComp(uid, out LimitedChargesComponent? charges) | ||
|| _charges.IsEmpty(uid, charges) | ||
|| args.HitEntities.Count <= 0) | ||
return false; | ||
|
||
_charges.UseCharge(uid, charges); | ||
return true; | ||
} | ||
|
||
private void HandleEmpHit(EntityUid uid, EmpOnHitComponent comp, MeleeHitEvent args) | ||
{ | ||
if (!TryEmpHit(uid, comp, args)) | ||
return; | ||
|
||
foreach (var affected in args.HitEntities) | ||
_emp.EmpPulse(_transform.GetMapCoordinates(affected), comp.Range, comp.EnergyConsumption, comp.DisableDuration); | ||
|
||
args.Handled = true; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Resources/Locale/ru-RU/entities/objects/tools/empflashlight.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ent-FlashlightEmp = Фонарик | ||
.desc = Он озаряет путь к свободе. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
uplink-emp-flashlight-name = Электромагнитный фонарик | ||
uplink-emp-flashlight-desc = Замаскированное под фонарик устройство. При ударе выпускает ЭМИ, поражающий электрические устройства. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Resources/Prototypes/Entities/Objects/Tools/EmpFlashlight.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
- type: entity | ||
parent: FlashlightLantern | ||
id: FlashlightEmp | ||
name: flashlight | ||
description: It lights the way to freedom. | ||
suffix: EMP | ||
components: | ||
- type: ItemSlots | ||
slots: | ||
cell_slot: | ||
name: power-cell-clot-component-spot-name-default | ||
startingItem: PowerCellHigh | ||
- type: MeleeWeapon | ||
wideAnimationRotation: -135 | ||
damage: | ||
types: | ||
Blunt: 12 | ||
angle: 60 | ||
animation: WeaponArcThrust | ||
- type: EmpOnHit | ||
range: 0.1 | ||
energyConsumption: 100000 | ||
disableDuration: 100 | ||
- type: LimitedCharges | ||
- type: AutoRecharge | ||
rechargeDuration: 60 |