Reduce vendor thank you message spam and add variety (#23746)

* 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
This commit is contained in:
Tayrtahn
2024-01-08 20:34:47 -05:00
committed by GitHub
parent efb1c58a13
commit eb9770efb9
63 changed files with 208 additions and 15 deletions

View File

@@ -74,6 +74,17 @@ namespace Content.Server.Advertise
_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))

View File

@@ -11,5 +11,8 @@ namespace Content.Server.Advertisements
[DataField("advertisements")]
public List<string> Advertisements { get; private set; } = new();
[DataField("thankyous")]
public List<string> ThankYous { get; private set; } = new();
}
}

View File

@@ -24,6 +24,7 @@ using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Server.VendingMachines
{
@@ -37,7 +38,7 @@ 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!;
@@ -56,6 +57,7 @@ namespace Content.Server.VendingMachines
SubscribeLocalEvent<VendingMachineComponent, ActivatableUIOpenAttemptEvent>(OnActivatableUIOpenAttempt);
SubscribeLocalEvent<VendingMachineComponent, BoundUIOpenedEvent>(OnBoundUIOpened);
SubscribeLocalEvent<VendingMachineComponent, BoundUIClosedEvent>(OnBoundUIClosed);
SubscribeLocalEvent<VendingMachineComponent, VendingMachineEjectMessage>(OnInventoryEjectMessage);
SubscribeLocalEvent<VendingMachineComponent, VendingMachineSelfDispenseEvent>(OnSelfDispense);
@@ -110,6 +112,19 @@ namespace Content.Server.VendingMachines
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));
@@ -387,11 +402,7 @@ namespace Content.Server.VendingMachines
_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;

View File

@@ -51,6 +51,8 @@ namespace Content.Shared.VendingMachines
public bool Broken;
public bool ShouldSayThankYou;
/// <summary>
/// When true, will forcefully throw any object it dispenses
/// </summary>

View File

@@ -6,4 +6,3 @@ advertisement-ammo-5 = Float like an astronaut, sting like a bullet!
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?

View File

@@ -17,3 +17,4 @@ advertisement-boozeomat-16 = Award-winning wine!
advertisement-boozeomat-17 = Maximum alcohol!
advertisement-boozeomat-18 = Man loves beer.
advertisement-boozeomat-19 = A toast for progress!
thankyou-boozeomat-1 = Please drink responsibly!

View File

@@ -2,3 +2,5 @@
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!

View File

@@ -4,4 +4,7 @@ advertisement-chefvend-3 = Slap some butter on it!
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.
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!

View File

@@ -9,3 +9,5 @@ advertisement-cigs-8 = Don't quit, buy more!
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!

View File

@@ -11,3 +11,6 @@ advertisement-coffee-10 = Coffee helps you work!
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.

View File

@@ -5,3 +5,6 @@ advertisement-cola-4 = Thirsty? Why not cola?
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!

View File

@@ -6,3 +6,10 @@ advertisement-discount-5 = Don't listen to those eggheads at the CDC, buy now!
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.

View File

@@ -1,3 +1,6 @@
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!

View File

@@ -6,3 +6,6 @@ advertisement-goodcleanfun-5 = Elves and dwarves!
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!

View File

@@ -7,3 +7,6 @@ advertisement-happyhonk-6 = How many security officers does it take to arrest yo
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!

View File

@@ -3,4 +3,5 @@ advertisement-nutrimax-2 = Don't you want some?
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!
advertisement-nutrimax-6 = Buckets now included!
thankyou-nutrimax-1 = Get planting!

View File

@@ -2,4 +2,5 @@
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!

View File

@@ -10,3 +10,7 @@ advertisement-snack-9 = Have some more Getmore!
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!

View File

@@ -3,3 +3,5 @@ advertisement-sovietsoda-2 = Have you fulfilled your nutrition quota today?
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.

View File

@@ -29,4 +29,6 @@ advertisement-syndiedrobe-28 = Our suits are moisture-resistant, which means you
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.

View File

@@ -9,3 +9,5 @@
- advertisement-ammo-6
- advertisement-ammo-7
- advertisement-ammo-8
thankyous:
- vending-machine-thanks

View File

@@ -2,3 +2,5 @@
id: AtmosDrobeAds
advertisements:
- advertisement-atmosdrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -2,3 +2,5 @@
id: BarDrobeAds
advertisements:
- advertisement-bardrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -20,3 +20,6 @@
- advertisement-boozeomat-17
- advertisement-boozeomat-18
- advertisement-boozeomat-19
thankyous:
- vending-machine-thanks
- thankyou-boozeomat-1

View File

@@ -3,3 +3,5 @@
advertisements:
- advertisement-cargodrobe-1
- advertisement-cargodrobe-2
thankyous:
- vending-machine-thanks

View File

@@ -4,4 +4,8 @@
- advertisement-chang-1
- advertisement-chang-2
- advertisement-chang-3
- advertisement-chang-4
- advertisement-chang-4
thankyous:
- vending-machine-thanks
- thankyou-chang-1
- thankyou-chang-2

View File

@@ -2,3 +2,5 @@
id: ChefDrobeAds
advertisements:
- advertisement-chefdrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -7,4 +7,9 @@
- advertisement-chefvend-4
- advertisement-chefvend-5
- advertisement-chefvend-6
- advertisement-chefvend-7
- advertisement-chefvend-7
thankyous:
- vending-machine-thanks
- thankyou-chefvend-1
- thankyou-chefvend-2
- thankyou-chefvend-3

View File

@@ -2,4 +2,6 @@
id: ChemDrobeAds
advertisements:
- advertisement-chemdrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -12,3 +12,7 @@
- advertisement-cigs-9
- advertisement-cigs-10
- advertisement-cigs-11
thankyous:
- vending-machine-thanks
- thankyou-cigs-1
- thankyou-cigs-2

View File

@@ -6,3 +6,5 @@
- advertisement-clothes-3
- advertisement-clothes-4
- advertisement-clothes-5
thankyous:
- vending-machine-thanks

View File

@@ -14,3 +14,8 @@
- advertisement-coffee-11
- advertisement-coffee-12
- advertisement-coffee-13
thankyous:
- vending-machine-thanks
- thankyou-coffee-1
- thankyou-coffee-2
- thankyou-coffee-3

View File

@@ -8,3 +8,8 @@
- advertisement-cola-5
- advertisement-cola-6
- advertisement-cola-7
thankyous:
- vending-machine-thanks
- thankyou-cola-1
- thankyou-cola-2
- thankyou-cola-3

View File

@@ -5,4 +5,6 @@
- advertisement-condiment-2
- advertisement-condiment-3
- advertisement-condiment-4
- advertisement-condiment-5
- advertisement-condiment-5
thankyous:
- vending-machine-thanks

View File

@@ -3,3 +3,5 @@
advertisements:
- advertisement-curadrobe-1
- advertisement-curadrobe-2
thankyous:
- vending-machine-thanks

View File

@@ -2,3 +2,5 @@
id: DetDrobeAds
advertisements:
- advertisement-detdrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -8,3 +8,5 @@
- advertisement-dinnerware-5
- advertisement-dinnerware-6
- advertisement-dinnerware-7
thankyous:
- vending-machine-thanks

View File

@@ -9,3 +9,12 @@
- 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

View File

@@ -4,3 +4,8 @@
- advertisement-donut-1
- advertisement-donut-2
- advertisement-donut-3
thankyous:
- vending-machine-thanks
- thankyou-donut-1
- thankyou-donut-2
- thankyou-donut-3

View File

@@ -3,3 +3,5 @@
advertisements:
- advertisement-engidrobe-1
- advertisement-engidrobe-2
thankyous:
- vending-machine-thanks

View File

@@ -7,3 +7,5 @@
- fat-extractor-fact-4
- fat-extractor-fact-5
- fat-extractor-fact-6
thankyous:
- vending-machine-thanks

View File

@@ -9,3 +9,8 @@
- advertisement-goodcleanfun-6
- advertisement-goodcleanfun-7
- advertisement-goodcleanfun-8
thankyous:
- vending-machine-thanks
- thankyou-goodcleanfun-1
- thankyou-goodcleanfun-2
- thankyou-goodcleanfun-3

View File

@@ -2,3 +2,5 @@
id: GeneDrobeAds
advertisements:
- advertisement-genedrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -10,3 +10,8 @@
- advertisement-happyhonk-7
- advertisement-happyhonk-8
- advertisement-happyhonk-9
thankyous:
- vending-machine-thanks
- thankyou-happyhonk-1
- thankyou-happyhonk-2
- thankyou-happyhonk-3

View File

@@ -3,3 +3,5 @@
advertisements:
- advertisement-hydrobe-1
- advertisement-hydrobe-2
thankyous:
- vending-machine-thanks

View File

@@ -2,3 +2,5 @@
id: JaniDrobeAds
advertisements:
- advertisement-janidrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -2,3 +2,5 @@
id: LawDrobeAds
advertisements:
- advertisement-lawdrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -10,4 +10,5 @@
- advertisement-magivend-7
- advertisement-magivend-8
- advertisement-magivend-9
thankyous:
- vending-machine-thanks

View File

@@ -2,3 +2,5 @@
id: MediDrobeAds
advertisements:
- advertisement-medidrobe-1
thankyous:
- vending-machine-thanks

View File

@@ -5,3 +5,5 @@
- advertisement-megaseed-2
- advertisement-megaseed-3
- advertisement-megaseed-4
thankyous:
- vending-machine-thanks

View File

@@ -8,3 +8,5 @@
- advertisement-nanomed-5
- advertisement-nanomed-6
- advertisement-nanomed-7
thankyous:
- vending-machine-thanks

View File

@@ -7,3 +7,6 @@
- advertisement-nutrimax-4
- advertisement-nutrimax-5
- advertisement-nutrimax-6
thankyous:
- vending-machine-thanks
- thankyou-nutrimax-1

View File

@@ -3,3 +3,5 @@
advertisements:
- advertisement-robodrobe-1
- advertisement-robodrobe-2
thankyous:
- vending-machine-thanks

View File

@@ -3,3 +3,5 @@
advertisements:
- advertisement-scidrobe-1
- advertisement-scidrobe-2
thankyous:
- vending-machine-thanks

View File

@@ -5,3 +5,5 @@
- advertisement-secdrobe-2
- advertisement-secdrobe-3
- advertisement-secdrobe-4
thankyous:
- vending-machine-thanks

View File

@@ -5,3 +5,7 @@
- advertisement-sectech-2
- advertisement-sectech-3
- advertisement-sectech-4
thankyous:
- vending-machine-thanks
- thankyou-sectech-1
- thankyou-sectech-2

View File

@@ -7,3 +7,5 @@
- advertisement-smartfridge-4
- advertisement-smartfridge-5
- advertisement-smartfridge-6
thankyous:
- vending-machine-thanks

View File

@@ -13,3 +13,9 @@
- 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

View File

@@ -6,3 +6,7 @@
- advertisement-sovietsoda-3
- advertisement-sovietsoda-4
- advertisement-sovietsoda-5
thankyous:
- vending-machine-thanks
- thankyou-sovietsoda-1
- thankyou-sovietsoda-2

View File

@@ -32,3 +32,8 @@
- advertisement-syndiedrobe-29
- advertisement-syndiedrobe-30
- advertisement-syndiedrobe-31
thankyous:
- vending-machine-thanks
- thankyou-syndiedrobe-1
- thankyou-syndiedrobe-2
- thankyou-syndiedrobe-3

View File

@@ -5,3 +5,5 @@
- advertisement-theater-2
- advertisement-theater-3
- advertisement-theater-4
thankyous:
- vending-machine-thanks

View File

@@ -5,3 +5,5 @@
- advertisement-vendomat-2
- advertisement-vendomat-3
- advertisement-vendomat-4
thankyous:
- vending-machine-thanks

View File

@@ -2,3 +2,5 @@
id: ViroDrobeAds
advertisements:
- advertisement-virodrobe-1
thankyous:
- vending-machine-thanks