Skip to content

Commit

Permalink
Port frontier no power popups (DeltaV-Station#2230)
Browse files Browse the repository at this point in the history
* meow

* meow

* meow

* meow

* meow
  • Loading branch information
Lyndomen authored Nov 18, 2024
1 parent 1f5132f commit 0e3643b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Content.Server/Weapons/Ranged/Systems/GunSystem.AutoFire.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
using Content.Shared.Interaction; // Frontier
using Content.Shared.Examine; // Frontier
using Content.Shared.Power; // Frontier
using Content.Server.Popups; // Frontier

namespace Content.Server.Weapons.Ranged.Systems;

public sealed partial class GunSystem
{
[Dependency] public PopupSystem _popup = default!; // Frontier
public override void Update(float frameTime)
{
base.Update(frameTime);
Expand Down Expand Up @@ -37,9 +39,6 @@ public override void Update(float frameTime)
// This code is licensed under AGPLv3. See AGPLv3.txt
private void OnGunExamine(EntityUid uid, AutoShootGunComponent component, ExaminedEvent args)
{
if (!HasComp<ApcPowerReceiverComponent>(uid))
return;

// Powered is already handled by other power components
var enabled = Loc.GetString(component.On ? "gun-comp-enabled" : "gun-comp-disabled");

Expand All @@ -60,6 +59,7 @@ private void OnActivateGun(EntityUid uid, AutoShootGunComponent component, Activ

DisableGun(uid, component);
args.Handled = true;
_popup.PopupEntity(Loc.GetString("auto-fire-disabled"), uid, args.User);
}
else if (CanEnable(uid, component))
{
Expand All @@ -68,6 +68,11 @@ private void OnActivateGun(EntityUid uid, AutoShootGunComponent component, Activ

EnableGun(uid, component);
args.Handled = true;
_popup.PopupEntity(Loc.GetString("auto-fire-enabled"), uid, args.User);
}
else
{
_popup.PopupEntity(Loc.GetString("auto-fire-enabled-no-power"), uid, args.User);
}
}

Expand Down
4 changes: 4 additions & 0 deletions Resources/Locale/en-US/_NF/weapons/gun.ftl
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
gun-comp-enabled = The gun is turned [color=green]on[/color].
gun-comp-disabled = The gun is turned [color=red]off[/color].
auto-fire-enabled = Gun turned on.
auto-fire-disabled = Gun turned off.
auto-fire-enabled-no-power = Gun turned on; but it has no power!

0 comments on commit 0e3643b

Please sign in to comment.