diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index e67efb0c8ab..86d3b16fbed 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -36,7 +36,11 @@ /obj/item/stack/Initialize(mapload, new_amount=null , merge = TRUE) . = ..() if(new_amount) - amount = new_amount + if(new_amount > max_amount) + amount = max_amount + new type(loc, new_amount - max_amount, merge) + else + amount = new_amount if(!merge_type) merge_type = type if(merge) diff --git a/code/modules/hydroponics/grown/grass_carpet.dm b/code/modules/hydroponics/grown/grass_carpet.dm index e1e9de5bc91..8e55f8a15d9 100644 --- a/code/modules/hydroponics/grown/grass_carpet.dm +++ b/code/modules/hydroponics/grown/grass_carpet.dm @@ -36,12 +36,7 @@ continue grassAmt += 1 + round(G.seed.potency * tile_coefficient) qdel(G) - var/obj/item/stack/tile/GT = stacktype - var/atom/Tsec = user.drop_location() - while(grassAmt > 0) - var/amount = min(grassAmt, initial(GT.max_amount)) - new stacktype(Tsec, amount) - grassAmt -= amount + new stacktype(user.drop_location(), grassAmt) qdel(src) // Carpet diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index 524ce9223da..f47f936db7e 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -164,12 +164,7 @@ update_controls() /mob/living/simple_animal/bot/floorbot/proc/empty_tiles() - var/atom/Tsec = drop_location() - - while(specialtiles > initial(tiletype.max_amount)) - new tiletype(Tsec,initial(tiletype.max_amount)) - specialtiles -= initial(tiletype.max_amount) - new tiletype(Tsec,specialtiles) + new tiletype(drop_location(), specialtiles) specialtiles = 0 tiletype = null diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 79a8b066b5f..7a6e313cd07 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -111,13 +111,8 @@ /obj/machinery/power/port_gen/pacman/DropFuel() if(sheets) - var/obj/item/stack/sheet/S = sheet_path - var/fail_safe = FALSE - while(sheets > 0 && fail_safe < 100) - fail_safe += 1 - var/amount = min(sheets, initial(S.max_amount)) - new sheet_path(drop_location(), amount) - sheets -= amount + new sheet_path(drop_location(), sheets) + sheets = 0 /obj/machinery/power/port_gen/pacman/UseFuel() var/needed_sheets = 1 / (time_per_sheet * consumption / power_output)