mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-24 05:30:05 +01:00
Stacks check for invalid amounts (#91656)
## About The Pull Request Alleviates #91603 As in it does not fix it because i have not been able to reproduce it. It now checks for invalid values and defaults to `amount`(which is 1) during `Initialize()` and not null so we don't have to pass the number `1` when creating a single sheet. A stack trace is thrown for <= 0 sheet amounts so we can debug & fix stuff ## Changelog 🆑 code: stacks error on invalid amounts, removed manual passing of number `1` when creating a single stack in many cases /🆑
This commit is contained in:
@@ -82,7 +82,7 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( \
|
||||
if(istype(W, /obj/item/stack/ore/glass))
|
||||
var/obj/item/stack/ore/glass/G = W
|
||||
to_chat(user, span_notice("You fill the sandbag."))
|
||||
var/obj/item/stack/sheet/mineral/sandbags/I = new /obj/item/stack/sheet/mineral/sandbags(drop_location())
|
||||
var/obj/item/stack/sheet/mineral/sandbags/I = new (drop_location())
|
||||
qdel(src)
|
||||
if (Adjacent(user) && !issilicon(user))
|
||||
user.put_in_hands(I)
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
table_type = /obj/structure/table/greyscale
|
||||
pickup_sound = 'sound/items/handling/materials/metal_pick_up.ogg'
|
||||
drop_sound = 'sound/items/handling/materials/metal_drop.ogg'
|
||||
var/sheettype = null //this is used for girders in the creation of walls/false walls
|
||||
sound_vary = TRUE
|
||||
/// this is used for girders in the creation of walls/false walls
|
||||
var/sheettype = null
|
||||
///If true, this is worth points in the gulag labour stacker
|
||||
var/gulag_valid = FALSE
|
||||
///Set to true if this is vended from a material storage
|
||||
@@ -25,8 +27,6 @@
|
||||
var/walltype
|
||||
/// whether this sheet can be sniffed by the material sniffer
|
||||
var/sniffable = FALSE
|
||||
/// this makes pickup and drop sounds vary
|
||||
sound_vary = TRUE
|
||||
|
||||
/obj/item/stack/sheet/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1)
|
||||
. = ..()
|
||||
|
||||
@@ -72,9 +72,11 @@
|
||||
/// or until the cut heals, whichever comes first
|
||||
var/absorption_rate
|
||||
|
||||
/obj/item/stack/Initialize(mapload, new_amount, merge = TRUE, list/mat_override=null, mat_amt=1)
|
||||
if(new_amount != null)
|
||||
amount = new_amount
|
||||
/obj/item/stack/Initialize(mapload, new_amount = amount, merge = TRUE, list/mat_override=null, mat_amt=1)
|
||||
amount = new_amount
|
||||
if(amount <= 0)
|
||||
stack_trace("invalid amount [amount]!")
|
||||
return INITIALIZE_HINT_QDEL
|
||||
while(amount > max_amount)
|
||||
amount -= max_amount
|
||||
new type(loc, max_amount, FALSE, mat_override, mat_amt)
|
||||
|
||||
Reference in New Issue
Block a user