This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
forked from new-frontiers-14/frontier-station-14
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
235 changed files
with
3,092 additions
and
201 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
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
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
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
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
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
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,38 @@ | ||
using Content.Shared.Implants; | ||
using Content.Shared.Implants.Components; | ||
using Content.Server.Bible.Components; | ||
using Robust.Shared.Containers; | ||
|
||
namespace Content.Server.Implants; | ||
|
||
public sealed class BibleUserImplantSystem : EntitySystem | ||
{ | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<BibleUserImplantComponent, ImplantImplantedEvent>(OnInsert); | ||
// We need to remove the BibleUserComponent from the owner before the implant | ||
// is removed, so we need to execute before the SubdermalImplantSystem. | ||
SubscribeLocalEvent<BibleUserImplantComponent, EntGotRemovedFromContainerMessage>(OnRemove, before: new[] { typeof(SubdermalImplantSystem) }); | ||
} | ||
|
||
private void OnInsert(EntityUid uid, BibleUserImplantComponent component, ImplantImplantedEvent args) | ||
{ | ||
if (!args.Implanted.HasValue) | ||
return; | ||
|
||
var bibleUserComp = EnsureComp<BibleUserComponent>(args.Implanted.Value); | ||
Dirty(args.Implanted.Value, bibleUserComp); | ||
} | ||
|
||
// Currently permanent, but should support removal if/when a viable solution is found. | ||
private void OnRemove(EntityUid uid, BibleUserImplantComponent component, EntGotRemovedFromContainerMessage args) | ||
{ | ||
if (!TryComp<SubdermalImplantComponent>(uid, out var implanted) || implanted.ImplantedEntity == null) | ||
return; | ||
|
||
RemComp<BibleUserComponent>(implanted.ImplantedEntity.Value); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
Content.Server/_NF/Security/Components/ContrabandPriceGunComponent.cs
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,10 @@ | ||
namespace Content.Server._NF.Security.Components; | ||
|
||
/// <summary> | ||
/// This is used for the contraband appraisal gun, which checks the contraband turn-in value in FUCs of any object it appraises. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class ContrabandPriceGunComponent : Component | ||
{ | ||
|
||
} |
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,67 @@ | ||
using Content.Server.Popups; | ||
using Content.Shared._NF.Contraband.Components; | ||
using Content.Server._NF.Security.Components; | ||
using Content.Shared.IdentityManagement; | ||
using Content.Shared.Interaction; | ||
using Content.Shared.Timing; | ||
using Content.Shared.Verbs; | ||
|
||
namespace Content.Server._NF.Security.Systems; | ||
|
||
/// <summary> | ||
/// This system handles contraband appraisal messages and will inform a user of how much an item is worth for trade-in in FUCs. | ||
/// </summary> | ||
public sealed class ContrabandPriceGunSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly UseDelaySystem _useDelay = default!; | ||
[Dependency] private readonly PopupSystem _popupSystem = default!; | ||
|
||
/// <inheritdoc/> | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<ContrabandPriceGunComponent, AfterInteractEvent>(OnAfterInteract); | ||
SubscribeLocalEvent<ContrabandPriceGunComponent, GetVerbsEvent<UtilityVerb>>(OnUtilityVerb); | ||
} | ||
|
||
private void OnUtilityVerb(EntityUid uid, ContrabandPriceGunComponent component, GetVerbsEvent<UtilityVerb> args) | ||
{ | ||
if (!args.CanAccess || !args.CanInteract || args.Using == null) | ||
return; | ||
|
||
if (!TryComp(uid, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((uid, useDelay))) | ||
return; | ||
|
||
if (!TryComp<ContrabandComponent>(args.Target, out var contraband)) | ||
return; | ||
|
||
var verb = new UtilityVerb() | ||
{ | ||
Act = () => | ||
{ | ||
_popupSystem.PopupEntity(Loc.GetString("contraband-price-gun-pricing-result", ("object", Identity.Entity(args.Target, EntityManager)), ("price", contraband.Value)), args.User, args.User); | ||
_useDelay.TryResetDelay((uid, useDelay)); | ||
}, | ||
Text = Loc.GetString("contraband-price-gun-verb-text"), | ||
Message = Loc.GetString("contraband-price-gun-verb-message", ("object", Identity.Entity(args.Target, EntityManager))) | ||
}; | ||
|
||
args.Verbs.Add(verb); | ||
} | ||
|
||
private void OnAfterInteract(EntityUid uid, ContrabandPriceGunComponent component, AfterInteractEvent args) | ||
{ | ||
if (!args.CanReach || args.Target == null || args.Handled) | ||
return; | ||
|
||
if (!TryComp(uid, out UseDelayComponent? useDelay) || _useDelay.IsDelayed((uid, useDelay))) | ||
return; | ||
|
||
if (TryComp<ContrabandComponent>(args.Target, out var contraband)) | ||
_popupSystem.PopupEntity(Loc.GetString("contraband-price-gun-pricing-result", ("object", Identity.Entity(args.Target.Value, EntityManager)), ("price", contraband.Value)), args.User, args.User); | ||
else | ||
_popupSystem.PopupEntity(Loc.GetString("contraband-price-gun-pricing-result-none", ("object", Identity.Entity(args.Target.Value, EntityManager))), args.User, args.User); | ||
|
||
_useDelay.TryResetDelay((uid, useDelay)); | ||
args.Handled = true; | ||
} | ||
} |
Oops, something went wrong.