Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions code/datums/components/material_container.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,21 @@
var/list/tc = allowed_item_typecache
if(!(mat_container_flags & MATCONTAINER_ANY_INTENT) && user.combat_mode)
return

if(I.item_flags & ABSTRACT)
return

if((I.flags_1 & HOLOGRAM_1) || (I.item_flags & NO_MAT_REDEMPTION) || (tc && !is_type_in_typecache(I, tc)))
if(!(mat_container_flags & MATCONTAINER_SILENT))
to_chat(user, span_warning("[parent] won't accept [I]!"))
return

. = COMPONENT_NO_AFTERATTACK

var/datum/callback/pc = precondition
if(pc && !pc.Invoke(user))
return

var/material_amount = get_item_material_amount(I, mat_container_flags)
if(!material_amount)
to_chat(user, span_warning("[I] does not contain sufficient materials to be accepted by [parent]."))
Expand Down
6 changes: 6 additions & 0 deletions code/game/machinery/lightswitch.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
TYPEINFO_DEF(/obj/item/wallframe/light_switch)
default_materials = list(
/datum/material/iron = 200,
/datum/material/glass = 200,
)

/obj/item/wallframe/light_switch
name = "light switch frame"
icon = /obj/machinery/light_switch::icon
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/tools/weldingtool.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define WELDER_FUEL_BURN_INTERVAL 9
TYPEINFO_DEF(/obj/item/weldingtool)
default_armor = list(BLUNT = 0, PUNCTURE = 0, SLASH = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 100, ACID = 30)
default_materials = list(/datum/material/iron=70, /datum/material/glass=30)
default_materials = list(/datum/material/iron=70, /datum/material/glass=20)

/obj/item/weldingtool
name = "welding tool"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/toys.dm
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ TYPEINFO_DEF(/obj/item/toy/gun)
return ITEM_INTERACT_SUCCESS

TYPEINFO_DEF(/obj/item/toy/ammo/gun)
default_materials = list(/datum/material/iron=10, /datum/material/glass=10)
default_materials = list(/datum/material/iron = 20, /datum/material/glass = 5)

/obj/item/toy/ammo/gun
name = "capgun ammo"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/modular_computers/hardware/battery_module.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
battery.forceMove(drop_location())
return TRUE

TYPEINFO_DEF(/obj/item/stock_parts/cell/computer)
default_materials = list(/datum/material/iron=700, /datum/material/glass=50)

/obj/item/stock_parts/cell/computer
name = "standard battery"
desc = "A standard power cell, commonly seen in high-end portable microcomputers or low-end laptops."
Expand Down
4 changes: 2 additions & 2 deletions code/modules/power/cell.dm
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ TYPEINFO_DEF(/obj/item/stock_parts/cell/super)
empty = TRUE

TYPEINFO_DEF(/obj/item/stock_parts/cell/hyper)
default_materials = list(/datum/material/glass=400)
default_materials = list(/datum/material/iron = 700, /datum/material/gold = 150, /datum/material/silver = 150, /datum/material/glass = 80)

/obj/item/stock_parts/cell/hyper
name = "hyper-capacity power cell"
Expand All @@ -311,7 +311,7 @@ TYPEINFO_DEF(/obj/item/stock_parts/cell/hyper)
empty = TRUE

TYPEINFO_DEF(/obj/item/stock_parts/cell/bluespace)
default_materials = list(/datum/material/glass=600)
default_materials = list(/datum/material/iron = 800, /datum/material/gold = 120, /datum/material/glass = 160, /datum/material/diamond = 160, /datum/material/titanium = 300, /datum/material/bluespace = 100)

/obj/item/stock_parts/cell/bluespace
name = "bluespace power cell"
Expand Down
3 changes: 3 additions & 0 deletions code/modules/power/lighting/light_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ TYPEINFO_DEF(/obj/item/light)
/obj/item/light/tube/broken
status = LIGHT_BROKEN

TYPEINFO_DEF(/obj/item/light/bulb)
default_materials = list(/datum/material/glass = 50)

/obj/item/light/bulb
name = "light bulb"
desc = "A replacement light bulb."
Expand Down
4 changes: 2 additions & 2 deletions code/modules/projectiles/ammunition/ballistic/shotgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ TYPEINFO_DEF(/obj/item/ammo_casing/shotgun/stunslug)
variance = 25

TYPEINFO_DEF(/obj/item/ammo_casing/shotgun/rubbershot)
default_materials = list(/datum/material/iron=4000)
default_materials = list(/datum/material/iron=200)

/obj/item/ammo_casing/shotgun/rubbershot
name = "rubber shot"
Expand All @@ -95,7 +95,7 @@ TYPEINFO_DEF(/obj/item/ammo_casing/shotgun/rubbershot)
variance = 20

TYPEINFO_DEF(/obj/item/ammo_casing/shotgun/incapacitate)
default_materials = list(/datum/material/iron=4000)
default_materials = list(/datum/material/iron=200)

/obj/item/ammo_casing/shotgun/incapacitate
name = "custom incapacitating shot"
Expand Down
7 changes: 7 additions & 0 deletions code/modules/projectiles/guns/energy/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@
ammo_type = list(/obj/item/ammo_casing/energy/mindflayer)
ammo_x_offset = 2

TYPEINFO_DEF(/obj/item/gun/energy/plasmacutter)
default_materials = list(
/datum/material/iron = 1500,
/datum/material/glass = 500,
/datum/material/plasma = 400
)

/obj/item/gun/energy/plasmacutter
name = "plasma cutter"
desc = "A mining tool capable of expelling concentrated plasma bursts. You could use it to cut limbs off xenos! Or, you know, mine stuff."
Expand Down
6 changes: 3 additions & 3 deletions code/modules/research/designs/autolathe_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
mapload_design_flags = DESIGN_FAB_SERVICE | DESIGN_FAB_OMNI

/datum/design/crowbar
name = "Pocket Crowbar"
name = "Crowbar"
id = "crowbar"
build_type = AUTOLATHE | FABRICATOR
materials = list(/datum/material/iron = 50)
materials = list(/datum/material/iron = 70)
build_path = /obj/item/crowbar
category = list(DCAT_BASIC_TOOL)
mapload_design_flags = DESIGN_FAB_ENGINEERING | DESIGN_FAB_OMNI
Expand Down Expand Up @@ -141,7 +141,7 @@
name = "Cable Coil"
id = "cable_coil"
build_type = AUTOLATHE | FABRICATOR
materials = list(/datum/material/iron = 10, /datum/material/glass = 5)
materials = list(/datum/material/iron = 10 * MAXCOIL, /datum/material/glass = 5 * MAXCOIL)
build_path = /obj/item/stack/cable_coil
category = list(DCAT_BASIC_TOOL)
maxstack = MAXCOIL
Expand Down
10 changes: 5 additions & 5 deletions code/modules/research/designs/computer_part_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
name = "Battery Module"
id = "bat_normal"
build_type = FABRICATOR
materials = list(/datum/material/iron = 400)
materials = list(/datum/material/iron=700, /datum/material/glass = 50)
build_path = /obj/item/stock_parts/cell/computer
category = list(DCAT_COMPUTER_PART)
mapload_design_flags = DESIGN_FAB_OMNI
Expand All @@ -175,7 +175,7 @@
name = "Advanced Battery Module"
id = "bat_advanced"
build_type = FABRICATOR
materials = list(/datum/material/iron = 800)
materials = list(/datum/material/iron = 800, /datum/material/glass = 50)
build_path = /obj/item/stock_parts/cell/computer/advanced
category = list(DCAT_COMPUTER_PART)
mapload_design_flags = DESIGN_FAB_OMNI
Expand All @@ -184,7 +184,7 @@
name = "Super Battery Module"
id = "bat_super"
build_type = FABRICATOR
materials = list(/datum/material/iron = 1600)
materials = list(/datum/material/iron = 1600, /datum/material/glass = 50)
build_path = /obj/item/stock_parts/cell/computer/super
category = list(DCAT_COMPUTER_PART)
mapload_design_flags = DESIGN_FAB_OMNI
Expand All @@ -193,7 +193,7 @@
name = "Nano Battery Module"
id = "bat_nano"
build_type = FABRICATOR
materials = list(/datum/material/iron = 200)
materials = list(/datum/material/iron = 700, /datum/material/glass = 50)
build_path = /obj/item/stock_parts/cell/computer/nano
category = list(DCAT_COMPUTER_PART)
mapload_design_flags = DESIGN_FAB_OMNI
Expand All @@ -202,7 +202,7 @@
name = "Micro Battery Module"
id = "bat_micro"
build_type = FABRICATOR
materials = list(/datum/material/iron = 400)
materials = list(/datum/material/iron = 700, /datum/material/glass = 50)
build_path = /obj/item/stock_parts/cell/computer/micro
category = list(DCAT_COMPUTER_PART)
mapload_design_flags = DESIGN_FAB_OMNI
2 changes: 1 addition & 1 deletion code/modules/research/designs/electronics_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
desc = "Produce additional disks for storing data."
id = "design_disk_floppy"
build_type = FABRICATOR | AUTOLATHE
materials = list(/datum/material/iron = 100, /datum/material/glass = 100)
materials = list(/datum/material/iron = 300, /datum/material/glass = 100)
build_path = /obj/item/disk/data/floppy
category = list("Electronics")
mapload_design_flags = DESIGN_FAB_OMNI
Expand Down
2 changes: 1 addition & 1 deletion code/modules/research/designs/misc_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
desc = "A gas mask with built in welding goggles and face shield. Looks like a skull, clearly designed by a nerd."
id = "weldingmask"
build_type = FABRICATOR
materials = list(/datum/material/iron = 3000, /datum/material/glass = 1000)
materials = list(/datum/material/iron=4000, /datum/material/glass=2000)
build_path = /obj/item/clothing/mask/gas/welding
category = list(DCAT_WEARABLE, DCAT_ATMOS)
mapload_design_flags = DESIGN_FAB_OMNI | DESIGN_FAB_ENGINEERING
Expand Down
2 changes: 1 addition & 1 deletion code/modules/research/designs/power_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
desc = "A power cell that holds 20 MJ of energy."
id = "super_cell"
build_type = FABRICATOR | MECHFAB
materials = list(/datum/material/iron = 700, /datum/material/glass = 70)
materials = list(/datum/material/iron = 700, /datum/material/glass = 300)
construction_time=100
build_path = /obj/item/stock_parts/cell/super/empty
category = list(DCAT_POWER, DCAT_STOCK_PART)
Expand Down
10 changes: 7 additions & 3 deletions code/modules/research/designs/weapon_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
/////////////////////////////////////////

/datum/design/rubbershot/sec
name = "Rubber Slug"
name = ".12ga Rubber"
id = "sec_rshot"
materials = list(/datum/material/iron = 200)
build_path = /obj/item/ammo_casing/shotgun/rubbershot
build_type = FABRICATOR
category = list(DCAT_AMMO)
mapload_design_flags = DESIGN_FAB_SECURITY

/datum/design/beanbag_slug/sec
name = "Beanbag Slug"
name = ".12ga Beanbag Slug"
id = "sec_beanbag_slug"
materials = list(/datum/material/iron = 250)
build_path = /obj/item/ammo_casing/shotgun/beanbag
build_type = FABRICATOR
category = list(DCAT_AMMO)
mapload_design_flags = DESIGN_FAB_SECURITY
Expand Down Expand Up @@ -91,7 +95,7 @@
desc = "A stunning shell for a shotgun."
id = "stunshell"
build_type = FABRICATOR
materials = list(/datum/material/iron = 200)
materials = list(/datum/material/iron = 250)
build_path = /obj/item/ammo_casing/shotgun/stunslug
category = list(DCAT_AMMO)
mapload_design_flags = DESIGN_FAB_SECURITY
Expand Down
3 changes: 2 additions & 1 deletion code/modules/unit_tests/__unit_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@
#include "atmospherics\__include.dm"
#include "combat\__include.dm"
#include "mapping_standards\__include.dm"
#include "materials\__include.dm"
#include "miracles\__include.dm"
#include "reagents\__include.dm"
#include "screenshots\__include.dm"
#include "miracles\__include.dm"

// Single File Includes
#include "achievements.dm"
Expand Down
1 change: 1 addition & 0 deletions code/modules/unit_tests/materials/__include.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "infinite_materials.dm"
26 changes: 26 additions & 0 deletions code/modules/unit_tests/materials/infinite_materials.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This test is for testing that items created with designs from a fabricator do not result in a net gain in materials.
// This test does NOT account for material categories or materials becoming other materials, such as being able to transmute Iron to Glass.
/datum/unit_test/infinite_materials
name = "MATERIALS/DESIGNS: Printable Items Shall Not Grant More Materials Than Cost"

/datum/unit_test/infinite_materials/Run()
for(var/datum/design/design as anything in SStech.designs)
if(isabstract(design))
continue

var/object_path = design.build_path
if(isnull(object_path))
if(!length(design.make_reagents))
TEST_FAIL("Non-abstract design [design.type] does not create an item or reagent.")
continue

var/obj/item/built = new object_path(run_loc_floor_bottom_left)
var/list/item_materials = built.get_material_composition()

for(var/material_or_text, cost in design.materials)
if(!istext(material_or_text))
var/datum/material/material = material_or_text
if(item_materials[material] > cost)
TEST_FAIL("Design [design.type]'s product has more [material.id] than it costs. (Cost: [cost] | Produces: [item_materials[material]])")

qdel(built)
Loading