Skip to content

Commit

Permalink
Revert хуеты из моего ПРа и реворк ее (#168)
Browse files Browse the repository at this point in the history
* Revert "Увеличена ёмкость СМЭС и подстанций"

This reverts commit 895fc10.

* Reverse

Signed-off-by: JDtrimble <[email protected]>

* Подредачил систему рандомизации лута в торгоматах. Посмотрим как выйдет

Signed-off-by: JDtrimble <[email protected]>

* Вернул изменение СМЭСов, которое не повлияет на злосчастный фронтир

---------

Signed-off-by: JDtrimble <[email protected]>
  • Loading branch information
pxc1984 authored Jul 3, 2024
1 parent 7eb919b commit d9ee46f
Show file tree
Hide file tree
Showing 55 changed files with 542 additions and 479 deletions.
50 changes: 40 additions & 10 deletions Content.Shared/VendingMachines/SharedVendingMachineSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Content.Shared.Emag.Components;
using Robust.Shared.Prototypes;
using System.Linq;
using Content.Shared.DoAfter;
using Content.Shared.Emag.Components;
using Content.Shared.Interaction;
using Content.Shared.Popups;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;

namespace Content.Shared.VendingMachines;
Expand All @@ -19,6 +19,7 @@ public abstract partial class SharedVendingMachineSystem : EntitySystem
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] protected readonly SharedPopupSystem Popup = default!;
[Dependency] protected readonly IRobustRandom Randomizer = default!;
[Dependency] protected readonly ISharedPlayerManager SharedPlayerSystem = default!;

public override void Initialize()
{
Expand All @@ -33,7 +34,8 @@ protected virtual void OnComponentInit(EntityUid uid, VendingMachineComponent co
}

public void RestockInventoryFromPrototype(EntityUid uid,
VendingMachineComponent? component = null, float restockQuality = 1f)
VendingMachineComponent? component = null,
float restockQuality = 1f)
{
if (!Resolve(uid, ref component))
{
Expand All @@ -43,9 +45,30 @@ public void RestockInventoryFromPrototype(EntityUid uid,
if (!PrototypeManager.TryIndex(component.PackPrototypeId, out VendingMachineInventoryPrototype? packPrototype))
return;

AddInventoryFromPrototype(uid, packPrototype.StartingInventory, InventoryType.Regular, component, restockQuality);
AddInventoryFromPrototype(uid, packPrototype.EmaggedInventory, InventoryType.Emagged, component, restockQuality);
AddInventoryFromPrototype(uid, packPrototype.ContrabandInventory, InventoryType.Contraband, component, restockQuality);
FillPlayerCount(component);

AddInventoryFromPrototype(uid,
packPrototype.StartingInventory,
InventoryType.Regular,
component,
restockQuality);
AddInventoryFromPrototype(uid,
packPrototype.EmaggedInventory,
InventoryType.Emagged,
component,
restockQuality);
AddInventoryFromPrototype(uid,
packPrototype.ContrabandInventory,
InventoryType.Contraband,
component,
restockQuality);
}

private void FillPlayerCount(VendingMachineComponent component)
{
if (component.StartingPlayerCount != 0)
return;
component.StartingPlayerCount = SharedPlayerSystem.GetAllPlayerData().Count();
}

/// <summary>
Expand All @@ -72,17 +95,20 @@ public List<VendingMachineInventoryEntry> GetAllInventory(EntityUid uid, Vending
return inventory;
}

public List<VendingMachineInventoryEntry> GetAvailableInventory(EntityUid uid, VendingMachineComponent? component = null)
public List<VendingMachineInventoryEntry> GetAvailableInventory(EntityUid uid,
VendingMachineComponent? component = null)
{
if (!Resolve(uid, ref component))
return new();

return GetAllInventory(uid, component).Where(_ => _.Amount > 0).ToList();
}

private void AddInventoryFromPrototype(EntityUid uid, Dictionary<string, uint>? entries,
private void AddInventoryFromPrototype(EntityUid uid,
Dictionary<string, uint>? entries,
InventoryType type,
VendingMachineComponent? component = null, float restockQuality = 1.0f)
VendingMachineComponent? component = null,
float restockQuality = 1.0f)
{
if (!Resolve(uid, ref component) || entries == null)
{
Expand Down Expand Up @@ -118,6 +144,10 @@ private void AddInventoryFromPrototype(EntityUid uid, Dictionary<string, uint>?
restock = (uint) Math.Floor(amount * result / chanceOfMissingStock);
}

// Sunrise-start
restock = (uint) Math.Floor(amount + component.StartingPlayerCount * component.PlayerCountModifier);
// Sunrise-end

if (inventory.TryGetValue(id, out var entry))
// Prevent a machine's stock from going over three times
// the prototype's normal amount. This is an arbitrary
Expand Down
21 changes: 19 additions & 2 deletions Content.Shared/VendingMachines/VendingMachineComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Component = Robust.Shared.GameObjects.Component;

namespace Content.Shared.VendingMachines
{
Expand All @@ -14,7 +15,9 @@ public sealed partial class VendingMachineComponent : Component
/// <summary>
/// PrototypeID for the vending machine's inventory, see <see cref="VendingMachineInventoryPrototype"/>
/// </summary>
[DataField("pack", customTypeSerializer: typeof(PrototypeIdSerializer<VendingMachineInventoryPrototype>), required: true)]
[DataField("pack",
customTypeSerializer: typeof(PrototypeIdSerializer<VendingMachineInventoryPrototype>),
required: true)]
public string PackPrototypeId = string.Empty;

/// <summary>
Expand Down Expand Up @@ -136,6 +139,7 @@ public sealed partial class VendingMachineComponent : Component
public TimeSpan NextEmpEject = TimeSpan.Zero;

#region Client Visuals

/// <summary>
/// RSI state for when the vending machine is unpowered.
/// Will be displayed on the layer <see cref="VendingMachineVisualLayers.Base"/>
Expand Down Expand Up @@ -186,18 +190,30 @@ public sealed partial class VendingMachineComponent : Component
/// </summary>
[DataField("loopDeny")]
public bool LoopDenyAnimation = true;

#endregion

// Sunrise-start
[DataField("startingPlayerCount")]
public int StartingPlayerCount = 0;

[DataField("playerCountModifier")]
public double PlayerCountModifier = 0.1; // +1 предмет за 10 онлайна на момент создания автомата
// Sunrise-end
}

[Serializable, NetSerializable]
public sealed class VendingMachineInventoryEntry
{
[ViewVariables(VVAccess.ReadWrite)]
public InventoryType Type;

[ViewVariables(VVAccess.ReadWrite)]
public string ID;

[ViewVariables(VVAccess.ReadWrite)]
public uint Amount;

public VendingMachineInventoryEntry(InventoryType type, string id, uint amount)
{
Type = type;
Expand Down Expand Up @@ -236,10 +252,12 @@ public enum VendingMachineVisualLayers : byte
/// Off / Broken. The other layers will overlay this if the machine is on.
/// </summary>
Base,

/// <summary>
/// Normal / Deny / Eject
/// </summary>
BaseUnshaded,

/// <summary>
/// Screens that are persistent (where the machine is not off or broken)
/// </summary>
Expand All @@ -261,6 +279,5 @@ public enum EjectWireKey : byte

public sealed partial class VendingMachineSelfDispenseEvent : InstantActionEvent
{

};
}
4 changes: 2 additions & 2 deletions Resources/Maps/_Sunrise/Station/box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141210,7 +141210,7 @@ entities:
- type: Transform
pos: -3.5,51.5
parent: 8364
- proto: SMESBasic
- proto: SMESExtended
entities:
- uid: 865
components:
Expand Down Expand Up @@ -144069,7 +144069,7 @@ entities:
- type: Transform
pos: 62.5,-33.5
parent: 8364
- proto: SubstationBasic
- proto: SubstationExtended
entities:
- uid: 1666
components:
Expand Down
4 changes: 2 additions & 2 deletions Resources/Maps/_Sunrise/Station/centcomm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33039,7 +33039,7 @@ entities:
rot: 1.5707963267948966 rad
pos: 19.5,-24.5
parent: 1668
- proto: SMESBasic
- proto: SMESExtended
entities:
- uid: 327
components:
Expand Down Expand Up @@ -33254,7 +33254,7 @@ entities:
- type: Transform
pos: 4.4667654,19.499214
parent: 1668
- proto: SubstationBasic
- proto: SubstationExtended
entities:
- uid: 1130
components:
Expand Down
4 changes: 2 additions & 2 deletions Resources/Maps/_Sunrise/Station/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66519,7 +66519,7 @@ entities:
- type: Transform
pos: 18.5,-0.5
parent: 1
- proto: SMESBasic
- proto: SMESExtended
entities:
- uid: 1097
components:
Expand Down Expand Up @@ -67724,7 +67724,7 @@ entities:
- type: Transform
pos: 19.622953,15.5812435
parent: 1
- proto: SubstationBasic
- proto: SubstationExtended
entities:
- uid: 1469
components:
Expand Down
4 changes: 2 additions & 2 deletions Resources/Maps/_Sunrise/Station/delta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223940,7 +223940,7 @@ entities:
- type: Transform
pos: -29.5,44.5
parent: 13307
- proto: SMESBasic
- proto: SMESExtended
entities:
- uid: 232
components:
Expand Down Expand Up @@ -228562,7 +228562,7 @@ entities:
- type: Transform
pos: 11.549865,-31.462252
parent: 13307
- proto: SubstationBasic
- proto: SubstationExtended
entities:
- uid: 1486
components:
Expand Down
4 changes: 2 additions & 2 deletions Resources/Maps/_Sunrise/Station/fland.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184376,7 +184376,7 @@ entities:
- type: Transform
pos: 32.5,42.5
parent: 13329
- proto: SMESBasic
- proto: SMESExtended
entities:
- uid: 3711
components:
Expand Down Expand Up @@ -188844,7 +188844,7 @@ entities:
- type: Transform
pos: 41.39552,9.469629
parent: 13329
- proto: SubstationBasic
- proto: SubstationExtended
entities:
- uid: 2337
components:
Expand Down
4 changes: 2 additions & 2 deletions Resources/Maps/_Sunrise/Station/marathon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115324,7 +115324,7 @@ entities:
- type: Transform
pos: -10.5,-9.5
parent: 30
- proto: SMESBasic
- proto: SMESExtended
entities:
- uid: 5472
components:
Expand Down Expand Up @@ -118001,7 +118001,7 @@ entities:
- type: ContainerContainer
containers:
cell_slot: !type:ContainerSlot {}
- proto: SubstationBasic
- proto: SubstationExtended
entities:
- uid: 1414
components:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
- type: vendingMachineInventory
id: AtmosDrobeInventory
startingInventory:
ClothingBackpackDuffelAtmospherics: 6 # Sunrise-edit
ClothingBackpackSatchelAtmospherics: 6 # Sunrise-edit
ClothingBackpackAtmospherics: 6 # Sunrise-edit
ClothingUniformJumpsuitAtmos: 5 # Sunrise-edit
ClothingUniformJumpskirtAtmos: 5 # Sunrise-edit
ClothingUniformJumpsuitAtmosCasual: 5 # Sunrise-edit
ClothingShoesColorWhite: 5 # Sunrise-edit
ClothingHeadsetEngineering: 4 # Sunrise-edit
ClothingHeadHelmetFire: 4 # Sunrise-edit
ClothingOuterSuitFire: 4 # Sunrise-edit
ClothingOuterWinterAtmos: 4 # Sunrise-edit
ClothingNeckScarfStripedLightBlue: 6 # Sunrise-edit
ClothingBackpackDuffelAtmospherics: 2
ClothingBackpackSatchelAtmospherics: 2
ClothingBackpackAtmospherics: 2
ClothingUniformJumpsuitAtmos: 3
ClothingUniformJumpskirtAtmos: 3
ClothingUniformJumpsuitAtmosCasual: 3
ClothingShoesColorWhite: 3
ClothingHeadsetEngineering: 2
ClothingHeadHelmetFire: 2
ClothingOuterSuitFire: 2
ClothingOuterWinterAtmos: 2
ClothingNeckScarfStripedLightBlue: 3
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
- type: vendingMachineInventory
id: BarDrobeInventory
startingInventory:
ClothingHeadHatBowlerHat: 4 # Sunrise-edit
ClothingHeadHatTophat: 4 # Sunrise-edit
ClothingEyesHudBeer: 3 # Sunrise-edit
ClothingEyesEyepatchHudBeer: 3 # Sunrise-edit
ClothingHeadsetService: 5 # Sunrise-edit
ClothingOuterApronBar: 4 # Sunrise-edit
ClothingOuterWinterBar: 4 # Sunrise-edit
ClothingUniformJumpsuitBartender: 4 # Sunrise-edit
ClothingUniformJumpskirtBartender: 4 # Sunrise-edit
ClothingUniformJumpsuitBartenderPurple: 4 # Sunrise-edit
ClothingShoesColorBlack: 4 # Sunrise-edit
ClothingOuterArmorBasicSlim: 4 # Sunrise-edit
ClothingOuterVest: 4 # Sunrise-edit
ClothingBeltBandolier: 4 # Sunrise-edit
ClothingEyesGlassesSunglasses: 4 # Sunrise-edit
ClothingHeadHatBowlerHat: 2
ClothingHeadHatTophat: 2
ClothingEyesHudBeer: 2
ClothingEyesEyepatchHudBeer: 2
ClothingHeadsetService: 2
ClothingOuterApronBar: 2
ClothingOuterWinterBar: 2
ClothingUniformJumpsuitBartender: 2
ClothingUniformJumpskirtBartender: 2
ClothingUniformJumpsuitBartenderPurple: 2
ClothingShoesColorBlack: 2
ClothingOuterArmorBasicSlim: 2
ClothingOuterVest: 2
ClothingBeltBandolier: 2
ClothingEyesGlassesSunglasses: 2

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
- type: vendingMachineInventory
id: CargoDrobeInventory
startingInventory:
ClothingBackpackCargo: 6 # Sunrise-edit
ClothingBackpackSatchelCargo: 6 # Sunrise-edit
ClothingBackpackDuffelCargo: 6 # Sunrise-edit
ClothingUniformJumpsuitCargo: 5 # Sunrise-edit
ClothingUniformJumpskirtCargo: 5 # Sunrise-edit
ClothingShoesColorBlack: 5 # Sunrise-edit
ClothingHandsGlovesFingerless: 6 # Sunrise-edit
ClothingHeadHatCargosoft: 6 # Sunrise-edit
ClothingHeadBandBrown: 6 # Sunrise-edit
ClothingHeadsetCargo: 9 # Sunrise-edit
ClothingOuterWinterCargo: 4 # Sunrise-edit
ClothingOuterWinterMiner: 4 # Sunrise-edit
ClothingNeckScarfStripedBrown: 6 # Sunrise-edit
ClothingShoesBootsWinterCargo: 4 # Sunrise-edit
ClothingBackpackCargo: 3
ClothingBackpackSatchelCargo: 3
ClothingBackpackDuffelCargo: 3
ClothingUniformJumpsuitCargo: 3
ClothingUniformJumpskirtCargo: 3
ClothingShoesColorBlack: 3
ClothingHandsGlovesFingerless: 3
ClothingHeadHatCargosoft: 3
ClothingHeadBandBrown: 3
ClothingHeadsetCargo: 3
ClothingOuterWinterCargo: 2
ClothingOuterWinterMiner: 2
ClothingNeckScarfStripedBrown: 3
ClothingShoesBootsWinterCargo: 2
Loading

0 comments on commit d9ee46f

Please sign in to comment.