forked from space-wizards/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.
Thief beacons (try 2) (space-wizards#29997)
content
- Loading branch information
Showing
14 changed files
with
264 additions
and
24 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
Content.Server/Objectives/Components/StealAreaComponent.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,23 @@ | ||
using Content.Server.Objectives.Systems; | ||
using Content.Server.Thief.Systems; | ||
|
||
namespace Content.Server.Objectives.Components; | ||
|
||
/// <summary> | ||
/// An abstract component that allows other systems to count adjacent objects as "stolen" when controlling other systems | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(StealConditionSystem), typeof(ThiefBeaconSystem))] | ||
public sealed partial class StealAreaComponent : Component | ||
{ | ||
[DataField] | ||
public bool Enabled = true; | ||
|
||
[DataField] | ||
public float Range = 1f; | ||
|
||
/// <summary> | ||
/// all the minds that will be credited with stealing from this area. | ||
/// </summary> | ||
[DataField] | ||
public HashSet<EntityUid> Owners = 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
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,17 @@ | ||
using Content.Server.Thief.Systems; | ||
using Robust.Shared.Audio; | ||
|
||
namespace Content.Server.Thief.Components; | ||
|
||
/// <summary> | ||
/// working together with StealAreaComponent, allows the thief to count objects near the beacon as stolen when setting up. | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(ThiefBeaconSystem))] | ||
public sealed partial class ThiefBeaconComponent : Component | ||
{ | ||
[DataField] | ||
public SoundSpecifier LinkSound = new SoundPathSpecifier("/Audio/Machines/high_tech_confirm.ogg"); | ||
|
||
[DataField] | ||
public SoundSpecifier UnlinkSound = new SoundPathSpecifier("/Audio/Machines/beep.ogg"); | ||
} |
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,95 @@ | ||
using Content.Server.Mind; | ||
using Content.Server.Objectives.Components; | ||
using Content.Server.Roles; | ||
using Content.Server.Thief.Components; | ||
using Content.Shared.Examine; | ||
using Content.Shared.Foldable; | ||
using Content.Shared.Popups; | ||
using Content.Shared.Verbs; | ||
using Robust.Shared.Audio.Systems; | ||
|
||
namespace Content.Server.Thief.Systems; | ||
|
||
/// <summary> | ||
/// <see cref="ThiefBeaconComponent"/> | ||
/// </summary> | ||
public sealed class ThiefBeaconSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedTransformSystem _transform = default!; | ||
[Dependency] private readonly SharedAudioSystem _audio = default!; | ||
[Dependency] private readonly SharedPopupSystem _popup = default!; | ||
[Dependency] private readonly MindSystem _mind = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<ThiefBeaconComponent, GetVerbsEvent<InteractionVerb>>(OnGetInteractionVerbs); | ||
SubscribeLocalEvent<ThiefBeaconComponent, FoldedEvent>(OnFolded); | ||
SubscribeLocalEvent<ThiefBeaconComponent, ExaminedEvent>(OnExamined); | ||
} | ||
|
||
private void OnGetInteractionVerbs(Entity<ThiefBeaconComponent> beacon, ref GetVerbsEvent<InteractionVerb> args) | ||
{ | ||
if (!args.CanAccess || !args.CanInteract || args.Hands is null) | ||
return; | ||
|
||
if (TryComp<FoldableComponent>(beacon, out var foldable) && foldable.IsFolded) | ||
return; | ||
|
||
var mind = _mind.GetMind(args.User); | ||
if (!HasComp<ThiefRoleComponent>(mind)) | ||
return; | ||
|
||
var user = args.User; | ||
args.Verbs.Add(new() | ||
{ | ||
Act = () => | ||
{ | ||
SetCoordinate(beacon, mind.Value); | ||
}, | ||
Message = Loc.GetString("thief-fulton-verb-message"), | ||
Text = Loc.GetString("thief-fulton-verb-text"), | ||
}); | ||
} | ||
|
||
private void OnFolded(Entity<ThiefBeaconComponent> beacon, ref FoldedEvent args) | ||
{ | ||
if (args.IsFolded) | ||
ClearCoordinate(beacon); | ||
} | ||
|
||
private void OnExamined(Entity<ThiefBeaconComponent> beacon, ref ExaminedEvent args) | ||
{ | ||
if (!TryComp<StealAreaComponent>(beacon, out var area)) | ||
return; | ||
|
||
args.PushText(Loc.GetString(area.Owners.Count == 0 | ||
? "thief-fulton-examined-unset" | ||
: "thief-fulton-examined-set")); | ||
} | ||
|
||
private void SetCoordinate(Entity<ThiefBeaconComponent> beacon, EntityUid mind) | ||
{ | ||
if (!TryComp<StealAreaComponent>(beacon, out var area)) | ||
return; | ||
|
||
_audio.PlayPvs(beacon.Comp.LinkSound, beacon); | ||
_popup.PopupEntity(Loc.GetString("thief-fulton-set"), beacon); | ||
area.Owners.Clear(); //We only reconfigure the beacon for ourselves, we don't need multiple thieves to steal from the same beacon. | ||
area.Owners.Add(mind); | ||
} | ||
|
||
private void ClearCoordinate(Entity<ThiefBeaconComponent> beacon) | ||
{ | ||
if (!TryComp<StealAreaComponent>(beacon, out var area)) | ||
return; | ||
|
||
if (area.Owners.Count == 0) | ||
return; | ||
|
||
_audio.PlayPvs(beacon.Comp.UnlinkSound, beacon); | ||
_popup.PopupEntity(Loc.GetString("thief-fulton-clear"), beacon); | ||
area.Owners.Clear(); | ||
} | ||
} |
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,8 @@ | ||
thief-fulton-set = Delivery coordinates are set. | ||
thief-fulton-clear = Delivery coordinates cleared. | ||
thief-fulton-examined-set = Coordinates entered. Bluespace teleportation of the nearest objects will be performed when the evacuation shuttle departs. | ||
thief-fulton-examined-unset = Beacon coordinates are not set. | ||
thief-fulton-verb-text = Set coordinates | ||
thief-fulton-verb-message = Set the coordinates of your thief's hideout, where all nearby items will be sent at the end of the round. |
38 changes: 38 additions & 0 deletions
38
Resources/Prototypes/Entities/Objects/Tools/thief_beacon.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,38 @@ | ||
- type: entity | ||
id: ThiefBeacon | ||
name: thieving beacon | ||
description: A device that will teleport everything around it to the thief's vault at the end of the shift. | ||
components: | ||
- type: ThiefBeacon | ||
- type: StealArea | ||
- type: Item | ||
size: Normal | ||
- type: Physics | ||
bodyType: Dynamic | ||
- type: Fixtures | ||
fixtures: | ||
fix1: | ||
shape: | ||
!type:PhysShapeAabb | ||
bounds: "-0.25,-0.4,0.25,0.1" | ||
density: 20 | ||
mask: | ||
- Impassable | ||
- type: Foldable | ||
folded: true | ||
- type: Clickable | ||
- type: InteractionOutline | ||
- type: Appearance | ||
- type: GenericVisualizer | ||
visuals: | ||
enum.FoldedVisuals.State: | ||
foldedLayer: | ||
True: { state: folded_extraction } | ||
False: { state: extraction_point } | ||
- type: Sprite | ||
sprite: Objects/Tools/thief_beacon.rsi | ||
drawdepth: SmallObjects | ||
noRot: true | ||
layers: | ||
- state: extraction_point | ||
map: [ "foldedLayer" ] |
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 |
---|---|---|
|
@@ -10,4 +10,5 @@ | |
storage: | ||
back: | ||
- ToolboxThief | ||
- ClothingHandsChameleonThief | ||
- ClothingHandsChameleonThief | ||
- ThiefBeacon |
Binary file added
BIN
+954 Bytes
Resources/Textures/Objects/Tools/thief_beacon.rsi/extraction_point.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+281 Bytes
Resources/Textures/Objects/Tools/thief_beacon.rsi/extraction_point_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+681 Bytes
Resources/Textures/Objects/Tools/thief_beacon.rsi/folded_extraction.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions
32
Resources/Textures/Objects/Tools/thief_beacon.rsi/meta.json
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,32 @@ | ||
{ | ||
"version": 1, | ||
"license": "CC-BY-SA-3.0", | ||
"copyright": "Taken from https://github.com/austation/austation/commit/e2a4fefd01e702f48d3d4cc8d6a2686d54d104fa and edited by TheShuEd", | ||
"size": { | ||
"x": 32, | ||
"y": 32 | ||
}, | ||
"states": [ | ||
{ | ||
"name": "folded_extraction" | ||
}, | ||
{ | ||
"name": "extraction_point", | ||
"delays": [ | ||
[ | ||
0.5, | ||
0.5 | ||
] | ||
] | ||
}, | ||
{ | ||
"name": "extraction_point_light", | ||
"delays": [ | ||
[ | ||
0.5, | ||
0.5 | ||
] | ||
] | ||
} | ||
] | ||
} |