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
-1
View File
@@ -290,7 +290,6 @@
to_chat(user, "[total_volume] units of various reagents")
else
to_chat(user, "Nothing.")
SendSignal(COMSIG_PARENT_EXAMINE, list(user), FALSE)
/atom/proc/relaymove()
return
+39 -28
View File
@@ -32,6 +32,8 @@
var/selected_category
var/screen = 1
var/datum/material_container/materials
var/list/categories = list(
"Tools",
"Electronics",
@@ -46,15 +48,15 @@
)
/obj/machinery/autolathe/Initialize()
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS))
. = ..()
materials = new /datum/material_container(src, list(MAT_METAL, MAT_GLASS))
wires = new /datum/wires/autolathe(src)
files = new /datum/research/autolathe(src)
matching_designs = list()
return ..()
/obj/machinery/autolathe/Destroy()
QDEL_NULL(wires)
QDEL_NULL(materials)
return ..()
/obj/machinery/autolathe/interact(mob/user)
@@ -79,7 +81,6 @@
popup.open()
/obj/machinery/autolathe/on_deconstruction()
GET_COMPONENT(materials, /datum/component/material_container)
materials.retrieve_all()
/obj/machinery/autolathe/attackby(obj/item/O, mob/user, params)
@@ -122,26 +123,42 @@
busy = FALSE
return 1
return ..()
if(O.flags_2 & HOLOGRAM_2)
return 1
/obj/machinery/mecha_part_fabricator/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
if(ispath(lit, /obj/item/ore/bluespace_crystal))
use_power(max(500,M.last_amount_inserted/10))
else
var/obj/item/stack/S = lit
var/list/initmats = initial(S.materials)
if (initmats[MAT_METAL])
var/material_amount = materials.get_item_material_amount(O)
if(!material_amount)
to_chat(user, "<span class='warning'>This object does not contain sufficient amounts of metal or glass to be accepted by the autolathe.</span>")
return 1
if(!materials.has_space(material_amount))
to_chat(user, "<span class='warning'>The autolathe is full. Please remove metal or glass from the autolathe in order to insert more.</span>")
return 1
if(!user.temporarilyRemoveItemFromInventory(O))
to_chat(user, "<span class='warning'>\The [O] is stuck to you and cannot be placed into the autolathe.</span>")
return 1
busy = TRUE
var/inserted = materials.insert_item(O)
if(inserted)
if(istype(O, /obj/item/stack))
if (O.materials[MAT_METAL])
flick("autolathe_o",src)//plays metal insertion animation
if (initmats[MAT_GLASS])
if (O.materials[MAT_GLASS])
flick("autolathe_r",src)//plays glass insertion animation
use_power(M.last_amount_inserted*100)
updateUsrDialog()
to_chat(user, "<span class='notice'>You insert [inserted] sheet[inserted>1 ? "s" : ""] to the autolathe.</span>")
use_power(inserted*100)
if(!QDELETED(O))
user.put_in_active_hand(O)
else
to_chat(user, "<span class='notice'>You insert a material total of [inserted] to the autolathe.</span>")
use_power(max(500,inserted/10))
qdel(O)
else
user.put_in_active_hand(O)
busy = FALSE
updateUsrDialog()
return 1
/obj/machinery/autolathe/Topic(href, href_list)
if(..())
@@ -176,7 +193,6 @@
var/power = max(2000, (metal_cost+glass_cost)*multiplier/5)
GET_COMPONENT(materials, /datum/component/material_container)
if((materials.amount(MAT_METAL) >= metal_cost*multiplier*coeff) && (materials.amount(MAT_GLASS) >= glass_cost*multiplier*coeff))
busy = TRUE
use_power(power)
@@ -230,7 +246,6 @@
var/T = 0
for(var/obj/item/stock_parts/matter_bin/MB in component_parts)
T += MB.rating*75000
GET_COMPONENT(materials, /datum/component/material_container)
materials.max_amount = T
T=1.2
for(var/obj/item/stock_parts/manipulator/M in component_parts)
@@ -279,7 +294,6 @@
dat += "<a href='?src=\ref[src];make=[D.id];multiplier=1'>[D.name]</a>"
if(ispath(D.build_path, /obj/item/stack))
GET_COMPONENT(materials, /datum/component/material_container)
var/max_multiplier = min(D.maxstack, D.materials[MAT_METAL] ?round(materials.amount(MAT_METAL)/D.materials[MAT_METAL]):INFINITY,D.materials[MAT_GLASS]?round(materials.amount(MAT_GLASS)/D.materials[MAT_GLASS]):INFINITY)
if (max_multiplier>10 && !disabled)
dat += " <a href='?src=\ref[src];make=[D.id];multiplier=10'>x10</a>"
@@ -311,7 +325,6 @@
dat += "<a href='?src=\ref[src];make=[D.id];multiplier=1'>[D.name]</a>"
if(ispath(D.build_path, /obj/item/stack))
GET_COMPONENT(materials, /datum/component/material_container)
var/max_multiplier = min(D.maxstack, D.materials[MAT_METAL] ?round(materials.amount(MAT_METAL)/D.materials[MAT_METAL]):INFINITY,D.materials[MAT_GLASS]?round(materials.amount(MAT_GLASS)/D.materials[MAT_GLASS]):INFINITY)
if (max_multiplier>10 && !disabled)
dat += " <a href='?src=\ref[src];make=[D.id];multiplier=10'>x10</a>"
@@ -326,7 +339,6 @@
return dat
/obj/machinery/autolathe/proc/materials_printout()
GET_COMPONENT(materials, /datum/component/material_container)
var/dat = "<b>Total amount:</b> [materials.total_amount] / [materials.max_amount] cm<sup>3</sup><br>"
for(var/mat_id in materials.materials)
var/datum/material/M = materials.materials[mat_id]
@@ -339,7 +351,6 @@
var/coeff = (ispath(D.build_path, /obj/item/stack) ? 1 : prod_coeff)
GET_COMPONENT(materials, /datum/component/material_container)
if(D.materials[MAT_METAL] && (materials.amount(MAT_METAL) < (D.materials[MAT_METAL] * coeff * amount)))
return 0
if(D.materials[MAT_GLASS] && (materials.amount(MAT_GLASS) < (D.materials[MAT_GLASS] * coeff * amount)))
@@ -392,4 +403,4 @@
//Called when the object is constructed by an autolathe
//Has a reference to the autolathe so you can do !!FUN!! things with hacked lathes
/obj/item/proc/autolathe_crafted(obj/machinery/autolathe/A)
return
return
+30 -5
View File
@@ -22,6 +22,7 @@
var/icon_recharging = "recharge"
var/icon_creating = "make"
var/datum/material_container/materials
var/list/using_materials
var/starting_amount = 0
var/metal_cost = 1000
@@ -54,10 +55,14 @@
/obj/machinery/droneDispenser/Initialize()
. = ..()
var/datum/component/material_container/materials = AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS), MINERAL_MATERIAL_AMOUNT * MAX_STACK_SIZE * 2, TRUE)
materials = new(src, list(MAT_METAL, MAT_GLASS), MINERAL_MATERIAL_AMOUNT*MAX_STACK_SIZE*2)
materials.insert_amount(starting_amount)
using_materials = list(MAT_METAL=metal_cost, MAT_GLASS=glass_cost)
/obj/machinery/droneDispenser/Destroy()
QDEL_NULL(materials)
return ..()
/obj/machinery/droneDispenser/preloaded
starting_amount = 5000
@@ -143,6 +148,10 @@
..()
if((mode == DRONE_RECHARGING) && !stat && recharging_text)
to_chat(user, "<span class='warning'>[recharging_text]</span>")
if(metal_cost)
to_chat(user, "<span class='notice'>It has [materials.amount(MAT_METAL)] units of metal stored.</span>")
if(glass_cost)
to_chat(user, "<span class='notice'>It has [materials.amount(MAT_GLASS)] units of glass stored.</span>")
/obj/machinery/droneDispenser/power_change()
..()
@@ -157,7 +166,6 @@
if((stat & (NOPOWER|BROKEN)) || !anchored)
return
GET_COMPONENT(materials, /datum/component/material_container)
if(!materials.has_materials(using_materials))
return // We require more minerals
@@ -224,8 +232,25 @@
icon_state = icon_on
/obj/machinery/droneDispenser/attackby(obj/item/O, mob/living/user)
if(istype(O, /obj/item/crowbar))
GET_COMPONENT(materials, /datum/component/material_container)
if(istype(O, /obj/item/stack))
if(!O.materials[MAT_METAL] && !O.materials[MAT_GLASS])
return ..()
if(!metal_cost && !glass_cost)
to_chat(user, "<span class='warning'>There isn't a place to insert [O]!</span>")
return
var/obj/item/stack/sheets = O
if(!user.canUnEquip(sheets))
to_chat(user, "<span class='warning'>[O] is stuck to your hand, you can't get it off!</span>")
return
var/used = materials.insert_stack(sheets, sheets.amount)
if(used)
to_chat(user, "<span class='notice'>You insert [used] sheet[used > 1 ? "s" : ""] into [src].</span>")
else
to_chat(user, "<span class='warning'>The [src] isn't accepting the [sheets].</span>")
else if(istype(O, /obj/item/crowbar))
materials.retrieve_all()
playsound(loc, O.usesound, 50, 1)
to_chat(user, "<span class='notice'>You retrieve the materials from [src].</span>")
@@ -284,4 +309,4 @@
#undef DRONE_PRODUCTION
#undef DRONE_RECHARGING
#undef DRONE_READY
#undef DRONE_READY
+4 -5
View File
@@ -14,14 +14,15 @@
var/blood = 0
var/eat_dir = WEST
var/amount_produced = 50
var/datum/material_container/materials
var/crush_damage = 1000
var/eat_victim_items = TRUE
var/item_recycle_sound = 'sound/items/welder.ogg'
/obj/machinery/recycler/Initialize()
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM))
. = ..()
materials = new /datum/material_container(src, list(MAT_METAL, MAT_GLASS, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM))
update_icon()
return ..()
/obj/machinery/recycler/RefreshParts()
var/amt_made = 0
@@ -31,7 +32,6 @@
mat_mod *= 50000
for(var/obj/item/stock_parts/manipulator/M in component_parts)
amt_made = 12.5 * M.rating //% of materials salvaged
GET_COMPONENT(materials, /datum/component/material_container)
materials.max_amount = mat_mod
amount_produced = min(50, amt_made) + 50
@@ -126,7 +126,6 @@
/obj/machinery/recycler/proc/recycle_item(obj/item/I)
I.loc = src.loc
GET_COMPONENT(materials, /datum/component/material_container)
var/material_amount = materials.get_item_material_amount(I)
if(!material_amount)
qdel(I)
@@ -194,4 +193,4 @@
name = "paper - 'garbage duty instructions'"
info = "<h2>New Assignment</h2> You have been assigned to collect garbage from trash bins, located around the station. The crewmembers will put their trash into it and you will collect the said trash.<br><br>There is a recycling machine near your closet, inside maintenance; use it to recycle the trash for a small chance to get useful minerals. Then deliver these minerals to cargo or engineering. You are our last hope for a clean station, do not screw this up!"
#undef SAFETY_COOLDOWN
#undef SAFETY_COOLDOWN
+66 -28
View File
@@ -12,6 +12,7 @@
circuit = /obj/item/circuitboard/machine/mechfab
var/time_coeff = 1
var/component_coeff = 1
var/datum/material_container/materials
var/datum/research/files
var/sync = 0
var/part_set
@@ -35,11 +36,9 @@
)
/obj/machinery/mecha_part_fabricator/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),
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready))
. = ..()
files = new /datum/research(src) //Setup the research data holder.
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/mecha_part_fabricator/RefreshParts()
var/T = 0
@@ -47,7 +46,6 @@
//maximum stocking amount (default 300000, 600000 at T4)
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
T += M.rating
GET_COMPONENT(materials, /datum/component/material_container)
materials.max_amount = (200000 + (T*50000))
//resources adjustment coefficient (1 -> 0.85 -> 0.7 -> 0.55)
@@ -115,7 +113,6 @@
/obj/machinery/mecha_part_fabricator/proc/output_available_resources()
var/output
GET_COMPONENT(materials, /datum/component/material_container)
for(var/mat_id in materials.materials)
var/datum/material/M = materials.materials[mat_id]
output += "<span class=\"res_name\">[M.name]: </span>[M.amount] cm&sup3;"
@@ -136,7 +133,6 @@
/obj/machinery/mecha_part_fabricator/proc/check_resources(datum/design/D)
if(D.reagents_list.len) // No reagents storage - no reagent designs.
return 0
GET_COMPONENT(materials, /datum/component/material_container)
if(materials.has_materials(get_resources_w_coeff(D)))
return 1
return 0
@@ -146,7 +142,6 @@
desc = "It's building \a [initial(D.name)]."
var/list/res_coef = get_resources_w_coeff(D)
GET_COMPONENT(materials, /datum/component/material_container)
materials.use_amount(res_coef)
add_overlay("fab-active")
use_power = ACTIVE_POWER_USE
@@ -403,34 +398,15 @@
break
if(href_list["remove_mat"] && href_list["material"])
GET_COMPONENT(materials, /datum/component/material_container)
materials.retrieve_sheets(text2num(href_list["remove_mat"]), href_list["material"])
updateUsrDialog()
return
/obj/machinery/mecha_part_fabricator/on_deconstruction()
GET_COMPONENT(materials, /datum/component/material_container)
materials.retrieve_all()
..()
/obj/machinery/mecha_part_fabricator/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"
else
var/obj/item/stack/S = lit
stack_name = material2name(initial(S.materials)[1])
add_overlay("fab-load-[stack_name]")
addtimer(CALLBACK(src, /atom/proc/cut_overlay, "fab-load-[stack_name]"), 10)
updateUsrDialog()
/obj/machinery/mecha_part_fabricator/attackby(obj/item/W, mob/user, params)
if(default_deconstruction_screwdriver(user, "fab-o", "fab-idle", W))
return 1
@@ -441,7 +417,55 @@
if(default_deconstruction_crowbar(W))
return 1
return ..()
if(istype(W, /obj/item/stack/sheet))
if(!is_insertion_ready(user))
return 1
var/material_amount = materials.get_item_material_amount(W)
if(!try_insert(user, W, material_amount))
return 1
var/inserted = materials.insert_item(W)
if(inserted)
to_chat(user, "<span class='notice'>You insert [inserted] sheet\s into [src].</span>")
if(W && W.materials.len)
if(!QDELETED(W))
user.put_in_active_hand(W)
var/mat_overlay = "fab-load-[material2name(W.materials[1])]"
add_overlay(mat_overlay)
sleep(10)
if(!QDELETED(src))
cut_overlay(mat_overlay) //No matter what the overlay shall still be deleted
updateUsrDialog()
else if(istype(W, /obj/item/ore/bluespace_crystal))
if(!is_insertion_ready(user))
return 1
var/material_amount = materials.get_item_material_amount(W)
if(!try_insert(user, W, material_amount))
return 1
var/inserted = materials.insert_item(W)
if(inserted)
to_chat(user, "<span class='notice'>You add [W] to the [src].</span>")
if(W && W.materials.len)
qdel(W)
var/mat_overlay = "fab-load-bluespace"
add_overlay(mat_overlay)
sleep(10)
if(!QDELETED(src))
cut_overlay(mat_overlay)
updateUsrDialog()
else
return ..()
/obj/machinery/mecha_part_fabricator/proc/material2name(ID)
return copytext(ID,2)
@@ -454,4 +478,18 @@
to_chat(user, "<span class='warning'>\The [src] is currently processing! Please wait until completion.</span>")
return FALSE
return TRUE
/obj/machinery/mecha_part_fabricator/proc/try_insert(mob/user, obj/item/I, material_amount)
if(!material_amount)
to_chat(user, "<span class='warning'>This object does not contain sufficient amounts of materials to be accepted by [src].</span>")
return FALSE
if(!materials.has_space(material_amount))
to_chat(user, "<span class='warning'>\The [src] is full. Please remove some materials from [src] in order to insert more.</span>")
return FALSE
if(!user.temporarilyRemoveItemFromInventory(I))
to_chat(user, "<span class='warning'>\The [I] is stuck to you and cannot be placed into [src].</span>")
return FALSE
return TRUE