forked from space-sunrise/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
plutonium core steal objective (#26786)
* add textures * add SealingCabinet system * add StoreUnlocker/ObjectiveUnlock system * add plutonium core and nuke core container * make nuke deconstructable * add steal core objective * add core extraction toolbox to new category * typo ops wrench fuel * use queries and resolve, have it resolve instead of using Comp --------- Co-authored-by: deltanedas <@deltanedas:kde.org>
- Loading branch information
1 parent
1c66e1d
commit f6ce072
Showing
33 changed files
with
497 additions
and
20 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
Content.Server/Objectives/Components/StoreUnlockerComponent.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,14 @@ | ||
using Content.Shared.Store; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.Objectives.Components; | ||
|
||
/// <summary> | ||
/// Unlocks store listings that use <see cref="ObjectiveUnlockCondition"/>. | ||
/// </summary> | ||
[RegisterComponent] | ||
public sealed partial class StoreUnlockerComponent : Component | ||
{ | ||
[DataField(required: true)] | ||
public List<ProtoId<ListingPrototype>> Listings = new(); | ||
} |
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,34 @@ | ||
using Content.Server.Objectives.Components; | ||
using Content.Shared.Mind; | ||
|
||
namespace Content.Server.Objectives.Systems; | ||
|
||
/// <summary> | ||
/// Provides api for listings with <c>ObjectiveUnlockRequirement</c> to use. | ||
/// </summary> | ||
public sealed class StoreUnlockerSystem : EntitySystem | ||
{ | ||
private EntityQuery<StoreUnlockerComponent> _query; | ||
|
||
public override void Initialize() | ||
{ | ||
_query = GetEntityQuery<StoreUnlockerComponent>(); | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if a listing id is unlocked by any objectives on a mind. | ||
/// </summary> | ||
public bool IsUnlocked(MindComponent mind, string id) | ||
{ | ||
foreach (var obj in mind.Objectives) | ||
{ | ||
if (!_query.TryComp(obj, out var comp)) | ||
continue; | ||
|
||
if (comp.Listings.Contains(id)) | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
Content.Server/Store/Conditions/ObjectiveUnlockCondition.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,21 @@ | ||
using Content.Shared.Mind; | ||
using Content.Shared.Store; | ||
using Content.Server.Objectives.Systems; | ||
|
||
namespace Content.Server.Store.Conditions; | ||
|
||
/// <summary> | ||
/// Requires that the buyer have an objective that unlocks this listing. | ||
/// </summary> | ||
public sealed partial class ObjectiveUnlockCondition : ListingCondition | ||
{ | ||
public override bool Condition(ListingConditionArgs args) | ||
{ | ||
var minds = args.EntityManager.System<SharedMindSystem>(); | ||
if (!minds.TryGetMind(args.Buyer, out _, out var mind)) | ||
return false; | ||
|
||
var unlocker = args.EntityManager.System<StoreUnlockerSystem>(); | ||
return unlocker.IsUnlocked(mind, args.Listing.ID); | ||
} | ||
} |
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,23 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Cabinet; | ||
|
||
/// <summary> | ||
/// Item cabinet that cannot be opened if it has an item inside. | ||
/// The only way to open it after that is to emag it. | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class SealingCabinetComponent : Component | ||
{ | ||
/// <summary> | ||
/// Popup shown when trying to open the cabinet once sealed. | ||
/// </summary> | ||
[DataField(required: true)] | ||
public LocId SealedPopup = string.Empty; | ||
|
||
/// <summary> | ||
/// Set to false to disable emag unsealing. | ||
/// </summary> | ||
[DataField] | ||
public bool Emaggable = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Content.Shared.Emag.Systems; | ||
using Content.Shared.Nutrition.Components; | ||
using Content.Shared.Nutrition.EntitySystems; | ||
using Content.Shared.Popups; | ||
|
||
namespace Content.Shared.Cabinet; | ||
|
||
public sealed class SealingCabinetSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly ItemCabinetSystem _cabinet = default!; | ||
[Dependency] private readonly OpenableSystem _openable = default!; | ||
[Dependency] private readonly SharedPopupSystem _popup = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<SealingCabinetComponent, OpenableOpenAttemptEvent>(OnOpenAttempt); | ||
SubscribeLocalEvent<SealingCabinetComponent, GotEmaggedEvent>(OnEmagged); | ||
} | ||
|
||
private void OnOpenAttempt(Entity<SealingCabinetComponent> ent, ref OpenableOpenAttemptEvent args) | ||
{ | ||
if (!_cabinet.HasItem(ent.Owner)) | ||
return; | ||
|
||
args.Cancelled = true; | ||
if (args.User is {} user) | ||
_popup.PopupClient(Loc.GetString(ent.Comp.SealedPopup, ("container", ent.Owner)), ent, user); | ||
} | ||
|
||
private void OnEmagged(Entity<SealingCabinetComponent> ent, ref GotEmaggedEvent args) | ||
{ | ||
if (!ent.Comp.Emaggable) | ||
return; | ||
|
||
if (!_cabinet.HasItem(ent.Owner) || _openable.IsOpen(ent)) | ||
return; | ||
|
||
_openable.SetOpen(ent, true); | ||
|
||
args.Handled = true; | ||
args.Repeatable = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nuke-core-container-whitelist-fail-popup = That doesn't fit into the container. | ||
nuke-core-container-sealed-popup = The {$container} is sealed shut! |
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
63 changes: 63 additions & 0 deletions
63
Resources/Prototypes/Entities/Objects/Misc/plutonium_core.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,63 @@ | ||
- type: entity | ||
parent: BaseItem | ||
id: PlutoniumCore | ||
name: plutonium core | ||
description: Extremely radioactive, even looking at this with the naked eye is dangerous. | ||
components: | ||
- type: Sprite | ||
sprite: Objects/Misc/plutonium_core.rsi | ||
state: icon | ||
- type: StealTarget | ||
stealGroup: PlutoniumCore | ||
- type: RadiationSource | ||
intensity: 4 | ||
slope: 1 | ||
- type: StaticPrice | ||
price: 49000 | ||
- type: Tag | ||
tags: | ||
- PlutoniumCore | ||
|
||
- type: entity | ||
parent: [BaseItem, BaseItemCabinet] | ||
id: NukeCoreContainer | ||
name: nuke core container | ||
description: Solid container for radioactive objects. | ||
components: | ||
- type: Sprite | ||
sprite: Objects/Misc/nuke_core_container.rsi | ||
layers: | ||
- state: closed | ||
map: [ "enum.OpenableVisuals.Layer" ] | ||
- state: core_closed | ||
map: [ "enum.ItemCabinetVisuals.Layer" ] | ||
visible: false | ||
shader: unshaded | ||
- type: Item | ||
size: Normal | ||
shape: | ||
- 0,0,1,1 | ||
- type: RadiationBlockingContainer | ||
resistance: 4 | ||
- type: SealingCabinet | ||
sealedPopup: nuke-core-container-sealed-popup | ||
- type: ItemSlots | ||
slots: | ||
ItemCabinet: | ||
whitelist: | ||
tags: | ||
- PlutoniumCore | ||
whitelistFailPopup: nuke-core-container-whitelist-fail-popup | ||
- type: GenericVisualizer | ||
visuals: | ||
enum.OpenableVisuals.Opened: | ||
enum.OpenableVisuals.Layer: | ||
True: { state: open } | ||
False: { state: closed } | ||
enum.ItemCabinetVisuals.Layer: | ||
True: { state: core_open } | ||
False: { state: core_closed } | ||
enum.ItemCabinetVisuals.ContainsItem: | ||
enum.ItemCabinetVisuals.Layer: | ||
True: { visible: true } | ||
False: { visible: false } |
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 @@ | ||
- type: entity | ||
parent: Screwdriver | ||
id: ThinTippedScrewdriver | ||
description: A screwdriver with an ultra thin tip that's carefully designed to boost screwing speed. | ||
suffix: DO NOT MAP | ||
components: | ||
- type: Tool | ||
qualities: | ||
- Screwing | ||
- FineScrewing |
Oops, something went wrong.