Merge remote-tracking branch 'citadel/master' into mobility_flags

This commit is contained in:
kevinz000
2020-02-21 23:29:25 -07:00
279 changed files with 4174 additions and 1928 deletions
@@ -9,7 +9,7 @@
icon = 'icons/obj/assemblies/electronic_setups.dmi'
icon_state = "setup_small"
item_flags = NOBLUDGEON
materials = list() // To be filled later
custom_materials = null // To be filled later
datum_flags = DF_USE_TAG
var/list/assembly_components = list()
var/list/ckeys_allowed_to_scan = list() // Players who built the circuit can scan it as a ghost.
@@ -95,9 +95,9 @@
D.open()
/obj/item/electronic_assembly/Initialize()
LAZYSET(custom_materials, /datum/material/iron, round((max_complexity + max_components) * 0.25) * SScircuit.cost_multiplier)
.=..()
START_PROCESSING(SScircuit, src)
materials[MAT_METAL] = round((max_complexity + max_components) / 4) * SScircuit.cost_multiplier
//sets up diagnostic hud view
prepare_huds()
@@ -4,7 +4,7 @@
icon = 'icons/obj/assemblies/electronic_components.dmi'
icon_state = "template"
w_class = WEIGHT_CLASS_TINY
materials = list() // To be filled later
custom_materials = null // To be filled later
var/obj/item/electronic_assembly/assembly // Reference to the assembly holding this circuit, if any.
var/extended_desc
var/list/inputs = list()
@@ -84,7 +84,7 @@ a creative player the means to solve many problems. Circuits are held inside an
setup_io(inputs, /datum/integrated_io, inputs_default, IC_INPUT)
setup_io(outputs, /datum/integrated_io, outputs_default, IC_OUTPUT)
setup_io(activators, /datum/integrated_io/activate, null, IC_ACTIVATOR)
materials[MAT_METAL] = w_class * SScircuit.cost_multiplier
LAZYSET(custom_materials, /datum/material/iron, w_class * SScircuit.cost_multiplier)
. = ..()
/obj/item/integrated_circuit/proc/on_data_written() //Override this for special behaviour when new data gets pushed to the circuit.
@@ -33,7 +33,8 @@
/obj/item/integrated_circuit_printer/Initialize()
. = ..()
AddComponent(/datum/component/material_container, list(MAT_METAL), MINERAL_MATERIAL_AMOUNT * 25, TRUE, list(/obj/item/stack, /obj/item/integrated_circuit, /obj/item/electronic_assembly))
var/datum/component/material_container/materials = AddComponent(/datum/component/material_container, list(/datum/material/iron), MINERAL_MATERIAL_AMOUNT * 25, TRUE, list(/obj/item/stack, /obj/item/integrated_circuit, /obj/item/electronic_assembly))
materials.precise_insertion = TRUE
/obj/item/integrated_circuit_printer/proc/print_program(mob/user)
if(!cloning)
@@ -189,16 +190,16 @@
var/cost = 400
if(ispath(build_type, /obj/item/electronic_assembly))
var/obj/item/electronic_assembly/E = SScircuit.cached_assemblies[build_type]
cost = E.materials[MAT_METAL]
cost = E.custom_materials[getmaterialref(/datum/material/iron)]
else if(ispath(build_type, /obj/item/integrated_circuit))
var/obj/item/integrated_circuit/IC = SScircuit.cached_components[build_type]
cost = IC.materials[MAT_METAL]
cost = IC.custom_materials[getmaterialref(/datum/material/iron)]
else if(!(build_type in SScircuit.circuit_fabricator_recipe_list["Tools"]))
return
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
if(!debug && !materials.use_amount_type(cost, MAT_METAL))
if(!debug && !materials.use_amount_mat(cost, /datum/material/iron))
to_chat(usr, "<span class='warning'>You need [cost] metal to build that!</span>")
return TRUE
@@ -270,14 +271,14 @@
return
else if(fast_clone)
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
if(debug || materials.use_amount_type(program["metal_cost"], MAT_METAL))
if(debug || materials.use_amount_mat(program["metal_cost"], /datum/material/iron))
cloning = TRUE
print_program(usr)
else
to_chat(usr, "<span class='warning'>You need [program["metal_cost"]] metal to build that!</span>")
else
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
if(!materials.use_amount_type(program["metal_cost"], MAT_METAL))
if(!materials.use_amount_mat(program["metal_cost"], /datum/material/iron))
to_chat(usr, "<span class='warning'>You need [program["metal_cost"]] metal to build that!</span>")
return
var/cloning_time = round(program["metal_cost"] / 15)
@@ -295,7 +296,7 @@
to_chat(usr, "<span class='notice'>Cloning has been canceled. Metal cost has been refunded.</span>")
cloning = FALSE
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
materials.use_amount_type(-program["metal_cost"], MAT_METAL) //use negative amount to regain the cost
materials.use_amount_mat(-program["metal_cost"], /datum/material/iron) //use negative amount to regain the cost
interact(usr)
@@ -260,7 +260,7 @@
blocks["max_space"] = assembly.max_components
// Start keeping track of total metal cost
blocks["metal_cost"] = assembly.materials[MAT_METAL]
blocks["metal_cost"] = assembly.custom_materials[getmaterialref(/datum/material/iron)]
// Block 2. Components.
@@ -291,7 +291,7 @@
// Update estimated assembly complexity, taken space and material cost
blocks["complexity"] += component.complexity
blocks["used_space"] += component.size
blocks["metal_cost"] += component.materials[MAT_METAL]
blocks["metal_cost"] += component.custom_materials[getmaterialref(/datum/material/iron)]
// Check if the assembly requires printer upgrades
if(!(component.spawn_flags & IC_SPAWN_DEFAULT))
@@ -1090,6 +1090,7 @@
"Titanium" = IC_PINTYPE_NUMBER,
"Bluespace Mesh" = IC_PINTYPE_NUMBER,
"Biomass" = IC_PINTYPE_NUMBER,
"Plastic" = IC_PINTYPE_NUMBER
)
activators = list(
"scan" = IC_PINTYPE_PULSE_IN,
@@ -1098,7 +1099,7 @@
)
spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 40
var/list/mtypes = list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE, MAT_BIOMASS)
var/list/mtypes = list(/datum/material/iron, /datum/material/glass, /datum/material/silver, /datum/material/gold, /datum/material/diamond, /datum/material/plasma, /datum/material/uranium, /datum/material/bananium, /datum/material/titanium, /datum/material/bluespace, /datum/material/biomass, /datum/material/plastic)
/obj/item/integrated_circuit/input/matscan/do_work()
@@ -1108,10 +1109,9 @@
if(!mt) //Invalid input
return
if(H in view(T)) // This is a camera. It can't examine thngs,that it can't see.
for(var/I in 1 to mtypes.len)
var/datum/material/M = mt.materials[mtypes[I]]
if(M)
set_pin_data(IC_OUTPUT, I, M.amount)
for(var/I in mtypes)
if(I in mt.materials)
set_pin_data(IC_OUTPUT, I, mt.materials[I])
else
set_pin_data(IC_OUTPUT, I, null)
push_data()
@@ -373,6 +373,7 @@
"Bluespace Mesh" = IC_PINTYPE_NUMBER,
"Bananium" = IC_PINTYPE_NUMBER,
"Titanium" = IC_PINTYPE_NUMBER,
"Plastic" = IC_PINTYPE_NUMBER
)
outputs = list(
"self ref" = IC_PINTYPE_REF,
@@ -386,7 +387,8 @@
"Solid Plasma" = IC_PINTYPE_NUMBER,
"Bluespace Mesh" = IC_PINTYPE_NUMBER,
"Bananium" = IC_PINTYPE_NUMBER,
"Titanium" = IC_PINTYPE_NUMBER
"Titanium" = IC_PINTYPE_NUMBER,
"Plastic" = IC_PINTYPE_NUMBER
)
activators = list(
"insert sheet" = IC_PINTYPE_PULSE_IN,
@@ -400,13 +402,11 @@
power_draw_per_use = 40
ext_cooldown = 1
cooldown_per_use = 10
var/list/mtypes = list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE)
var/list/mtypes = list(/datum/material/iron, /datum/material/glass, /datum/material/silver, /datum/material/gold, /datum/material/diamond, /datum/material/uranium, /datum/material/plasma, /datum/material/bluespace, /datum/material/bananium, /datum/material/titanium, /datum/material/plastic)
/obj/item/integrated_circuit/manipulation/matman/Initialize()
var/datum/component/material_container/materials = AddComponent(/datum/component/material_container,
list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE), 0,
FALSE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.max_amount =100000
mtypes, 100000, FALSE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
.=..()
@@ -414,9 +414,10 @@
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
set_pin_data(IC_OUTPUT, 2, materials.total_amount)
for(var/I in 1 to mtypes.len)
var/datum/material/M = materials.materials[mtypes[I]]
var/datum/material/M = materials.materials[getmaterialref(I)]
var/amount = materials[M]
if(M)
set_pin_data(IC_OUTPUT, I+2, M.amount)
set_pin_data(IC_OUTPUT, I+2, amount)
push_data()
/obj/item/integrated_circuit/manipulation/matman/proc/is_insertion_ready(mob/user)
@@ -435,7 +436,7 @@
if(!S)
activate_pin(4)
return
if(materials.insert_stack(S, CLAMP(get_pin_data(IC_INPUT, 2),0,100), multiplier = 1) )
if(materials.insert_item(S, CLAMP(get_pin_data(IC_INPUT, 2),0,100), multiplier = 1) )
AfterMaterialInsert()
activate_pin(3)
else
@@ -451,7 +452,7 @@
continue
if(!mt) //Invalid input
if(U>0)
if(materials.retrieve_amount(U, mtypes[I], T))
if(materials.retrieve_sheets(U, getmaterialref(mtypes[I]), T))
suc = TRUE
else
if(mt.transer_amt_to(materials, U, mtypes[I]))