mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-19 19:13:30 +01:00
Makes the coinpress respect inventory limits (#15202)
Co-authored-by: joep van der velden <15887760+farie82@users.noreply.github.com>
This commit is contained in:
@@ -81,8 +81,11 @@
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
while(coinsToProduce > 0 && materials.use_amount_type(coin_mat, chosen))
|
||||
create_coins(M.coin_type)
|
||||
while(coinsToProduce > 0 && materials.can_use_amount(coin_mat, chosen))
|
||||
if(!create_coins(M.coin_type))
|
||||
visible_message("<span class='notice'>[src] stops printing to prevent an overflow.</span>")
|
||||
break
|
||||
materials.use_amount_type(coin_mat, chosen)
|
||||
coinsToProduce--
|
||||
newCoins++
|
||||
updateUsrDialog()
|
||||
@@ -95,10 +98,15 @@
|
||||
|
||||
/obj/machinery/mineral/mint/proc/create_coins(P)
|
||||
var/turf/T = get_step(src,output_dir)
|
||||
if(T)
|
||||
var/obj/item/O = new P(src)
|
||||
var/obj/item/storage/bag/money/M = locate(/obj/item/storage/bag/money, T)
|
||||
if(!M)
|
||||
M = new /obj/item/storage/bag/money(src)
|
||||
unload_mineral(M)
|
||||
O.forceMove(M)
|
||||
if(!T)
|
||||
return FALSE
|
||||
var/obj/item/O = new P(src)
|
||||
var/obj/item/storage/bag/money/M = locate(/obj/item/storage/bag/money, T)
|
||||
if(!M)
|
||||
M = new /obj/item/storage/bag/money(src)
|
||||
unload_mineral(M)
|
||||
else if(!M.can_be_inserted(O, FALSE)) // First coin will always fit. But will the Xth?
|
||||
qdel(O)
|
||||
return FALSE
|
||||
O.forceMove(M)
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user