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

Up110824 #13

Merged
merged 13 commits into from
Aug 11, 2024
5 changes: 5 additions & 0 deletions Content.Client/PDA/PdaMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@
<ContainerButton Name="StationAlertLevelInstructionsButton">
<RichTextLabel Name="StationAlertLevelInstructions" Access="Public"/>
</ContainerButton>
<!-- Frontier -->
<ContainerButton Name="BalanceButton">
<RichTextLabel Name="BalanceLabel" Access="Public"/>
</ContainerButton>
<ContainerButton Name="ShuttleDeedButton">
<RichTextLabel Name="ShuttleDeedLabel" Access="Public"/>
</ContainerButton>
<!-- End Frontier -->
</BoxContainer>
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="True">
<BoxContainer Orientation="Vertical"
Expand Down
13 changes: 12 additions & 1 deletion Content.Client/PDA/PdaMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public sealed partial class PdaMenu : PdaWindow
private string _instructions = Loc.GetString("comp-pda-ui-unknown");

private string _balance = Loc.GetString("comp-pda-ui-unknown"); // Frontier
private string _shuttleDeed = Loc.GetString("comp-pda-ui-unknown"); // Frontier

private int _currentView;

Expand Down Expand Up @@ -116,10 +117,16 @@ public PdaMenu()
_clipboard.SetText(_alertLevel);
};

BalanceButton.OnPressed += _ => // Frontier
// Frontier
BalanceButton.OnPressed += _ =>
{
_clipboard.SetText(_balance);
};
ShuttleDeedButton.OnPressed += _ =>
{
_clipboard.SetText(_shuttleDeed);
};
// End Frontier

StationTimeButton.OnPressed += _ =>
{
Expand Down Expand Up @@ -171,6 +178,10 @@ public void UpdateState(PdaUpdateState state)
_balance = state.Balance.ToString(); // Frontier
BalanceLabel.SetMarkup(Loc.GetString("comp-pda-ui-balance", ("balance", _balance))); // Frontier

_shuttleDeed = state.OwnedShipName ?? ""; // Frontier
ShuttleDeedLabel.SetMarkup(Loc.GetString("comp-pda-ui-shuttle-deed", ("shipname", _shuttleDeed))); // Frontier
ShuttleDeedLabel.Visible = !string.IsNullOrEmpty(state.OwnedShipName); // Frontier

var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);

StationTimeLabel.SetMarkup(Loc.GetString("comp-pda-ui-station-time",
Expand Down
33 changes: 23 additions & 10 deletions Content.Server/Fluids/EntitySystems/AbsorbentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Content.Server.Popups;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Chemistry.Reagent; // Frontier
using Content.Shared.FixedPoint;
using Content.Shared.Fluids;
using Content.Shared.Fluids.Components;
Expand Down Expand Up @@ -30,6 +31,11 @@ public sealed class AbsorbentSystem : SharedAbsorbentSystem
[Dependency] private readonly UseDelaySystem _useDelay = default!;
[Dependency] private readonly MapSystem _mapSystem = default!;

private static readonly ProtoId<ReagentPrototype> Water = "Water"; // Frontier
private static readonly ProtoId<ReagentPrototype> Holywater = "Holywater"; // Frontier
public static readonly string[] MopFriendlyReagents = [Water, Holywater]; // Frontier: separate list of reagents we consider practical for use in a mop
// Frontier: if updating this list, consider updating PuddleSystem.EvaporationReagents

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -58,13 +64,13 @@ private void UpdateAbsorbent(EntityUid uid, AbsorbentComponent component)
var oldProgress = component.Progress.ShallowClone();
component.Progress.Clear();

var water = solution.GetTotalPrototypeQuantity(PuddleSystem.EvaporationReagents);
var water = solution.GetTotalPrototypeQuantity(MopFriendlyReagents); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents
if (water > FixedPoint2.Zero)
{
component.Progress[solution.GetColorWithOnly(_prototype, PuddleSystem.EvaporationReagents)] = water.Float();
component.Progress[solution.GetColorWithOnly(_prototype, MopFriendlyReagents)] = water.Float(); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents
}

var otherColor = solution.GetColorWithout(_prototype, PuddleSystem.EvaporationReagents);
var otherColor = solution.GetColorWithout(_prototype, MopFriendlyReagents); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents
var other = (solution.Volume - water).Float();

if (other > 0f)
Expand Down Expand Up @@ -181,7 +187,7 @@ private bool TryTransferFromAbsorbentToRefillable(
}

// Prioritize transferring non-evaporatives if absorbent has any
var contaminants = _solutionContainerSystem.SplitSolutionWithout(absorbentSoln, transferAmount, PuddleSystem.EvaporationReagents);
var contaminants = _solutionContainerSystem.SplitSolutionWithout(absorbentSoln, transferAmount, MopFriendlyReagents); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents
if (contaminants.Volume > 0)
{
_solutionContainerSystem.TryAddSolution(refillableSoln, contaminants);
Expand All @@ -206,7 +212,7 @@ private bool TryTwoWayAbsorbentRefillableTransfer(
Entity<SolutionComponent> absorbentSoln,
Entity<SolutionComponent> refillableSoln)
{
var contaminantsFromAbsorbent = _solutionContainerSystem.SplitSolutionWithout(absorbentSoln, component.PickupAmount, PuddleSystem.EvaporationReagents);
var contaminantsFromAbsorbent = _solutionContainerSystem.SplitSolutionWithout(absorbentSoln, component.PickupAmount, MopFriendlyReagents); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents

var absorbentSolution = absorbentSoln.Comp.Solution;
if (contaminantsFromAbsorbent.Volume == FixedPoint2.Zero && absorbentSolution.AvailableVolume == FixedPoint2.Zero)
Expand All @@ -223,7 +229,7 @@ private bool TryTwoWayAbsorbentRefillableTransfer(
absorbentSolution.AvailableVolume;

var refillableSolution = refillableSoln.Comp.Solution;
var waterFromRefillable = refillableSolution.SplitSolutionWithOnly(waterPulled, PuddleSystem.EvaporationReagents);
var waterFromRefillable = refillableSolution.SplitSolutionWithOnly(waterPulled, MopFriendlyReagents); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents
_solutionContainerSystem.UpdateChemicals(refillableSoln);

if (waterFromRefillable.Volume == FixedPoint2.Zero && contaminantsFromAbsorbent.Volume == FixedPoint2.Zero)
Expand Down Expand Up @@ -277,15 +283,15 @@ private bool TryPuddleInteract(EntityUid user, EntityUid used, EntityUid target,
return false;

// Check if the puddle has any non-evaporative reagents
if (_puddleSystem.CanFullyEvaporate(puddleSolution))
if (IsMoppable(puddleSolution)) // Frontier: _puddleSystem.CanFullyEvaporate<IsMoppable
{
_popups.PopupEntity(Loc.GetString("mopping-system-puddle-evaporate", ("target", target)), user, user);
return true;
}

// Check if we have any evaporative reagents on our absorber to transfer
var absorberSolution = absorberSoln.Comp.Solution;
var available = absorberSolution.GetTotalPrototypeQuantity(PuddleSystem.EvaporationReagents);
var available = absorberSolution.GetTotalPrototypeQuantity(MopFriendlyReagents); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents

// No material
if (available == FixedPoint2.Zero)
Expand All @@ -297,8 +303,8 @@ private bool TryPuddleInteract(EntityUid user, EntityUid used, EntityUid target,
var transferMax = absorber.PickupAmount;
var transferAmount = available > transferMax ? transferMax : available;

var puddleSplit = puddleSolution.SplitSolutionWithout(transferAmount, PuddleSystem.EvaporationReagents);
var absorberSplit = absorberSolution.SplitSolutionWithOnly(puddleSplit.Volume, PuddleSystem.EvaporationReagents);
var puddleSplit = puddleSolution.SplitSolutionWithout(transferAmount, MopFriendlyReagents); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents
var absorberSplit = absorberSolution.SplitSolutionWithOnly(puddleSplit.Volume, MopFriendlyReagents); // Frontier: PuddleSystem.EvaporationReagents<MopFriendlyReagents

// Do tile reactions first
var transform = Transform(target);
Expand All @@ -325,4 +331,11 @@ private bool TryPuddleInteract(EntityUid user, EntityUid used, EntityUid target,

return true;
}

// Frontier: separate check from CanFullyEvaporate against mop-friendly reagents
public bool IsMoppable(Solution solution)
{
return solution.GetTotalPrototypeQuantity(MopFriendlyReagents) == solution.Volume;
}
// End Frontier
}
6 changes: 6 additions & 0 deletions Content.Server/PDA/PdaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
using Robust.Shared.Player;
using Robust.Shared.Utility;
using Content.Shared.Bank.Components; // Frontier
using Content.Shared.Shipyard.Components; // Frontier
using Content.Server.Shipyard.Systems; // Frontier

namespace Content.Server.PDA
{
Expand Down Expand Up @@ -171,6 +173,9 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null, EntityUid? acto
var balance = 0; // frontier
if (actor_uid != null && TryComp<BankAccountComponent>(actor_uid, out var account)) // frontier
balance = account.Balance; // frontier
var ownedShipName = ""; // Frontier
if (TryComp<ShuttleDeedComponent>(pda.ContainedId, out var shuttleDeedComp)) // Frontier
ownedShipName = ShipyardSystem.GetFullName(shuttleDeedComp); // Frontier
var state = new PdaUpdateState(
programs,
GetNetEntity(loader.ActiveProgram),
Expand All @@ -187,6 +192,7 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null, EntityUid? acto
StationAlertColor = pda.StationAlertColor
},
balance, // Frontier
ownedShipName, // Frontier
pda.StationName,
showUplink,
hasInstrument,
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 @@ -320,7 +320,7 @@ public bool TrySign(EntityUid paper, EntityUid signer, EntityUid pen, PaperCompo
info.StampedColor = crayon.Color;

// Try stamp with the info, return false if failed.
if (!StampDelayed(pen) && TryStamp(paper, info, "paper_stamp-generic", paperComp)) // Frontier: add !StampDelayed(pen)
if (!StampDelayed(pen) && TryStamp(paper, info, "paper_stamp-nf-signature", paperComp)) // Frontier: add !StampDelayed(pen)
{
// Signing successful, popup time.
_popupSystem.PopupEntity(
Expand Down
24 changes: 24 additions & 0 deletions Content.Server/Shipyard/Systems/ShuttleDeedSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Content.Shared.Shipyard.Components;
using Content.Shared.Examine;
using Content.Server.Shipyard.Systems;

namespace Content.Shared.Shipyard;

public sealed partial class ShuttleDeedSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ShuttleDeedComponent, ExaminedEvent>(OnExamined);
}

private void OnExamined(Entity<ShuttleDeedComponent> ent, ref ExaminedEvent args)
{
var comp = ent.Comp;
if (!string.IsNullOrEmpty(comp.ShuttleName))
{
var fullName = ShipyardSystem.GetFullName(comp);
args.PushMarkup(Loc.GetString("shuttle-deed-examine-text", ("shipname", fullName)));
}
}
}
25 changes: 13 additions & 12 deletions Content.Server/Spider/SpiderSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@
using Content.Shared.Maps;
using Robust.Server.GameObjects;
using Robust.Shared.Map;
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Nutrition.Components;

namespace Content.Server.Spider;

public sealed class SpiderSystem : SharedSpiderSystem
{
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly HungerSystem _hungerSystem = default!;

public override void Initialize()
{
Expand All @@ -25,13 +22,6 @@ private void OnSpawnNet(EntityUid uid, SpiderComponent component, SpiderWebActio
if (args.Handled)
return;

if (TryComp<HungerComponent>(uid, out var hungerComp)
&& _hungerSystem.IsHungerBelowState(uid, HungerThreshold.Okay, hungerComp.CurrentHunger - 5, hungerComp))
{
_popup.PopupEntity(Loc.GetString("sericulture-failure-hunger"), args.Performer, args.Performer);
return;
}

var transform = Transform(uid);

if (transform.GridUid == null)
Expand All @@ -52,10 +42,22 @@ private void OnSpawnNet(EntityUid uid, SpiderComponent component, SpiderWebActio
result = true;
}

// Spawn web in other directions
for (var i = 0; i < 4; i++)
{
var direction = (DirectionFlag) (1 << i);
coords = transform.Coordinates.Offset(direction.AsDir().ToVec());

if (!IsTileBlockedByWeb(coords))
{
Spawn(component.WebPrototype, coords);
result = true;
}
}

if (result)
{
_popup.PopupEntity(Loc.GetString("spider-web-action-success"), args.Performer, args.Performer);
_hungerSystem.ModifyHunger(uid, -5);
args.Handled = true;
}
else
Expand All @@ -72,4 +74,3 @@ private bool IsTileBlockedByWeb(EntityCoordinates coords)
return false;
}
}

36 changes: 30 additions & 6 deletions Content.Server/Station/Systems/StationJobsSystem.Roundstart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,19 +299,43 @@ public void AssignOverflowJobs(

_random.Shuffle(givenStations);

// Frontier: get player session
_playerManager.TryGetSessionById(player, out var nfSession);
// End Frontier

foreach (var station in givenStations)
{
// Pick a random overflow job from that station
var overflows = GetOverflowJobs(station).ToList();
_random.Shuffle(overflows);

// Stations with no overflow slots should simply get skipped over.
if (overflows.Count == 0)
continue;
// Frontier: check job requirements on overflow jobs
bool nfJobAssigned = false;
foreach (var overflowJob in overflows)
{
if (nfSession != null && _playTime.IsAllowed(nfSession, overflowJob))
{
assignedJobs.Add(player, (overflowJob, station));
nfJobAssigned = true;
break;
}
}
// No need to look at other stations, we have a job.
if (nfJobAssigned)
{
break;
}
// End Frontier

// Frontier: commented out the implementation below
// // Stations with no overflow slots should simply get skipped over.
// if (overflows.Count == 0)
// continue;

// If the overflow exists, put them in as it.
assignedJobs.Add(player, (overflows[0], givenStations[0]));
break;
// // If the overflow exists, put them in as it.
// assignedJobs.Add(player, (overflows[0], givenStations[0]));
// break;
// End Frontier
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions Content.Server/_NF/ArachnidChaos/ArachnidChaosComponent.cs

This file was deleted.

Loading
Loading