Fixing issues

Adds a check for stacktype and a turf check, preventing bad behavior.
This commit is contained in:
FartMaster69420
2022-04-14 00:01:59 -04:00
parent cdb1b8f43d
commit d7abb2e81e

View File

@@ -3,6 +3,10 @@
/obj/item/stack/proc/merge(obj/item/stack/S) //Merge src into S, as much as possible
if(uses_charge || S.uses_charge) // This should realistically never happen, but in case it does lets avoid breaking things.
return
if(S.stacktype != stacktype)
return
if(S.amount >= S.max_amount)
return
var/transfer = get_amount()
transfer = min(transfer, S.max_amount - S.amount)
@@ -15,6 +19,6 @@
S.add(transfer)
/obj/item/stack/Crossed(var/atom/movable/AM)
if(AM != src && istype(AM, src.type) && !AM.throwing)
if(isturf(AM.loc) && AM != src && istype(AM, src.type) && !AM.throwing)
merge(AM)
return ..()