mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2026-07-20 20:52:52 +01:00
Resolves remaining issues with xenohydro PR.
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
#define GAS 3
|
||||
|
||||
#define CHEM_DISPENSER_ENERGY_COST 0.1 //How many energy points do we use per unit of chemical?
|
||||
|
||||
#define BOTTLE_SPRITES list("bottle-1", "bottle-2", "bottle-3", "bottle-4") //list of available bottle sprites
|
||||
#define REAGENTS_PER_SHEET 20
|
||||
|
||||
/obj/machinery/chem_dispenser
|
||||
name = "chem dispenser"
|
||||
@@ -827,6 +827,14 @@
|
||||
var/obj/item/weapon/reagent_containers/beaker = null
|
||||
var/limit = 10
|
||||
var/list/holdingitems = list()
|
||||
var/list/sheet_reagents = list(
|
||||
/obj/item/stack/sheet/mineral/iron = "iron",
|
||||
/obj/item/stack/sheet/mineral/uranium = "uranium",
|
||||
/obj/item/stack/sheet/mineral/phoron = "phoron",
|
||||
/obj/item/stack/sheet/mineral/gold = "gold",
|
||||
/obj/item/stack/sheet/mineral/silver = "silver",
|
||||
/obj/item/stack/sheet/mineral/mhydrogen = "hydrogen"
|
||||
)
|
||||
|
||||
/obj/machinery/reagentgrinder/New()
|
||||
..()
|
||||
@@ -857,12 +865,10 @@
|
||||
usr << "The machine cannot hold anymore items."
|
||||
return 1
|
||||
|
||||
//Fill machine with the plantbag!
|
||||
if(!istype(O))
|
||||
return
|
||||
|
||||
if(istype(O,/obj/item/weapon/storage/bag/plants))
|
||||
|
||||
var/failed = 1
|
||||
for (var/obj/item/G in O.contents)
|
||||
if(!O.reagents || !O.reagents.total_volume)
|
||||
@@ -886,7 +892,7 @@
|
||||
src.updateUsrDialog()
|
||||
return 0
|
||||
|
||||
if(!O.reagents || !O.reagents.total_volume)
|
||||
if(!sheet_reagents[O.type] && (!O.reagents || !O.reagents.total_volume))
|
||||
user << "\The [O] is not suitable for blending."
|
||||
return 1
|
||||
|
||||
@@ -1008,8 +1014,25 @@
|
||||
|
||||
// Process.
|
||||
for (var/obj/item/O in holdingitems)
|
||||
O.reagents.trans_to(beaker, min(O.reagents.total_volume, (beaker.reagents.maximum_volume - beaker.reagents.total_volume)))
|
||||
|
||||
if(!O || !istype(O))
|
||||
holdingitems -= null
|
||||
continue
|
||||
|
||||
var/remaining_volume = beaker.reagents.maximum_volume - beaker.reagents.total_volume
|
||||
if(sheet_reagents[O.type])
|
||||
var/obj/item/stack/stack = O
|
||||
if(istype(stack))
|
||||
var/amount_to_take = max(0,min(stack.amount,round(remaining_volume/REAGENTS_PER_SHEET)))
|
||||
if(amount_to_take)
|
||||
stack.use(amount_to_take)
|
||||
beaker.reagents.add_reagent(sheet_reagents[stack.type], (amount_to_take*REAGENTS_PER_SHEET))
|
||||
continue
|
||||
|
||||
O.reagents.trans_to(beaker, min(O.reagents.total_volume, remaining_volume))
|
||||
if(O.reagents.total_volume == 0)
|
||||
remove_object(O)
|
||||
if (beaker.reagents.total_volume >= beaker.reagents.maximum_volume)
|
||||
break
|
||||
|
||||
#undef REAGENTS_PER_SHEET
|
||||
Reference in New Issue
Block a user