Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contraband Reagent System + Contraband Produce #1275

Merged
merged 4 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ private void GenerateControl(ReagentPrototype reagent)
GenerateSources(reagent);

FormattedMessage description = new();
if (_prototype.TryIndex(reagent.Contraband, out var severity)) // Beginning of imp edit
{
description.AddMarkupOrThrow(Loc.GetString(severity.ExamineText, ("color", severity.ExamineColor)));
description.PushNewline();
} // end of imp edit
description.AddText(reagent.LocalizedDescription);
description.PushNewline();
description.AddMarkupOrThrow(Loc.GetString("guidebook-reagent-physical-description",
Expand Down
37 changes: 36 additions & 1 deletion Content.Server/Forensics/Systems/ForensicPadSystem.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
using System.Linq; // imp
using Content.Server.Labels;
using Content.Server.Popups;
using Content.Shared.Chemistry.EntitySystems; // imp
using Content.Shared.Chemistry.Reagent; // imp
using Content.Shared.Contraband; // imp
using Content.Shared.DoAfter;
using Content.Shared.Examine;
using Content.Shared.Forensics;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Robust.Shared.Prototypes; // imp

namespace Content.Server.Forensics
{
Expand All @@ -15,9 +20,10 @@ namespace Content.Server.Forensics
public sealed class ForensicPadSystem : EntitySystem
{
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainerSystem = default!; // imp
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; // imp edit
[Dependency] private readonly LabelSystem _label = default!;

public override void Initialize()
Expand Down Expand Up @@ -76,7 +82,36 @@ private void OnAfterInteract(EntityUid uid, ForensicPadComponent component, Afte
}

if (TryComp<FiberComponent>(args.Target, out var fiber))
{
StartScan(uid, args.User, args.Target.Value, component, string.IsNullOrEmpty(fiber.FiberColor) ? Loc.GetString("forensic-fibers", ("material", fiber.FiberMaterial)) : Loc.GetString("forensic-fibers-colored", ("color", fiber.FiberColor), ("material", fiber.FiberMaterial)));
return;
}

if (_solutionContainerSystem.TryGetDrainableSolution(args.Target.Value, out _, out var solution) || // imp edit beginning
_solutionContainerSystem.TryGetDrawableSolution(args.Target.Value, out _, out solution) ||
_solutionContainerSystem.TryGetInjectorSolution(args.Target.Value, out _, out solution))
{
if (solution.Contents.Count == 0)
{
return;
}

var sample = solution.Contents.Select(x =>
{
if (_prototypeManager.TryIndex(x.Reagent.Prototype, out ReagentPrototype? reagent))
{
var localizedName = Loc.GetString(reagent.LocalizedName);
if (_prototypeManager.TryIndex(reagent.Contraband, out var contraband))
{
localizedName = $"[color={contraband.ExamineColor}]{localizedName}[/color]";
}
return localizedName;
}
return "???";
}).Aggregate((x, y) => x + ", " + y);
StartScan(uid, args.User, args.Target.Value, component, sample);
return;
} // imp edit end
}

private void StartScan(EntityUid used, EntityUid user, EntityUid target, ForensicPadComponent pad, string sample)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,19 @@ public bool TryGetMixableSolution(Entity<MixableSolutionComponent?, SolutionCont
return TryGetSolution((entity.Owner, entity.Comp2), entity.Comp1.Solution, out soln, out solution);
}

// imp edit beginning
public bool TryGetInjectorSolution(Entity<InjectorComponent?, SolutionContainerManagerComponent?> entity, [NotNullWhen(true)] out Entity<SolutionComponent>? soln, [NotNullWhen(true)] out Solution? solution)
{
if (!Resolve(entity, ref entity.Comp1, logMissing: false))
{
(soln, solution) = (default!, null);
return false;
}

return TryGetSolution((entity.Owner, entity.Comp2), entity.Comp1.SolutionName, out soln, out solution);
}
// imp edit end

#endregion Solution Accessors

#region Solution Modifiers
Expand Down
7 changes: 7 additions & 0 deletions Content.Shared/Chemistry/Reagent/ReagentPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Content.Shared.Body.Prototypes;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Contraband; // imp
using Content.Shared.EntityEffects;
using Content.Shared.Database;
using Content.Shared.FixedPoint;
Expand Down Expand Up @@ -143,6 +144,12 @@ public sealed partial class ReagentPrototype : IPrototype, IInheritingPrototype
[DataField]
public SoundSpecifier FootstepSound = new SoundCollectionSpecifier("FootstepWater", AudioParams.Default.WithVolume(6));

/// <summary>
/// Is this reagent considered contraband? And how severe is it?
/// </summary> Also, this is an imp edit
[DataField]
public ProtoId<ContrabandSeverityPrototype>? Contraband = null;

public FixedPoint2 ReactionTile(TileRef tile, FixedPoint2 reactVolume, IEntityManager entityManager, List<ReagentData>? data)
{
var removed = FixedPoint2.Zero;
Expand Down
6 changes: 6 additions & 0 deletions Content.Shared/Contraband/ContrabandSeverityPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ public sealed partial class ContrabandSeverityPrototype : IPrototype
[IdDataField]
public string ID { get; } = default!;

/// <summary>
/// Color of the ExamineText. Imp edit
/// </summary>
[DataField]
public required string ExamineColor;

/// <summary>
/// Text shown for this severity level when the contraband is examined.
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/Contraband/ContrabandSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ private void OnExamined(Entity<ContrabandComponent> ent, ref ExaminedEvent args)
var list = ContentLocalizationManager.FormatList(ent.Comp.AllowedDepartments.Select(p => Loc.GetString($"department-{p.Id}")).ToList());

// department restricted text
args.PushMarkup(Loc.GetString("contraband-examine-text-Restricted-department", ("departments", list)));
args.PushMarkup(Loc.GetString("contraband-examine-text-Restricted-department", ("color", severity.ExamineColor), ("departments", list))); // imp edit
}
else
{
args.PushMarkup(Loc.GetString(severity.ExamineText));
args.PushMarkup(Loc.GetString(severity.ExamineText, ("color", severity.ExamineColor))); // imp edit
}

// text based on ID card
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
contraband-examine-text-DecapoidEmpire = [color=red]This item is property of the Decapoid Empire![/color]
contraband-examine-text-DecapoidEmpire = [color={$color}]This item is property of the Decapoid Empire![/color]

contraband-examine-text-Tier1 = [color=crimson]This item is Tier 1 Syndicate contraband![/color]
contraband-examine-text-Tier2 = [color=crimson]This item is Tier 2 Syndicate contraband![/color]
contraband-examine-text-Tier3 = [color=crimson]This item is Tier 3 Syndicate contraband![/color]
contraband-examine-text-Tier1 = [color={$color}]This item is Tier 1 Syndicate contraband![/color]
contraband-examine-text-Tier2 = [color={$color}]This item is Tier 2 Syndicate contraband![/color]
contraband-examine-text-Tier3 = [color={$color}]This item is Tier 3 Syndicate contraband![/color]

contraband-examine-text-TierX = [color=purple]This item is Tier X contraband![/color]
contraband-examine-text-TierX = [color={$color}]This item is Tier X contraband![/color]
12 changes: 6 additions & 6 deletions Resources/Locale/en-US/contraband/contraband-severity.ftl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
contraband-examine-text-Minor = [color=yellow]This item is considered minor contraband.[/color]
contraband-examine-text-Restricted = [color=yellow]This item is departmentally restricted.[/color]
contraband-examine-text-Restricted-department = [color=yellow]This item is restricted to {$departments}, and may be considered contraband.[/color]
contraband-examine-text-Major = [color=red]This item is considered major contraband.[/color]
contraband-examine-text-GrandTheft = [color=red]This item is a highly valuable target for Syndicate agents![/color]
contraband-examine-text-Syndicate = [color=crimson]This item is highly illegal Syndicate contraband![/color]
contraband-examine-text-Minor = [color={$color}]This item is considered minor contraband.[/color]
contraband-examine-text-Restricted = [color={$color}]This item is departmentally restricted.[/color]
contraband-examine-text-Restricted-department = [color={$color}]This item is restricted to {$departments}, and may be considered contraband.[/color]
contraband-examine-text-Major = [color={$color}]This item is considered major contraband.[/color]
contraband-examine-text-GrandTheft = [color={$color}]This item is a highly valuable target for Syndicate agents![/color]
contraband-examine-text-Syndicate = [color={$color}]This item is highly illegal Syndicate contraband![/color]

contraband-examine-text-avoid-carrying-around = [color=red][italic]You probably want to avoid having this in your possession without a good reason.[/italic][/color]
contraband-examine-text-in-the-clear = [color=green][italic]You should be in the clear to have possession of this.[/italic][/color]
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@

- type: entity
name: stick of rainbow cannabis butter
parent: FoodBakingBase
parent: [FoodBakingBase, BaseMinorContraband]
id: FoodRainbowCannabisButter
description: Add this to your favorite baked goods for a horrible time.
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
name: death nettle
description: This nettle's out for blood.
id: DeathNettle
parent: ProduceBase
parent: [ProduceBase, BaseMajorContraband]
components:
- type: Sprite
sprite: Objects/Specific/Hydroponics/death_nettle.rsi
Expand Down Expand Up @@ -1712,7 +1712,7 @@

- type: entity
name: fly amanita
parent: FoodProduceBase
parent: [FoodProduceBase, BaseMajorContraband]
id: FoodFlyAmanita
description: A delicious-looking mushroom like you see in those cartoons.
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@

- type: entity
name: amanita jelly
parent: FoodInjectableBase
parent: [FoodInjectableBase, BaseMajorContraband]
id: FoodJellyAmanita
description: It's evil, don't touch it!
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

- type: entity
id: JointRainbow
parent: Joint
parent: [Joint, BaseMinorContraband]
name: joint
suffix: Rainbow
description: A roll of dried plant matter wrapped in thin paper. Seems to be colorful inside.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
id: ForensicPad
name: forensic pad
parent: BaseItem
description: A forensic pad for collecting fingerprints or fibers.
description: A forensic pad for collecting fingerprints, fibers or chemicals.
components:
- type: Item
size: Tiny
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

- type: entity
name: rainbow cannabis leaves
parent: LeavesCannabis
parent: [LeavesCannabis, BaseMinorContraband]
id: LeavesCannabisRainbow
description: "Is it supposed to be glowing like that...?"
components:
Expand Down Expand Up @@ -137,7 +137,7 @@

- type: entity
name: dried rainbow cannabis leaves
parent: LeavesCannabisDried
parent: [LeavesCannabisDried, BaseMinorContraband]
id: LeavesCannabisRainbowDried
description: "Dried rainbow cannabis leaves, ready to be ground."
components:
Expand Down Expand Up @@ -172,7 +172,7 @@

- type: entity
name: ground rainbow cannabis
parent: GroundCannabis
parent: [GroundCannabis, BaseMinorContraband]
id: GroundCannabisRainbow
description: "Ground rainbow cannabis, ready to take you on a trip."
components:
Expand Down
1 change: 1 addition & 0 deletions Resources/Prototypes/Reagents/fun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
physicalDesc: reagent-physical-desc-buzzy
flavor: bee
color: "#FFD35D"
contraband: Minor # imp
tileReactions:
- !type:CreateEntityTileReaction
entity: MobBee
Expand Down
5 changes: 5 additions & 0 deletions Resources/Prototypes/Reagents/narcotics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
color: "#9A040E"
boilingPoint: 212.0
meltingPoint: 170.0
contraband: Tier3Contraband # imp
metabolisms:
Narcotic:
metabolismRate: 1.0
Expand Down Expand Up @@ -255,6 +256,7 @@
physicalDesc: reagent-physical-desc-syrupy
flavor: bitter
color: "#63806e"
contraband: Minor
metabolisms:
Narcotic:
effects:
Expand Down Expand Up @@ -293,6 +295,7 @@
color: "#128e80"
boilingPoint: 444.0
meltingPoint: 128.0
contraband: Tier2Contraband # imp
metabolisms:
Narcotic:
effects:
Expand All @@ -313,6 +316,7 @@
desc: reagent-desc-mute-toxin
physicalDesc: reagent-physical-desc-syrupy
color: "#000000"
contraband: Tier2Contraband # imp
boilingPoint: 255.0
meltingPoint: 36.0
metabolisms:
Expand All @@ -335,6 +339,7 @@
color: "#96a8b5"
boilingPoint: 255.0
meltingPoint: 36.0
contraband: Minor
metabolisms:
Narcotic:
effects:
Expand Down
6 changes: 5 additions & 1 deletion Resources/Prototypes/Reagents/pyrotechnic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
color: "#757245"
boilingPoint: 2977.0 # Aluminum oxide
meltingPoint: 2030.0
contraband: Major # imp
tileReactions:
- !type:FlammableTileReaction
temperatureMultiplier: 2
Expand All @@ -43,6 +44,7 @@
physicalDesc: reagent-physical-desc-soapy
flavor: bitter
color: "#FA00AF"
contraband: Major # imp
tileReactions:
- !type:FlammableTileReaction
temperatureMultiplier: 5
Expand Down Expand Up @@ -72,6 +74,7 @@
physicalDesc: reagent-physical-desc-burning
flavor: bitter
color: "#D4872A"
contraband: Minor # imp
metabolisms:
Poison:
effects:
Expand Down Expand Up @@ -101,6 +104,7 @@
physicalDesc: reagent-physical-desc-blazing
flavor: bitter
color: "#FFC8C8"
contraband: Major # imp
tileReactions:
- !type:PryTileReaction
metabolisms:
Expand Down Expand Up @@ -177,4 +181,4 @@
flavor: bitter
color: "#9e6b38"
boilingPoint: 190.0 # Perfluorooctanoic Acid.
meltingPoint: 45.0
meltingPoint: 45.0
7 changes: 7 additions & 0 deletions Resources/Prototypes/Reagents/toxins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@
desc: reagent-desc-heartbreaker-toxin
physicalDesc: reagent-physical-desc-strong-smelling
color: "#5f959c"
contraband: Major # imp
metabolisms:
Poison:
effects:
Expand All @@ -319,6 +320,7 @@
desc: reagent-desc-lexorin
physicalDesc: reagent-physical-desc-pungent
color: "#6b0007"
contraband: Tier3Contraband # imp
metabolisms:
Poison:
effects:
Expand All @@ -335,6 +337,7 @@
physicalDesc: reagent-physical-desc-opaque
flavor: bitter
color: "#77b58e"
contraband: Minor # imp
plantMetabolism:
- !type:PlantAdjustToxins
amount: 10
Expand Down Expand Up @@ -422,6 +425,7 @@
desc: reagent-desc-amatoxin
physicalDesc: reagent-physical-desc-nondescript
color: "#D6CE7B"
contraband: Major
metabolisms:
Poison:
metabolismRate: 0.2
Expand Down Expand Up @@ -461,6 +465,7 @@
physicalDesc: reagent-physical-desc-necrotic
flavor: bitter
color: "#7e916e"
contraband: Tier3Contraband
worksOnTheDead: true
metabolisms:
Medicine:
Expand Down Expand Up @@ -624,6 +629,7 @@
physicalDesc: reagent-physical-desc-shiny
flavor: medicine
color: "#435166"
contraband: Tier2Contraband # imp
metabolisms:
Poison:
effects:
Expand All @@ -647,6 +653,7 @@
physicalDesc: reagent-physical-desc-metallic
flavor: shocking
color: "#FDD023"
contraband: Tier3Contraband
metabolisms:
Poison:
effects:
Expand Down
Loading
Loading