Revert "[MIRROR] Port material containers to datum components" (#2597)

* Revert "sprite fix on kitsune tails"

This reverts commit 44d5b21a43.

* Revert "Update vg_clothing_packs.dm (#2591)"

This reverts commit 7f46280d6b.

* Revert "Automatic changelog generation for PR #2590 [ci skip]"

This reverts commit 201e07033f.

* Revert "[MIRROR] Gives the detective a mass spectrometer (#2590)"

This reverts commit 5c98b9a13b.

* Revert "Quick sync (#2587)"

This reverts commit 92e055be97.

* Revert "Automatic changelog generation for PR #2557 [ci skip]"

This reverts commit 241a10d88d.

* Revert "Decreases hacked ai module cost (#2557)"

This reverts commit d959b7538a.

* Revert "[MIRROR] Port material containers to datum components (#2562)"

This reverts commit 32300086d5.
This commit is contained in:
Poojawa
2017-09-04 09:07:40 -05:00
committed by GitHub
parent f39bf40e76
commit 5f1d88ffeb
20 changed files with 362 additions and 372 deletions
+53 -20
View File
@@ -11,6 +11,7 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
container_type = OPENCONTAINER_1
circuit = /obj/item/circuitboard/machine/circuit_imprinter
var/datum/material_container/materials
var/efficiency_coeff
var/list/categories = list(
@@ -28,18 +29,20 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
)
/obj/machinery/r_n_d/circuit_imprinter/Initialize()
AddComponent(/datum/component/material_container, list(MAT_GLASS, MAT_GOLD, MAT_DIAMOND, MAT_METAL, MAT_BLUESPACE),
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready))
materials = new(src, list(MAT_GLASS, MAT_GOLD, MAT_DIAMOND, MAT_METAL, MAT_BLUESPACE))
create_reagents(0)
return ..()
/obj/machinery/r_n_d/circuit_imprinter/Destroy()
QDEL_NULL(materials)
return ..()
/obj/machinery/r_n_d/circuit_imprinter/RefreshParts()
reagents.maximum_volume = 0
for(var/obj/item/reagent_containers/glass/G in component_parts)
reagents.maximum_volume += G.volume
G.reagents.trans_to(src, G.reagents.total_volume)
GET_COMPONENT(materials, /datum/component/material_container)
materials.max_amount = 0
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
materials.max_amount += M.rating * 75000
@@ -56,7 +59,6 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
/obj/machinery/r_n_d/circuit_imprinter/proc/check_mat(datum/design/being_built, M) // now returns how many times the item can be built with the material
var/list/all_materials = being_built.reagents_list + being_built.materials
GET_COMPONENT(materials, /datum/component/material_container)
var/A = materials.amount(M)
if(!A)
A = reagents.get_reagent_amount(M)
@@ -67,7 +69,6 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
/obj/machinery/r_n_d/circuit_imprinter/on_deconstruction()
for(var/obj/item/reagent_containers/glass/G in component_parts)
reagents.trans_to(G, G.reagents.maximum_volume)
GET_COMPONENT(materials, /datum/component/material_container)
materials.retrieve_all()
..()
@@ -76,20 +77,52 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
linked_console.linked_imprinter = null
..()
/obj/machinery/r_n_d/circuit_imprinter/ComponentActivated(datum/component/C)
..()
if(istype(C, /datum/component/material_container))
var/datum/component/material_container/M = C
if(!M.last_insert_success)
/obj/machinery/r_n_d/circuit_imprinter/Insert_Item(obj/item/O, mob/user)
if(istype(O, /obj/item/stack/sheet))
. = 1
if(!is_insertion_ready(user))
return
var/lit = M.last_inserted_type
var/stack_name
if(ispath(lit, /obj/item/ore/bluespace_crystal))
stack_name = "bluespace"
use_power(MINERAL_MATERIAL_AMOUNT / 10)
var/sheet_material = materials.get_item_material_amount(O)
if(!sheet_material)
return
if(!materials.has_space(sheet_material))
to_chat(user, "<span class='warning'>The [src.name]'s material bin is full! Please remove material before adding more.</span>")
return 1
var/obj/item/stack/sheet/stack = O
var/amount = round(input("How many sheets do you want to add?") as num)//No decimals
if(!in_range(src, stack) || !user.Adjacent(src))
return
var/amount_inserted = materials.insert_stack(O,amount)
if(!amount_inserted)
return 1
else
var/obj/item/stack/S = lit
stack_name = initial(S.name)
use_power(max(1000, (MINERAL_MATERIAL_AMOUNT * M.last_amount_inserted / 10)))
add_overlay("protolathe_[stack_name]")
addtimer(CALLBACK(src, /atom/proc/cut_overlay, "protolathe_[stack_name]"), 10)
use_power(max(1000, (MINERAL_MATERIAL_AMOUNT*amount_inserted/10)))
to_chat(user, "<span class='notice'>You add [amount_inserted] sheets to the [src.name].</span>")
updateUsrDialog()
else if(istype(O, /obj/item/ore/bluespace_crystal)) //Bluespace crystals can be either a stack or an item
. = 1
if(!is_insertion_ready(user))
return
var/bs_material = materials.get_item_material_amount(O)
if(!bs_material)
return
if(!materials.has_space(bs_material))
to_chat(user, "<span class='warning'>The [src.name]'s material bin is full! Please remove material before adding more.</span>")
return 1
materials.insert_item(O)
use_power(MINERAL_MATERIAL_AMOUNT/10)
to_chat(user, "<span class='notice'>You add [O] to the [src.name].</span>")
qdel(O)
updateUsrDialog()
else if(user.a_intent != INTENT_HARM)
to_chat(user, "<span class='warning'>You cannot insert this item into the [name]!</span>")
return 1
else
return 0
+2 -3
View File
@@ -418,9 +418,8 @@
if(exp == SCANTYPE_OBLITERATE)
visible_message("<span class='warning'>[exp_on] activates the crushing mechanism, [exp_on] is destroyed!</span>")
if(linked_console.linked_lathe)
GET_COMPONENT_FROM(linked_materials, /datum/component/material_container, linked_console.linked_lathe)
for(var/material in exp_on.materials)
linked_materials.insert_amount( min((linked_materials.max_amount - linked_materials.total_amount), (exp_on.materials[material])), material)
linked_console.linked_lathe.materials.insert_amount( min((linked_console.linked_lathe.materials.max_amount - linked_console.linked_lathe.materials.total_amount), (exp_on.materials[material])), material)
if(prob(EFFECT_PROB_LOW) && criticalReaction)
visible_message("<span class='warning'>[src]'s crushing mechanism slowly and smoothly descends, flattening the [exp_on]!</span>")
new /obj/item/stack/sheet/plasteel(get_turf(pick(oview(1,src))))
@@ -707,4 +706,4 @@
if(priority) //For truly dangerous relics that may need an admin's attention. BWOINK!
message_admins("[RelicType] relic activated by [ADMIN_LOOKUPFLW(user)] in [ADMIN_COORDJMP(T)]",0,1)
log_game(log_msg)
investigate_log(log_msg, "experimentor")
investigate_log(log_msg, "experimentor")
+64 -21
View File
@@ -14,6 +14,7 @@ Note: Must be placed west/left of and R&D console to function.
container_type = OPENCONTAINER_1
circuit = /obj/item/circuitboard/machine/protolathe
var/datum/material_container/materials
var/efficiency_coeff
var/list/categories = list(
@@ -33,9 +34,11 @@ Note: Must be placed west/left of and R&D console to function.
/obj/machinery/r_n_d/protolathe/Initialize()
create_reagents(0)
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),
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready))
materials = new(src, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE))
return ..()
/obj/machinery/r_n_d/protolathe/Destroy()
QDEL_NULL(materials)
return ..()
/obj/machinery/r_n_d/protolathe/RefreshParts()
@@ -44,7 +47,6 @@ Note: Must be placed west/left of and R&D console to function.
reagents.maximum_volume += G.volume
G.reagents.trans_to(src, G.reagents.total_volume)
GET_COMPONENT(materials, /datum/component/material_container)
materials.max_amount = 0
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
materials.max_amount += M.rating * 75000
@@ -57,7 +59,6 @@ Note: Must be placed west/left of and R&D console to function.
/obj/machinery/r_n_d/protolathe/proc/check_mat(datum/design/being_built, M) // now returns how many times the item can be built with the material
var/list/all_materials = being_built.reagents_list + being_built.materials
GET_COMPONENT(materials, /datum/component/material_container)
var/A = materials.amount(M)
if(!A)
A = reagents.get_reagent_amount(M)
@@ -68,7 +69,6 @@ Note: Must be placed west/left of and R&D console to function.
/obj/machinery/r_n_d/protolathe/on_deconstruction()
for(var/obj/item/reagent_containers/glass/G in component_parts)
reagents.trans_to(G, G.reagents.maximum_volume)
GET_COMPONENT(materials, /datum/component/material_container)
materials.retrieve_all()
..()
@@ -77,20 +77,63 @@ Note: Must be placed west/left of and R&D console to function.
linked_console.linked_lathe = null
..()
/obj/machinery/r_n_d/protolathe/ComponentActivated(datum/component/C)
..()
if(istype(C, /datum/component/material_container))
var/datum/component/material_container/M = C
if(!M.last_insert_success)
/obj/machinery/r_n_d/protolathe/Insert_Item(obj/item/O, mob/user)
if(istype(O, /obj/item/stack/sheet))
. = 1
if(!is_insertion_ready(user))
return
var/lit = M.last_inserted_type
var/stack_name
if(ispath(lit, /obj/item/ore/bluespace_crystal))
stack_name = "bluespace"
use_power(MINERAL_MATERIAL_AMOUNT / 10)
var/sheet_material = materials.get_item_material_amount(O)
if(!sheet_material)
return
if(!materials.has_space(sheet_material))
to_chat(user, "<span class='warning'>The [src.name]'s material bin is full! Please remove material before adding more.</span>")
return 1
var/obj/item/stack/sheet/stack = O
var/amount = round(input("How many sheets do you want to add?") as num)//No decimals
if(!in_range(src, stack) || !user.Adjacent(src))
return
var/amount_inserted = materials.insert_stack(O,amount)
if(!amount_inserted)
return 1
else
var/obj/item/stack/S = lit
stack_name = initial(S.name)
use_power(max(1000, (MINERAL_MATERIAL_AMOUNT * M.last_amount_inserted / 10)))
add_overlay("protolathe_[stack_name]")
addtimer(CALLBACK(src, /atom/proc/cut_overlay, "protolathe_[stack_name]"), 10)
var/stack_name = stack.name
busy = TRUE
use_power(max(1000, (MINERAL_MATERIAL_AMOUNT*amount_inserted/10)))
to_chat(user, "<span class='notice'>You add [amount_inserted] sheets to the [src.name].</span>")
add_overlay("protolathe_[stack_name]")
sleep(10)
cut_overlay("protolathe_[stack_name]")
busy = FALSE
updateUsrDialog()
else if(istype(O, /obj/item/ore/bluespace_crystal)) //Bluespace crystals can be either a stack or an item
. = 1
if(!is_insertion_ready(user))
return
var/bs_material = materials.get_item_material_amount(O)
if(!bs_material)
return
if(!materials.has_space(bs_material))
to_chat(user, "<span class='warning'>The [src.name]'s material bin is full! Please remove material before adding more.</span>")
return 1
materials.insert_item(O)
busy = TRUE
use_power(MINERAL_MATERIAL_AMOUNT/10)
to_chat(user, "<span class='notice'>You add [O] to the [src.name].</span>")
qdel(O)
add_overlay("protolathe_bluespace")
sleep(10)
cut_overlay("protolathe_bluespace")
busy = FALSE
updateUsrDialog()
else if(user.a_intent != INTENT_HARM)
to_chat(user, "<span class='warning'>You cannot insert this item into the [name]!</span>")
return 1
else
return 0
+17 -34
View File
@@ -169,15 +169,6 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(href_list["menu"]) //Switches menu screens. Converts a sent text string into a number. Saves a LOT of code.
var/temp_screen = text2num(href_list["menu"])
screen = temp_screen
var/datum/component/material_container/linked_materials
if(linked_lathe)
linked_materials = linked_lathe.GetComponent(/datum/component/material_container)
var/datum/component/material_container/imprinter_materials
if(linked_imprinter)
imprinter_materials = linked_imprinter.GetComponent(/datum/component/material_container)
if(href_list["category"])
selected_category = href_list["category"]
@@ -324,7 +315,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(linked_lathe) //Also sends salvaged materials to a linked protolathe, if any.
for(var/material in linked_destroy.loaded_item.materials)
linked_materials.insert_amount(min((linked_materials.max_amount - linked_materials.total_amount), (linked_destroy.loaded_item.materials[material]*(linked_destroy.decon_mod/10))), material)
linked_lathe.materials.insert_amount(min((linked_lathe.materials.max_amount - linked_lathe.materials.total_amount), (linked_destroy.loaded_item.materials[material]*(linked_destroy.decon_mod/10))), material)
SSblackbox.add_details("item_deconstructed","[linked_destroy.loaded_item.type]")
linked_destroy.loaded_item = null
for(var/obj/I in linked_destroy.contents)
@@ -430,7 +421,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
for(var/MAT in being_built.materials)
efficient_mats[MAT] = being_built.materials[MAT]*coeff
if(!linked_materials.has_materials(efficient_mats, amount))
if(!linked_lathe.materials.has_materials(efficient_mats, amount))
linked_lathe.say("Not enough materials to complete prototype.")
enough_materials = 0
g2g = 0
@@ -442,7 +433,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
g2g = 0
if(enough_materials)
linked_materials.use_amount(efficient_mats, amount)
linked_lathe.materials.use_amount(efficient_mats, amount)
for(var/R in being_built.reagents_list)
linked_lathe.reagents.remove_reagent(R, being_built.reagents_list[R]*coeff)
@@ -506,7 +497,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
for(var/MAT in being_built.materials)
efficient_mats[MAT] = being_built.materials[MAT]/coeff
if(!imprinter_materials.has_materials(efficient_mats))
if(!linked_imprinter.materials.has_materials(efficient_mats))
linked_imprinter.say("Not enough materials to complete prototype.")
enough_materials = 0
g2g = 0
@@ -518,7 +509,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
g2g = 0
if(enough_materials)
imprinter_materials.use_amount(efficient_mats)
linked_imprinter.materials.use_amount(efficient_mats)
for(var/R in being_built.reagents_list)
linked_imprinter.reagents.remove_reagent(R, being_built.reagents_list[R]/coeff)
@@ -545,7 +536,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
linked_lathe.reagents.clear_reagents()
else if(href_list["ejectsheet"] && linked_lathe) //Causes the protolathe to eject a sheet of material
linked_materials.retrieve_sheets(text2num(href_list["eject_amt"]), href_list["ejectsheet"])
linked_lathe.materials.retrieve_sheets(text2num(href_list["eject_amt"]), href_list["ejectsheet"])
//Circuit Imprinter Materials
else if(href_list["disposeI"] && linked_imprinter) //Causes the circuit imprinter to dispose of a single reagent (all of it)
@@ -555,7 +546,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
linked_imprinter.reagents.clear_reagents()
else if(href_list["imprinter_ejectsheet"] && linked_imprinter) //Causes the imprinter to eject a sheet of material
imprinter_materials.retrieve_sheets(text2num(href_list["eject_amt"]), href_list["imprinter_ejectsheet"])
linked_imprinter.materials.retrieve_sheets(text2num(href_list["eject_amt"]), href_list["imprinter_ejectsheet"])
else if(href_list["find_device"]) //The R&D console looks for devices nearby to link up with.
@@ -643,14 +634,6 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(linked_imprinter == null)
screen = 4.0
var/datum/component/material_container/linked_materials
if(linked_lathe)
linked_materials = linked_lathe.GetComponent(/datum/component/material_container)
var/datum/component/material_container/imprinter_materials
if(linked_imprinter)
imprinter_materials = linked_imprinter.GetComponent(/datum/component/material_container)
switch(screen)
//////////////////////R&D CONSOLE SCREENS//////////////////
@@ -840,7 +823,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "<A href='?src=\ref[src];menu=3.2'>Material Storage</A>"
dat += "<A href='?src=\ref[src];menu=3.3'>Chemical Storage</A><div class='statusDisplay'>"
dat += "<h3>Protolathe Menu:</h3><BR>"
dat += "<B>Material Amount:</B> [linked_materials.total_amount] / [linked_materials.max_amount]<BR>"
dat += "<B>Material Amount:</B> [linked_lathe.materials.total_amount] / [linked_lathe.materials.max_amount]<BR>"
dat += "<B>Chemical Volume:</B> [linked_lathe.reagents.total_volume] / [linked_lathe.reagents.maximum_volume]<BR>"
dat += "<form name='search' action='?src=\ref[src]'>\
@@ -858,7 +841,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "<A href='?src=\ref[src];menu=1.0'>Main Menu</A>"
dat += "<A href='?src=\ref[src];menu=3.1'>Protolathe Menu</A>"
dat += "<div class='statusDisplay'><h3>Browsing [selected_category]:</h3><BR>"
dat += "<B>Material Amount:</B> [linked_materials.total_amount] / [linked_materials.max_amount]<BR>"
dat += "<B>Material Amount:</B> [linked_lathe.materials.total_amount] / [linked_lathe.materials.max_amount]<BR>"
dat += "<B>Chemical Volume:</B> [linked_lathe.reagents.total_volume] / [linked_lathe.reagents.maximum_volume]<HR>"
var/coeff = linked_lathe.efficiency_coeff
@@ -896,7 +879,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "<A href='?src=\ref[src];menu=1.0'>Main Menu</A>"
dat += "<A href='?src=\ref[src];menu=3.1'>Protolathe Menu</A>"
dat += "<div class='statusDisplay'><h3>Search results:</h3><BR>"
dat += "<B>Material Amount:</B> [linked_materials.total_amount] / [linked_materials.max_amount]<BR>"
dat += "<B>Material Amount:</B> [linked_lathe.materials.total_amount] / [linked_lathe.materials.max_amount]<BR>"
dat += "<B>Chemical Volume:</B> [linked_lathe.reagents.total_volume] / [linked_lathe.reagents.maximum_volume]<HR>"
var/coeff = linked_lathe.efficiency_coeff
@@ -933,8 +916,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(!linked_lathe)
dat += "ERROR: Protolathe connection failed."
else
for(var/mat_id in linked_materials.materials)
var/datum/material/M = linked_materials.materials[mat_id]
for(var/mat_id in linked_lathe.materials.materials)
var/datum/material/M = linked_lathe.materials.materials[mat_id]
dat += "* [M.amount] of [M.name]: "
if(M.amount >= MINERAL_MATERIAL_AMOUNT) dat += "<A href='?src=\ref[src];ejectsheet=[M.id];eject_amt=1'>Eject</A> "
if(M.amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "<A href='?src=\ref[src];ejectsheet=[M.id];eject_amt=5'>5x</A> "
@@ -961,7 +944,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "<A href='?src=\ref[src];menu=4.3'>Material Storage</A>"
dat += "<A href='?src=\ref[src];menu=4.2'>Chemical Storage</A><div class='statusDisplay'>"
dat += "<h3>Circuit Imprinter Menu:</h3><BR>"
dat += "Material Amount: [imprinter_materials.total_amount]<BR>"
dat += "Material Amount: [linked_imprinter.materials.total_amount]<BR>"
dat += "Chemical Volume: [linked_imprinter.reagents.total_volume]<HR>"
dat += "<form name='search' action='?src=\ref[src]'>\
@@ -978,7 +961,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "<A href='?src=\ref[src];menu=1.0'>Main Menu</A>"
dat += "<A href='?src=\ref[src];menu=4.1'>Circuit Imprinter Menu</A>"
dat += "<div class='statusDisplay'><h3>Browsing [selected_category]:</h3><BR>"
dat += "Material Amount: [imprinter_materials.total_amount]<BR>"
dat += "Material Amount: [linked_imprinter.materials.total_amount]<BR>"
dat += "Chemical Volume: [linked_imprinter.reagents.total_volume]<HR>"
var/coeff = linked_imprinter.efficiency_coeff
@@ -1008,7 +991,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
dat += "<A href='?src=\ref[src];menu=1.0'>Main Menu</A>"
dat += "<A href='?src=\ref[src];menu=4.1'>Circuit Imprinter Menu</A>"
dat += "<div class='statusDisplay'><h3>Search results:</h3><BR>"
dat += "Material Amount: [imprinter_materials.total_amount]<BR>"
dat += "Material Amount: [linked_imprinter.materials.total_amount]<BR>"
dat += "Chemical Volume: [linked_imprinter.reagents.total_volume]<HR>"
var/coeff = linked_imprinter.efficiency_coeff
@@ -1045,8 +1028,8 @@ won't update every console in existence) but it's more of a hassle to do. Also,
if(!linked_imprinter)
dat += "ERROR: Protolathe connection failed."
else
for(var/mat_id in imprinter_materials.materials)
var/datum/material/M = imprinter_materials.materials[mat_id]
for(var/mat_id in linked_imprinter.materials.materials)
var/datum/material/M = linked_imprinter.materials.materials[mat_id]
dat += "* [M.amount] of [M.name]: "
if(M.amount >= MINERAL_MATERIAL_AMOUNT) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=[M.id];eject_amt=1'>Eject</A> "
if(M.amount >= MINERAL_MATERIAL_AMOUNT*5) dat += "<A href='?src=\ref[src];imprinter_ejectsheet=[M.id];eject_amt=5'>5x</A> "