Mech fabricators can now store bluespace mesh (#25927)

* Allows bluespace polycrystal in the mech fabricator

Fixes #24591

* Titanium and polycrystal sheet insert

* You can now also insert single crystals

* Check if the fabricator is not slated for deletion before removing the overlay
This commit is contained in:
Profakos
2017-04-10 10:40:37 +12:00
committed by oranges
parent 6b13512740
commit 5b8997fe68
2 changed files with 54 additions and 15 deletions
+54 -15
View File
@@ -37,7 +37,7 @@
/obj/machinery/mecha_part_fabricator/New()
..()
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))
materials = new(src, list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE))
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/mechfab(null)
B.apply_default_parts(src)
@@ -430,22 +430,13 @@
return 1
if(istype(W, /obj/item/stack/sheet))
if(panel_open)
to_chat(user, "<span class='warning'>You can't load [src] while it's opened!</span>")
return 1
if(being_built)
to_chat(user, "<span class='warning'>\The [src] is currently processing! Please wait until completion.</span>")
if(!is_insertion_ready(user))
return 1
var/material_amount = materials.get_item_material_amount(W)
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 1
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 1
if(!user.temporarilyRemoveItemFromInventory(W))
to_chat(user, "<span class='warning'>\The [W] is stuck to you and cannot be placed into [src].</span>")
if(!try_insert(user, W, material_amount))
return 1
var/inserted = materials.insert_item(W)
@@ -457,7 +448,31 @@
var/mat_overlay = "fab-load-[material2name(W.materials[1])]"
add_overlay(mat_overlay)
sleep(10)
cut_overlay(mat_overlay) //No matter what the overlay shall still be deleted
if(!QDELETED(src))
cut_overlay(mat_overlay) //No matter what the overlay shall still be deleted
updateUsrDialog()
else if(istype(W, /obj/item/weapon/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()
@@ -466,3 +481,27 @@
/obj/machinery/mecha_part_fabricator/proc/material2name(ID)
return copytext(ID,2)
/obj/machinery/mecha_part_fabricator/proc/is_insertion_ready(mob/user)
if(panel_open)
to_chat(user, "<span class='warning'>You can't load [src] while it's opened!</span>")
return FALSE
if(being_built)
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
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB