[MIRROR] Techweb Fixes (#11299)

Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-08-04 15:36:43 -07:00
committed by GitHub
parent 399e4948e8
commit ac77b94d4b
29 changed files with 518 additions and 805 deletions

View File

@@ -464,8 +464,19 @@
/datum/component/material_container/proc/on_attackby(datum/source, obj/item/I, mob/living/user)
SIGNAL_HANDLER
if(istype(I, /obj/item/storage/bag/sheetsnatcher))
return OnSheetSnatcher(source, user, I)
return attempt_insert(user, I)
/datum/component/material_container/proc/OnSheetSnatcher(datum/source, mob/user, obj/item/storage/bag/sheetsnatcher/S)
SIGNAL_HANDLER
// this is called both locally and from remote_materials
var/list/sheets = S.quick_empty()
for(var/obj/item/stack/material/M as anything in sheets)
attempt_insert(user, M)
/// Proc that allows players to fill the parent with mats
/datum/component/material_container/proc/attempt_insert(mob/living/user, obj/item/weapon)
if(istype(parent, /obj/machinery))
@@ -714,17 +725,16 @@
return sheet_amt * SHEET_MATERIAL_AMOUNT
return FALSE
/datum/component/material_container/tgui_static_data(mob/user)
var/list/data = list()
var/list/data = ..()
data["SHEET_MATERIAL_AMOUNT"] = SHEET_MATERIAL_AMOUNT
return data
/// List format is list(list(name = ..., amount = ..., ref = ..., etc.), list(...))
/datum/component/material_container/tgui_data(mob/user, skip_empty = FALSE)
var/list/data = list()
for(var/datum/material/material as anything in materials)
var/amount = materials[material]

View File

@@ -165,6 +165,9 @@ handles linking back and forth.
if(mat_container_flags & MATCONTAINER_NO_INSERT)
return
if(istype(target, /obj/item/storage/bag/sheetsnatcher))
return mat_container.OnSheetSnatcher(source, target, user)
return attempt_insert(user, target)
/// Insert mats into silo

View File

@@ -89,11 +89,13 @@
data["recipes"] = recipes
data["categories"] = categories
data += rmat.mat_container.tgui_static_data(user)
return data
/obj/machinery/autolathe/ui_assets(mob/user)
return list(
get_asset_datum(/datum/asset/spritesheet/sheetmaterials)
get_asset_datum(/datum/asset/spritesheet_batched/sheetmaterials)
)
/obj/machinery/autolathe/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
@@ -169,20 +171,16 @@
if(making.hidden && !hacked)
return
var/datum/component/material_container/materials = rmat.mat_container
var/list/materials_used = list()
var/multiplier = (params["multiplier"] || 1)
if(making.is_stack)
var/max_sheets
for(var/material in making.resources)
var/coeff = (making.no_scale ? 1 : mat_efficiency) //stacks are unaffected by production coefficient
var/sheets = round(materials.get_material_amount(material) / round(making.resources[material] * coeff))
var/sheets = round(rmat.mat_container.get_material_amount(material) / round(making.resources[material] * coeff))
if(isnull(max_sheets) || max_sheets > sheets)
max_sheets = sheets
if(!isnull(materials.get_material_amount(material)) && materials.get_material_amount(material) < round(making.resources[material] * coeff))
if(!isnull(rmat.mat_container.get_material_amount(material)) && rmat.mat_container.get_material_amount(material) < round(making.resources[material] * coeff))
max_sheets = 0
//Build list of multipliers for sheets.
multiplier = tgui_input_number(ui.user, "How many do you want to print? (0-[max_sheets])", null, null, max_sheets, 0)
@@ -192,8 +190,11 @@
//Check if we still have the materials.
var/coeff = (making.no_scale ? 1 : mat_efficiency) //stacks are unaffected by production coefficient
if(LAZYLEN(materials_used))
if(!materials.has_materials(making.resources))
if(!rmat.can_use_resource())
return
if(LAZYLEN(making.resources))
if(!rmat.mat_container.has_materials(making.resources, coeff, multiplier))
return
rmat.use_materials(making.resources, coeff, multiplier)

View File

@@ -236,7 +236,7 @@
/obj/machinery/partslathe/ui_assets(mob/user)
return list(
get_asset_datum(/datum/asset/spritesheet/sheetmaterials)
get_asset_datum(/datum/asset/spritesheet_batched/sheetmaterials)
)
/obj/machinery/partslathe/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
@@ -258,6 +258,7 @@
"removable" = materials[M] >= SHEET_MATERIAL_AMOUNT,
)))
data["materials"] = materials_ui
data["SHEET_MATERIAL_AMOUNT"] = SHEET_MATERIAL_AMOUNT
data["copyBoard"] = null
data["copyBoardReqComponents"] = null

View File

@@ -364,16 +364,23 @@
// Modified quick_empty verb drops appropriate sized stacks
/obj/item/storage/bag/sheetsnatcher/quick_empty()
. = list()
var/location = get_turf(src)
for(var/obj/item/stack/material/S in contents)
var/cur_amount = S.get_amount()
var/full_stacks = round(cur_amount / S.max_amount) // Floor of current/max is amount of full stacks we make
var/remainder = cur_amount % S.max_amount // Current mod max is remainder after full sheets removed
for(var/i = 1 to full_stacks)
new S.type(location, S.max_amount)
. += new S.type(location, S.max_amount)
if(remainder)
new S.type(location, remainder)
. += new S.type(location, remainder)
S.set_amount(0)
for(var/mob/M in is_seeing)
if(!M.client || QDELETED(M))
hide_from(M)
else
M.client.screen -= S
orient2hud(usr)
if(usr.s_active)
usr.s_active.show_to(usr)

View File

@@ -1,5 +1,24 @@
/datum/asset/spritesheet/sheetmaterials
name = "sheetmaterials"
/datum/asset/spritesheet_batched/sheetmaterials
name = "sheetmaterials_batched"
/datum/asset/spritesheet/sheetmaterials/create_spritesheets()
InsertAll("", 'icons/obj/stacks.dmi')
/datum/asset/spritesheet_batched/sheetmaterials/create_spritesheets()
for(var/obj/item/stack/material/M as anything in subtypesof(/obj/item/stack/material))
if(M::default_type in entries)
continue
if(!M::icon_state)
continue
var/append = "_3"
if(M::no_variants)
append = ""
// rods inexplicably have a different format than everything else
if(M::icon_state == "rods")
append = "-3"
var/datum/universal_icon/UI = uni_icon(M::icon, "[M::icon_state][append]")
if(M.apply_colour)
var/datum/material/material = GET_MATERIAL_REF(M::default_type)
UI.blend_color(material.icon_colour, ICON_MULTIPLY)
insert_icon(M::default_type, UI)

View File

@@ -1,6 +1,6 @@
/datum/material/resin
name = MAT_RESIN
// icon_colour = "#353C40" // CHOMPedit: No longer needed
icon_colour = "#ffffff" // CHOMPedit: No longer needed
icon_base = "resin"
integrity = 50 // CHOMPedit: Same as wood.
hardness = 15 // CHOMPedit: Same as wood.

View File

@@ -60,7 +60,7 @@
/obj/machinery/ore_silo/proc/log_sheets_ejected(datum/component/material_container/container, obj/item/stack/material/sheets, atom/context)
SIGNAL_HANDLER
silo_log(context, "ejected", -sheets.amount, "[sheets.singular_name]", list(sheets.material))
silo_log(context, "ejected", -sheets.amount, "[sheets.singular_name]", list(GET_MATERIAL_REF(sheets.default_type) = sheets.amount * SHEET_MATERIAL_AMOUNT))
/obj/machinery/ore_silo/attackby(obj/item/W, mob/user, attack_modifier, click_parameters)
if(default_deconstruction_screwdriver(user, W))
@@ -79,7 +79,7 @@
/obj/machinery/ore_silo/ui_assets(mob/user)
return list(
get_asset_datum(/datum/asset/spritesheet/sheetmaterials)
get_asset_datum(/datum/asset/spritesheet_batched/sheetmaterials)
)
/obj/machinery/ore_silo/tgui_interact(mob/user, datum/tgui/ui)

View File

@@ -1,11 +1,11 @@
//CHOMP Disabled in DME in favor of modular_chomp folder
/*
* Device
*/
/obj/item/cell/device
name = "device power cell"
desc = "A small power cell designed to power handheld devices."
icon_state = "device_cell"
icon = 'modular_chomp/icons/obj/power_cells.dmi' // CHOMPEdit
icon_state = "m_st" // CHOMPEdit
item_state = "egg6"
w_class = ITEMSIZE_SMALL
force = 0
@@ -25,6 +25,7 @@
*/
/obj/item/cell/device/crap
name = "\improper rechargable D battery"
icon = 'icons/obj/power_cells.dmi' // CHOMPAdd
desc = "An older, cheap power cell designed to power handheld devices. It's probably been in use for quite some time now."
description_fluff = "You can't top the rust top." //TOTALLY TRADEMARK INFRINGEMENT
origin_tech = list(TECH_POWER = 0)
@@ -45,10 +46,12 @@
/obj/item/cell/device/hyper
name = "hyper device power cell"
desc = "A small power cell designed to power handheld devices. Has a better charge than a standard device cell."
icon_state = "hype_device_cell"
charge = 600
maxcharge = 600
icon_state = "meb_m_st" // CHOMPEdit
charge = 4800 // CHOMPEdit
maxcharge = 4800 // CHOMPEdit
charge_amount = 20 // CHOMPEdit
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
origin_tech = list(TECH_POWER = 4) // CHOMPAdd
/obj/item/cell/device/hyper/empty
charge = 0
@@ -59,9 +62,10 @@
/obj/item/cell/device/empproof
name = "shielded device power cell"
desc = "A small power cell designed to power handheld devices. Shielded from EMPs."
icon_state = "up_device_cell"
icon_state = "s_st" // CHOMPEdit
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
emp_proof = TRUE
origin_tech = list(TECH_POWER = 3) // CHOMPAdd
/obj/item/cell/device/empproof/empty
charge = 0
@@ -70,76 +74,32 @@
* Weapon
*/
/obj/item/cell/device/weapon
name = "weapon power cell"
desc = "A small power cell designed to power handheld weaponry."
icon_state = "weapon_cell"
// CHOMPEdit Start
name = "advanced device power cell" //This was a yawn change. I quite like this, makes more sense.
desc = "A small upgraded power cell designed to power handheld devices."
icon_state = "m_sup"
// CHOMPEdit End
charge = 2400
maxcharge = 2400
charge_amount = 20
origin_tech = list(TECH_POWER = 2) // CHOMPAdd
/obj/item/cell/device/weapon/empty
charge = 0
//Yawn Changes
/obj/item/cell/device/weapon //Aka adv
name = "advanced device power cell" //This was a yawn change. I quite like this, makes more sense.
desc = "A small upgraded power cell designed to power handheld devices."
icon_state = "weapon_cell"
maxcharge = 2400
charge_amount = 20
origin_tech = list(TECH_POWER = 2)
/obj/item/cell/device/super
name = "super device power cell"
desc = "A small upgraded power cell designed to power handheld devices."
icon_state = "sc_weapon_cell" //CHOMP Add
maxcharge = 3600
charge_amount = 20
origin_tech = list(TECH_POWER = 3)
/obj/item/cell/device/super/empty/Initialize(mapload)
. = ..()
charge = 0
update_icon()
/obj/item/cell/device/hyper
name = "hyper device power cell"
desc = "A small upgraded power cell designed to hold much more power for handheld devices."
icon_state = "cap_weapon_cell" //CHOMP Add
maxcharge = 4800
charge_amount = 20
origin_tech = list(TECH_POWER = 4)
/obj/item/cell/device/hyper/empty/Initialize(mapload)
. = ..()
charge = 0
update_icon()
//End of Yawn changes
//CHOMP Add begin
/obj/item/cell/device/giga //CHOMP Add: Why not? Lets add a new one. Lets put the new sprites to use.
name = "giga device power cell"
desc = "A small power cell that holds a blistering amount of energy, constructed by clever scientists using secrets gleaned from alien technology."
icon_state = "cap_weapon_cell"
maxcharge = 6000
charge_amount = 20
origin_tech = list(TECH_POWER = 5, TECH_PRECURSOR = 1)
/obj/item/cell/device/giga/empty/Initialize(mapload)
. = ..()
charge = 0
update_icon()
//CHOMP Add end
/*
* EMP Proof Weapon
*/
/obj/item/cell/device/weapon/empproof
name = "shielded weapon power cell"
desc = "A small power cell designed to power handheld weaponry. Shielded from EMPs."
icon_state = "emp_weapon_cell"
icon_state = "s_hi" // CHOMPEdit
charge = 2400 // CHOMPEdit
maxcharge = 2400 // CHOMPEdit
charge_amount = 20 // CHOMPEdit
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
emp_proof = TRUE
origin_tech = list(TECH_POWER = 4) // CHOMPEdit
/obj/item/cell/device/weapon/empproof/empty
charge = 0
@@ -150,17 +110,18 @@
/obj/item/cell/device/weapon/recharge
name = "self-charging weapon power cell"
desc = "A small power cell designed to power handheld weaponry. This one recharges itself."
icon_state = "sc_weapon_cell"
icon_state = "meb_m_nu" // CHOMPEdit
matter = list(MAT_STEEL = 400, MAT_GLASS = 80)
self_recharge = TRUE
charge_amount = 120
charge_amount = 60 //2.5% // CHOMPEdit
charge_delay = 75
origin_tech = list(TECH_POWER = 5, TECH_ARCANE = 1) // CHOMPEdit
/*
* Captain's Self-charging Weapon
*/
/obj/item/cell/device/weapon/recharge/captain
icon_state = "cap_weapon_cell"
icon_state = "infinite_m" // CHOMPEdit
matter = list(MAT_STEEL = 400, MAT_GLASS = 100)
charge_amount = 160 //Recharges a lot more quickly...
charge_delay = 100 //... but it takes a while to get started
@@ -188,9 +149,11 @@
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_void_cell)
icon = 'icons/obj/abductor.dmi'
icon_state = "cell"
charge_amount = 120 // 5%.
charge = 5000 // CHOMPEdit
maxcharge = 5000 // CHOMPEdit
charge_amount = 130 // 2.5%. // CHOMPEdit
charge_delay = 50 // Every five seconds, bit faster than the default.
origin_tech = list(TECH_POWER = 8, TECH_ENGINEERING = 6)
origin_tech = list(TECH_POWER = 7, TECH_ENGINEERING = 6, TECH_PHORON = 6, TECH_ARCANE = 2, TECH_PRECURSOR = 2) // CHOMPEdit
var/swaps_to = /obj/item/cell/void
standard_overlays = FALSE
@@ -198,6 +161,8 @@
return // No overlays please.
/obj/item/cell/device/weapon/recharge/alien/attack_self(var/mob/user)
if(!swaps_to)
return
user.remove_from_mob(src)
to_chat(user, span_notice("You swap [src] to 'machinery cell' mode."))
var/obj/item/cell/newcell = new swaps_to(null)
@@ -212,16 +177,3 @@
icon = 'icons/obj/power_vr.dmi'
icon_state = "cellb"
swaps_to = /obj/item/cell/void/hybrid
//YAWN Addtion
/obj/item/cell/device/weapon/recharge/alien/omni
name = "omni weapon power cell"
desc = "A mix between alien technology and phoron tech. Seems to fit in almost any cell slot..."
charge_amount = 90 // 5%.
charge = 1800
maxcharge = 1800
charge_delay = 50 SECONDS
origin_tech = list(TECH_POWER = 6, TECH_ENGINEERING = 4, TECH_PHORON = 3)
/obj/item/cell/device/weapon/recharge/alien/omni/empty
charge = 0

View File

@@ -1,4 +1,3 @@
//CHOMP Disabled in DME in favor of modular_chomp folder
/obj/item/cell/spike
name = "modified power cell"
desc = "A modified power cell sitting in a highly conductive chassis."

View File

@@ -1,4 +1,3 @@
//CHOMP Disabled in DME in favor of modular_chomp folder
/*
* Empty
*/
@@ -9,9 +8,9 @@
* Crap
*/
/obj/item/cell/crap
name = "\improper rechargable DD battery"
name = "\improper rechargable AA battery" // CHOMPEdit
desc = "An older, cheap power cell. It's probably been in use for quite some time now."
description_fluff = "You can't top the rust top." //TOTALLY TRADEMARK INFRINGEMENT
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT // CHOMPEdit
origin_tech = list(TECH_POWER = 0)
icon_state = "crap"
charge = 500
@@ -19,8 +18,10 @@
matter = list(MAT_STEEL = 700, MAT_GLASS = 40)
robot_durability = 20
/* CHOMPRemove Start
/obj/item/cell/crap/update_icon() //No visible charge indicator
return
*/// CHOMPRemve End
/obj/item/cell/crap/empty
charge = 0
@@ -50,7 +51,7 @@
/obj/item/cell/high
name = "high-capacity power cell"
origin_tech = list(TECH_POWER = 2)
icon_state = "high"
icon_state = "b_hi" // CHOMPEdit
charge = 10000
maxcharge = 10000
matter = list(MAT_STEEL = 700, MAT_GLASS = 60)
@@ -65,7 +66,7 @@
/obj/item/cell/super
name = "super-capacity power cell"
origin_tech = list(TECH_POWER = 5)
icon_state = "super"
icon_state = "b_sup" // CHOMPEdit
charge = 20000
maxcharge = 20000
matter = list(MAT_STEEL = 700, MAT_GLASS = 70)
@@ -80,7 +81,7 @@
/obj/item/cell/robot_syndi
name = "syndicate robot power cell"
description_fluff = "Almost as good as a hyper."
icon_state = "super" //We don't want roboticists confuse it with a low standard cell
icon_state = "b_sup" //We don't want roboticists confuse it with a low standard cell // CHOMPEdit
charge = 25000
maxcharge = 25000
robot_durability = 65
@@ -91,7 +92,7 @@
/obj/item/cell/hyper
name = "hyper-capacity power cell"
origin_tech = list(TECH_POWER = 6)
icon_state = "hyper"
icon_state = "b_hy" // CHOMPEdit
charge = 30000
maxcharge = 30000
matter = list(MAT_STEEL = 700, MAT_GLASS = 80)
@@ -105,7 +106,7 @@
*/
/obj/item/cell/mech
name = "mecha power cell"
icon_state = "mech"
icon_state = "exs_s" // CHOMPEdit
connector_type = "mech"
charge = 15000
maxcharge = 15000
@@ -116,6 +117,7 @@
desc = "An ancient battery design not commonly seen anymore. It looks like it'd fit inside a mech however..."
origin_tech = list(TECH_POWER = 0) //Litteraly an old car battery, doesn't need tech
icon_state = "lead"
icon = 'icons/obj/power_cells.dmi' // CHOMPAdd
charge = 8000
maxcharge = 8000
matter = list(MAT_STEEL = 300, MAT_GLASS = 10)
@@ -126,7 +128,7 @@
/obj/item/cell/mech/high
name = "high-capacity mecha power cell"
origin_tech = list(TECH_POWER = 3)
icon_state = "blue"
icon_state = "exs_m" // CHOMPEdit
charge = 20000
maxcharge = 20000
matter = list(MAT_STEEL = 800, MAT_GLASS = 80)
@@ -134,7 +136,7 @@
/obj/item/cell/mech/super
name = "super-capacity mecha power cell"
origin_tech = list(TECH_POWER = 6)
icon_state = "white"
icon_state = "exs_l" // CHOMPEdit
charge = 25000
maxcharge = 25000
matter = list(MAT_STEEL = 800, MAT_GLASS = 100)
@@ -144,7 +146,7 @@
*/
/obj/item/cell/infinite
name = "infinite-capacity power cell!"
icon_state = "infinity"
icon_state = "infinite_b" // CHOMPEdit
origin_tech = null
charge = 30000
maxcharge = 30000 //determines how badly mobs get shocked
@@ -180,9 +182,12 @@
icon = 'icons/mob/slimes.dmi' //'icons/obj/harvest.dmi'
icon_state = "yellow slime extract" //"potato_battery"
connector_type = "slime"
description_info = "This 'cell' holds a max charge of 10k and self recharges over time."
charge = 10000
maxcharge = 10000
// CHOMPEdit Start
description_info = "This 'cell' holds a max charge of 20k and self recharges over time."
charge = 20000
maxcharge = 20000
charge_amount = 500 // 2.5%.
// CHOMPEdit End
matter = null
self_recharge = TRUE
standard_overlays = FALSE
@@ -193,9 +198,10 @@
/obj/item/cell/emergency_light
name = "miniature power cell"
desc = "A tiny power cell with a very low power capacity. Used in light fixtures to power them in the event of an outage."
charge = 720
maxcharge = 720 //Emergency lights use 0.2 W per tick, meaning ~60 minutes of emergency power from a cell
charge = 360 // CHOMPEdit
maxcharge = 360 //Emergency lights use 0.2 W per tick, meaning ~30 minutes of emergency power from a cell // CHOMPEdit
matter = list(MAT_GLASS = 20)
icon = 'icons/obj/power_cells.dmi' // CHOMPAdd
icon_state = "em_light"
connector_type = "emergency"
w_class = ITEMSIZE_TINY
@@ -258,9 +264,9 @@
origin_tech = list(TECH_POWER = 8, TECH_ENGINEERING = 6)
icon = 'icons/obj/abductor.dmi'
icon_state = "cell"
charge = 4800
maxcharge = 4800 //10x the device version
charge_amount = 1200 //10x the device version
charge = 10000 // CHOMPEdit
maxcharge = 10000 // CHOMPEdit
charge_amount = 500 // CHOMPEdit
self_recharge = TRUE
charge_delay = 50
matter = null

View File

@@ -351,7 +351,7 @@
id = "basic_cell"
build_type = PROTOLATHE | AUTOLATHE
materials = list(MAT_STEEL = 700, MAT_GLASS = 50)
build_path = /obj/item/cell
build_path = /obj/item/cell/empty
category = list(
RND_CATEGORY_STOCK_PARTS + RND_SUBCATEGORY_STOCK_PARTS_1
)
@@ -363,7 +363,7 @@
id = "high_cell"
build_type = PROTOLATHE
materials = list(MAT_STEEL = 700, MAT_GLASS = 60)
build_path = /obj/item/cell/high
build_path = /obj/item/cell/high/empty
category = list(
RND_CATEGORY_STOCK_PARTS + RND_SUBCATEGORY_STOCK_PARTS_2
)
@@ -375,7 +375,7 @@
id = "super_cell"
build_type = PROTOLATHE
materials = list(MAT_STEEL = 700, MAT_GLASS = 70)
build_path = /obj/item/cell/super
build_path = /obj/item/cell/super/empty
category = list(
RND_CATEGORY_STOCK_PARTS + RND_SUBCATEGORY_STOCK_PARTS_3
)
@@ -388,7 +388,7 @@
// req_tech = list(TECH_POWER = 5, TECH_MATERIAL = 4)
build_type = PROTOLATHE
materials = list(MAT_STEEL = 400, MAT_GOLD = 150, MAT_SILVER = 150, MAT_GLASS = 70)
build_path = /obj/item/cell/hyper
build_path = /obj/item/cell/hyper/empty
category = list(
RND_CATEGORY_STOCK_PARTS + RND_SUBCATEGORY_STOCK_PARTS_4
)
@@ -400,7 +400,7 @@
id = "device_cell"
build_type = PROTOLATHE
materials = list(MAT_STEEL = 350, MAT_GLASS = 25)
build_path = /obj/item/cell/device
build_path = /obj/item/cell/device/empty
category = list(
RND_CATEGORY_STOCK_PARTS + RND_SUBCATEGORY_STOCK_PARTS_1
)
@@ -410,7 +410,7 @@
id = "weapon_cell"
build_type = PROTOLATHE
materials = list(MAT_STEEL = 700, MAT_GLASS = 50)
build_path = /obj/item/cell/device/weapon
build_path = /obj/item/cell/device/weapon/empty
category = list(
RND_CATEGORY_STOCK_PARTS + RND_SUBCATEGORY_STOCK_PARTS_1
)

View File

@@ -206,7 +206,7 @@
/obj/machinery/rnd/production/ui_assets(mob/user)
return list(
get_asset_datum(/datum/asset/spritesheet/sheetmaterials),
get_asset_datum(/datum/asset/spritesheet_batched/sheetmaterials),
get_asset_datum(/datum/asset/spritesheet_batched/research_designs)
)
@@ -254,6 +254,7 @@
data["designs"] = designs
data["fabName"] = name
data += materials.mat_container.tgui_static_data()
return data

View File

@@ -361,7 +361,7 @@
/obj/machinery/mecha_part_fabricator_tg/ui_assets(mob/user)
return list(
get_asset_datum(/datum/asset/spritesheet/sheetmaterials),
get_asset_datum(/datum/asset/spritesheet_batched/sheetmaterials),
get_asset_datum(/datum/asset/spritesheet_batched/research_designs)
)

View File

@@ -117,10 +117,10 @@
///Proc called when the Station (Science techweb specific) researches a node.
/datum/techweb_node/proc/on_station_research(atom/research_source)
SHOULD_CALL_PARENT(TRUE)
var/channels_to_use = announce_channels
if(length(channels_to_use) && !starting_node)
for(var/channel in channels_to_use)
GLOB.global_announcer.autosay("Science just researched node \"[display_name]\".", "Science Announcer", channel)
// var/channels_to_use = announce_channels
// if(length(channels_to_use) && !starting_node)
// for(var/channel in channels_to_use)
// GLOB.global_announcer.autosay("Science just researched node \"[display_name]\".", "Science Announcer", channel)
// if(istype(research_source, /obj/machinery/computer/rdconsole))
// var/obj/machinery/computer/rdconsole/console = research_source
// var/obj/item/circuitboard/computer/rdconsole/board = console.circuit

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -1,81 +1,3 @@
/*
* Device
*/
/obj/item/cell/device
name = "device power cell"
desc = "A small power cell designed to power handheld devices."
icon = 'modular_chomp/icons/obj/power_cells.dmi'
icon_state = "m_st"
item_state = "egg6"
w_class = ITEMSIZE_SMALL
force = 0
throw_speed = 5
throw_range = 7
charge = 480
maxcharge = 480
charge_amount = 5
matter = list(MAT_STEEL = 350, MAT_GLASS = 50)
preserve_item = 1
/obj/item/cell/device/empty
charge = 0
/*
* EMP Proof Device
*/
/obj/item/cell/device/empproof
name = "shielded device power cell"
desc = "A small power cell designed to power handheld devices. Shielded from EMPs."
icon_state = "s_st"
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
emp_proof = TRUE
origin_tech = list(TECH_POWER = 3)
/obj/item/cell/device/empproof/empty
charge = 0
/*
* Weapon
*/
/obj/item/cell/device/weapon
name = "advanced device power cell" //This was a yawn change. I quite like this, makes more sense.
desc = "A small upgraded power cell designed to power handheld devices."
icon_state = "m_sup"
charge = 2400
maxcharge = 2400
charge_amount = 20
origin_tech = list(TECH_POWER = 2)
/obj/item/cell/device/weapon/empty
charge = 0
/obj/item/cell/device/super
name = "super device power cell"
desc = "A small upgraded power cell designed to power handheld devices."
icon_state = "m_hy"
charge = 3600
maxcharge = 3600
charge_amount = 20
origin_tech = list(TECH_POWER = 3)
/obj/item/cell/device/super/empty
charge = 0
/*
* Hyper
*/
/obj/item/cell/device/hyper
name = "hyper device power cell"
desc = "A small upgraded power cell designed to hold much more power for handheld devices."
icon_state = "meb_m_st"
charge = 4800
maxcharge = 4800
charge_amount = 20
origin_tech = list(TECH_POWER = 4)
/obj/item/cell/device/hyper/empty
charge = 0
/*
* Giga
*/
@@ -91,133 +13,23 @@
/obj/item/cell/device/giga/empty
charge = 0
/*
* EMP Proof Weapon
*/
/obj/item/cell/device/weapon/empproof
name = "shielded weapon power cell"
desc = "A small power cell designed to power handheld weaponry. Shielded from EMPs."
icon_state = "s_hi"
charge = 2400
maxcharge = 2400
/obj/item/cell/device/super
name = "super device power cell"
desc = "A small upgraded power cell designed to power handheld devices."
icon_state = "m_hy"
charge = 3600
maxcharge = 3600
charge_amount = 20
matter = list(MAT_STEEL = 400, MAT_GLASS = 60)
emp_proof = TRUE
origin_tech = list(TECH_POWER = 4)
origin_tech = list(TECH_POWER = 3)
/obj/item/cell/device/weapon/empproof/empty
/obj/item/cell/device/super/empty
charge = 0
/*
* Self-charging Weapon
*/
/obj/item/cell/device/weapon/recharge
name = "self-charging weapon power cell"
desc = "A small power cell designed to power handheld weaponry. This one recharges itself."
icon_state = "meb_m_nu"
matter = list(MAT_STEEL = 400, MAT_GLASS = 80)
self_recharge = TRUE
charge_amount = 60 //2.5%
charge_delay = 75
origin_tech = list(TECH_POWER = 5, TECH_ARCANE = 1)
/*
* Captain's Self-charging Weapon
*/
/obj/item/cell/device/weapon/recharge/captain
icon_state = "infinite_m"
matter = list(MAT_STEEL = 400, MAT_GLASS = 100)
charge_amount = 160 //Recharges a lot more quickly...
charge_delay = 100 //... but it takes a while to get started
/*
* Alien Void Cell
*/
/datum/category_item/catalogue/anomalous/precursor_a/alien_void_cell
name = "Precursor Alpha Object - Void Cell"
desc = "This is a very enigmatic and small machine. It is able to output a direct electrical current \
from itself to another device or machine that it is connected to. Its shape has a similar form as \
a battery cell, which might imply that the species who created these had a desire for some form of \
a modular power supply.\
<br><br>\
These appear to be limited in throughput, only able to put out so much energy at a time. It is unknown \
if this was intentional, or was a design constraint that the creators of this object had to work around. \
Regardless, it will likely function inside of various devices which run off of conventional power cells.\
<br><br>\
Scanning similar objects may yield more information."
value = CATALOGUER_REWARD_EASY
/obj/item/cell/device/weapon/recharge/alien
name = "void cell"
desc = "An alien technology that produces energy seemingly out of nowhere. Its small, cylinderal shape means it might be able to be used with human technology, perhaps?"
catalogue_data = list(/datum/category_item/catalogue/anomalous/precursor_a/alien_void_cell)
icon = 'icons/obj/abductor.dmi'
icon_state = "cell"
charge = 5000
maxcharge = 5000
charge_amount = 130 // 2.5%.
charge_delay = 50 // Every five seconds, bit faster than the default.
origin_tech = list(TECH_POWER = 7, TECH_ENGINEERING = 6, TECH_PHORON = 6, TECH_ARCANE = 2, TECH_PRECURSOR = 2)
/obj/item/cell/device/weapon/recharge/alien/update_icon()
return // No overlays please.
//CHOMP Add Putting virgo code into our code to make sure this does not change.
//The device cell
/obj/item/cell/device/weapon/recharge/alien
name = "void cell (device)"
var/swaps_to = /obj/item/cell/void
standard_overlays = FALSE
/obj/item/cell/device/weapon/recharge/alien/attack_self(var/mob/user)
if(!swaps_to)
return
user.remove_from_mob(src)
to_chat(user, span_notice("You swap [src] to 'machinery cell' mode."))
var/obj/item/cell/newcell = new swaps_to(null)
user.put_in_active_hand(newcell)
var/percentage = charge/maxcharge
newcell.charge = newcell.maxcharge * percentage
qdel(src)
//The machine cell
/obj/item/cell/void
name = "void cell (machinery)"
desc = "An alien technology that produces energy seemingly out of nowhere. Its small, cylinderal shape means it might be able to be used with human technology, perhaps?"
origin_tech = list(TECH_POWER = 8, TECH_ENGINEERING = 6)
icon = 'icons/obj/abductor.dmi'
icon_state = "cell"
charge = 10000
maxcharge = 10000
charge_amount = 500
self_recharge = TRUE
charge_delay = 50
matter = null
standard_overlays = FALSE
var/swaps_to = /obj/item/cell/device/weapon/recharge/alien
/obj/item/cell/void/attack_self(var/mob/user)
user.remove_from_mob(src)
to_chat(user, span_notice("You swap [src] to 'device cell' mode."))
var/obj/item/cell/newcell = new swaps_to(null)
user.put_in_active_hand(newcell)
var/percentage = charge/maxcharge
newcell.charge = newcell.maxcharge * percentage
qdel(src)
// Bloo friendlier hybrid tech
/obj/item/cell/device/weapon/recharge/alien/hybrid
icon = 'icons/obj/power_vr.dmi'
icon_state = "cellb"
swaps_to = /obj/item/cell/void/hybrid
/obj/item/cell/void/hybrid
icon = 'icons/obj/power_vr.dmi'
icon_state = "cellb"
swaps_to = /obj/item/cell/device/weapon/recharge/alien/hybrid
//YAWN Addtion
/obj/item/cell/device/weapon/recharge/alien/omni
name = "omni weapon power cell"
desc = "A mix between alien technology and phoron-based tech. Not quite as good as a true void cell though."

View File

@@ -1,75 +0,0 @@
//I don't know what this is, but whatever it is, I am taking it from virgo code so they stop messing with cells.
/obj/item/cell/spike
name = "modified power cell"
desc = "A modified power cell sitting in a highly conductive chassis."
origin_tech = list(TECH_POWER = 2)
icon_state = "modded"
charge = 10000
maxcharge = 10000
matter = list(MAT_STEEL = 1000, MAT_GLASS = 80, MAT_SILVER = 100)
self_recharge = TRUE
charge_amount = 150
/obj/item/cell/spike/process()
..()
var/turf/Center = get_turf(src)
var/shock_count = 0
for(var/turf/T in range(Center, 1))
if(prob(round(charge / 250)) && charge >= (maxcharge / 4))
if(locate(/obj/effect/temporary_effect/pulse/staticshock) in T)
continue
var/conductive = FALSE
if(istype(T, /turf/simulated/wall))
var/turf/simulated/wall/WT = T
if(WT.material.conductive)
conductive = TRUE
else if(WT.girder_material.conductive)
conductive = TRUE
else if(WT.reinf_material && WT.reinf_material.conductive)
conductive = TRUE
if(istype(T, /turf/simulated/floor))
var/turf/simulated/floor/F = T
if(istype(F.flooring, /decl/flooring/reinforced))
conductive = TRUE
if(conductive)
shock_count += 1
new /obj/effect/temporary_effect/pulse/staticshock(T)
if(shock_count)
while(shock_count)
use(200)
shock_count--
/obj/effect/temporary_effect/pulse/staticshock
name = "electric field"
desc = "Caution: Do not touch."
pulses_remaining = 10
pulse_delay = 2 SECONDS
icon_state = "blue_static"
/obj/effect/temporary_effect/pulse/staticshock/on_pulse()
..()
for(var/mob/living/L in view(1, src))
if(!issilicon(L) && prob(L.mob_size))
var/obj/item/projectile/beam/shock/weak/P = new (get_turf(src))
P.launch_projectile_from_turf(L, BP_TORSO)
var/obj/item/plastique/C4 = locate() in get_turf(src)
if(C4)
C4.visible_message(span_danger("The current fries \the [C4]!"))
if(prob(10))
C4.explode(get_turf(src))
else
qdel(C4)

View File

@@ -1,35 +1,3 @@
/*
* Crap
*/
/obj/item/cell/crap
name = "\improper rechargable AA battery"
desc = "You can't top the plasma top." //TOTALLY TRADEMARK INFRINGEMENT
origin_tech = list(TECH_POWER = 0)
icon_state = "crap"
charge = 500
maxcharge = 500
matter = list(MAT_STEEL = 700, MAT_GLASS = 40)
/obj/item/cell/crap/empty
charge = 0
/*
* Robot
*/
/obj/item/cell/robot_station
name = "standard robot power cell"
charge = 7500
maxcharge = 7500
/*
* Syndicate
*/
/obj/item/cell/robot_syndi
name = "syndicate robot power cell"
description_fluff = "Almost as good as a hyper."
icon_state = "b_sup" //We don't want roboticists confuse it with a low standard cell
charge = 25000
maxcharge = 25000
/*
* Security Borg
@@ -45,59 +13,6 @@
/obj/item/cell/secborg/empty
charge = 0
/*
* APC
*/
/obj/item/cell/apc
name = "heavy-duty power cell"
origin_tech = list(TECH_POWER = 1)
icon_state = "apc"
charge = 5000
maxcharge = 5000
matter = list(MAT_STEEL = 700, MAT_GLASS = 50)
/*
* High
*/
/obj/item/cell/high
name = "high-capacity power cell"
origin_tech = list(TECH_POWER = 2)
icon_state = "b_hi"
charge = 10000
maxcharge = 10000
matter = list(MAT_STEEL = 700, MAT_GLASS = 60)
/obj/item/cell/high/empty
charge = 0
/*
* Super
*/
/obj/item/cell/super
name = "super-capacity power cell"
origin_tech = list(TECH_POWER = 5)
icon_state = "b_sup"
charge = 20000
maxcharge = 20000
matter = list(MAT_STEEL = 700, MAT_GLASS = 70)
/obj/item/cell/super/empty
charge = 0
/*
* Hyper
*/
/obj/item/cell/hyper
name = "hyper-capacity power cell"
origin_tech = list(TECH_POWER = 6)
icon_state = "b_hy"
charge = 30000
maxcharge = 30000
matter = list(MAT_STEEL = 700, MAT_GLASS = 80)
/obj/item/cell/hyper/empty
charge = 0
/*
* Giga
*/
@@ -111,134 +26,3 @@
/obj/item/cell/giga/empty
charge = 0
/*
* Mecha
*/
/obj/item/cell/mech
name = "mecha power cell"
icon_state = "exs_s"
charge = 15000
maxcharge = 15000
matter = list(MAT_STEEL = 800, MAT_GLASS = 60)
/obj/item/cell/mech/high
name = "high-capacity mecha power cell"
origin_tech = list(TECH_POWER = 3)
icon_state = "exs_m"
charge = 20000
maxcharge = 20000
matter = list(MAT_STEEL = 800, MAT_GLASS = 80)
/obj/item/cell/mech/super
name = "super-capacity mecha power cell"
origin_tech = list(TECH_POWER = 6)
icon_state = "exs_l"
charge = 25000
maxcharge = 25000
matter = list(MAT_STEEL = 800, MAT_GLASS = 100)
/*
* Infinite
*/
/obj/item/cell/infinite
name = "infinite-capacity power cell!"
icon_state = "infinite_b"
origin_tech = null
charge = 30000
maxcharge = 30000 //determines how badly mobs get shocked
matter = list(MAT_STEEL = 700, MAT_GLASS = 80)
/obj/item/cell/infinite/check_charge()
return 1
/obj/item/cell/infinite/use()
return 1
/*
* Potato
*/
/obj/item/cell/potato
name = "potato battery"
desc = "A rechargable starch based power cell."
origin_tech = list(TECH_POWER = 0)
icon_state = "potato"
charge = 100
maxcharge = 300
minor_fault = 1
/*
* Slime
*/
/obj/item/cell/slime
name = "charged slime core"
desc = "A yellow slime core infused with phoron, it crackles with power."
origin_tech = list(TECH_POWER = 4, TECH_BIO = 5)
icon = 'icons/mob/slimes.dmi' //'icons/obj/harvest.dmi'
icon_state = "yellow slime extract" //"potato_battery"
description_info = "This 'cell' holds a max charge of 20k and self recharges over time."
charge = 20000
maxcharge = 20000
charge_amount = 500 // 2.5%.
matter = null
self_recharge = TRUE
standard_overlays = FALSE
/*
* Emergency Light
*/
/obj/item/cell/emergency_light
name = "miniature power cell"
desc = "A tiny power cell with a very low power capacity. Used in light fixtures to power them in the event of an outage."
charge = 360
maxcharge = 360 //Emergency lights use 0.2 W per tick, meaning ~30 minutes of emergency power from a cell
matter = list(MAT_GLASS = 20)
icon_state = "em_light"
w_class = ITEMSIZE_TINY
/obj/item/cell/emergency_light/Initialize(mapload)
. = ..()
var/area/A = get_area(src)
if(!A.lightswitch || !A.light_power)
charge = 0 //For naturally depowered areas, we start with no power
/*
* Backup Battery
*
* Not actually a cell, but if people look for it, they'll probably look near other cells
*/
/obj/item/fbp_backup_cell
name = "backup battery"
desc = "A small one-time-use chemical battery for synthetic crew when they are low on power in emergency situations."
icon = 'icons/obj/power_cells.dmi'
icon_state = "backup"
w_class = ITEMSIZE_SMALL
var/amount = 100
var/used = FALSE
/obj/item/fbp_backup_cell/Initialize(mapload)
. = ..()
add_overlay("[icon_state]_100")
/obj/item/fbp_backup_cell/attack(mob/living/M as mob, mob/user as mob)
if(!used && ishuman(M))
var/mob/living/carbon/human/H = M
if(H.isSynthetic())
if(H.nutrition <= amount)
use(user,H)
else
to_chat(user,span_warning("The difference in potential is too great. [user == M ? "You have" : "[H] has"] too much charge to use such a small battery."))
else if(M == user)
to_chat(user,span_warning("You lick the cell, and your tongue tingles slightly."))
else
to_chat(user,span_warning("This cell is meant for use on humanoid synthetics only."))
. = ..()
/obj/item/fbp_backup_cell/proc/use(var/mob/living/user, var/mob/living/target)
if(used)
return
used = TRUE
desc += " This one has already been used."
cut_overlays()
target.adjust_nutrition(amount)
user.custom_emote(message = "connects \the [src] to [user == target ? "their" : "[target]'s"] charging port, expending it.")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 699 B

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -14,8 +14,8 @@ import {
import { formatSiUnit } from 'tgui-core/format';
import type { BooleanLike } from 'tgui-core/react';
import { toTitleCase } from 'tgui-core/string';
import { Materials } from './ExosuitFabricator/Material';
import { MaterialAccessBar } from './common/MaterialAccessBar';
import type { Material } from './Fabrication/Types';
type MaterialData = {
name: string;
@@ -37,24 +37,37 @@ type RecipeData = {
type Data = {
busy: string;
materials: MaterialData[];
materials: Material[];
mat_efficiency: number;
recipes: RecipeData[];
SHEET_MATERIAL_AMOUNT: number;
};
export const Autolathe = (props) => {
const { act, data } = useBackend<Data>();
const { SHEET_MATERIAL_AMOUNT } = data;
return (
<Window width={670} height={600}>
<Window.Content>
<Stack vertical fill>
<Stack.Item>
<Section title="Materials">
<Materials />
</Section>
</Stack.Item>
<Stack.Item grow>
<Designs />
</Stack.Item>
<Stack.Item>
<Section>
<MaterialAccessBar
availableMaterials={data.materials}
SHEET_MATERIAL_AMOUNT={SHEET_MATERIAL_AMOUNT}
onEjectRequested={(mat: Material, qty: number) =>
act('remove_mat', {
id: mat.name,
amount: qty,
})
}
/>
</Section>
</Stack.Item>
</Stack>
</Window.Content>
</Window>

View File

@@ -11,10 +11,15 @@ import { type BooleanLike, classes } from 'tgui-core/react';
import { useBackend } from '../backend';
import { Window } from '../layouts';
import { Materials } from './ExosuitFabricator/Material';
import { MaterialAccessBar } from './common/MaterialAccessBar';
import { DesignBrowser } from './Fabrication/DesignBrowser';
import { MaterialCostSequence } from './Fabrication/MaterialCostSequence';
import type { Design, FabricatorData, MaterialMap } from './Fabrication/Types';
import type {
Design,
FabricatorData,
Material,
MaterialMap,
} from './Fabrication/Types';
type ExosuitDesign = Design & {
constructionTime: number;
@@ -77,7 +82,16 @@ export const ExosuitFabricatorTg = (props) => {
</Stack.Item>
<Stack.Item>
<Section>
<Materials />
<MaterialAccessBar
availableMaterials={data.materials}
SHEET_MATERIAL_AMOUNT={SHEET_MATERIAL_AMOUNT}
onEjectRequested={(mat: Material, qty: number) =>
act('remove_mat', {
id: mat.name,
amount: qty,
})
}
/>
</Section>
</Stack.Item>
</Stack>

View File

@@ -1,62 +1,6 @@
import { Icon } from 'tgui-core/components';
import { classes } from 'tgui-core/react';
import { MATERIAL_KEYS } from './Types';
const MATERIAL_ICONS: Record<string, [number, string][]> = {
iron: [
[0, 'sheet-metal'],
[17, 'sheet-metal_2'],
[34, 'sheet-metal_3'],
],
glass: [
[0, 'sheet-glass'],
[17, 'sheet-glass_2'],
[34, 'sheet-glass_3'],
],
silver: [
[0, 'sheet-silver'],
[17, 'sheet-silver_2'],
[34, 'sheet-silver_3'],
],
gold: [
[0, 'sheet-gold'],
[17, 'sheet-gold_2'],
[34, 'sheet-gold_3'],
],
diamond: [
[0, 'sheet-diamond'],
[17, 'sheet-diamond_2'],
[34, 'sheet-diamond_3'],
],
plasma: [
[0, 'sheet-plasma'],
[17, 'sheet-plasma_2'],
[34, 'sheet-plasma_3'],
],
uranium: [
[0, 'sheet-uranium'],
[17, 'sheet-uranium_2'],
[34, 'sheet-uranium_3'],
],
bananium: [
[0, 'sheet-bananium'],
[17, 'sheet-bananium_2'],
[34, 'sheet-bananium_3'],
],
titanium: [
[0, 'sheet-titanium'],
[17, 'sheet-titanium_2'],
[34, 'sheet-titanium_3'],
],
'bluespace crystal': [[0, 'bluespace_crystal']],
plastic: [
[0, 'sheet-plastic'],
[17, 'sheet-plastic_2'],
[34, 'sheet-plastic_3'],
],
};
export type MaterialIconProps = {
/**
* The name of the material.
@@ -75,7 +19,7 @@ export type MaterialIconProps = {
*/
export const MaterialIcon = (props: MaterialIconProps) => {
const { materialName, sheets = 0 } = props;
const icon_name = MATERIAL_KEYS[materialName];
const icon_name = materialName;
if (!icon_name) {
return <Icon name="question-circle" />;
@@ -87,7 +31,7 @@ export const MaterialIcon = (props: MaterialIconProps) => {
className={classes([
'FabricatorMaterialIcon__Icon',
'FabricatorMaterialIcon__Icon--active',
'sheetmaterials32x32',
'sheetmaterials_batched32x32',
icon_name,
])}
/>

View File

@@ -5,28 +5,6 @@ import type { BooleanLike } from 'tgui-core/react';
*/
export type MaterialMap = Record<string, number>;
export const MATERIAL_KEYS = {
steel: 'sheet-metal_3',
glass: 'sheet-glass_3',
silver: 'sheet-silver_3',
graphite: 'sheet-puck_3',
plasteel: 'sheet-plasteel_3',
durasteel: 'sheet-durasteel_3',
verdantium: 'sheet-wavy_3',
morphium: 'sheet-wavy_3',
mhydrogen: 'sheet-mythril_3',
gold: 'sheet-gold_3',
diamond: 'sheet-diamond',
supermatter: 'sheet-super_3',
osmium: 'sheet-silver_3',
phoron: 'sheet-phoron_3',
uranium: 'sheet-uranium_3',
titanium: 'sheet-titanium_3',
lead: 'sheet-adamantine_3',
platinum: 'sheet-adamantine_3',
plastic: 'sheet-plastic_3',
};
/**
* A single, uniquely identifiable material.
*/

View File

@@ -11,10 +11,15 @@ import { classes } from 'tgui-core/react';
import { useBackend } from '../backend';
import { Window } from '../layouts';
import { Materials } from './ExosuitFabricator/Material';
import { MaterialAccessBar } from './common/MaterialAccessBar';
import { DesignBrowser } from './Fabrication/DesignBrowser';
import { MaterialCostSequence } from './Fabrication/MaterialCostSequence';
import type { Design, FabricatorData, MaterialMap } from './Fabrication/Types';
import type {
Design,
FabricatorData,
Material,
MaterialMap,
} from './Fabrication/Types';
export const Fabricator = (props) => {
const { act, data } = useBackend<FabricatorData>();
@@ -47,7 +52,16 @@ export const Fabricator = (props) => {
</Stack.Item>
<Stack.Item>
<Section>
<Materials />
<MaterialAccessBar
availableMaterials={data.materials}
SHEET_MATERIAL_AMOUNT={SHEET_MATERIAL_AMOUNT}
onEjectRequested={(mat: Material, qty: number) =>
act('remove_mat', {
id: mat.name,
amount: qty,
})
}
/>
</Section>
</Stack.Item>
</Stack>

View File

@@ -16,7 +16,7 @@ import { capitalize } from 'tgui-core/string';
import { useBackend } from '../backend';
import { Window } from '../layouts';
import { Materials } from './ExosuitFabricator/Material';
import { MaterialAccessBar } from './common/MaterialAccessBar';
import type { Material } from './Fabrication/Types';
type Machine = {
@@ -88,7 +88,16 @@ export const OreSilo = (props: any) => {
</Stack.Item>
<Stack.Item>
<Section fill>
<Materials />
<MaterialAccessBar
SHEET_MATERIAL_AMOUNT={SHEET_MATERIAL_AMOUNT}
availableMaterials={data.materials}
onEjectRequested={(mat: Material, qty: number) =>
act('remove_mat', {
id: mat.name,
amount: qty,
})
}
/>
</Section>
</Stack.Item>
</Stack>

View File

@@ -7,16 +7,17 @@ import {
NoticeBox,
ProgressBar,
Section,
Stack,
} from 'tgui-core/components';
import type { BooleanLike } from 'tgui-core/react';
import { toTitleCase } from 'tgui-core/string';
import { Materials } from './ExosuitFabricator/Material';
import type { material } from './ExosuitFabricator/types';
import { MaterialAccessBar } from './common/MaterialAccessBar';
import type { Material } from './Fabrication/Types';
type Data = {
panelOpen: BooleanLike;
materials: material[];
materials: Material[];
SHEET_MATERIAL_AMOUNT: number;
copyBoard: string | null;
copyBoardReqComponents: { name: string; qty: number }[] | null;
queue: string[];
@@ -36,91 +37,131 @@ export const PartsLathe = (props) => {
buildPercent,
error,
recipies,
SHEET_MATERIAL_AMOUNT,
} = data;
return (
<Window width={500} height={500}>
<Window.Content scrollable>
{(error && <NoticeBox danger>Missing Materials: {error}</NoticeBox>) ||
''}
<Section title="Materials">
<Materials displayAllMat />
</Section>
{(building && (
<Section title="Currently Building">
<LabeledList>
<LabeledList.Item label="Name">
{toTitleCase(building)}
</LabeledList.Item>
<LabeledList.Item label="Progress">
<ProgressBar
color="good"
value={buildPercent!}
maxValue={100}
/>
</LabeledList.Item>
</LabeledList>
</Section>
)) ||
''}
{copyBoard && (
<Section title="Circuit Reader">
<LabeledList>
<LabeledList.Item
label="Loaded Circuit"
buttons={
<Button icon="eject" onClick={() => act('ejectBoard')}>
Eject
</Button>
<Window.Content>
<Stack fill vertical>
{error ? (
<NoticeBox danger>Missing Materials: {error}</NoticeBox>
) : null}
<Stack.Item grow>
<Stack fill>
<Stack.Item grow>
<Section title="Recipes" fill>
{recipies.length &&
recipies.map((recipe) => (
<Box key={recipe.name}>
<Button
icon="wrench"
onClick={() => act('queue', { queue: recipe.type })}
>
{toTitleCase(recipe.name)}
</Button>
</Box>
))}
</Section>
</Stack.Item>
<Stack.Item grow>
<Stack vertical fill>
{building ? (
<Stack.Item grow>
<Section title="Currently Building" fill>
<LabeledList>
<LabeledList.Item label="Name">
{toTitleCase(building)}
</LabeledList.Item>
<LabeledList.Item label="Progress">
<ProgressBar
color="good"
value={buildPercent!}
maxValue={100}
/>
</LabeledList.Item>
</LabeledList>
</Section>
</Stack.Item>
) : (
''
)}
{copyBoard ? (
<Stack.Item grow>
<Section title="Circuit Reader">
<LabeledList>
<LabeledList.Item
label="Loaded Circuit"
buttons={
<Button
icon="eject"
onClick={() => act('ejectBoard')}
>
Eject
</Button>
}
>
{toTitleCase(copyBoard)}
</LabeledList.Item>
</LabeledList>
{(copyBoardReqComponents?.length && (
<>
{copyBoardReqComponents.map((comp) => (
<Box key={comp.name}>
{comp.qty} x {toTitleCase(comp.name)}
</Box>
))}
<Button
icon="wrench"
onClick={() => act('queueBoard')}
>
Build All
</Button>
</>
)) || <Box>Board has no required components.</Box>}
</Section>
</Stack.Item>
) : (
''
)}
<Stack.Item grow>
<Section title="Queue" fill>
{(queue.length &&
queue.map((item, i) => (
<Box key={item} color="label">
#{i + 1}: {toTitleCase(item)}
{((i > 0 || !building) && (
<Button
ml={1}
icon="times"
onClick={() => act('cancel', { cancel: i + 1 })}
>
Cancel
</Button>
)) ||
''}
</Box>
))) || <NoticeBox info>Queue Empty</NoticeBox>}
</Section>
</Stack.Item>
</Stack>
</Stack.Item>
</Stack>
</Stack.Item>
<Stack.Item>
<Section fill>
<MaterialAccessBar
availableMaterials={data.materials}
SHEET_MATERIAL_AMOUNT={SHEET_MATERIAL_AMOUNT}
onEjectRequested={(mat: Material, qty: number) =>
act('remove_mat', {
id: mat.name,
amount: qty,
})
}
>
{toTitleCase(copyBoard)}
</LabeledList.Item>
</LabeledList>
{(copyBoardReqComponents?.length && (
<>
{copyBoardReqComponents.map((comp) => (
<Box key={comp.name}>
{comp.qty} x {toTitleCase(comp.name)}
</Box>
))}
<Button icon="wrench" onClick={() => act('queueBoard')}>
Build All
</Button>
</>
)) || <Box>Board has no required components.</Box>}
</Section>
)}
<Section title="Queue">
{(queue.length &&
queue.map((item, i) => (
<Box key={item} color="label">
#{i + 1}: {toTitleCase(item)}
{((i > 0 || !building) && (
<Button
ml={1}
icon="times"
onClick={() => act('cancel', { cancel: i + 1 })}
>
Cancel
</Button>
)) ||
''}
</Box>
))) || <NoticeBox info>Queue Empty</NoticeBox>}
</Section>
<Section title="Recipes">
{recipies.length &&
recipies.map((recipe) => (
<Box key={recipe.name}>
<Button
icon="wrench"
onClick={() => act('queue', { queue: recipe.type })}
>
{toTitleCase(recipe.name)}
</Button>
</Box>
))}
</Section>
/>
</Section>
</Stack.Item>
</Stack>
</Window.Content>
</Window>
);

View File

@@ -0,0 +1,178 @@
import { sortBy } from 'es-toolkit';
import { useState } from 'react';
import { AnimatedNumber, Button, Stack } from 'tgui-core/components';
import { formatSiUnit } from 'tgui-core/format';
import { classes } from 'tgui-core/react';
import { toTitleCase } from 'tgui-core/string';
import { MaterialIcon } from '../Fabrication/MaterialIcon';
import type { Material } from '../Fabrication/Types';
// by popular demand of discord people (who are always right and never wrong)
// this is completely made up
const MATERIAL_RARITY: Record<string, number> = {
steel: 0,
glass: 1,
silver: 2,
graphite: 3,
plasteel: 4,
durasteel: 5,
verdantium: 6,
morphium: 7,
mhydrogen: 8,
gold: 9,
diamond: 10,
supermatter: 11,
osmium: 12,
phoron: 13,
uranium: 14,
titanium: 15,
lead: 16,
platinum: 17,
plastic: 18,
};
export type MaterialAccessBarProps = {
/**
* All materials currently available to the user.
*/
availableMaterials: Material[];
/**
* Definition of how much units 1 sheet has.
*/
SHEET_MATERIAL_AMOUNT: number;
/**
* Invoked when the user requests that a material be ejected.
*/
onEjectRequested?: (material: Material, quantity: number) => void;
};
/**
* The formatting function applied to the quantity labels in the bar.
*/
const LABEL_FORMAT = (value: number) => formatSiUnit(value, 0);
export const MaterialAccessBar = (props: MaterialAccessBarProps) => {
const { availableMaterials, SHEET_MATERIAL_AMOUNT, onEjectRequested } = props;
return (
<Stack wrap>
{sortBy(availableMaterials, [(m: Material) => MATERIAL_RARITY[m.name]])
.filter((material) => material.amount > 0)
.map((material) => (
<Stack.Item grow basis={4.5} key={material.ref}>
<MaterialCounter
material={material}
SHEET_MATERIAL_AMOUNT={SHEET_MATERIAL_AMOUNT}
onEjectRequested={(quantity) =>
onEjectRequested?.(material, quantity)
}
/>
</Stack.Item>
))}
</Stack>
);
};
type MaterialCounterProps = {
material: Material;
SHEET_MATERIAL_AMOUNT: number;
onEjectRequested: (quantity: number) => void;
};
const MaterialCounter = (props: MaterialCounterProps) => {
const { material, onEjectRequested, SHEET_MATERIAL_AMOUNT } = props;
const [hovering, setHovering] = useState(false);
const sheets = material.amount / SHEET_MATERIAL_AMOUNT;
return (
<div
onMouseEnter={() => setHovering(true)}
onMouseLeave={() => setHovering(false)}
className={classes([
'MaterialDock',
hovering && 'MaterialDock--active',
sheets < 1 && 'MaterialDock--disabled',
])}
>
<Stack vertical>
<Stack.Item>
<Stack
vertical
className="MaterialDock__Label"
textAlign="center"
onClick={() => onEjectRequested(1)}
>
<Stack.Item>
<MaterialIcon materialName={material.name} sheets={sheets} />
</Stack.Item>
<Stack.Item>
<AnimatedNumber value={sheets} format={LABEL_FORMAT} />
</Stack.Item>
</Stack>
</Stack.Item>
{hovering && (
<Stack.Item className="MaterialDock__Dock">
<Stack vertical>
<Stack.Item>
<EjectButton
sheets={sheets}
amount={50}
onEject={onEjectRequested}
/>
</Stack.Item>
<Stack.Item>
<EjectButton
sheets={sheets}
amount={25}
onEject={onEjectRequested}
/>
</Stack.Item>
<Stack.Item>
<EjectButton
sheets={sheets}
amount={10}
onEject={onEjectRequested}
/>
</Stack.Item>
<Stack.Item>
<EjectButton
sheets={sheets}
amount={5}
onEject={onEjectRequested}
/>
</Stack.Item>
<Stack.Item>{toTitleCase(material.name)}</Stack.Item>
</Stack>
</Stack.Item>
)}
</Stack>
</div>
);
};
type EjectButtonProps = {
amount: number;
sheets: number;
onEject: (quantity: number) => void;
};
const EjectButton = (props: EjectButtonProps) => {
const { amount, sheets, onEject } = props;
return (
<Button
fluid
color={'transparent'}
className={classes([
'Fabricator__PrintAmount',
amount > sheets && 'Fabricator__PrintAmount--disabled',
])}
onClick={() => onEject(amount)}
>
&times;{amount}
</Button>
);
};

View File

@@ -4130,6 +4130,9 @@
#include "code\modules\power\antimatter\containment_jar.dm"
#include "code\modules\power\antimatter\control.dm"
#include "code\modules\power\antimatter\shielding.dm"
#include "code\modules\power\cells\device_cells.dm"
#include "code\modules\power\cells\esoteric_cells.dm"
#include "code\modules\power\cells\power_cells.dm"
#include "code\modules\power\fusion\_setup.dm"
#include "code\modules\power\fusion\fusion_circuits.dm"
#include "code\modules\power\fusion\fusion_particle_catcher.dm"
@@ -4433,11 +4436,11 @@
#include "code\modules\research\tg\designs\modular_computer_designs.dm"
#include "code\modules\research\tg\designs\prosfab_designs.dm"
#include "code\modules\research\tg\designs\stock_part_designs.dm"
#include "code\modules\research\tg\designs\boards\boards_ch.dm"
#include "code\modules\research\tg\designs\boards\boards_yw.dm"
#include "code\modules\research\tg\designs\tool_designs.dm"
#include "code\modules\research\tg\designs\weapon_designs.dm"
#include "code\modules\research\tg\designs\boards\atmos.dm"
#include "code\modules\research\tg\designs\boards\boards_ch.dm"
#include "code\modules\research\tg\designs\boards\boards_yw.dm"
#include "code\modules\research\tg\designs\boards\cargo.dm"
#include "code\modules\research\tg\designs\boards\engineering.dm"
#include "code\modules\research\tg\designs\boards\kitchen.dm"
@@ -4949,9 +4952,9 @@
#include "modular_chomp\code\datums\crafting\items.dm"
#include "modular_chomp\code\datums\crafting\recipes.dm"
#include "modular_chomp\code\datums\crafting\tyr_tribal.dm"
#include "modular_chomp\code\datums\elements\lootable\christmas_present.dm"
#include "modular_chomp\code\datums\elements\lootable\mecha.dm"
#include "modular_chomp\code\datums\outfits\jobs\command.dm"
#include "modular_chomp\code\datums\elements\lootable\christmas_present.dm"
#include "modular_chomp\code\datums\outfits\jobs\noncrew.dm"
#include "modular_chomp\code\datums\outfits\jobs\security.dm"
#include "modular_chomp\code\datums\supplypacks\contraband.dm"
@@ -5240,7 +5243,6 @@
#include "modular_chomp\code\modules\planet\smokestar\turf.dm"
#include "modular_chomp\code\modules\player_tips\player_tips_list.dm"
#include "modular_chomp\code\modules\power\cells\device_cells.dm"
#include "modular_chomp\code\modules\power\cells\esoteric_cells.dm"
#include "modular_chomp\code\modules\power\cells\power_cells.dm"
#include "modular_chomp\code\modules\projectiles\gun.dm"
#include "modular_chomp\code\modules\projectiles\mob.dm"