Merge pull request #4236 from Citadel-Station-13/upstream-merge-33274

[MIRROR] Removes ComponentActivated in favor of callbacks
This commit is contained in:
deathride58
2017-12-06 03:53:35 +00:00
committed by GitHub
14 changed files with 79 additions and 151 deletions
+4 -20
View File
@@ -27,9 +27,11 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
"Computer Parts"
)
var/datum/component/material_container/materials
/obj/machinery/r_n_d/circuit_imprinter/Initialize()
var/datum/component/material_container/materials = 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 = 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), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
create_reagents(0)
return ..()
@@ -76,21 +78,3 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
/obj/machinery/r_n_d/circuit_imprinter/disconnect_console()
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)
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)
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)
+1 -19
View File
@@ -35,7 +35,7 @@ Note: Must be placed west/left of and R&D console to function.
create_reagents(0)
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),
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready))
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
return ..()
@@ -77,21 +77,3 @@ Note: Must be placed west/left of and R&D console to function.
/obj/machinery/r_n_d/protolathe/disconnect_console()
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)
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)
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)
+12
View File
@@ -106,3 +106,15 @@
if(loaded_item)
loaded_item.forceMove(loc)
..()
/obj/machinery/r_n_d/proc/AfterMaterialInsert(type_inserted, id_inserted, amount_inserted)
var/stack_name
if(ispath(type_inserted, /obj/item/ore/bluespace_crystal))
stack_name = "bluespace"
use_power(MINERAL_MATERIAL_AMOUNT / 10)
else
var/obj/item/stack/S = type_inserted
stack_name = initial(S.name)
use_power(max(1000, (MINERAL_MATERIAL_AMOUNT * amount_inserted / 10)))
add_overlay("protolathe_[stack_name]")
addtimer(CALLBACK(src, /atom/proc/cut_overlay, "protolathe_[stack_name]"), 10)