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
+3 -7
View File
@@ -66,6 +66,7 @@
density = TRUE
anchored = TRUE
var/obj/machinery/mineral/CONSOLE = null
var/datum/material_container/materials
var/on = FALSE
var/selected_material = MAT_METAL
var/selected_alloy = null
@@ -74,11 +75,12 @@
/obj/machinery/mineral/processing_unit/Initialize()
. = ..()
proximity_monitor = new(src, 1)
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), INFINITY)
materials = new(src, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE),INFINITY)
files = new /datum/research/smelter(src)
/obj/machinery/mineral/processing_unit/Destroy()
CONSOLE = null
QDEL_NULL(materials)
QDEL_NULL(files)
return ..()
@@ -87,7 +89,6 @@
process_ore(AM)
/obj/machinery/mineral/processing_unit/proc/process_ore(obj/item/ore/O)
GET_COMPONENT(materials, /datum/component/material_container)
var/material_amount = materials.get_item_material_amount(O)
if(!materials.has_space(material_amount))
unload_mineral(O)
@@ -99,7 +100,6 @@
/obj/machinery/mineral/processing_unit/proc/get_machine_data()
var/dat = "<b>Smelter control console</b><br><br>"
GET_COMPONENT(materials, /datum/component/material_container)
for(var/mat_id in materials.materials)
var/datum/material/M = materials.materials[mat_id]
dat += "<span class=\"res_name\">[M.name]: </span>[M.amount] cm&sup3;"
@@ -165,7 +165,6 @@
continue*/
/obj/machinery/mineral/processing_unit/proc/smelt_ore()
GET_COMPONENT(materials, /datum/component/material_container)
var/datum/material/mat = materials.materials[selected_material]
if(mat)
var/sheets_to_remove = (mat.amount >= (MINERAL_MATERIAL_AMOUNT * SMELT_AMOUNT) ) ? SMELT_AMOUNT : round(mat.amount / MINERAL_MATERIAL_AMOUNT)
@@ -188,7 +187,6 @@
on = FALSE
return
GET_COMPONENT(materials, /datum/component/material_container)
materials.use_amount(alloy.materials, amount)
generate_mineral(alloy.build_path)
@@ -199,7 +197,6 @@
var/build_amount = SMELT_AMOUNT
GET_COMPONENT(materials, /datum/component/material_container)
for(var/mat_id in D.materials)
var/M = D.materials[mat_id]
@@ -217,7 +214,6 @@
unload_mineral(O)
/obj/machinery/mineral/processing_unit/on_deconstruction()
GET_COMPONENT(materials, /datum/component/material_container)
materials.retrieve_all()
..()
+11 -9
View File
@@ -22,15 +22,17 @@
var/list/ore_values = list(MAT_GLASS = 1, MAT_METAL = 1, MAT_PLASMA = 15, MAT_SILVER = 16, MAT_GOLD = 18, MAT_TITANIUM = 30, MAT_URANIUM = 30, MAT_DIAMOND = 50, MAT_BLUESPACE = 50, MAT_BANANIUM = 60)
var/message_sent = FALSE
var/list/ore_buffer = list()
var/datum/material_container/materials
var/datum/research/files
var/obj/item/disk/design_disk/inserted_disk
/obj/machinery/mineral/ore_redemption/Initialize()
. = ..()
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),INFINITY)
materials = new(src, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE),INFINITY)
files = new /datum/research/smelter(src)
/obj/machinery/mineral/ore_redemption/Destroy()
QDEL_NULL(materials)
QDEL_NULL(files)
return ..()
@@ -55,7 +57,6 @@
if(O && O.refined_type)
points += O.points * point_upgrade
GET_COMPONENT(materials, /datum/component/material_container)
var/material_amount = materials.get_item_material_amount(O)
if(!material_amount)
@@ -74,7 +75,6 @@
var/build_amount = 0
GET_COMPONENT(materials, /datum/component/material_container)
for(var/mat_id in D.materials)
var/M = D.materials[mat_id]
var/datum/material/redemption_mat = materials.materials[mat_id]
@@ -110,7 +110,6 @@
var/has_minerals = FALSE
GET_COMPONENT(materials, /datum/component/material_container)
for(var/mat_id in materials.materials)
var/datum/material/M = materials.materials[mat_id]
var/mineral_amount = M.amount / MINERAL_MATERIAL_AMOUNT
@@ -149,7 +148,6 @@
/obj/machinery/mineral/ore_redemption/attackby(obj/item/W, mob/user, params)
if(exchange_parts(user, W))
return
GET_COMPONENT(materials, /datum/component/material_container)
if(default_pry_open(W))
materials.retrieve_all()
return
@@ -183,10 +181,16 @@
if(user.transferItemToLoc(W, src))
inserted_disk = W
return TRUE
if(istype(W, /obj/item/stack/sheet))
var/obj/item/stack/sheet/S = W
var/inserted = materials.insert_stack(S, S.amount)
to_chat(user, "<span class='notice'>You add [inserted] [S] sheets to \the [src].</span>")
return
return ..()
/obj/machinery/mineral/ore_redemption/on_deconstruction()
GET_COMPONENT(materials, /datum/component/material_container)
materials.retrieve_all()
..()
@@ -209,7 +213,6 @@
data["claimedPoints"] = inserted_id.mining_points
data["materials"] = list()
GET_COMPONENT(materials, /datum/component/material_container)
for(var/mat_id in materials.materials)
var/datum/material/M = materials.materials[mat_id]
var/sheet_amount = M.amount ? M.amount / MINERAL_MATERIAL_AMOUNT : "0"
@@ -233,7 +236,6 @@
/obj/machinery/mineral/ore_redemption/ui_act(action, params)
if(..())
return
GET_COMPONENT(materials, /datum/component/material_container)
switch(action)
if("Eject")
if(!inserted_id)
@@ -352,4 +354,4 @@
icon_state = initial(icon_state)
else
icon_state = "[initial(icon_state)]-off"
return
return
+16 -12
View File
@@ -5,32 +5,37 @@
name = "coin press"
icon = 'icons/obj/economy.dmi'
icon_state = "coinpress0"
density = TRUE
anchored = TRUE
density = TRUE
anchored = TRUE
var/datum/material_container/materials
var/newCoins = 0 //how many coins the machine made in it's last load
var/processing = FALSE
var/processing = FALSE
var/chosen = MAT_METAL //which material will be used to make coins
var/coinsToProduce = 10
speed_process = 1
/obj/machinery/mineral/mint/Initialize()
. = ..()
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_URANIUM, MAT_DIAMOND, MAT_BANANIUM), MINERAL_MATERIAL_AMOUNT * 50)
/obj/machinery/mineral/mint/Initialize()
. = ..()
materials = new /datum/material_container(src,
list(MAT_METAL, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_URANIUM, MAT_DIAMOND, MAT_BANANIUM),
max_amt = MINERAL_MATERIAL_AMOUNT*50)
/obj/machinery/mineral/mint/Destroy()
QDEL_NULL(materials)
return ..()
/obj/machinery/mineral/mint/process()
var/turf/T = get_step(src, input_dir)
if(!T)
return
GET_COMPONENT(materials, /datum/component/material_container)
for(var/obj/item/stack/sheet/O in T)
materials.insert_stack(O, O.amount)
/obj/machinery/mineral/mint/attack_hand(mob/user)
var/dat = "<b>Coin Press</b><br>"
GET_COMPONENT(materials, /datum/component/material_container)
for(var/mat_id in materials.materials)
var/datum/material/M = materials.materials[mat_id]
if(!M.amount && chosen != mat_id)
@@ -63,7 +68,6 @@
if(processing==1)
to_chat(usr, "<span class='notice'>The machine is processing.</span>")
return
GET_COMPONENT(materials, /datum/component/material_container)
if(href_list["choose"])
if(materials.materials[href_list["choose"]])
chosen = href_list["choose"]
@@ -71,7 +75,7 @@
coinsToProduce = Clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
if(href_list["makeCoins"])
var/temp_coins = coinsToProduce
processing = TRUE
processing = TRUE
icon_state = "coinpress1"
var/coin_mat = MINERAL_MATERIAL_AMOUNT * 0.2
var/datum/material/M = materials.materials[chosen]
@@ -87,7 +91,7 @@
sleep(5)
icon_state = "coinpress0"
processing = FALSE
processing = FALSE
coinsToProduce = temp_coins
src.updateUsrDialog()
return