Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into pr/671
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan committed Dec 24, 2023
2 parents 3514e54 + cd6ef8c commit a8b91ea
Show file tree
Hide file tree
Showing 159 changed files with 48,715 additions and 3,952 deletions.
1 change: 1 addition & 0 deletions Content.Client/Shipyard/UI/ShipyardConsoleMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void PopulateProducts(ShipyardConsoleUiKey uiKey)
ShipyardConsoleUiKey.Security => "Security",
ShipyardConsoleUiKey.BlackMarket => "BlackMarket",
ShipyardConsoleUiKey.Expedition => "Expedition",
ShipyardConsoleUiKey.Scrap => "Scrap",
_ => "Shipyard",
};

Expand Down
30 changes: 20 additions & 10 deletions Content.Client/VendingMachines/UI/VendingMachineMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Reagent;

namespace Content.Client.VendingMachines.UI
{
Expand Down Expand Up @@ -120,26 +122,34 @@ public void Populate(List<VendingMachineInventoryEntry> inventory, float priceMo
cost = (int) (price * priceModifier);
}
else
{
cost = (int) (cost * priceModifier);
}
}

}
else
{
cost = (int) (cost * priceModifier);
}

// This block exists to allow the VendPrice flag to set a vending machine item price.
if (prototype != null && prototype.TryGetComponent<VendPriceComponent>(out var vendPriceComponent))
if (prototype != null && prototype.TryGetComponent<SolutionContainerManagerComponent>(out var priceSolutions))
{
if (vendPriceComponent.Price != 0)
foreach (var solution in priceSolutions.Solutions.Values)
{
var price = (float) vendPriceComponent.Price;
cost = (int) (price);
foreach (var (reagent, quantity) in solution.Contents)
{
if (!_prototypeManager.TryIndex<ReagentPrototype>(reagent.Prototype, out var reagentProto))
continue;

// TODO check ReagentData for price information?
var costReagent = (float) quantity * reagentProto.PricePerUnit;
cost += (int) (costReagent * priceModifier);
}
}
}

// This block exists to allow the VendPrice flag to set a vending machine item price.
if (prototype != null && prototype.TryGetComponent<VendPriceComponent>(out var vendPriceComponent) && vendPriceComponent.Price != 0 && cost <= (float) vendPriceComponent.Price)
{
var price = (float) vendPriceComponent.Price;
cost = (int) price;
}
// This block exists to allow the VendPrice flag to set a vending machine item price.

vendingItem.Text = $"[${cost}] {itemName} [{entry.Amount}]";
Expand Down
12 changes: 0 additions & 12 deletions Content.Server/Cargo/Systems/PricingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,18 +359,6 @@ private double GetStaticPrice(EntityPrototype prototype)
return price;
}

private double GetVendPrice(EntityUid uid)
{
var price = 0.0;

if (TryComp<VendPriceComponent>(uid, out var vendPrice))
{
price += vendPrice.Price;
}

return price;
}

private double GetVendPrice(EntityPrototype prototype)
{
var price = 0.0;
Expand Down
10 changes: 10 additions & 0 deletions Content.Server/Chemistry/ReagentEffects/MakeSentient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Content.Shared.Language.Systems;
using Content.Shared.Mind.Components;
using Robust.Shared.Prototypes;
using Content.Shared.Humanoid; //Delta-V - Banning humanoids from becoming ghost roles.

namespace Content.Server.Chemistry.ReagentEffects;

Expand Down Expand Up @@ -53,6 +54,15 @@ public override void Effect(ReagentEffectArgs args)
return;
}

// Delta-V: Do not allow humanoids to become sentient. Intended to stop people from
// repeatedly cloning themselves and using cognizine on their bodies.
// HumanoidAppearanceComponent is common to all player species, and is also used for the
// Ripley pilot whitelist, so there's a precedent for using it for this kind of check.
if (entityManager.HasComponent<HumanoidAppearanceComponent>(uid))
{
return;
}

ghostRole = entityManager.AddComponent<GhostRoleComponent>(uid);
entityManager.EnsureComponent<GhostTakeoverAvailableComponent>(uid);

Expand Down
34 changes: 34 additions & 0 deletions Content.Server/DeltaV/Nutrition/Events.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace Content.Server.Nutrition;

/// <summary>
/// Raised on a food being sliced.
/// Used by deep frier to apply friedness to slices (e.g. deep fried pizza)
/// </summary>
public sealed class SliceFoodEvent : EntityEventArgs
{
/// <summary>
/// Who did the slicing?
/// <summary>
public EntityUid User;

/// <summary>
/// What has been sliced?
/// <summary>
/// <remarks>
/// This could soon be deleted if there was not enough food left to
/// continue slicing.
/// </remarks>
public EntityUid Food;

/// <summary>
/// What is the slice?
/// <summary>
public EntityUid Slice;

public SliceFoodEvent(EntityUid user, EntityUid food, EntityUid slice)
{
User = user;
Food = food;
Slice = slice;
}
}
93 changes: 30 additions & 63 deletions Content.Server/Nutrition/EntitySystems/SliceableFoodSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Server.Nutrition; // DeltaV
using Content.Server.Nutrition.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Components.SolutionManager;
Expand All @@ -7,16 +8,18 @@
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Robust.Shared.Audio;
//using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.Player;
//using Robust.Shared.Player;

namespace Content.Server.Nutrition.EntitySystems
{
internal sealed class SliceableFoodSystem : EntitySystem
public sealed class SliceableFoodSystem : EntitySystem
{
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -55,28 +58,15 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
return false;
}

var sliceUid = Spawn(component.Slice, transform.Coordinates);
var sliceUid = Slice(uid, user, component, transform);

var lostSolution = _solutionContainerSystem.SplitSolution(uid, solution,
solution.Volume / FixedPoint2.New(component.Count));

// Fill new slice
FillSlice(sliceUid, lostSolution);

var inCont = _containerSystem.IsEntityInContainer(component.Owner);
if (inCont)
{
_handsSystem.PickupOrDrop(user, sliceUid);
}
else
{
var xform = Transform(sliceUid);
_containerSystem.AttachParentToContainerOrGrid((sliceUid, xform));
xform.LocalRotation = 0;
}

SoundSystem.Play(component.Sound.GetSound(), Filter.Pvs(uid),
transform.Coordinates, AudioParams.Default.WithVolume(-2));
_audio.PlayPvs(component.Sound, transform.Coordinates, AudioParams.Default.WithVolume(-2));

// Decrease size of item based on count - Could implement in the future
// Bug with this currently is the size in a container is not updated
Expand All @@ -87,12 +77,6 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,

component.Count--;

//Nyano - Summary: Begin Nyano Code to tell us we've sliced something for Fryer --

var sliceEvent = new SliceFoodEvent(user, usedItem, uid, sliceUid);
RaiseLocalEvent(uid, sliceEvent);
//Nyano - End Nyano Code.

// If someone makes food proto with 1 slice...
if (component.Count < 1)
{
Expand All @@ -104,11 +88,26 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
if (component.Count > 1)
return true;

sliceUid = Spawn(component.Slice, transform.Coordinates);
sliceUid = Slice(uid, user, component, transform);

// Fill last slice with the rest of the solution
FillSlice(sliceUid, solution);

DeleteFood(uid, user);
return true;
}

/// <summary>
/// Create a new slice in the world and returns its entity.
/// The solutions must be set afterwards.
/// </summary>
private EntityUid Slice(EntityUid uid, EntityUid user, SliceableFoodComponent? comp = null, TransformComponent? transform = null) // Frontier - Public to private
{
if (!Resolve(uid, ref comp, ref transform))
return EntityUid.Invalid;

var sliceUid = Spawn(comp.Slice, transform.Coordinates);
var inCont = _containerSystem.IsEntityInContainer(uid);
if (inCont)
{
_handsSystem.PickupOrDrop(user, sliceUid);
Expand All @@ -120,8 +119,12 @@ private bool TrySliceFood(EntityUid uid, EntityUid user, EntityUid usedItem,
xform.LocalRotation = 0;
}

DeleteFood(uid, user);
return true;
// DeltaV - Begin deep frier related code
var sliceEvent = new SliceFoodEvent(user, uid, sliceUid);
RaiseLocalEvent(uid, sliceEvent);
// DeltaV - End deep frier related code

return sliceUid;
}

private void DeleteFood(EntityUid uid, EntityUid user)
Expand Down Expand Up @@ -163,40 +166,4 @@ private void OnExamined(EntityUid uid, SliceableFoodComponent component, Examine
args.PushMarkup(Loc.GetString("sliceable-food-component-on-examine-remaining-slices-text", ("remainingCount", component.Count)));
}
}
//Nyano - Summary: Begin Nyano Code for the sliced food event.
public sealed class SliceFoodEvent : EntityEventArgs
{
/// <summary>
/// Who did the slicing?
/// <summary>
public EntityUid User;

/// <summary>
/// What did the slicing?
/// <summary>
public EntityUid Tool;

/// <summary>
/// What has been sliced?
/// <summary>
/// <remarks>
/// This could soon be deleted if there was not enough food left to
/// continue slicing.
/// </remarks>
public EntityUid Food;

/// <summary>
/// What is the slice?
/// <summary>
public EntityUid Slice;

public SliceFoodEvent(EntityUid user, EntityUid tool, EntityUid food, EntityUid slice)
{
User = user;
Tool = tool;
Food = food;
Slice = slice;
}
}
//End Nyano Code.
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
using Content.Server.Ghost.Roles.Components;
using Content.Server.Kitchen.Components;
using Content.Server.NPC.Components;
using Content.Server.Nutrition;
using Content.Server.Nutrition.Components;
using Content.Server.Nutrition.EntitySystems;
using Content.Server.Paper;
Expand Down Expand Up @@ -62,6 +63,8 @@
using FastAccessors;
using Content.Shared.NPC;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Construction;
//using Robust.Shared.Audio.Systems;

namespace Content.Server.Kitchen.EntitySystems
{
Expand All @@ -86,7 +89,7 @@ public sealed class DeepFryerSystem : EntitySystem
[Dependency] private readonly TemperatureSystem _temperature = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly AmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly MetaDataSystem _meta = default!;
[Dependency] private readonly MetaDataSystem _metaDataSystem = default!;

private static readonly string CookingDamageType = "Heat";
private static readonly float CookingDamageAmount = 10.0f;
Expand Down Expand Up @@ -265,7 +268,7 @@ private void UpdateNextFryTime(EntityUid uid, DeepFryerComponent component)
/// <summary>
/// Make an item look deep-fried.
/// </summary>
private void MakeCrispy(EntityUid item)
public void MakeCrispy(EntityUid item)
{
EnsureComp<AppearanceComponent>(item);
EnsureComp<DeepFriedComponent>(item);
Expand Down Expand Up @@ -512,11 +515,11 @@ private void UpdateDeepFriedName(EntityUid uid, DeepFriedComponent component)
// Already handled at OnInitDeepFried.
break;
case 1:
_meta.SetEntityName(uid, Loc.GetString("deep-fried-fried-item",
_metaDataSystem.SetEntityName(uid, Loc.GetString("deep-fried-crispy-item",
("entity", component.OriginalName)));
break;
default:
_meta.SetEntityName(uid, Loc.GetString("deep-fried-burned-item",
_metaDataSystem.SetEntityName(uid, Loc.GetString("deep-fried-burned-item",
("entity", component.OriginalName)));
break;
}
Expand Down Expand Up @@ -819,8 +822,9 @@ private void OnBeforeActivatableUIOpen(EntityUid uid, DeepFryerComponent compone

private void OnRemoveItem(EntityUid uid, DeepFryerComponent component, DeepFryerRemoveItemMessage args)
{
var removedItem = EntityManager.GetEntity( args.Item );
if (removedItem.Valid) { //JJ Comment - This line should be unnecessary. Some issue is keeping the UI from updating when converting straight to a Burned Mess while the UI is still open. To replicate, put a Raw Meat in the fryer with no oil in it. Wait until it sputters with no effect. It should transform to Burned Mess, but doesn't.
var removedItem = EntityManager.GetEntity(args.Item);
if (removedItem.Valid)
{ //JJ Comment - This line should be unnecessary. Some issue is keeping the UI from updating when converting straight to a Burned Mess while the UI is still open. To replicate, put a Raw Meat in the fryer with no oil in it. Wait until it sputters with no effect. It should transform to Burned Mess, but doesn't.
if (!component.Storage.Remove(removedItem))
return;

Expand Down Expand Up @@ -990,7 +994,7 @@ private void OnInitDeepFried(EntityUid uid, DeepFriedComponent component, Compon
{
var meta = MetaData(uid);
component.OriginalName = meta.EntityName;
_meta.SetEntityName(uid, Loc.GetString("deep-fried-crispy-item", ("entity", meta.EntityName)));
_metaDataSystem.SetEntityName(uid, Loc.GetString("deep-fried-crispy-item", ("entity", meta.EntityName)));
}

private void OnExamineFried(EntityUid uid, DeepFriedComponent component, ExaminedEvent args)
Expand Down
10 changes: 5 additions & 5 deletions Content.Server/Shipyard/Systems/ShipyardSystem.Consoles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private void OnPurchaseMessage(EntityUid uid, ShipyardConsoleComponent component

_accessSystem.TrySetTags(targetId, newAccess, newCap);
}

var deedID = EnsureComp<ShuttleDeedComponent>(targetId);
AssignShuttleDeedProperties(deedID, shuttle.Owner, name, player);

Expand Down Expand Up @@ -401,8 +401,8 @@ private void SendPurchaseMessage(EntityUid uid, EntityUid player, string name, s

if (secret)
{
_radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-docking-secret", ("vessel", name)), channel, uid);
_chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-docking-secret", ("vessel", name)), InGameICChatType.Speak, true);
_radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-docking-secret"), channel, uid);
_chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-docking-secret"), InGameICChatType.Speak, true);
}
else
{
Expand All @@ -417,8 +417,8 @@ private void SendSellMessage(EntityUid uid, EntityUid? player, string name, stri

if (secret)
{
_radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-leaving-secret", ("vessel", name!)), channel, uid);
_chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-leaving-secret", ("vessel", name!)), InGameICChatType.Speak, true);
_radio.SendRadioMessage(uid, Loc.GetString("shipyard-console-leaving-secret"), channel, uid);
_chat.TrySendInGameICMessage(uid, Loc.GetString("shipyard-console-leaving-secret"), InGameICChatType.Speak, true);
}
else
{
Expand Down
Loading

0 comments on commit a8b91ea

Please sign in to comment.