Revert "[MIRROR] Port material containers to datum components" (#2597)
* Revert "sprite fix on kitsune tails" This reverts commit44d5b21a43. * Revert "Update vg_clothing_packs.dm (#2591)" This reverts commit7f46280d6b. * Revert "Automatic changelog generation for PR #2590 [ci skip]" This reverts commit201e07033f. * Revert "[MIRROR] Gives the detective a mass spectrometer (#2590)" This reverts commit5c98b9a13b. * Revert "Quick sync (#2587)" This reverts commit92e055be97. * Revert "Automatic changelog generation for PR #2557 [ci skip]" This reverts commit241a10d88d. * Revert "Decreases hacked ai module cost (#2557)" This reverts commitd959b7538a. * Revert "[MIRROR] Port material containers to datum components (#2562)" This reverts commit32300086d5.
This commit is contained in:
@@ -5,11 +5,12 @@
|
||||
desc = "Lost prototype of advanced clown tech. Powered by bananium, these shoes leave a trail of chaos in their wake."
|
||||
icon_state = "clown_prototype_off"
|
||||
var/on = FALSE
|
||||
var/datum/material_container/bananium
|
||||
actions_types = list(/datum/action/item_action/toggle)
|
||||
|
||||
/obj/item/clothing/shoes/clown_shoes/banana_shoes/Initialize()
|
||||
. = ..()
|
||||
AddComponent(/datum/component/material_container, list(MAT_BANANIUM), 200000, TRUE)
|
||||
/obj/item/clothing/shoes/clown_shoes/banana_shoes/New()
|
||||
..()
|
||||
bananium = new/datum/material_container(src,list(MAT_BANANIUM),200000)
|
||||
|
||||
/obj/item/clothing/shoes/clown_shoes/banana_shoes/step_action()
|
||||
if(on)
|
||||
@@ -20,7 +21,6 @@
|
||||
footstep++
|
||||
|
||||
new/obj/item/grown/bananapeel/specialpeel(get_step(src,turn(usr.dir, 180))) //honk
|
||||
GET_COMPONENT(bananium, /datum/component/material_container)
|
||||
bananium.use_amount_type(100, MAT_BANANIUM)
|
||||
if(bananium.amount(MAT_BANANIUM) < 100)
|
||||
on = !on
|
||||
@@ -31,19 +31,33 @@
|
||||
..()
|
||||
|
||||
/obj/item/clothing/shoes/clown_shoes/banana_shoes/attack_self(mob/user)
|
||||
GET_COMPONENT(bananium, /datum/component/material_container)
|
||||
var/sheet_amount = bananium.retrieve_all()
|
||||
if(sheet_amount)
|
||||
to_chat(user, "<span class='notice'>You retrieve [sheet_amount] sheets of bananium from the prototype shoes.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You cannot retrieve any bananium from the prototype shoes.</span>")
|
||||
|
||||
/obj/item/clothing/shoes/clown_shoes/banana_shoes/attackby(obj/item/O, mob/user, params)
|
||||
if(!bananium.get_item_material_amount(O))
|
||||
to_chat(user, "<span class='notice'>This item has no bananium!</span>")
|
||||
return
|
||||
if(!user.dropItemToGround(O))
|
||||
to_chat(user, "<span class='notice'>You can't drop [O]!</span>")
|
||||
return
|
||||
|
||||
var/bananium_amount = bananium.insert_item(O)
|
||||
if(bananium_amount)
|
||||
to_chat(user, "<span class='notice'>You insert [O] into the prototype shoes.</span>")
|
||||
qdel(O)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You are unable to insert more bananium!</span>")
|
||||
|
||||
/obj/item/clothing/shoes/clown_shoes/banana_shoes/examine(mob/user)
|
||||
..()
|
||||
to_chat(user, "<span class='notice'>The shoes are [on ? "enabled" : "disabled"]</span>")
|
||||
var/ban_amt = bananium.amount(MAT_BANANIUM)
|
||||
to_chat(user, "<span class='notice'>The shoes are [on ? "enabled" : "disabled"]. There is [ban_amt ? ban_amt : "no"] bananium left.</span>")
|
||||
|
||||
/obj/item/clothing/shoes/clown_shoes/banana_shoes/ui_action_click(mob/user)
|
||||
GET_COMPONENT(bananium, /datum/component/material_container)
|
||||
if(bananium.amount(MAT_BANANIUM))
|
||||
on = !on
|
||||
update_icon()
|
||||
@@ -63,4 +77,4 @@
|
||||
usr.update_inv_shoes()
|
||||
for(var/X in actions)
|
||||
var/datum/action/A = X
|
||||
A.UpdateButtonIcon()
|
||||
A.UpdateButtonIcon()
|
||||
|
||||
@@ -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³"
|
||||
@@ -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()
|
||||
..()
|
||||
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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> "
|
||||
|
||||
Reference in New Issue
Block a user