Skip to content

Commit

Permalink
Merge branch 'master' into FSB-Caladrius-(Replacement-Shuttle---Caduc…
Browse files Browse the repository at this point in the history
…eus)
  • Loading branch information
dustylens authored Dec 14, 2024
2 parents 8d2f55f + b499656 commit 7d7cccf
Show file tree
Hide file tree
Showing 128 changed files with 4,715 additions and 1,208 deletions.
4 changes: 4 additions & 0 deletions Content.Server/Botany/Systems/BotanySystem.Seed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Robust.Shared.Random;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Content.Server._NF.Contraband.Systems; // Frontier

namespace Content.Server.Botany.Systems;

Expand All @@ -30,6 +31,7 @@ public sealed partial class BotanySystem : EntitySystem
[Dependency] private readonly MetaDataSystem _metaData = default!;
[Dependency] private readonly FixtureSystem _fixtureSystem = default!;
[Dependency] private readonly RandomHelperSystem _randomHelper = default!;
[Dependency] private readonly ContrabandTurnInSystem _contraband = default!; // Frontier

public override void Initialize()
{
Expand Down Expand Up @@ -101,6 +103,7 @@ private void OnExamined(EntityUid uid, SeedComponent component, ExaminedEvent ar
public EntityUid SpawnSeedPacket(SeedData proto, EntityCoordinates coords, EntityUid user, float? healthOverride = null)
{
var seed = SpawnAtPosition(proto.PacketPrototype, coords); // Frontier: Spawn<SpawnAtPosition
_contraband.ClearContrabandValue(seed); // Frontier
var seedComp = EnsureComp<SeedComponent>(seed);
seedComp.Seed = proto;
seedComp.HealthOverride = healthOverride;
Expand Down Expand Up @@ -160,6 +163,7 @@ public IEnumerable<EntityUid> GenerateProduct(SeedData proto, EntityCoordinates
var product = _robustRandom.Pick(proto.ProductPrototypes);

var entity = SpawnAtPosition(product, position); // Frontier: Spawn<SpawnAtPosition
_contraband.ClearContrabandValue(entity); // Frontier
_randomHelper.RandomOffset(entity, 0.25f);
products.Add(entity);

Expand Down
51 changes: 49 additions & 2 deletions Content.Server/Lathe/LatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
using Robust.Shared.Audio.Systems;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Content.Shared.Cargo.Components; // Frontier
using Content.Server._NF.Contraband.Systems; // Frontier
using Robust.Shared.Containers; // Frontier

namespace Content.Server.Lathe
{
Expand All @@ -51,6 +54,7 @@ public sealed class LatheSystem : SharedLatheSystem
[Dependency] private readonly SharedSolutionContainerSystem _solution = default!;
[Dependency] private readonly StackSystem _stack = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly ContrabandTurnInSystem _contraband = default!; // Frontier

/// <summary>
/// Per-tick cache
Expand All @@ -75,7 +79,7 @@ public override void Initialize()
SubscribeLocalEvent<EmagLatheRecipesComponent, LatheGetRecipesEvent>(GetEmagLatheRecipes);
SubscribeLocalEvent<LatheHeatProducingComponent, LatheStartPrintingEvent>(OnHeatStartPrinting);

//Frontier Upgrade Code Restore
//Frontier: upgradeable parts
SubscribeLocalEvent<LatheComponent, RefreshPartsEvent>(OnPartsRefresh);
SubscribeLocalEvent<LatheComponent, UpgradeExamineEvent>(OnUpgradeExamine);
}
Expand Down Expand Up @@ -234,6 +238,16 @@ public void FinishProducing(EntityUid uid, LatheComponent? comp = null, LathePro
if (comp.CurrentRecipe.Result is { } resultProto)
{
var result = Spawn(resultProto, Transform(uid).Coordinates);

// Frontier: adjust price before merge (stack prices changed once)
if (result.Valid)
{
ModifyPrintedEntityPrice(uid, comp, result);

_contraband.ClearContrabandValue(result);
}
// End Frontier

_stack.TryMergeToContacts(result);
}

Expand Down Expand Up @@ -425,6 +439,39 @@ private void OnUpgradeExamine(EntityUid uid, LatheComponent component, UpgradeEx
args.AddPercentageUpgrade("lathe-component-upgrade-speed", 1 / component.FinalTimeMultiplier);
args.AddPercentageUpgrade("lathe-component-upgrade-material-use", component.FinalMaterialUseMultiplier);
}
// End of modified code

// Frontier: modify item value
private void ModifyPrintedEntityPrice(EntityUid uid, LatheComponent component, EntityUid target)
{
// Cannot reduce value, leave item as-is
if (component.ProductValueModifier == null
|| !float.IsFinite(component.ProductValueModifier.Value)
|| component.ProductValueModifier < 0f)
return;

if (TryComp<StackPriceComponent>(target, out var stackPrice))
{
if (stackPrice.Price > 0)
stackPrice.Price *= component.ProductValueModifier.Value;
}
if (TryComp<StaticPriceComponent>(target, out var staticPrice))
{
if (staticPrice.Price > 0)
staticPrice.Price *= component.ProductValueModifier.Value;
}

// Recurse into contained entities
if (TryComp<ContainerManagerComponent>(target, out var containers))
{
foreach (var container in containers.Containers.Values)
{
foreach (var ent in container.ContainedEntities)
{
ModifyPrintedEntityPrice(uid, component, ent);
}
}
}
}
// End Frontier
}
}
6 changes: 3 additions & 3 deletions Content.Server/Station/Systems/StationSpawningSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public EntityUid SpawnPlayerMob(
{
loadout = new RoleLoadout(jobLoadout);
loadout.SetDefault(profile, _actors.GetSession(entity), _prototypeManager);
loadout.EnsureValid(profile!, session, _dependencyCollection); // Frontier - profile must not be null, but if it was, TryGetValue above should fail
}
}

Expand Down Expand Up @@ -182,8 +183,8 @@ public EntityUid SpawnPlayerMob(

if (loadout != null)
{
/// Frontier: overwriting EquipRoleLoadout
//EquipRoleLoadout(entity.Value, loadout, roleProto!);
// Frontier: overwriting EquipRoleLoadout
var initialBankBalance = profile!.BankBalance; //Frontier
var bankBalance = profile!.BankBalance; //Frontier
bool hasBalance = false; // Frontier
Expand Down Expand Up @@ -254,7 +255,6 @@ public EntityUid SpawnPlayerMob(
break;
}
}
// End Frontier
}

// Frontier: do not re-equip roleLoadout, make sure we equip job startingGear,
Expand All @@ -268,7 +268,7 @@ public EntityUid SpawnPlayerMob(
{
_bank.TryBankWithdraw(session!, prefs!, profile!, initialBankBalance - bankBalance, out var newBalance);
}
// End Frontier
/// End Frontier: overwriting EquipRoleLoadout
}

var gearEquippedEv = new StartingGearEquippedEvent(entity.Value);
Expand Down
4 changes: 4 additions & 0 deletions Content.Server/VendingMachines/VendingMachineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
using Content.Server.Administration.Logs; // Frontier
using Content.Shared.Database; // Frontier
using Content.Shared._NF.Bank.BUI; // Frontier
using Content.Server._NF.Contraband.Systems; // Frontier

namespace Content.Server.VendingMachines
{
Expand All @@ -53,6 +54,7 @@ public sealed class VendingMachineSystem : SharedVendingMachineSystem
[Dependency] private readonly BankSystem _bankSystem = default!; // Frontier
[Dependency] private readonly PopupSystem _popupSystem = default!; // Frontier
[Dependency] private readonly IAdminLogManager _adminLogger = default!; // Frontier
[Dependency] private readonly ContrabandTurnInSystem _contraband = default!; // Frontier

private const float WallVendEjectDistanceFromWall = 1f;

Expand Down Expand Up @@ -507,6 +509,8 @@ private void EjectItem(EntityUid uid, VendingMachineComponent? vendComponent = n

var ent = Spawn(vendComponent.NextItemToEject, spawnCoordinates);

_contraband.ClearContrabandValue(ent); // Frontier

if (vendComponent.ThrowNextItem)
{
var range = vendComponent.NonLimitedEjectRange;
Expand Down
8 changes: 7 additions & 1 deletion Content.Shared/Clothing/LoadoutSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public sealed class LoadoutSystem : EntitySystem
[Dependency] private readonly SharedStationSpawningSystem _station = default!;
[Dependency] private readonly IPrototypeManager _protoMan = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IDependencyCollection _dependencies = default!; // Frontier

public override void Initialize()
{
Expand Down Expand Up @@ -160,7 +161,12 @@ public void Equip(EntityUid uid, List<ProtoId<StartingGearPrototype>>? startingG
var id = _random.Pick(loadoutGroups);
var proto = _protoMan.Index(id);
var loadout = new RoleLoadout(id);
loadout.SetDefault(GetProfile(uid), _actors.GetSession(uid), _protoMan, true);
// Frontier: cache, ensure valid loadouts.
var profile = GetProfile(uid);
var session = _actors.GetSession(uid);
loadout.SetDefault(profile, session, _protoMan, true);
loadout.EnsureValid(profile, session, _dependencies);
// End Frontier
_station.EquipRoleLoadout(uid, loadout, proto);

GearEquipped(uid);
Expand Down
8 changes: 8 additions & 0 deletions Content.Shared/Lathe/LatheComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ public sealed partial class LatheComponent : Component
[DataField]
public float PartRatingMaterialUseMultiplier = DefaultPartRatingMaterialUseMultiplier;
// End Frontier

// Frontier: restored for machine part upgrades
/// <summary>
/// If not null, finite and non-negative, modifies values on spawned items
/// </summary>
[DataField]
public float? ProductValueModifier = 0.3f;
// End Frontier
#endregion
}

Expand Down
4 changes: 4 additions & 0 deletions Content.Shared/Lathe/SharedLatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ private void OnExamined(Entity<LatheComponent> ent, ref ExaminedEvent args)

if (ent.Comp.ReagentOutputSlotId != null)
args.PushMarkup(Loc.GetString("lathe-menu-reagent-slot-examine"));

if (ent.Comp.ProductValueModifier != null) // Frontier
args.PushMarkup(Loc.GetString($"lathe-product-value-modifier", ("modifier", ent.Comp.ProductValueModifier))); // Frontier

}

[PublicAPI]
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Preferences/Loadouts/RoleLoadout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public RoleLoadout Clone()
/// <summary>
/// Ensures all prototypes exist and effects can be applied.
/// </summary>
public void EnsureValid(HumanoidCharacterProfile profile, ICommonSession session, IDependencyCollection collection)
public void EnsureValid(HumanoidCharacterProfile profile, ICommonSession? session, IDependencyCollection collection) // Frontier: nullable session
{
var groupRemove = new ValueList<string>();
var protoManager = collection.Resolve<IPrototypeManager>();
Expand Down
29 changes: 28 additions & 1 deletion Content.Shared/_NF/Contraband/SharedContrabandTurnInSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Content.Shared.Contraband;
using Robust.Shared.Containers;
using Robust.Shared.Serialization;

namespace Content.Shared._NF.Contraband;
Expand All @@ -8,4 +10,29 @@ public enum ContrabandPalletConsoleUiKey : byte
Contraband
}

public abstract class SharedContrabandTurnInSystem : EntitySystem {}
public abstract class SharedContrabandTurnInSystem : EntitySystem
{
public void ClearContrabandValue(EntityUid item)
{
// Clear contraband value for printed items
if (TryComp<ContrabandComponent>(item, out var contraband))
{
foreach (var valueKey in contraband.TurnInValues.Keys)
{
contraband.TurnInValues[valueKey] = 0;
}
}

// Recurse into contained entities
if (TryComp<ContainerManagerComponent>(item, out var containers))
{
foreach (var container in containers.Containers.Values)
{
foreach (var ent in container.ContainedEntities)
{
ClearContrabandValue(ent);
}
}
}
}
}
48 changes: 48 additions & 0 deletions Resources/Changelog/Frontier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5855,3 +5855,51 @@ Entries:
message: Clugg is no longer prompted to return to the cave if leaving.
id: 5578
time: '2024-12-12T01:51:46.0000000+00:00'
- author: Radezolid and Stop-Signs
changes:
- type: Add
message: The syringe gun and mini syringes are now accessible through research.
id: 5579
time: '2024-12-12T17:54:21.0000000+00:00'
- author: lermal
changes:
- type: Fix
message: Fixed MapRenderer rendering for all shuttles
id: 5580
time: '2024-12-13T17:35:18.0000000+00:00'
- author: dvir001
changes:
- type: Fix
message: Fixed a few issues with exped/vgroid configs & maps.
id: 5581
time: '2024-12-13T22:15:43.0000000+00:00'
- author: whatston3
changes:
- type: Fix
message: Clarpy no longer attacks pirates, Clippy no longer attacks pirates.
- type: Tweak
message: The CDET now only targets entities wearing contraband clothing.
- type: Tweak
message: >-
Clugg now has a caveman accent; Clarpy, a pirate accent; Cappy, a
southern accent if cognizined.
id: 5582
time: '2024-12-14T02:06:42.0000000+00:00'
- author: whatston3
changes:
- type: Fix
message: >-
Fixed a case where existing characters can spawn without gear when the
role changes.
id: 5583
time: '2024-12-14T14:00:02.0000000+00:00'
- author: whatston3
changes:
- type: Tweak
message: >-
Grown items, seeds, printed items, and vended items have no contraband
value.
- type: Tweak
message: Items printed from most lathes have a market value of 30%.
id: 5584
time: '2024-12-14T14:01:28.0000000+00:00'
19 changes: 9 additions & 10 deletions Resources/Locale/en-US/_NF/accent/caveman.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ accent-caveman-forbidden-4 = at
accent-caveman-forbidden-5 = am
accent-caveman-forbidden-6 = as
accent-caveman-forbidden-7 = is
accent-caveman-forbidden-8 = it
accent-caveman-forbidden-9 = do
accent-caveman-forbidden-10 = does
accent-caveman-forbidden-11 = did
accent-caveman-forbidden-12 = just
accent-caveman-forbidden-13 = are
accent-caveman-forbidden-14 = was
accent-caveman-forbidden-15 = the
accent-caveman-forbidden-16 = it's
accent-caveman-forbidden-17 = its
accent-caveman-forbidden-8 = do
accent-caveman-forbidden-9 = does
accent-caveman-forbidden-10 = did
accent-caveman-forbidden-11 = just
accent-caveman-forbidden-12 = are
accent-caveman-forbidden-13 = was
accent-caveman-forbidden-14 = the
accent-caveman-forbidden-15 = it's
accent-caveman-forbidden-16 = its
accent-caveman-forbidden-empty = {""}
accent-caveman-numbers-0 = no
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/lathe/ui/lathe-menu.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lathe-product-value-modifier = Printed items sell at [color=red]{NATURALFIXED($modifier, 2)}x[/color] market rate.
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/medical/medicine.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
medicine-label-mannitol-clarpy = Clarpy's dementia pills
3 changes: 3 additions & 0 deletions Resources/Locale/en-US/_NF/reagents/meta/narcotics.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ reagent-desc-rock-dust = A blend of finely pulverized rock minerals suspended in
reagent-name-shroom-mix = shroom mix
reagent-desc-shroom-mix = A blend of cut, chewed and ground partially dried shrooms, suspended in mopwata.
# Missing upstream definition
reagent-name-hyperzine = hyperzine
1 change: 1 addition & 0 deletions Resources/Locale/en-US/deltav/research/technologies.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
research-technology-syringe-gun = Syringe Gun
6 changes: 0 additions & 6 deletions Resources/Maps/_NF/Dungeon/cave_factory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9289,12 +9289,6 @@ entities:
- type: Transform
pos: 25.5,47.5
parent: 1
- proto: MaterialDiamond1
entities:
- uid: 551
components:
- type: Transform
parent: 550
- proto: MedicalBed
entities:
- uid: 1141
Expand Down
2 changes: 1 addition & 1 deletion Resources/Maps/_NF/Dungeon/haunted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ entities:
- type: Transform
pos: 13.526197,27.541958
parent: 1653
- proto: PortableGeneratorJrPacman
- proto: PortableGeneratorJrPacmanShuttle
entities:
- uid: 392
components:
Expand Down
Loading

0 comments on commit 7d7cccf

Please sign in to comment.