Skip to content

Commit

Permalink
Merge branch 'master' into Sec-Shades-Returns
Browse files Browse the repository at this point in the history
  • Loading branch information
ps3moira authored Jan 15, 2024
2 parents 3be0f78 + 9f4dc00 commit 4693617
Show file tree
Hide file tree
Showing 47 changed files with 654 additions and 2 deletions.
26 changes: 26 additions & 0 deletions Content.Client/DeltaV/Biscuit/BiscuitSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Content.Shared.DeltaV.Biscuit;
using Robust.Client.GameObjects;

namespace Content.Client.DeltaV.Biscuit;

public sealed class BiscuitSystem : VisualizerSystem<BiscuitVisualsComponent>
{
[Dependency] private readonly AppearanceSystem _appearance = default!;

protected override void OnAppearanceChange(EntityUid uid, BiscuitVisualsComponent component,
ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;

_appearance.TryGetData(uid, BiscuitStatus.Cracked, out bool cracked);

args.Sprite.LayerSetVisible(BiscuitVisualLayers.Top, !cracked);
}
}

public enum BiscuitVisualLayers : byte
{
Base,
Top
}
5 changes: 5 additions & 0 deletions Content.Client/DeltaV/Biscuit/BiscuitVisualsComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Content.Client.DeltaV.Biscuit;

[RegisterComponent]
public sealed partial class BiscuitVisualsComponent : Component
{}
10 changes: 10 additions & 0 deletions Content.Server/DeltaV/Biscuit/BiscuitComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Content.Shared.DeltaV.Biscuit;

namespace Content.Server.DeltaV.Biscuit;

[RegisterComponent]
public sealed partial class BiscuitComponent : SharedBiscuitComponent
{
[DataField]
public bool Cracked { get; set; }
}
49 changes: 49 additions & 0 deletions Content.Server/DeltaV/Biscuit/BiscuitSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.DeltaV.Biscuit;
using Content.Shared.Verbs;
using Robust.Server.Audio;
using Robust.Server.GameObjects;
using Robust.Shared.Audio;

namespace Content.Server.DeltaV.Biscuit;

public sealed class BiscuitSystem : EntitySystem
{
[Dependency] private readonly AppearanceSystem _appearanceSystem = default!;
[Dependency] private readonly ItemSlotsSystem _slotSystem = default!;
[Dependency] private readonly AudioSystem _audioSystem = default!;

public override void Initialize()
{
SubscribeLocalEvent<BiscuitComponent, GetVerbsEvent<AlternativeVerb>>(AddCrackVerb);
}

private void AddCrackVerb(EntityUid uid, BiscuitComponent component, GetVerbsEvent<AlternativeVerb> args)
{
if (!args.CanInteract || !args.CanAccess || component.Cracked)
return;

AlternativeVerb verb = new()
{
Act = () =>
{
CrackBiscuit(uid, component);
},
Text = Loc.GetString("biscuit-verb-crack"),
Priority = 2
};
args.Verbs.Add(verb);
}

private void CrackBiscuit(EntityUid uid, BiscuitComponent component)
{
component.Cracked = true;

_appearanceSystem.SetData(uid, BiscuitStatus.Cracked, true);

_audioSystem.PlayPvs("/Audio/DeltaV/Effects/crack1.ogg", uid,
AudioParams.Default.WithVariation(0.2f).WithVolume(-4f));

_slotSystem.SetLock(uid, "PaperSlip", false);
}
}
4 changes: 4 additions & 0 deletions Content.Server/Paper/PaperComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ public sealed partial class PaperComponent : SharedPaperComponent
[DataField("stampedBy")]
public List<StampDisplayInfo> StampedBy { get; set; } = new();

[DataField("canEdit")]
[ViewVariables(VVAccess.ReadWrite)]
public bool CanEdit { get; set; } = true; // DeltaV - Used for paper slips

/// <summary>
/// Stamp to be displayed on the paper, state from beauracracy.rsi
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Paper/PaperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private void OnInteractUsing(EntityUid uid, PaperComponent paperComp, InteractUs
{
// only allow editing if there are no stamps or when using a cyberpen
var editable = paperComp.StampedBy.Count == 0 || _tagSystem.HasTag(args.Used, "WriteIgnoreStamps");
if (_tagSystem.HasTag(args.Used, "Write") && editable)
if (_tagSystem.HasTag(args.Used, "Write") && editable && paperComp.CanEdit)
{
var writeEvent = new PaperWriteEvent(uid, args.User);
RaiseLocalEvent(args.Used, ref writeEvent);
Expand Down
12 changes: 12 additions & 0 deletions Content.Shared/DeltaV/Biscuit/SharedBiscuitComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Robust.Shared.Serialization;

namespace Content.Shared.DeltaV.Biscuit;

public abstract partial class SharedBiscuitComponent : Component
{}

[Serializable, NetSerializable]
public enum BiscuitStatus : byte
{
Cracked
}
Binary file added Resources/Audio/DeltaV/Effects/crack1.ogg
Binary file not shown.
3 changes: 3 additions & 0 deletions Resources/Audio/DeltaV/Effects/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
crack1.ogg taken from
https://github.com/tgstation/tgstation/blob/ebc2e02e59d36214aff1eff8250b70a7970ff43d/sound/effects/wounds/crack1.ogg
licensed under CC BY-NC-SA 3.0
8 changes: 8 additions & 0 deletions Resources/Changelog/DeltaVChangelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1357,3 +1357,11 @@ Entries:
message: Shoukou has maintenance now in logistics and in security
id: 203
time: '2024-01-12T22:08:47.0000000+00:00'
- author: DebugOk
changes:
- type: Add
message: Added the spare ID safe
- type: Remove
message: The captain's locker no longer starts with a spare ID card
id: 204
time: '2024-01-14T23:48:30.0000000+00:00'
1 change: 1 addition & 0 deletions Resources/Locale/en-US/deltav/misc/biscuits.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
biscuit-verb-crack = Crack
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/prototypes/access/accesses.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,5 @@ id-card-access-level-external = External
id-card-access-level-nuclear-operative = Nuclear Operative
id-card-access-level-syndicate-agent = Syndicate Agent
id-card-access-level-unused = You shouldn't see this
2 changes: 1 addition & 1 deletion Resources/Prototypes/Catalog/Fills/Lockers/heads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- id: ClothingOuterArmorCaptainCarapace
- id: NukeDisk
- id: PinpointerNuclear
- id: CaptainIDCard
# - id: CaptainIDCard # DeltaV - Replaced by the spare ID system
- id: ClothingHeadHatCaptain
- id: ClothingHandsGlovesInspection # DeltaV - ClothingHandsGlovesCaptain replaced in favour of inspection gloves
- id: ClothingNeckCloakCap
Expand Down
3 changes: 3 additions & 0 deletions Resources/Prototypes/DeltaV/Access/misc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- type: accessLevel
id: DV-SpareSafe
name: id-card-access-level-unused
186 changes: 186 additions & 0 deletions Resources/Prototypes/DeltaV/Entities/Objects/Misc/paperslips.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Biscuits for the slips
- type: entity
parent: BaseItem
id: PaperBiscuit
name: biscuit card
description: A biscuit card. On the back, 'DO NOT DIGEST' is printed in large lettering.
components:
- type: Sprite
sprite: DeltaV/Objects/Misc/biscuits.rsi
layers:
- state: biscuit
- state: biscuit_paper
map: [ "biscuit_paper" ]
visible: false
- state: biscuit_top
map: [ "enum.BiscuitVisualLayers.Top" ]
- type: Item
size: 5
- type: Tag
tags:
- Document
- type: Appearance
- type: Damageable
damageModifierSet: Wood
- type: Biscuit
- type: BiscuitVisuals
- type: ItemSlots
slots:
PaperSlip:
name: Slip
whitelist:
tags:
- PaperSlip
locked: true
- type: ContainerContainer
containers:
PaperSlip: !type:ContainerSlot {}
- type: ItemMapper
sprite: DeltaV/Objects/Misc/biscuits.rsi
mapLayers:
biscuit_paper:
whitelist:
components:
- Paper
spriteLayers:
- biscuit_paper

- type: entity
parent: PaperBiscuit
id: PaperBiscuitFilled
suffix: Filled
components:
- type: ItemSlots
slots:
PaperSlip:
startingItem: PaperSlip
name: Slip
whitelist:
tags:
- PaperSlip
locked: true

- type: entity
parent: PaperBiscuit
id: PaperBiscuitCorporate
name: confidential biscuit card
description: A confidential biscuit card. The tasteful blue color and NT logo on the front makes it look a little like a chocolate bar.
components:
- type: Sprite
sprite: DeltaV/Objects/Misc/biscuits.rsi
layers:
- state: biscuit_secret
map: [ "enum.BiscuitVisualLayers.Base" ]
- state: biscuit_paper_corp
map: [ "biscuit_paper" ]
visible: false
- state: biscuit_secret_top
map: [ "enum.BiscuitVisualLayers.Top" ]
visible: true

- type: entity
parent: PaperBiscuitCorporate
id: PaperBiscuitCorporateFilled
suffix: Filled
components:
- type: ItemSlots
slots:
PaperSlip:
startingItem: PaperSlipCorporate
name: Slip
whitelist:
tags:
- PaperSlip
locked: true

- type: entity
parent: PaperBiscuitCorporate
id: PaperBiscuitCorporateSpareID
name: emergency access biscuit
components:
- type: ItemSlots
slots:
PaperSlip:
startingItem: PaperSlipSpareID
name: Slip
whitelist:
tags:
- PaperSlip
locked: true

# Paper slips
- type: entity
parent: BaseItem
id: PaperSlip
name: paper slip
description: A little slip of paper left over after a larger piece was cut. Whoa.
components:
- type: Sprite
sprite: DeltaV/Objects/Misc/biscuits.rsi
layers:
- state: slip
- state: slip_words
map: [ "enum.PaperVisualLayers.Writing" ]
visible: false
- type: Paper
- type: ActivatableUI
key: enum.PaperUiKey.Key
closeOnHandDeselect: false
- type: UserInterface
interfaces:
- key: enum.PaperUiKey.Key
type: PaperBoundUserInterface
- type: Item
size: 1
- type: Tag
tags:
- Document
- PaperSlip
- type: Appearance
- type: PaperVisuals
- type: Damageable
damageModifierSet: Wood
- type: Destructible
thresholds:
- trigger:
!type:DamageTrigger
damage: 15
behaviors:
- !type:SpawnEntitiesBehavior
spawn:
Ash:
min: 1
max: 1
- !type:DoActsBehavior
acts: [ "Destruction" ]

- type: entity
parent: PaperSlip
id: PaperSlipCorporate
name: corporate plastic card
description: A plastic card for confidential corporate matters.
components:
- type: Paper
canEdit: false
- type: Sprite
layers:
- state: corpslip
- state: corpslip_words
map: [ "enum.PaperVisualLayers.Writing" ]
visible: false
- type: PaperVisuals
backgroundImagePath: "/Textures/DeltaV/Interface/Paper/paper_background_corpcard.svg.96dpi.png"
contentMargin: 70.0, 16.0, 70.0, 16.0
maxWritableArea: 400.0, 600.0


- type: entity
parent: PaperSlipCorporate
id: PaperSlipSpareID
suffix: SpareID
name: emergency access card
description: A plastic card for confidential corporate matters. It has a magnetic strip on the back.
components:
- type: Access
tags:
- DV-SpareSafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
- type: entity
parent: FireAxeCabinet
id: SpareIdCabinet
name: spare id cabinet
description: There is a small label that reads "For emergency use only".
components:
- type: Sprite
sprite: DeltaV/Structures/Wallmounts/idcard_cabinet.rsi
layers:
- state: cabinet
- state: card
map: ["enum.ItemCabinetVisualLayers.ContainsItem"]
visible: true
- state: glass
map: ["enum.ItemCabinetVisualLayers.Door"]
- type: ItemCabinet
cabinetSlot:
ejectOnInteract: true
whitelist:
components:
- IdCard
- type: AccessReader
access: [["DV-SpareSafe"]]

- type: entity
id: SpareIdCabinetFilled
parent: [SpareIdCabinet,FireAxeCabinetFilled]
suffix: Filled
components:
- type: ItemCabinet
cabinetSlot:
startingItem: CaptainIDCard
ejectOnInteract: true
whitelist:
components:
- IdCard
3 changes: 3 additions & 0 deletions Resources/Prototypes/DeltaV/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@

- type: Tag
id: Wheat

- type: Tag
id: PaperSlip
Loading

0 comments on commit 4693617

Please sign in to comment.