-
Notifications
You must be signed in to change notification settings - Fork 658
Separation Of Cash Payment From VendingMachineComponent #3871
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
base: main
Are you sure you want to change the base?
Changes from all commits
ab97a11
6af9bf6
fdfba26
cb87433
32066a9
3899ccd
30e0b2c
6d12653
a1e0437
416baa1
95c07cb
1bfb8d0
8c666a5
c6825e0
5d7787c
444fcdb
a24fc04
ef0508b
53e1261
e270b58
cd319ce
bcc999b
a6ab072
93f69c5
73b4471
70c2415
8c6418d
49fac4f
6a259e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| using Content.Shared._Mono.Economy; | ||
| using Content.Shared._Mono.Economy.Component; | ||
| using Content.Shared.VendingMachines; | ||
|
|
||
| namespace Content.Client._Mono.Economy; | ||
|
|
||
| public sealed partial class CreditReceiverSystem : SharedCreditReceiverSystem | ||
| { | ||
| [Dependency] private readonly SharedUserInterfaceSystem _uiSystem = default!; | ||
|
|
||
| public override void Initialize() | ||
| { | ||
| base.Initialize(); | ||
|
|
||
| SubscribeLocalEvent<CreditReceiverComponent, AfterAutoHandleStateEvent>(OnVendingCashMoneyAfterState); | ||
| } | ||
|
|
||
| private void OnVendingCashMoneyAfterState(EntityUid uid, CreditReceiverComponent component, ref AfterAutoHandleStateEvent args) | ||
| { | ||
| if (_uiSystem.TryGetOpenUi(uid, VendingMachineUiKey.Key, out var bui)) | ||
| { | ||
| bui.Update(); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| using Content.Shared._Mono.Economy; | ||
|
|
||
| namespace Content.Server._Mono.Economy; | ||
|
|
||
| public sealed partial class CreditReceiverSystem : SharedCreditReceiverSystem | ||
| { | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,13 @@ | |
| using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; | ||
| using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; | ||
| using Content.Shared._NF.Bank.Components; // Frontier | ||
| using Content.Shared.Containers.ItemSlots; // Frontier | ||
| //using Content.Shared.Containers.ItemSlots; // Frontier // Mono | ||
| using Content.Shared._Mono.Economy.Component; // Mono | ||
|
|
||
| namespace Content.Shared.VendingMachines | ||
| { | ||
| /// Mono Change: Anything related to actually accepting physical cash or other currencies has been | ||
| /// moved over to <see cref="CreditReceiverComponent"/>. <seealso cref="CreditReceiverComponent.CashSlot"/> | ||
|
Comment on lines
+14
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove, as well unneeded |
||
| [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] | ||
| public sealed partial class VendingMachineComponent : Component | ||
| { | ||
|
|
@@ -218,29 +221,6 @@ public sealed partial class VendingMachineComponent : Component | |
| [DataField(serverOnly: true), ViewVariables(VVAccess.ReadWrite)] | ||
| public Dictionary<SectorBankAccount, float> TaxAccounts = new(); | ||
|
|
||
| // Optional item slot for cash | ||
| [DataField] | ||
| public ItemSlot? CashSlot = null; | ||
|
|
||
| /// <summary> | ||
| /// Name of the cash slot, if there is one. Null if there isn't. | ||
| /// </summary> | ||
| [DataField] | ||
| public string? CashSlotName; | ||
|
|
||
| /// <summary> | ||
| /// The type of currency to accept in the item slot. | ||
| /// </summary> | ||
| [DataField] | ||
| public string? CurrencyStackType; | ||
|
|
||
| /// <summary> | ||
| /// The current balance in the cash slot. | ||
| /// Kept for | ||
| /// </summary> | ||
| [DataField, AutoNetworkedField] | ||
| public int CashSlotBalance; | ||
|
|
||
| /// <summary> | ||
| /// Mono: Tracks the last purchase price for vending machine purchase tracking. | ||
| /// Used to mark spawned entities with purchase information. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| using Robust.Shared.GameStates; | ||
| using Content.Shared.Containers.ItemSlots; | ||
|
|
||
| namespace Content.Shared._Mono.Economy.Component; | ||
|
|
||
| [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)] | ||
| [Access(typeof(SharedCreditReceiverSystem))] | ||
| public sealed partial class CreditReceiverComponent : Robust.Shared.GameObjects.Component | ||
| { | ||
| /// <summary> | ||
| /// Item slot for cash.</summary> | ||
| /// <remarks> | ||
| /// Set this to Null if you want to disable this component | ||
| /// in case you can't get rid of it, i.e. YAML inherited. | ||
| /// </remarks> | ||
| [DataField] | ||
| public ItemSlot? CashSlot; | ||
|
|
||
| /// <summary> | ||
| /// Name of the cash slot, if there is one. Null if there isn't. | ||
| /// </summary> | ||
| [DataField] | ||
| public string? CashSlotName; | ||
|
Comment on lines
+10
to
+23
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make non-nullable and remove relevant checks, the comp just shouldn't be added if not needed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. All vending machines inherit this component since they base-line expect to be credit receivers. It's only some vendors that don't want this component. |
||
|
|
||
| /// <summary> | ||
| /// The type of currency to accept in the item slot. | ||
| /// </summary> | ||
| [DataField] | ||
| public string? CurrencyStackType; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use non-nullable ProtoId with a default value set to normal credits stack prototype
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A protoID makes sense, as well as the default money ID, but making it non-nullable will be a massive pain the ass YAML side. Instead of only nulling CreditReceiver for the four vendors that dont need it, I have to add the component to every single vendor that DOES accept it EXCEPT the four special goobers.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, you make a new base vendor type and reparent the ones that don't need credit receiver to it id: BaseVendomat
...
id: BaseVendomatCredit
parent: BaseVendomatand parent vendomats accordingly or make the first one BaseVendomatNoCredit and make the second one just BaseVendomat |
||
|
|
||
| /// <summary> | ||
| /// The current balance in the cash slot. | ||
| /// Kept for | ||
| /// </summary> | ||
| [DataField, AutoNetworkedField] | ||
| public int CashSlotBalance; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this shouldn't be needed (directly check the stack via method in system instead) |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.