mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Sheet loaders can feed protolathes and circuit imprinters
This commit is contained in:
@@ -110,6 +110,8 @@ using metal and glass, it uses glass and reagents (usually sulphuric acid).
|
||||
return
|
||||
if(default_part_replacement(user, O))
|
||||
return
|
||||
if(istype(O, /obj/item/weapon/gripper/no_use/loader))
|
||||
return 0 //Sheet loaders weren't finishing attack(), this prevents the message "You can't stuff that gripper into this" without preventing the rest of the attack sequence from finishing
|
||||
if(panel_open)
|
||||
user << "<span class='notice'>You can't load \the [src] while it's opened.</span>"
|
||||
return 1
|
||||
@@ -128,29 +130,35 @@ using metal and glass, it uses glass and reagents (usually sulphuric acid).
|
||||
user << "<span class='notice'>\The [src]'s material bin is full. Please remove material before adding more.</span>"
|
||||
return 1
|
||||
|
||||
var/obj/item/stack/stack = O
|
||||
|
||||
var/amount = round(input("How many sheets do you want to add?") as num)
|
||||
if(!O)
|
||||
var/obj/item/stack/material/S = O
|
||||
if(!(S.material.name in materials))
|
||||
user << "<span class='warning'>The [src] doesn't accept [S.material]!</span>"
|
||||
return
|
||||
if(amount <= 0)//No negative numbers
|
||||
return
|
||||
if(amount > stack.get_amount())
|
||||
amount = stack.get_amount()
|
||||
if(max_material_storage - TotalMaterials() < (amount * SHEET_MATERIAL_AMOUNT)) //Can't overfill
|
||||
amount = min(stack.get_amount(), round((max_material_storage - TotalMaterials()) / SHEET_MATERIAL_AMOUNT))
|
||||
|
||||
busy = 1
|
||||
use_power(max(1000, (SHEET_MATERIAL_AMOUNT * amount / 10)))
|
||||
var/stacktype = stack.type
|
||||
var/t = getMaterialName(stacktype)
|
||||
if(t)
|
||||
if(do_after(usr, 16))
|
||||
if(stack.use(amount))
|
||||
user << "<span class='notice'>You add [amount] sheets to \the [src].</span>"
|
||||
materials[t] += amount * SHEET_MATERIAL_AMOUNT
|
||||
var/sname = "[S.name]"
|
||||
var/amnt = S.perunit
|
||||
var/max_res_amount = max_material_storage
|
||||
for(var/mat in materials)
|
||||
max_res_amount -= materials[mat]
|
||||
|
||||
if(materials[S.material.name] + amnt <= max_res_amount)
|
||||
if(S && S.amount >= 1)
|
||||
var/count = 0
|
||||
overlays += "fab-load-metal"
|
||||
spawn(10)
|
||||
overlays -= "fab-load-metal"
|
||||
while(materials[S.material.name] + amnt <= max_res_amount && S.amount >= 1)
|
||||
materials[S.material.name] += amnt
|
||||
S.use(1)
|
||||
count++
|
||||
user << "You insert [count] [sname] into the fabricator."
|
||||
else
|
||||
user << "The fabricator cannot hold more [sname]."
|
||||
busy = 0
|
||||
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/r_n_d/circuit_imprinter/proc/addToQueue(var/datum/design/D)
|
||||
queue += D
|
||||
|
||||
@@ -102,6 +102,8 @@
|
||||
return
|
||||
if(O.is_open_container())
|
||||
return 1
|
||||
if(istype(O, /obj/item/weapon/gripper/no_use/loader))
|
||||
return 0 //Sheet loaders weren't finishing attack(), this prevents the message "You can't stuff that gripper into this" without preventing the rest of the attack sequence from finishing
|
||||
if(panel_open)
|
||||
user << "<span class='notice'>You can't load \the [src] while it's opened.</span>"
|
||||
return 1
|
||||
@@ -114,35 +116,39 @@
|
||||
if(stat)
|
||||
return 1
|
||||
|
||||
if(TotalMaterials() + SHEET_MATERIAL_AMOUNT > max_material_storage)
|
||||
user << "<span class='notice'>\The [src]'s material bin is full. Please remove material before adding more.</span>"
|
||||
return 1
|
||||
|
||||
var/obj/item/stack/material/stack = O
|
||||
var/amount = round(input("How many sheets do you want to add?") as num)//No decimals
|
||||
if(!O)
|
||||
var/obj/item/stack/material/S = O
|
||||
if(!(S.material.name in materials))
|
||||
user << "<span class='warning'>The [src] doesn't accept [S.material]!</span>"
|
||||
return
|
||||
if(amount <= 0)//No negative numbers
|
||||
return
|
||||
if(amount > stack.get_amount())
|
||||
amount = stack.get_amount()
|
||||
if(max_material_storage - TotalMaterials() < (amount * SHEET_MATERIAL_AMOUNT)) //Can't overfill
|
||||
amount = min(stack.get_amount(), round((max_material_storage - TotalMaterials()) / SHEET_MATERIAL_AMOUNT))
|
||||
|
||||
var/stacktype = stack.type
|
||||
busy = 1
|
||||
var/sname = "[S.name]"
|
||||
var/amnt = S.perunit
|
||||
var/max_res_amount = max_material_storage
|
||||
for(var/mat in materials)
|
||||
max_res_amount -= materials[mat]
|
||||
|
||||
if(materials[S.material.name] + amnt <= max_res_amount)
|
||||
if(S && S.amount >= 1)
|
||||
var/count = 0
|
||||
overlays += "fab-load-metal"
|
||||
spawn(10)
|
||||
overlays -= "fab-load-metal"
|
||||
while(materials[S.material.name] + amnt <= max_res_amount && S.amount >= 1)
|
||||
materials[S.material.name] += amnt
|
||||
S.use(1)
|
||||
count++
|
||||
user << "You insert [count] [sname] into the fabricator."
|
||||
else
|
||||
user << "The fabricator cannot hold more [sname]."
|
||||
busy = 0
|
||||
|
||||
var/stacktype = S.type
|
||||
var/t = getMaterialName(stacktype)
|
||||
overlays += "protolathe_[t]"
|
||||
spawn(10)
|
||||
overlays -= "protolathe_[t]"
|
||||
|
||||
busy = 1
|
||||
use_power(max(1000, (SHEET_MATERIAL_AMOUNT * amount / 10)))
|
||||
if(t)
|
||||
if(do_after(user, 16))
|
||||
if(stack.use(amount))
|
||||
user << "<span class='notice'>You add [amount] sheets to \the [src].</span>"
|
||||
materials[t] += amount * SHEET_MATERIAL_AMOUNT
|
||||
busy = 0
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
|
||||
37
html/changelogs/Atermonera - Sheetloader Fix.yml
Normal file
37
html/changelogs/Atermonera - Sheetloader Fix.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
################################
|
||||
# Example Changelog File
|
||||
#
|
||||
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
|
||||
#
|
||||
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
|
||||
# When it is, any changes listed below will disappear.
|
||||
#
|
||||
# Valid Prefixes:
|
||||
# bugfix
|
||||
# wip (For works in progress)
|
||||
# tweak
|
||||
# soundadd
|
||||
# sounddel
|
||||
# rscadd (general adding of nice things)
|
||||
# rscdel (general deleting of nice things)
|
||||
# imageadd
|
||||
# imagedel
|
||||
# maptweak
|
||||
# spellcheck (typo fixes)
|
||||
# experiment
|
||||
#################################
|
||||
|
||||
# Your name.
|
||||
author: Atermonera
|
||||
|
||||
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||
delete-after: True
|
||||
|
||||
# Any changes you've made. See valid prefix list above.
|
||||
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||
# SCREW THIS UP AND IT WON'T WORK.
|
||||
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
|
||||
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
|
||||
changes:
|
||||
- bugfix: "Sheetloaders can load materials into protolathes and circuit imprinters."
|
||||
- tweak: "Protolathes and circuit imprinters input materials like autolathes, taking as much of the fed stack as it can."
|
||||
Reference in New Issue
Block a user