From 7ce4a99516bd627fa75689412a8dd362472e5432 Mon Sep 17 00:00:00 2001 From: Arkatos1 Date: Mon, 6 May 2019 16:52:13 +0200 Subject: [PATCH] better output system for smartfridges --- code/game/machinery/machinery.dm | 8 ++++++++ .../food_and_drinks/kitchen_machinery/smartfridge.dm | 1 + 2 files changed, 9 insertions(+) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 91dcb43ab57..072281cb188 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -595,3 +595,11 @@ Class Procs: emp_act(EMP_LIGHT) else ex_act(EXPLODE_HEAVY) + +/obj/machinery/proc/adjust_item_drop_location(atom/movable/AM) // Adjust item drop location to a 3x3 grid inside the tile, returns slot id from 0 to 8 + var/md5 = md5(AM.name) // Oh, and it's deterministic too. A specific item will always drop from the same slot. + for (var/i in 1 to 32) + . += hex2num(md5[i]) + . = . % 9 + AM.pixel_x = -8 + ((.%3)*8) + AM.pixel_y = -8 + (round( . / 3)*8) diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 8283bbdad62..d70db0658e8 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -373,6 +373,7 @@ for(var/obj/O in contents) if(O.name == K) O.forceMove(loc) + adjust_item_drop_location(O) update_icon() i-- if(i <= 0)