Merge pull request #10924 from phil235/ProtolatheInsertFix

Fixes being able to insert sheets into the protolathe from a distance
This commit is contained in:
Cheridan
2015-07-31 02:01:55 -05:00
+5 -8
View File
@@ -165,18 +165,16 @@ Note: Must be placed west/left of and R&D console to function.
var/obj/item/stack/sheet/stack = O
var/amount = round(input("How many sheets do you want to add?") as num)//No decimals
if(!stack || stack.amount <= 0 || amount <= 0)
if(!stack || stack.amount <= 0 || amount <= 0 || !in_range(src, stack) || !user.Adjacent(src))
return
if(amount > stack.amount)
amount = stack.amount
if(max_material_storage - TotalMaterials() < (amount*stack.perunit))//Can't overfill
amount = min(stack.amount, round((max_material_storage-TotalMaterials())/stack.perunit))
icon_state = "protolathe"
busy = 1
use_power(max(1000, (MINERAL_MATERIAL_AMOUNT*amount/10)))
user << "<span class='notice'>You add [amount] sheets to the [src.name].</span>"
icon_state = "protolathe"
if(istype(stack, /obj/item/stack/sheet/metal))
m_amount += amount * MINERAL_MATERIAL_AMOUNT
else if(istype(stack, /obj/item/stack/sheet/glass))
@@ -196,11 +194,10 @@ Note: Must be placed west/left of and R&D console to function.
else if(istype(stack, /obj/item/stack/sheet/mineral/adamantine))
adamantine_amount += amount * MINERAL_MATERIAL_AMOUNT
stack.use(amount)
busy = 0
src.updateUsrDialog()
updateUsrDialog()
src.overlays += "protolathe_[stack.name]"
overlays += "protolathe_[stack.name]"
sleep(10)
src.overlays -= "protolathe_[stack.name]"
overlays -= "protolathe_[stack.name]"
busy = 0
return