space-station-14 icon indicating copy to clipboard operation
space-station-14 copied to clipboard

Clean up vending machines and port their visualizer

Open DoctorBeard opened this issue 2 years ago • 2 comments

About the PR

Ported the visualizer for vending machines to the new ECS conventions. While doing that noticed a number of bugs and inconsistencies and tried to clean the whole thing up a bit in general.

The VendingMachineInventoryPrototype has been reduced to pretty much just its inventory since most of the other functionality of it was a bit hacky and not actually used. From what I could gather the idea was originally that a vending machine inventory or "pack" also decides the vending machine's name and sprite but there is a matching vending machine for every inventory and each sets the sprite to what it already was on the vending machine prototype anyway. Making the vending machine inventories replace fields on the vending machine prototype really just felt like a roundabout reimplementation of prototype inheritance so I cut all of that out entirely. Fixes #10370.

The other thing I've tried to improve is animation consistency. Previously the eject delay, deny delay and their respective animation durations were all tied to to the animationDuration field of the inventory prototype (which is 0 by default). If this didn't fit both the deny and eject animation of a vending machine it resulted in either cut off animations, animations hanging on their last frame or just entirely suppressed animations Now both the eject and deny delay can be configured separately, have defaults that should look reasonable on most vending machines and allows for the deny animation to be looped rather than flicked, since a lot of vending machines have just two or three short frames for a deny animation. Sprite states are now also largely configurable, so vending machine RSIs don't have to adhere to a strict state naming standard anymore to work at all. Vending machines that had an idle animation would also not return to that animation after playing a deny or eject animation, but that is fixed too. Should fix #755

The vending machine UI has been touched up a bit on the technical side but functions largely the same. If the vending machine has no inventory it just lists "Out of stock" now, though this should only happen for vending machines with an empty configured inventory. This should fix #10321 and at least partially addresses #3871.

Ejection by damage, breakage or by wire manipulation should be a bit more consistent now and respects the vending machine's inventory. Once a machine is empty it should no longer try to eject items and fail while spamming "Out of stock". Each vending machine can now also be configured with a cooldown for ejecting items on damage. This will prevent it from ejecting another item for the duration of the cooldown regardless of the amount or frequency of damage dealt to it. Fixes #9879.

Changelog

:cl:

  • tweak: vending machine animations and their behaviors are more consistent now

DoctorBeard avatar Aug 09 '22 18:08 DoctorBeard

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 14 '22 05:08 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Aug 16 '22 10:08 github-actions[bot]

also im remembering this now but IIRC the vending machine pack sprite/anim data was so that in the future players would be able to construct generic vending machines and just use the packs to change their sprite instead. but imo that should just be reimplemented whenever thats done cause it didnt make a whole lot of sense now

mirrorcult avatar Aug 31 '22 12:08 mirrorcult