mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 04:57:12 +01:00
got it
This commit is contained in:
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
This datum should be used for handling mineral contents of machines and whatever else is supposed to hold minerals and make use of them.
|
||||
|
||||
Variables:
|
||||
amount - raw amount of the mineral this container is holding, calculated by the defined value MINERAL_MATERIAL_AMOUNT=2000.
|
||||
max_amount - max raw amount of mineral this container can hold.
|
||||
sheet_type - type of the mineral sheet the container handles, used for output.
|
||||
owner - object that this container is being used by, used for output.
|
||||
MAX_STACK_SIZE - size of a stack of mineral sheets. Constant.
|
||||
*/
|
||||
|
||||
/datum/material_container
|
||||
var/total_amount = 0
|
||||
var/max_amount
|
||||
var/sheet_type
|
||||
var/obj/owner
|
||||
var/list/materials = list()
|
||||
//MAX_STACK_SIZE = 50
|
||||
//MINERAL_MATERIAL_AMOUNT = 2000
|
||||
|
||||
/datum/material_container/New(obj/O, list/mat_list, max_amt = 0)
|
||||
owner = O
|
||||
max_amount = max(0, max_amt)
|
||||
|
||||
if(mat_list[MAT_METAL])
|
||||
materials[MAT_METAL] = new /datum/material/metal()
|
||||
if(mat_list[MAT_GLASS])
|
||||
materials[MAT_GLASS] = new /datum/material/glass()
|
||||
if(mat_list[MAT_SILVER])
|
||||
materials[MAT_SILVER] = new /datum/material/silver()
|
||||
if(mat_list[MAT_GOLD])
|
||||
materials[MAT_GOLD] = new /datum/material/gold()
|
||||
if(mat_list[MAT_DIAMOND])
|
||||
materials[MAT_DIAMOND] = new /datum/material/diamond()
|
||||
if(mat_list[MAT_URANIUM])
|
||||
materials[MAT_URANIUM] = new /datum/material/uranium()
|
||||
if(mat_list[MAT_PLASMA])
|
||||
materials[MAT_PLASMA] = new /datum/material/plasma()
|
||||
if(mat_list[MAT_BANANIUM])
|
||||
materials[MAT_BANANIUM] = new /datum/material/bananium()
|
||||
if(mat_list[MAT_TRANQUILLITE])
|
||||
materials[MAT_TRANQUILLITE] = new /datum/material/tranquillite()
|
||||
if(mat_list[MAT_TITANIUM])
|
||||
materials[MAT_TITANIUM] = new /datum/material/titanium()
|
||||
|
||||
/datum/material_container/Destroy()
|
||||
QDEL_LIST_ASSOC_VAL(materials)
|
||||
owner = null
|
||||
return ..()
|
||||
|
||||
//For inserting an amount of material
|
||||
/datum/material_container/proc/insert_amount(amt, material_type = null)
|
||||
if(amt > 0 && has_space(amt))
|
||||
var/total_amount_saved = total_amount
|
||||
if(material_type)
|
||||
var/datum/material/M = materials[material_type]
|
||||
if(M)
|
||||
M.amount += amt
|
||||
total_amount += amt
|
||||
else
|
||||
for(var/datum/material/M in materials)
|
||||
M.amount += amt
|
||||
total_amount += amt
|
||||
return (total_amount - total_amount_saved)
|
||||
return 0
|
||||
|
||||
/datum/material_container/proc/insert_stack(obj/item/stack/S, amt = 0)
|
||||
if(amt <= 0)
|
||||
return 0
|
||||
if(amt > S.amount)
|
||||
amt = S.amount
|
||||
var/material_amt = get_item_material_amount(S)
|
||||
if(!material_amt)
|
||||
return 0
|
||||
|
||||
amt = min(amt, round(((max_amount - total_amount) / material_amt)))
|
||||
if(!amt)
|
||||
return 0
|
||||
|
||||
insert_materials(S,amt)
|
||||
S.use(amt)
|
||||
return amt
|
||||
|
||||
/datum/material_container/proc/insert_item(obj/item/I, multiplier = 1)
|
||||
if(!I)
|
||||
return 0
|
||||
if(istype(I,/obj/item/stack))
|
||||
var/obj/item/stack/S = I
|
||||
return insert_stack(I, S.amount)
|
||||
|
||||
var/material_amount = get_item_material_amount(I)
|
||||
if(!material_amount || !has_space(material_amount))
|
||||
return 0
|
||||
|
||||
insert_materials(I, multiplier)
|
||||
return material_amount
|
||||
|
||||
/datum/material_container/proc/insert_materials(obj/item/I, multiplier = 1) //for internal usage only
|
||||
var/datum/material/M
|
||||
for(var/MAT in materials)
|
||||
M = materials[MAT]
|
||||
M.amount += I.materials[MAT] * multiplier
|
||||
total_amount += I.materials[MAT] * multiplier
|
||||
|
||||
//For consuming material
|
||||
//mats is a list of types of material to use and the corresponding amounts, example: list(MAT_METAL=100, MAT_GLASS=200)
|
||||
/datum/material_container/proc/use_amount(list/mats, multiplier=1)
|
||||
if(!mats || !mats.len)
|
||||
return 0
|
||||
|
||||
var/datum/material/M
|
||||
for(var/MAT in materials)
|
||||
M = materials[MAT]
|
||||
if(M.amount < (mats[MAT] * multiplier))
|
||||
return 0
|
||||
|
||||
var/total_amount_save = total_amount
|
||||
for(var/MAT in materials)
|
||||
M = materials[MAT]
|
||||
M.amount -= mats[MAT] * multiplier
|
||||
total_amount -= mats[MAT] * multiplier
|
||||
|
||||
return total_amount_save - total_amount
|
||||
|
||||
|
||||
/datum/material_container/proc/use_amount_type(amt, material_type)
|
||||
var/datum/material/M
|
||||
M = materials[material_type]
|
||||
if(M)
|
||||
if(M.amount >= amt)
|
||||
M.amount -= amt
|
||||
total_amount -= amt
|
||||
return amt
|
||||
return 0
|
||||
|
||||
//For spawning mineral sheets; internal use only
|
||||
/datum/material_container/proc/retrieve(sheet_amt, datum/material/M)
|
||||
if(!M.sheet_type)
|
||||
return 0
|
||||
if(sheet_amt > 0)
|
||||
if(M.amount < (sheet_amt * MINERAL_MATERIAL_AMOUNT))
|
||||
sheet_amt = round(M.amount / MINERAL_MATERIAL_AMOUNT)
|
||||
var/count = 0
|
||||
|
||||
while(sheet_amt > MAX_STACK_SIZE)
|
||||
new M.sheet_type(get_turf(owner), MAX_STACK_SIZE)
|
||||
count += MAX_STACK_SIZE
|
||||
use_amount_type(sheet_amt * MINERAL_MATERIAL_AMOUNT, M.id)
|
||||
sheet_amt -= MAX_STACK_SIZE
|
||||
|
||||
if(round(M.amount / MINERAL_MATERIAL_AMOUNT))
|
||||
new M.sheet_type(get_turf(owner), sheet_amt)
|
||||
count += sheet_amt
|
||||
use_amount_type(sheet_amt * MINERAL_MATERIAL_AMOUNT, M.id)
|
||||
return count
|
||||
return 0
|
||||
|
||||
/datum/material_container/proc/retrieve_sheets(sheet_amt, material_type)
|
||||
if(materials[material_type])
|
||||
return retrieve(sheet_amt, materials[material_type])
|
||||
return 0
|
||||
|
||||
/datum/material_container/proc/retrieve_amount(amt, material_type)
|
||||
return retrieve_sheets(amount2sheet(amt),material_type)
|
||||
|
||||
/datum/material_container/proc/retrieve_all()
|
||||
var/result = 0
|
||||
var/datum/material/M
|
||||
for(var/MAT in materials)
|
||||
M = materials[MAT]
|
||||
result += retrieve_sheets(amount2sheet(M.amount), MAT)
|
||||
return result
|
||||
|
||||
/datum/material_container/proc/has_space(amt = 0)
|
||||
return (total_amount + amt) <= max_amount
|
||||
|
||||
/datum/material_container/proc/has_materials(list/mats, multiplier=1)
|
||||
if(!mats || !mats.len)
|
||||
return 0
|
||||
|
||||
var/datum/material/M
|
||||
for(var/MAT in mats)
|
||||
M = materials[MAT]
|
||||
if(M.amount < (mats[MAT] * multiplier))
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/datum/material_container/proc/amount2sheet(amt)
|
||||
if(amt >= MINERAL_MATERIAL_AMOUNT)
|
||||
return round(amt / MINERAL_MATERIAL_AMOUNT)
|
||||
return 0
|
||||
|
||||
/datum/material_container/proc/sheet2amount(sheet_amt)
|
||||
if(sheet_amt > 0)
|
||||
return sheet_amt * MINERAL_MATERIAL_AMOUNT
|
||||
return 0
|
||||
|
||||
/datum/material_container/proc/amount(material_type)
|
||||
var/datum/material/M = materials[material_type]
|
||||
return M ? M.amount : 0
|
||||
|
||||
//returns the amount of material relevant to this container;
|
||||
//if this container does not support glass, any glass in 'I' will not be taken into account
|
||||
/datum/material_container/proc/get_item_material_amount(obj/item/I)
|
||||
if(!istype(I))
|
||||
return 0
|
||||
var/material_amount = 0
|
||||
for(var/MAT in materials)
|
||||
material_amount += I.materials[MAT]
|
||||
return material_amount
|
||||
@@ -1236,8 +1236,8 @@ var/list/all_supply_groups = list(supply_emergency,supply_security,supply_engine
|
||||
/datum/supply_packs/materials/plastic30
|
||||
name = "30 Plastic Sheets Crate"
|
||||
contains = list(/obj/item/stack/sheet/plastic)
|
||||
amount = 30
|
||||
cost = 25
|
||||
amount = 50
|
||||
cost = 10
|
||||
containername = "plastic sheets crate"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -13,25 +13,20 @@ var/const/SAFETY_COOLDOWN = 100
|
||||
var/blood = 0
|
||||
var/eat_dir = WEST
|
||||
var/amount_produced = 1
|
||||
var/datum/material_container/materials
|
||||
var/crush_damage = 1000
|
||||
var/eat_victim_items = 1
|
||||
var/item_recycle_sound = 'sound/machines/recycler.ogg'
|
||||
|
||||
/obj/machinery/recycler/New()
|
||||
AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_GLASS, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_PLASTIC, MAT_BLUESPACE))
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/circuitboard/recycler(null)
|
||||
component_parts += new /obj/item/stock_parts/matter_bin(null)
|
||||
component_parts += new /obj/item/stock_parts/manipulator(null)
|
||||
materials = new /datum/material_container(src, list(MAT_METAL=1, MAT_GLASS=1, MAT_SILVER=1, MAT_GOLD=1, MAT_DIAMOND=1, MAT_PLASMA=1, MAT_URANIUM=1, MAT_BANANIUM=1, MAT_TRANQUILLITE=1, MAT_TITANIUM=1))
|
||||
RefreshParts()
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/recycler/Destroy()
|
||||
QDEL_NULL(materials)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/recycler/RefreshParts()
|
||||
var/amt_made = 0
|
||||
var/mat_mod = 0
|
||||
@@ -40,6 +35,7 @@ var/const/SAFETY_COOLDOWN = 100
|
||||
mat_mod *= 50000
|
||||
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
||||
amt_made = 25 * M.rating //% of materials salvaged
|
||||
GET_COMPONENT(materials, /datum/component/material_container)
|
||||
materials.max_amount = mat_mod
|
||||
amount_produced = min(100, amt_made)
|
||||
|
||||
@@ -130,8 +126,9 @@ var/const/SAFETY_COOLDOWN = 100
|
||||
playsound(loc, item_recycle_sound, 100, 0)
|
||||
|
||||
/obj/machinery/recycler/proc/recycle_item(obj/item/I)
|
||||
I.loc = loc
|
||||
I.forceMove(loc)
|
||||
|
||||
GET_COMPONENT(materials, /datum/component/material_container)
|
||||
var/material_amount = materials.get_item_material_amount(I)
|
||||
if(!material_amount)
|
||||
qdel(I)
|
||||
|
||||
@@ -364,24 +364,26 @@ var/global/list/datum/stack_recipe/brass_recipes = list ( \
|
||||
throw_range = 3
|
||||
origin_tech = "materials=2;biotech=2"
|
||||
|
||||
var/global/list/datum/stack_recipe/plastic_recipes = list ( \
|
||||
new/datum/stack_recipe("plastic flaps", /obj/structure/plasticflaps, 5, one_per_turf = 1, on_floor = 1, time = 40), \
|
||||
new/datum/stack_recipe("plastic crate", /obj/structure/closet/crate/plastic, 10, one_per_turf = 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("plastic ashtray", /obj/item/ashtray/plastic, 2, one_per_turf = 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("plastic fork", /obj/item/kitchen/utensil/pfork, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("plastic spoon", /obj/item/kitchen/utensil/pspoon, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("plastic spork", /obj/item/kitchen/utensil/pspork, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("plastic knife", /obj/item/kitchen/knife/plastic, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("plastic bag", /obj/item/storage/bag/plasticbag, 3, on_floor = 1), \
|
||||
new/datum/stack_recipe("bear mould", /obj/item/kitchen/mould/bear, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("worm mould", /obj/item/kitchen/mould/worm, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("bean mould", /obj/item/kitchen/mould/bean, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("ball mould", /obj/item/kitchen/mould/ball, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("cane mould", /obj/item/kitchen/mould/cane, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("cash mould", /obj/item/kitchen/mould/cash, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("coin mould", /obj/item/kitchen/mould/coin, 1, on_floor = 1), \
|
||||
new/datum/stack_recipe("sucker mould", /obj/item/kitchen/mould/loli, 1, on_floor = 1), \
|
||||
)
|
||||
GLOBAL_LIST_INIT(plastic_recipes, list(
|
||||
new /datum/stack_recipe("plastic flaps", /obj/structure/plasticflaps, 5, one_per_turf = 1, on_floor = 1, time = 40), \
|
||||
new /datum/stack_recipe("wet floor sign", /obj/item/caution, 2), \
|
||||
new /datum/stack_recipe("water bottle", /obj/item/reagent_containers/food/drinks/waterbottle/empty), \
|
||||
new /datum/stack_recipe("large water bottle", /obj/item/reagent_containers/food/drinks/waterbottle/large/empty,3), \
|
||||
new /datum/stack_recipe("plastic crate", /obj/structure/closet/crate/plastic, 10, one_per_turf = 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("plastic ashtray", /obj/item/ashtray/plastic, 2, one_per_turf = 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("plastic fork", /obj/item/kitchen/utensil/pfork, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("plastic spoon", /obj/item/kitchen/utensil/pspoon, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("plastic spork", /obj/item/kitchen/utensil/pspork, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("plastic knife", /obj/item/kitchen/knife/plastic, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("plastic bag", /obj/item/storage/bag/plasticbag, 3, on_floor = 1), \
|
||||
new /datum/stack_recipe("bear mould", /obj/item/kitchen/mould/bear, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("worm mould", /obj/item/kitchen/mould/worm, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("bean mould", /obj/item/kitchen/mould/bean, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("ball mould", /obj/item/kitchen/mould/ball, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("cane mould", /obj/item/kitchen/mould/cane, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("cash mould", /obj/item/kitchen/mould/cash, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("coin mould", /obj/item/kitchen/mould/coin, 1, on_floor = 1), \
|
||||
new /datum/stack_recipe("sucker mould", /obj/item/kitchen/mould/loli, 1, on_floor = 1)))
|
||||
|
||||
/obj/item/stack/sheet/plastic
|
||||
name = "plastic"
|
||||
@@ -390,10 +392,11 @@ var/global/list/datum/stack_recipe/plastic_recipes = list ( \
|
||||
icon_state = "sheet-plastic"
|
||||
throwforce = 7
|
||||
origin_tech = "materials=1;biotech=1"
|
||||
materials = list(MAT_PLASTIC = MINERAL_MATERIAL_AMOUNT)
|
||||
merge_type = /obj/item/stack/sheet/plastic
|
||||
|
||||
/obj/item/stack/sheet/plastic/New()
|
||||
recipes = plastic_recipes
|
||||
recipes = GLOB.plastic_recipes
|
||||
. = ..()
|
||||
|
||||
/obj/item/stack/sheet/plastic/fifty
|
||||
|
||||
@@ -365,4 +365,29 @@
|
||||
name = "Goon from a Blue Toolbox special edition"
|
||||
desc = "Wine from the land down under, where the dingos roam and the roos do wander."
|
||||
icon_state = "goonbag"
|
||||
list_reagents = list("wine" = 70)
|
||||
list_reagents = list("wine" = 70)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/waterbottle
|
||||
name = "bottle of water"
|
||||
desc = "A bottle of water filled at an old Earth bottling facility."
|
||||
icon = 'icons/obj/drinks.dmi'
|
||||
icon_state = "smallbottle"
|
||||
item_state = "bottle"
|
||||
list_reagents = list("water" = 49.5, "fluorine" = 0.5) //see desc, don't think about it too hard
|
||||
materials = list(MAT_GLASS = 0)
|
||||
volume = 50
|
||||
amount_per_transfer_from_this = 10
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/waterbottle/empty
|
||||
list_reagents = list()
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/waterbottle/large
|
||||
desc = "A fresh commercial-sized bottle of water."
|
||||
icon_state = "largebottle"
|
||||
materials = list(MAT_GLASS = 0)
|
||||
list_reagents = list("water" = 100)
|
||||
volume = 100
|
||||
amount_per_transfer_from_this = 20
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/waterbottle/large/empty
|
||||
list_reagents = list()
|
||||
@@ -64,13 +64,6 @@
|
||||
icon_state = "cola"
|
||||
list_reagents = list("cola" = 30)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/cans/waterbottle
|
||||
name = "Bottled Water"
|
||||
desc = "Introduced to the vending machines by Skrellian request, this water comes straight from the Martian poles."
|
||||
icon_state = "waterbottle"
|
||||
is_plastic = 1
|
||||
list_reagents = list("water" = 30)
|
||||
|
||||
/obj/item/reagent_containers/food/drinks/cans/beer
|
||||
name = "Space Beer"
|
||||
desc = "Contains only water, malt and hops."
|
||||
|
||||
@@ -20,18 +20,6 @@
|
||||
M.adjustToxLoss(1.5)
|
||||
..()
|
||||
|
||||
/datum/reagent/plasticide
|
||||
name = "Plasticide"
|
||||
id = "plasticide"
|
||||
description = "Liquid plastic, do not eat."
|
||||
reagent_state = LIQUID
|
||||
color = "#CF3600" // rgb: 207, 54, 0
|
||||
|
||||
/datum/reagent/plasticide/on_mob_life(mob/living/M)
|
||||
M.adjustToxLoss(1.5)
|
||||
..()
|
||||
|
||||
|
||||
/datum/reagent/minttoxin
|
||||
name = "Mint Toxin"
|
||||
id = "minttoxin"
|
||||
|
||||
@@ -93,17 +93,18 @@
|
||||
result_amount = 2
|
||||
mix_message = "The mixture gives off a sharp acidic tang."
|
||||
|
||||
/datum/chemical_reaction/plastication
|
||||
name = "Plastic"
|
||||
id = "solidplastic"
|
||||
/datum/chemical_reaction/plastic_polymers
|
||||
name = "plastic polymers"
|
||||
id = "plastic_polymers"
|
||||
result = null
|
||||
required_reagents = list("facid" = 10, "plasticide" = 20)
|
||||
required_reagents = list("oil" = 5, "sacid" = 2, "ash" = 3)
|
||||
min_temp = 374
|
||||
result_amount = 1
|
||||
|
||||
/datum/chemical_reaction/plastication/on_reaction(datum/reagents/holder)
|
||||
var/obj/item/stack/sheet/metal/M = new /obj/item/stack/sheet/plastic
|
||||
M.amount = 10
|
||||
M.forceMove(get_turf(holder.my_atom))
|
||||
var/obj/item/stack/sheet/plastic/P = new /obj/item/stack/sheet/plastic
|
||||
P.amount = 10
|
||||
P.forceMove(get_turf(holder.my_atom))
|
||||
|
||||
/datum/chemical_reaction/lube
|
||||
name = "Space Lube"
|
||||
|
||||
@@ -450,8 +450,9 @@
|
||||
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))))
|
||||
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_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)
|
||||
linked_materials.insert_amount( min((linked_materials.max_amount - linked_materials.total_amount), (exp_on.materials[material])), material)
|
||||
if(prob(EFFECT_PROB_VERYLOW-badThingCoeff))
|
||||
visible_message("<span class='danger'>[src]'s crusher goes way too many levels too high, crushing right through space-time!</span>")
|
||||
playsound(src.loc, 'sound/effects/supermatter.ogg', 50, 1, -3)
|
||||
|
||||
@@ -13,7 +13,6 @@ Note: Must be placed west/left of and R&D console to function.
|
||||
icon_state = "protolathe"
|
||||
flags = OPENCONTAINER
|
||||
|
||||
var/datum/material_container/materials
|
||||
var/efficiency_coeff
|
||||
|
||||
var/list/categories = list(
|
||||
@@ -28,11 +27,15 @@ Note: Must be placed west/left of and R&D console to function.
|
||||
"Stock Parts",
|
||||
"Weapons"
|
||||
)
|
||||
|
||||
var/datum/component/material_container/materials //Store for hyper speed!
|
||||
reagents = new()
|
||||
|
||||
|
||||
/obj/machinery/r_n_d/protolathe/New()
|
||||
materials = AddComponent(/datum/component/material_container,
|
||||
list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TRANQUILLITE, MAT_TITANIUM, MAT_BLUESPACE, MAT_PLASTIC), 0,
|
||||
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
|
||||
materials.precise_insertion = TRUE
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/circuitboard/protolathe(null)
|
||||
@@ -42,7 +45,6 @@ Note: Must be placed west/left of and R&D console to function.
|
||||
component_parts += new /obj/item/stock_parts/manipulator(null)
|
||||
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
|
||||
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
|
||||
materials = new(src, list(MAT_METAL=1, MAT_GLASS=1, MAT_SILVER=1, MAT_GOLD=1, MAT_DIAMOND=1, MAT_PLASMA=1, MAT_URANIUM=1, MAT_BANANIUM=1, MAT_TRANQUILLITE=1, MAT_TITANIUM=1))
|
||||
RefreshParts()
|
||||
|
||||
reagents.my_atom = src
|
||||
@@ -61,10 +63,6 @@ Note: Must be placed west/left of and R&D console to function.
|
||||
|
||||
reagents.my_atom = src
|
||||
|
||||
/obj/machinery/r_n_d/protolathe/Destroy()
|
||||
QDEL_NULL(materials)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/r_n_d/protolathe/RefreshParts()
|
||||
var/T = 0
|
||||
for(var/obj/item/reagent_containers/glass/G in component_parts)
|
||||
@@ -88,7 +86,8 @@ Note: Must be placed west/left of and R&D console to function.
|
||||
|
||||
/obj/machinery/r_n_d/protolathe/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
|
||||
if(shocked)
|
||||
shock(user,50)
|
||||
if(shock(user,50))
|
||||
return TRUE
|
||||
if(default_deconstruction_screwdriver(user, "protolathe_t", "protolathe", O))
|
||||
if(linked_console)
|
||||
linked_console.linked_lathe = null
|
||||
@@ -112,39 +111,41 @@ Note: Must be placed west/left of and R&D console to function.
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You can't load the [src.name] while it's opened.</span>")
|
||||
return 1
|
||||
if(disabled)
|
||||
return
|
||||
if(!linked_console)
|
||||
to_chat(user, "<span class='warning'> The [src.name] must be linked to an R&D console first!</span>")
|
||||
return 1
|
||||
if(busy)
|
||||
to_chat(user, "<span class='warning'>The [src.name] is busy. Please wait for completion of previous operation.</span>")
|
||||
return 1
|
||||
if(O.is_open_container())
|
||||
return
|
||||
if(stat)
|
||||
return 1
|
||||
if(!istype(O,/obj/item/stack/sheet))
|
||||
return 1
|
||||
|
||||
if(!materials.has_space( materials.get_item_material_amount(O) ))
|
||||
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
|
||||
return FALSE
|
||||
else
|
||||
busy = 1
|
||||
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>")
|
||||
var/stackname = stack.name
|
||||
src.overlays += "protolathe_[stackname]"
|
||||
sleep(10)
|
||||
src.overlays -= "protolathe_[stackname]"
|
||||
busy = 0
|
||||
updateUsrDialog()
|
||||
return ..()
|
||||
|
||||
//whether the machine can have an item inserted in its current state.
|
||||
/obj/machinery/r_n_d/protolathe/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(disabled)
|
||||
return FALSE
|
||||
if(!linked_console)
|
||||
to_chat(user, "<span class='warning'>[src] must be linked to an R&D console first!</span>")
|
||||
return FALSE
|
||||
if(busy)
|
||||
to_chat(user, "<span class='warning'>[src] is busy right now.</span>")
|
||||
return FALSE
|
||||
if(stat & BROKEN)
|
||||
to_chat(user, "<span class='warning'>[src] is broken.</span>")
|
||||
return FALSE
|
||||
if(stat & NOPOWER)
|
||||
to_chat(user, "<span class='warning'>[src] has no power.</span>")
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/r_n_d/protolathe/proc/AfterMaterialInsert(type_inserted, id_inserted, amount_inserted)
|
||||
var/stack_name
|
||||
if(ispath(type_inserted, /obj/item/ore/bluespace_crystal))
|
||||
stack_name = "bluespace polycrystal"
|
||||
use_power(MINERAL_MATERIAL_AMOUNT / 10)
|
||||
else
|
||||
var/obj/item/stack/S = type_inserted
|
||||
stack_name = initial(S.name)
|
||||
use_power(min(1000, (amount_inserted / 100)))
|
||||
overlays += "protolathe_[stack_name]"
|
||||
sleep(10)
|
||||
overlays -= "protolathe_[stack_name]"
|
||||
@@ -100,6 +100,10 @@ won't update every console in existence) but it's more of a hassle to do. Also,
|
||||
return_name = "Tranquillite"
|
||||
if("titanium")
|
||||
return_name = "Titanium"
|
||||
if("bluespace")
|
||||
return_name = "Bluespace Mesh"
|
||||
if("plastic")
|
||||
return_name = "Plastic"
|
||||
return return_name
|
||||
else
|
||||
for(var/R in subtypesof(/datum/reagent))
|
||||
@@ -805,12 +809,14 @@ won't update every console in existence) but it's more of a hassle to do. Also,
|
||||
materials_list[++materials_list.len] = list("name" = "Glass", "id" = MAT_GLASS, "amount" = linked_lathe.materials.amount(MAT_GLASS))
|
||||
materials_list[++materials_list.len] = list("name" = "Gold", "id" = MAT_GOLD, "amount" = linked_lathe.materials.amount(MAT_GOLD))
|
||||
materials_list[++materials_list.len] = list("name" = "Silver", "id" = MAT_SILVER, "amount" = linked_lathe.materials.amount(MAT_SILVER))
|
||||
materials_list[++materials_list.len] = list("name" = "Plasma", "id" = MAT_PLASMA, "amount" = linked_lathe.materials.amount(MAT_PLASMA))
|
||||
materials_list[++materials_list.len] = list("name" = "Solid Plasma", "id" = MAT_PLASMA, "amount" = linked_lathe.materials.amount(MAT_PLASMA))
|
||||
materials_list[++materials_list.len] = list("name" = "Uranium", "id" = MAT_URANIUM, "amount" = linked_lathe.materials.amount(MAT_URANIUM))
|
||||
materials_list[++materials_list.len] = list("name" = "Diamond", "id" = MAT_DIAMOND, "amount" = linked_lathe.materials.amount(MAT_DIAMOND))
|
||||
materials_list[++materials_list.len] = list("name" = "Bananium", "id" = MAT_BANANIUM, "amount" = linked_lathe.materials.amount(MAT_BANANIUM))
|
||||
materials_list[++materials_list.len] = list("name" = "Tranquillite", "id" = MAT_TRANQUILLITE, "amount" = linked_lathe.materials.amount(MAT_TRANQUILLITE))
|
||||
materials_list[++materials_list.len] = list("name" = "Titanium", "id" = MAT_TITANIUM, "amount" = linked_lathe.materials.amount(MAT_TITANIUM))
|
||||
materials_list[++materials_list.len] = list("name" = "Plastic", "id" = MAT_PLASTIC, "amount" = linked_lathe.materials.amount(MAT_PLASTIC))
|
||||
materials_list[++materials_list.len] = list("name" = "Bluespace Mesh", "id" = MAT_BLUESPACE, "amount" = linked_lathe.materials.amount(MAT_BLUESPACE))
|
||||
if(submenu == 3)
|
||||
var/list/loaded_chemicals = list()
|
||||
data["loaded_chemicals"] = loaded_chemicals
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
icon = 'icons/obj/telescience.dmi'
|
||||
icon_state = "bluespace_crystal"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
materials = list(MAT_BLUESPACE = MINERAL_MATERIAL_AMOUNT)
|
||||
origin_tech = "bluespace=6;materials=3"
|
||||
points = 50
|
||||
var/blink_range = 8 // The teleport range when crushed/thrown at someone.
|
||||
@@ -45,6 +46,7 @@
|
||||
name = "artificial bluespace crystal"
|
||||
desc = "An artificially made bluespace crystal, it looks delicate."
|
||||
origin_tech = "bluespace=3;plasmatech=4"
|
||||
materials = list(MAT_BLUESPACE=MINERAL_MATERIAL_AMOUNT * 0.5)
|
||||
blink_range = 4 // Not as good as the organic stuff!
|
||||
points = 0 // nice try
|
||||
refined_type = null
|
||||
@@ -59,6 +61,7 @@ var/global/list/datum/stack_recipe/bluespace_crystal_recipes = list(new/datum/st
|
||||
icon_state = "polycrystal"
|
||||
desc = "A stable polycrystal, made of fused-together bluespace crystals. You could probably break one off."
|
||||
origin_tech = "bluespace=6;materials=3"
|
||||
materials = list(MAT_BLUESPACE = MINERAL_MATERIAL_AMOUNT)
|
||||
attack_verb = list("bluespace polybashed", "bluespace polybattered", "bluespace polybludgeoned", "bluespace polythrashed", "bluespace polysmashed")
|
||||
toolspeed = 1
|
||||
usesound = 'sound/items/Deconstruct.ogg'
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 80 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@@ -225,7 +225,6 @@
|
||||
#include "code\datums\datumvars.dm"
|
||||
#include "code\datums\gas_mixture.dm"
|
||||
#include "code\datums\hud.dm"
|
||||
#include "code\datums\material_container.dm"
|
||||
#include "code\datums\mind.dm"
|
||||
#include "code\datums\mixed.dm"
|
||||
#include "code\datums\modules.dm"
|
||||
|
||||
Reference in New Issue
Block a user