* Moved vendor thank you messages into AdvertisementPack, making them vendor-specific.
Wrote a few example messages.
* Only display thank yous when closing the UI after a purchase.
* Tweaked a few messages
* More custom messages
* Missed one
_chat.TrySendInGameICMessage(uid, Loc.GetString(_random.Pick(advertisements.Advertisements)), InGameICChatType.Speak, true);
}
+ public void SayThankYou(EntityUid uid, AdvertiseComponent? advertise = null)
+ {
+ if (!Resolve(uid, ref advertise))
+ return;
+
+ if (_prototypeManager.TryIndex(advertise.PackPrototypeId, out AdvertisementsPackPrototype? advertisements))
+ {
+ _chat.TrySendInGameICMessage(uid, Loc.GetString(_random.Pick(advertisements.ThankYous), ("name", Name(uid))), InGameICChatType.Speak, true);
+ }
+ }
+
public void SetEnabled(EntityUid uid, bool enable, AdvertiseComponent? advertise = null)
{
if (!Resolve(uid, ref advertise))
[DataField("advertisements")]
public List<string> Advertisements { get; private set; } = new();
+
+ [DataField("thankyous")]
+ public List<string> ThankYous { get; private set; } = new();
}
}
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
+using Robust.Shared.Utility;
namespace Content.Server.VendingMachines
{
[Dependency] private readonly ThrowingSystem _throwingSystem = default!;
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly IGameTiming _timing = default!;
- [Dependency] private readonly ChatSystem _chat = default!;
+ [Dependency] private readonly AdvertiseSystem _advertise = default!;
private ISawmill _sawmill = default!;
SubscribeLocalEvent<VendingMachineComponent, ActivatableUIOpenAttemptEvent>(OnActivatableUIOpenAttempt);
SubscribeLocalEvent<VendingMachineComponent, BoundUIOpenedEvent>(OnBoundUIOpened);
+ SubscribeLocalEvent<VendingMachineComponent, BoundUIClosedEvent>(OnBoundUIClosed);
SubscribeLocalEvent<VendingMachineComponent, VendingMachineEjectMessage>(OnInventoryEjectMessage);
SubscribeLocalEvent<VendingMachineComponent, VendingMachineSelfDispenseEvent>(OnSelfDispense);
UpdateVendingMachineInterfaceState(uid, component);
}
+ private void OnBoundUIClosed(EntityUid uid, VendingMachineComponent component, BoundUIClosedEvent args)
+ {
+ if ((VendingMachineUiKey) args.UiKey != VendingMachineUiKey.Key)
+ return;
+
+ // Only vendors that advertise will send message after dispensing
+ if (component.ShouldSayThankYou && TryComp<AdvertiseComponent>(uid, out var advertise))
+ {
+ _advertise.SayThankYou(uid, advertise);
+ component.ShouldSayThankYou = false;
+ }
+ }
+
private void UpdateVendingMachineInterfaceState(EntityUid uid, VendingMachineComponent component)
{
var state = new VendingMachineInterfaceState(GetAllInventory(uid, component));
_throwingSystem.TryThrow(ent, direction, vendComponent.NonLimitedEjectForce);
}
- // Only vendors that advertise will send message after dispensing
- if (TryComp<AdvertiseComponent>(uid, out var advertise))
- {
- _chat.TrySendInGameICMessage(uid, Loc.GetString("vending-machine-thanks", ("name", Name(uid))), InGameICChatType.Speak, true);
- }
+ vendComponent.ShouldSayThankYou = true;
vendComponent.NextItemToEject = null;
vendComponent.ThrowNextItem = false;
public bool Broken;
+ public bool ShouldSayThankYou;
+
/// <summary>
/// When true, will forcefully throw any object it dispenses
/// </summary>
advertisement-ammo-6 = Express your second amendment today!
advertisement-ammo-7 = Guns don't kill people, but you can!
advertisement-ammo-8 = Who needs responsibilities when you have guns?
-
advertisement-boozeomat-17 = Maximum alcohol!
advertisement-boozeomat-18 = Man loves beer.
advertisement-boozeomat-19 = A toast for progress!
+thankyou-boozeomat-1 = Please drink responsibly!
advertisement-chang-2 = Mr. Chang, approved for safe consumption in over 10 sectors!
advertisement-chang-3 = Chinese food is great for a date night, or a lonely night!
advertisement-chang-4 = You can't go wrong with Mr. Chang's authentic Chinese food!
+thankyou-chang-1 = Mr. Chang says thank you!
+thankyou-chang-2 = Enjoy your authentic meal!
advertisement-chefvend-4 = Are you worth your salt? We are.
advertisement-chefvend-5 = Mmm, meat.
advertisement-chefvend-6 = Harness the power of flour.
-advertisement-chefvend-7 = Show your customers who's the best chef around with our galaxy famous, award winning BBQ sauce.
\ No newline at end of file
+advertisement-chefvend-7 = Show your customers who's the best chef around with our galaxy famous, award winning BBQ sauce.
+thankyou-chefvend-1 = Time to get cooking!
+thankyou-chefvend-2 = Thanks for trusting our quality ingredients!
+thankyou-chefvend-3 = That should give them what they're craving!
advertisement-cigs-9 = Nicotine heaven.
advertisement-cigs-10 = Best cigarettes since 2150.
advertisement-cigs-11 = Award-winning cigs.
+thankyou-cigs-1 = You've got 'em, now smoke 'em!
+thankyou-cigs-2 = You probably won't regret it!
advertisement-coffee-11 = Try some tea.
advertisement-coffee-12 = We hope you like the best!
advertisement-coffee-13 = Try our new chocolate!
+thankyou-coffee-1 = Enjoy your beverage!
+thankyou-coffee-2 = Get it while it's hot!
+thankyou-coffee-3 = Beverage completed.
advertisement-cola-5 = Please, have a drink!
advertisement-cola-6 = Drink up!
advertisement-cola-7 = The best drinks in the galaxy!
+thankyou-cola-1 = Pop open that can and enjoy!
+thankyou-cola-2 = Pow! Take that, thirst!
+thankyou-cola-3 = I hope you like flavor!
advertisement-discount-6 = Discount Dan's: We're good for you! Nope, couldn't say it with a straight face.
advertisement-discount-7 = Discount Dan's: Only the best quality produ-*BZZT
advertisement-discount-8 = Discount Dan(tm) is not responsible for any damages caused by misuse of his product.
+thankyou-discount-1 = Thanks for usi-*BZZT
+thankyou-discount-2 = Remember: no refunds!
+thankyou-discount-3 = It's your problem now!
+thankyou-discount-4 = We are legally obligated to remind you not to eat that.
+thankyou-discount-5 = Please don't sue us!
+thankyou-discount-6 = We swear it looked like that when we stocked it!
+thankyou-discount-7 = Yeah, good luck with that.
advertisement-donut-1 = Each of us is a little cop!
advertisement-donut-2 = Hope you're hunger!
advertisement-donut-3 = Over 1 million donuts sold!
+thankyou-donut-1 = Enjoy your donut!
+thankyou-donut-2 = Another donut sold!
+thankyou-donut-3 = Have a nice day, officer!
advertisement-goodcleanfun-6 = Paranoid computers!
advertisement-goodcleanfun-7 = Totally not satanic!
advertisement-goodcleanfun-8 = Fun times forever!
+thankyou-goodcleanfun-1 = Have fun!
+thankyou-goodcleanfun-2 = Now you're playing with power!
+thankyou-goodcleanfun-3 = Go get your game on!
advertisement-happyhonk-7 = Happy Honk is not responsible for the quality of the food placed within our Happy Honk meal boxes.
advertisement-happyhonk-8 = Why not ask for our limited edition Mime Happy Honk Meal?
advertisement-happyhonk-9 = Happy Honk is a trademark of Honk! co. and is far superior to Robust Nukie Food corp.
+thankyou-happyhonk-1 = Honk!
+thankyou-happyhonk-2 = Honk honk!
+thankyou-happyhonk-3 = Go share the fun! Honk!
advertisement-nutrimax-3 = The greenest thumbs ever.
advertisement-nutrimax-4 = We like big plants.
advertisement-nutrimax-5 = Soft soil...
-advertisement-nutrimax-6 = Buckets now included!
\ No newline at end of file
+advertisement-nutrimax-6 = Buckets now included!
+thankyou-nutrimax-1 = Get planting!
advertisement-sectech-2 = Beat some heads in!
advertisement-sectech-3 = Don't forget - harm is good!
advertisement-sectech-4 = Your weapons are right here.
-
+thankyou-sectech-1 = Give 'em hell out there!
+thankyou-sectech-2 = Go enforce the law!
advertisement-snack-10 = Best quality snacks straight from mars.
advertisement-snack-11 = We love chocolate!
advertisement-snack-12 = Try our new jerky!
+thankyou-snack-1 = Eat up!
+thankyou-snack-2 = Enjoy your product!
+thankyou-snack-3 = Have a nice snack.
+thankyou-snack-4 = Yummy!
advertisement-sovietsoda-3 = Very nice!
advertisement-sovietsoda-4 = We are simple people, for this is all we eat.
advertisement-sovietsoda-5 = If there is a person, there is a problem. If there is no person, then there is no problem.
+thankyou-sovietsoda-1 = Enjoy, comrade!
+thankyou-sovietsoda-2 = Now get back to work.
advertisement-syndiedrobe-29 = The best in the galaxy!
advertisement-syndiedrobe-30 = What could be better than the smell of our uniform in the morning?
advertisement-syndiedrobe-31 = You can leave feedback about the convenience of the form by sending a request to our Taipan hotline, the main thing is not to the wrong number!
-
+thankyou-syndiedrobe-1 = Put it to good use!
+thankyou-syndiedrobe-2 = Death to NT!
+thankyou-syndiedrobe-3 = Show them the power of style.
- advertisement-ammo-6
- advertisement-ammo-7
- advertisement-ammo-8
+ thankyous:
+ - vending-machine-thanks
id: AtmosDrobeAds
advertisements:
- advertisement-atmosdrobe-1
+ thankyous:
+ - vending-machine-thanks
id: BarDrobeAds
advertisements:
- advertisement-bardrobe-1
+ thankyous:
+ - vending-machine-thanks
- advertisement-boozeomat-17
- advertisement-boozeomat-18
- advertisement-boozeomat-19
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-boozeomat-1
advertisements:
- advertisement-cargodrobe-1
- advertisement-cargodrobe-2
+ thankyous:
+ - vending-machine-thanks
- advertisement-chang-1
- advertisement-chang-2
- advertisement-chang-3
- - advertisement-chang-4
\ No newline at end of file
+ - advertisement-chang-4
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-chang-1
+ - thankyou-chang-2
id: ChefDrobeAds
advertisements:
- advertisement-chefdrobe-1
+ thankyous:
+ - vending-machine-thanks
- advertisement-chefvend-4
- advertisement-chefvend-5
- advertisement-chefvend-6
- - advertisement-chefvend-7
\ No newline at end of file
+ - advertisement-chefvend-7
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-chefvend-1
+ - thankyou-chefvend-2
+ - thankyou-chefvend-3
id: ChemDrobeAds
advertisements:
- advertisement-chemdrobe-1
+ thankyous:
+ - vending-machine-thanks
- advertisement-cigs-9
- advertisement-cigs-10
- advertisement-cigs-11
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-cigs-1
+ - thankyou-cigs-2
- advertisement-clothes-3
- advertisement-clothes-4
- advertisement-clothes-5
+ thankyous:
+ - vending-machine-thanks
- advertisement-coffee-11
- advertisement-coffee-12
- advertisement-coffee-13
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-coffee-1
+ - thankyou-coffee-2
+ - thankyou-coffee-3
- advertisement-cola-5
- advertisement-cola-6
- advertisement-cola-7
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-cola-1
+ - thankyou-cola-2
+ - thankyou-cola-3
- advertisement-condiment-2
- advertisement-condiment-3
- advertisement-condiment-4
- - advertisement-condiment-5
\ No newline at end of file
+ - advertisement-condiment-5
+ thankyous:
+ - vending-machine-thanks
advertisements:
- advertisement-curadrobe-1
- advertisement-curadrobe-2
+ thankyous:
+ - vending-machine-thanks
id: DetDrobeAds
advertisements:
- advertisement-detdrobe-1
+ thankyous:
+ - vending-machine-thanks
- advertisement-dinnerware-5
- advertisement-dinnerware-6
- advertisement-dinnerware-7
+ thankyous:
+ - vending-machine-thanks
- advertisement-discount-6
- advertisement-discount-7
- advertisement-discount-8
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-discount-1
+ - thankyou-discount-2
+ - thankyou-discount-3
+ - thankyou-discount-4
+ - thankyou-discount-5
+ - thankyou-discount-6
+ - thankyou-discount-7
- advertisement-donut-1
- advertisement-donut-2
- advertisement-donut-3
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-donut-1
+ - thankyou-donut-2
+ - thankyou-donut-3
advertisements:
- advertisement-engidrobe-1
- advertisement-engidrobe-2
+ thankyous:
+ - vending-machine-thanks
- fat-extractor-fact-4
- fat-extractor-fact-5
- fat-extractor-fact-6
+ thankyous:
+ - vending-machine-thanks
- advertisement-goodcleanfun-6
- advertisement-goodcleanfun-7
- advertisement-goodcleanfun-8
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-goodcleanfun-1
+ - thankyou-goodcleanfun-2
+ - thankyou-goodcleanfun-3
id: GeneDrobeAds
advertisements:
- advertisement-genedrobe-1
+ thankyous:
+ - vending-machine-thanks
- advertisement-happyhonk-7
- advertisement-happyhonk-8
- advertisement-happyhonk-9
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-happyhonk-1
+ - thankyou-happyhonk-2
+ - thankyou-happyhonk-3
advertisements:
- advertisement-hydrobe-1
- advertisement-hydrobe-2
+ thankyous:
+ - vending-machine-thanks
id: JaniDrobeAds
advertisements:
- advertisement-janidrobe-1
+ thankyous:
+ - vending-machine-thanks
id: LawDrobeAds
advertisements:
- advertisement-lawdrobe-1
+ thankyous:
+ - vending-machine-thanks
- advertisement-magivend-7
- advertisement-magivend-8
- advertisement-magivend-9
-
+ thankyous:
+ - vending-machine-thanks
id: MediDrobeAds
advertisements:
- advertisement-medidrobe-1
+ thankyous:
+ - vending-machine-thanks
- advertisement-megaseed-2
- advertisement-megaseed-3
- advertisement-megaseed-4
+ thankyous:
+ - vending-machine-thanks
- advertisement-nanomed-5
- advertisement-nanomed-6
- advertisement-nanomed-7
+ thankyous:
+ - vending-machine-thanks
- advertisement-nutrimax-4
- advertisement-nutrimax-5
- advertisement-nutrimax-6
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-nutrimax-1
advertisements:
- advertisement-robodrobe-1
- advertisement-robodrobe-2
+ thankyous:
+ - vending-machine-thanks
advertisements:
- advertisement-scidrobe-1
- advertisement-scidrobe-2
+ thankyous:
+ - vending-machine-thanks
- advertisement-secdrobe-2
- advertisement-secdrobe-3
- advertisement-secdrobe-4
+ thankyous:
+ - vending-machine-thanks
- advertisement-sectech-2
- advertisement-sectech-3
- advertisement-sectech-4
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-sectech-1
+ - thankyou-sectech-2
- advertisement-smartfridge-4
- advertisement-smartfridge-5
- advertisement-smartfridge-6
+ thankyous:
+ - vending-machine-thanks
- advertisement-snack-10
- advertisement-snack-11
- advertisement-snack-12
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-snack-1
+ - thankyou-snack-2
+ - thankyou-snack-3
+ - thankyou-snack-4
- advertisement-sovietsoda-3
- advertisement-sovietsoda-4
- advertisement-sovietsoda-5
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-sovietsoda-1
+ - thankyou-sovietsoda-2
- advertisement-syndiedrobe-29
- advertisement-syndiedrobe-30
- advertisement-syndiedrobe-31
+ thankyous:
+ - vending-machine-thanks
+ - thankyou-syndiedrobe-1
+ - thankyou-syndiedrobe-2
+ - thankyou-syndiedrobe-3
- advertisement-theater-2
- advertisement-theater-3
- advertisement-theater-4
+ thankyous:
+ - vending-machine-thanks
- advertisement-vendomat-2
- advertisement-vendomat-3
- advertisement-vendomat-4
+ thankyous:
+ - vending-machine-thanks
id: ViroDrobeAds
advertisements:
- advertisement-virodrobe-1
+ thankyous:
+ - vending-machine-thanks