Skip to content
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

Fixes Smartfridge deletions + Turing/Smartfridge networking issue #4696

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion code/game/machinery/kitchen/smartfridge.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var/icon_on = "smartfridge"
var/icon_off = "smartfridge-off"
var/icon_panel = "smartfridge-panel"
var/item_quants = list()
var/list/item_quants = list() //! Assoc list of names -> list(items)
var/ispowered = TRUE //starts powered
var/is_secure_fridge = FALSE
var/shoot_inventory = FALSE
Expand All @@ -40,6 +40,24 @@
GLOB.vending_products[/obj/item/reagent_container/glass/bottle] = 1
GLOB.vending_products[/obj/item/storage/pill_bottle] = 1

/obj/structure/machinery/smartfridge/Destroy(force)
if(is_in_network()) // Delete all contents from networked storage index
for(var/atom/movable/item as anything in contents)
delete_contents(item)
item_quants.Cut()
return ..() // parent will delete contents if we're not networked

/// Deletes given object in contents of the smartfridge
/obj/structure/machinery/smartfridge/proc/delete_contents(obj/item/item)
if(item.loc != src)
return
contents -= item
if(item_quants[item.name])
item_quants[item.name] -= item
if(is_in_network() && chemical_data.shared_item_storage[item.name])
chemical_data.shared_item_storage[item.name] -= item
qdel(item)

/obj/structure/machinery/smartfridge/proc/accept_check(obj/item/O as obj)
if(istype(O,/obj/item/reagent_container/food/snacks/grown/) || istype(O,/obj/item/seeds/))
return 1
Expand Down
3 changes: 1 addition & 2 deletions code/modules/reagents/chemistry_machinery/autodispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@
C.reagents.trans_to(container, amount)
//We don't care about keeping empty bottles stored
if(C.reagents.total_volume <= 0 && istypestrict(C,/obj/item/reagent_container/glass/bottle))
linked_storage.item_quants[C.name]--
qdel(C) //Might want to connect it to a disposal system later instead
linked_storage.delete_contents(C)

if(stage_missing)
amount = stage_missing
Expand Down
Loading