mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-28 02:21:53 +00:00
## About The Pull Request **1. Code Improvements** - Removed unused vars `coin`, `bill` & other stuff - Removed duplicate definition of `on_deconstruction()` - Autodoc for a lot of procs - Merged smaller procs into larger ones to avoid scrolling in the code editor & reduced overhead - Split the vending machine file into several smaller files for easy code management **2. Qol** - Implemented vending machine ads. They now display random stuff on the UI https://github.com/user-attachments/assets/9720ea60-f268-4ca2-940d-243e3d0ac75f - More error messages for custom & normal vendors as to why an item could not be loaded - Custom vending machines can be deconstructed safely via crowbar without any explosion only after unlinking your account from the machine else you get the same explosion. Upon deconstruction all loaded items are moved into its restock canister meaning the machine can be safely moved with all its products just like a regular vending machine to a new location **3. Fixes** - Fixes #81917. Any returned items in the vending machine now show up as free in the UI & won't cost credits to buy them - Fixes #87416. Custom & normal vendors now keep track of products removed via `Exited()` so the UI gets always updated - Fixes #83151. Items with different names & custom prices now show up in unique rows - Fixes #92170 Custom vendors now show the correct icon for inserted items - Closes #80010. From the above fix this situation is impossible so it's safe to close this as a duplicate - Closes #78016 same problem as above with `Exited()` duplicate - Custom vendors can now actually be used by players who are not the owner instead of locking down the UI - Vending machines keep track of `max_amount` of stocked items by hand as well & not just RPED **4. Refactor** - Separates custom vending machine code from normal vending machine code. This prime Marely focus on the `vending_machine_input` list which now only exists inside the custom vending machine - Compressed the UI code for vending machine so both custom & normal vending machines can send the same data instead of separating the 2. Overall less code - Moved attack chain from `attackby()` to `item_interaction()` for loading items ## Changelog 🆑 code: cleaned up vending machine code qol: vending machines now have more product slogans you never heard before qol: custom & normal vending machines now have more feedback on why an item could not be loaded qol: vending machines now display random ads on the UI qol: custom vending machines can be deconstructed via crowbar safely only after unlinking your account from the machine. qol: upon deconstructing a custom vendor all its products are moved into its refill canister & it will be restored when reconstructing the machine elsewhere fix: Returned items to the vending machine now show up as free in the UI and won't be greyed out if you don't have credits to get them back fix: items that leave the vending machine by any means will update the UI in all cases fix: loading items by hand to the vending machine now respects the max_amount for that category fix: custom vendors can now actually be used by players who are not the owner thus enabling them to transfer credits to the owner during purchases & basically they do their job again fix: custom vendors now show the correct icon for inserted items fix: Items with different names & custom prices now show up in unique rows in custom vendors refactor: separated custom & normal vending machine code. Reduced UI code & improved attack chain /🆑 --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> # Conflicts: # code/modules/vending/_vending.dm # tgui/packages/tgui/interfaces/Vending.tsx
33 lines
1.3 KiB
Plaintext
33 lines
1.3 KiB
Plaintext
/datum/computer_file/program/restock_tracker
|
|
filename = "restockapp"
|
|
filedesc = "NT Restock Tracker"
|
|
downloader_category = PROGRAM_CATEGORY_SUPPLY
|
|
program_open_overlay = "restock"
|
|
extended_desc = "Nanotrasen IoT network listing all the vending machines found on station, and how well stocked they are each. Profitable!"
|
|
program_flags = PROGRAM_ON_NTNET_STORE | PROGRAM_REQUIRES_NTNET
|
|
can_run_on_flags = PROGRAM_ALL
|
|
size = 4
|
|
program_icon = "cash-register"
|
|
tgui_id = "NtosRestock"
|
|
|
|
/datum/computer_file/program/restock_tracker/ui_data()
|
|
var/list/data = list()
|
|
var/list/vending_list = list()
|
|
var/id_increment = 1
|
|
for(var/obj/machinery/vending/vendor as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/vending))
|
|
if(vendor.all_products_free)
|
|
continue
|
|
var/list/total_legal_stock = vendor.total_stock(contrabrand = FALSE)
|
|
if((!total_legal_stock[2] || (total_legal_stock[1] >= total_legal_stock[2])) && !vendor.credits_contained)
|
|
continue
|
|
vending_list += list(list(
|
|
"name" = vendor.name,
|
|
"location" = get_area_name(vendor),
|
|
"credits" = vendor.credits_contained,
|
|
"percentage" = (total_legal_stock[1] / total_legal_stock[2]) * 100,
|
|
"id" = id_increment,
|
|
))
|
|
id_increment++
|
|
data["vending_list"] = vending_list
|
|
return data
|