Skip to content

Commit

Permalink
Merge remote-tracking branch 'space-wizards/master' into upstream-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
irismessage committed Sep 9, 2024
2 parents 8ae5921 + 6fb5ad5 commit 48af56d
Show file tree
Hide file tree
Showing 161 changed files with 40,778 additions and 24,188 deletions.
11 changes: 4 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<!--
Impstation note: there's no need to read all the official contributing guidelines, but please DON'T combine upstream changes with your own changes. Make separate pull requests for separate changes.
-->
<!-- Please read these guidelines before opening your PR: https://docs.spacestation14.io/en/getting-started/pr-guideline -->
<!-- The text between the arrows are comments - they will not be visible on your PR. -->
<!-- Guidelines: https://docs.spacestation14.io/en/getting-started/pr-guideline -->

**Changelog**
<!-- Impstation note: we have our own AUTOMATIC changelog now, so please DO use this section! -->
<!-- Add a Changelog entry to make players aware of new features or changes that could affect gameplay.
Make sure to read the guidelines and take this Changelog template out of the comment block in order for it to show up.
Changelog must have a :cl: symbol, so the bot recognizes the changes and adds them to the game's changelog. -->
<!--
Make players aware of new features and changes that could affect how they play the game by adding a Changelog entry. Please read the Changelog guidelines located at: https://docs.spacestation14.io/en/getting-started/pr-guideline#changelog
-->

<!--
Make sure to take this Changelog template out of the comment block in order for it to show up. Changelog must have a :cl: symbol, so the bot recognizes the changes and adds them to the game's changelog.
:cl:
- add: Added fun!
- remove: Removed fun!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Content.Shared.Nutrition.Components;
using Content.Shared.Nutrition.EntitySystems;
using Robust.Client.GameObjects;
using Robust.Shared.Utility;

namespace Content.Client.Nutrition.EntitySystems;

Expand Down Expand Up @@ -50,6 +49,7 @@ private void UpdateFoodVisuals(Entity<FoodSequenceStartPointComponent> start, Sp
sprite.AddBlankLayer(index);
sprite.LayerMapSet(keyCode, index);
sprite.LayerSetSprite(index, state.Sprite);
sprite.LayerSetScale(index, state.Scale);

//Offset the layer
var layerPos = start.Comp.StartPosition;
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Power/APC/ApcBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public ApcBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
protected override void Open()
{
base.Open();

_menu = this.CreateWindow<ApcMenu>();
_menu.SetEntity(Owner);
_menu.OnBreaker += BreakerPressed;
}

Expand Down
2 changes: 1 addition & 1 deletion Content.Server/Atmos/EntitySystems/FlammableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public void SetFireStacks(EntityUid uid, float stacks, FlammableComponent? flamm
}
else
{
flammable.OnFire = ignite;
flammable.OnFire |= ignite;
UpdateAppearance(uid, flammable);
}
}
Expand Down
1 change: 1 addition & 0 deletions Content.Server/Entry/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Content.Server.IoC;
using Content.Server.Maps;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.Objectives;
using Content.Server.Players;
using Content.Server.Players.JobWhitelist;
using Content.Server.Players.PlayTimeTracking;
Expand Down
1 change: 1 addition & 0 deletions Content.Server/IoC/ServerContentIoC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Content.Server.Maps;
using Content.Server.MoMMI;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.Objectives;
using Content.Server.Players;
using Content.Server.Players.JobWhitelist;
using Content.Server.Players.PlayTimeTracking;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Materials;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;

namespace Content.Server.Materials.Components;

/// <summary>
/// This is used for a machine that turns produce into a specified material.
/// </summary>
[RegisterComponent, Access(typeof(ProduceMaterialExtractorSystem))]
public sealed partial class ProduceMaterialExtractorComponent : Component
{
/// <summary>
/// The material that produce is converted into
/// </summary>
[DataField]
public ProtoId<MaterialPrototype> ExtractedMaterial = "Biomass";

/// <summary>
/// List of reagents that determines how much material is yielded from a produce.
/// </summary>
[DataField]
public List<ProtoId<ReagentPrototype>> ExtractionReagents = new()
{
"Nutriment"
};

[DataField]
public SoundSpecifier? ExtractSound = new SoundPathSpecifier("/Audio/Effects/waterswirl.ogg");
}
17 changes: 15 additions & 2 deletions Content.Server/Materials/MaterialReclaimerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,22 @@ private void SpawnChemicalsFromComposition(EntityUid reclaimer,
}

// if the item we inserted has reagents, add it in.
if (_solutionContainer.TryGetDrainableSolution(item, out _, out var drainableSolution))

if (reclaimerComponent.OnlyReclaimDrainable)
{
// Are we a recycler? Only use drainable solution.
if (_solutionContainer.TryGetDrainableSolution(item, out _, out var drainableSolution))
{
totalChemicals.AddSolution(drainableSolution, _prototype);
}
}
else
{
totalChemicals.AddSolution(drainableSolution, _prototype);
// Are we an industrial reagent grinder? Use extractable solution.
if (_solutionContainer.TryGetExtractableSolution(item, out _, out var extractableSolution))
{
totalChemicals.AddSolution(extractableSolution, _prototype);
}
}

if (!_solutionContainer.TryGetSolution(reclaimer, reclaimerComponent.SolutionContainerId, out var outputSolution) ||
Expand Down
48 changes: 48 additions & 0 deletions Content.Server/Materials/ProduceMaterialExtractorSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Linq;
using Content.Server.Botany.Components;
using Content.Server.Materials.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Interaction;
using Robust.Server.Audio;

namespace Content.Server.Materials;

public sealed class ProduceMaterialExtractorSystem : EntitySystem
{
[Dependency] private readonly AudioSystem _audio = default!;
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;

/// <inheritdoc/>
public override void Initialize()
{
SubscribeLocalEvent<ProduceMaterialExtractorComponent, AfterInteractUsingEvent>(OnInteractUsing);
}

private void OnInteractUsing(Entity<ProduceMaterialExtractorComponent> ent, ref AfterInteractUsingEvent args)
{
if (args.Handled)
return;

if (!this.IsPowered(ent, EntityManager))
return;

if (!TryComp<ProduceComponent>(args.Used, out var produce))
return;

if (!_solutionContainer.TryGetSolution(args.Used, produce.SolutionName, out var solution))
return;

// Can produce even have fractional amounts? Does it matter if they do?
// Questions man was never meant to answer.
var matAmount = solution.Value.Comp.Solution.Contents
.Where(r => ent.Comp.ExtractionReagents.Contains(r.Reagent.Prototype))
.Sum(r => r.Quantity.Float());
_materialStorage.TryChangeMaterialAmount(ent, ent.Comp.ExtractedMaterial, (int) matAmount);

_audio.PlayPvs(ent.Comp.ExtractSound, ent);
QueueDel(args.Used);
args.Handled = true;
}
}
Loading

0 comments on commit 48af56d

Please sign in to comment.