Deletes lots of autoylathe copypasta.
This commit is contained in:
@@ -16752,7 +16752,7 @@
|
||||
},
|
||||
/area/centcom/holding)
|
||||
"Nf" = (
|
||||
/obj/machinery/autoylathe,
|
||||
/obj/machinery/autolathe/toy,
|
||||
/turf/open/indestructible/hotelwood,
|
||||
/area/centcom/holding)
|
||||
"Ni" = (
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
|
||||
//used in design to specify which machine can build it
|
||||
#define IMPRINTER (1<<0) //For circuits. Uses glass/chemicals.
|
||||
#define PROTOLATHE (1<<1) //New stuff. Uses glass/metal/chemicals
|
||||
#define AUTOLATHE (1<<2) //Uses glass/metal only.
|
||||
#define CRAFTLATHE (1<<3) //Uses fuck if I know. For use eventually.
|
||||
#define MECHFAB (1<<4) //Remember, objects utilising this flag should have construction_time and construction_cost vars.
|
||||
#define BIOGENERATOR (1<<5) //Uses biomass
|
||||
#define LIMBGROWER (1<<6) //Uses synthetic flesh
|
||||
#define SMELTER (1<<7) //uses various minerals
|
||||
#define AUTOYLATHE (1<<8) // CITADEL ADD
|
||||
#define PROTOLATHE (1<<1) //New stuff. Uses materials/chemicals
|
||||
#define AUTOLATHE (1<<2) //Uses materials only.
|
||||
#define TOYLATHE (1<<3) //Glass/metal/plastic. Meant for toys.
|
||||
#define NO_PUBLIC_LATHE (1<<4) //prevents the design from being auto-unlocked by public auto(y)lathes.
|
||||
#define MECHFAB (1<<5) //Remember, objects utilising this flag should have construction_time and construction_cost vars.
|
||||
#define BIOGENERATOR (1<<6) //Uses biomass
|
||||
#define LIMBGROWER (1<<7) //Uses synthetic flesh
|
||||
#define SMELTER (1<<8) //uses various minerals
|
||||
#define NANITE_COMPILER (1<<9) //Prints nanite disks
|
||||
#define AUTOBOTTLER (1<<10) //Uses booze, for printing
|
||||
//Note: More then one of these can be added to a design but imprinter and lathe designs are incompatable.
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/datum/wires/autoylathe
|
||||
holder_type = /obj/machinery/autoylathe
|
||||
proper_name = "Autoylathe"
|
||||
|
||||
/datum/wires/autoylathe/New(atom/holder)
|
||||
wires = list(
|
||||
WIRE_HACK, WIRE_DISABLE,
|
||||
WIRE_SHOCK, WIRE_ZAP
|
||||
)
|
||||
add_duds(6)
|
||||
..()
|
||||
|
||||
/datum/wires/autoylathe/interactable(mob/user)
|
||||
var/obj/machinery/autoylathe/A = holder
|
||||
if(A.panel_open)
|
||||
return TRUE
|
||||
|
||||
/datum/wires/autoylathe/get_status()
|
||||
var/obj/machinery/autoylathe/A = holder
|
||||
var/list/status = list()
|
||||
status += "The red light is [A.disabled ? "on" : "off"]."
|
||||
status += "The blue light is [A.hacked ? "on" : "off"]."
|
||||
return status
|
||||
|
||||
/datum/wires/autoylathe/on_pulse(wire)
|
||||
var/obj/machinery/autoylathe/A = holder
|
||||
switch(wire)
|
||||
if(WIRE_HACK)
|
||||
A.adjust_hacked(!A.hacked)
|
||||
addtimer(CALLBACK(A, /obj/machinery/autoylathe.proc/reset, wire), 60)
|
||||
if(WIRE_SHOCK)
|
||||
A.shocked = !A.shocked
|
||||
addtimer(CALLBACK(A, /obj/machinery/autoylathe.proc/reset, wire), 60)
|
||||
if(WIRE_DISABLE)
|
||||
A.disabled = !A.disabled
|
||||
addtimer(CALLBACK(A, /obj/machinery/autoylathe.proc/reset, wire), 60)
|
||||
|
||||
/datum/wires/autoylathe/on_cut(wire, mend)
|
||||
var/obj/machinery/autoylathe/A = holder
|
||||
switch(wire)
|
||||
if(WIRE_HACK)
|
||||
A.adjust_hacked(!mend)
|
||||
if(WIRE_HACK)
|
||||
A.shocked = !mend
|
||||
if(WIRE_DISABLE)
|
||||
A.disabled = !mend
|
||||
if(WIRE_ZAP)
|
||||
A.shock(usr, 50)
|
||||
@@ -28,11 +28,11 @@
|
||||
var/prod_coeff = 1
|
||||
|
||||
var/datum/design/being_built
|
||||
var/datum/techweb/stored_research
|
||||
var/list/datum/design/matching_designs
|
||||
var/selected_category
|
||||
var/screen = 1
|
||||
|
||||
var/datum/techweb/stored_research = /datum/techweb/specialized/autounlocking/autolathe
|
||||
var/list/categories = list(
|
||||
"Tools",
|
||||
"Electronics",
|
||||
@@ -45,9 +45,7 @@
|
||||
"Dinnerware",
|
||||
"Imported"
|
||||
)
|
||||
|
||||
/obj/machinery/autolathe/Initialize()
|
||||
var/static/list/allowed_types = list(
|
||||
var/list/allowed_materials = list(
|
||||
/datum/material/iron,
|
||||
/datum/material/glass,
|
||||
/datum/material/gold,
|
||||
@@ -63,10 +61,12 @@
|
||||
/datum/material/adamantine,
|
||||
/datum/material/mythril
|
||||
)
|
||||
AddComponent(/datum/component/material_container, allowed_types, _show_on_examine=TRUE, _after_insert=CALLBACK(src, .proc/AfterMaterialInsert))
|
||||
|
||||
/obj/machinery/autolathe/Initialize()
|
||||
AddComponent(/datum/component/material_container, allowed_materials, _show_on_examine=TRUE, _after_insert=CALLBACK(src, .proc/AfterMaterialInsert))
|
||||
. = ..()
|
||||
wires = new /datum/wires/autolathe(src)
|
||||
stored_research = new /datum/techweb/specialized/autounlocking/autolathe
|
||||
stored_research = new stored_research
|
||||
matching_designs = list()
|
||||
|
||||
/obj/machinery/autolathe/Destroy()
|
||||
@@ -91,7 +91,7 @@
|
||||
if(AUTOLATHE_SEARCH_MENU)
|
||||
dat = search_win(user)
|
||||
|
||||
var/datum/browser/popup = new(user, "autolathe", name, 400, 500)
|
||||
var/datum/browser/popup = new(user, name, name, 400, 500)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
@@ -439,8 +439,37 @@
|
||||
desc = "An autolathe reprogrammed with security protocols to prevent hacking."
|
||||
hackable = FALSE
|
||||
circuit = /obj/item/circuitboard/machine/autolathe/secure
|
||||
stored_research = /datum/techweb/specialized/autounlocking/autolathe/public
|
||||
|
||||
//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
|
||||
|
||||
/obj/machinery/autolathe/toy
|
||||
name = "autoylathe"
|
||||
desc = "It produces toys using plastic, metal and glass."
|
||||
circuit = /obj/item/circuitboard/machine/autolathe/toy
|
||||
|
||||
stored_research = /datum/techweb/specialized/autounlocking/autolathe/toy
|
||||
categories = list(
|
||||
"Toys",
|
||||
"Figurines",
|
||||
"Pistols",
|
||||
"Rifles",
|
||||
"Heavy",
|
||||
"Melee",
|
||||
"Armor",
|
||||
"Adult",
|
||||
"Misc",
|
||||
"Imported"
|
||||
)
|
||||
allowed_materials = list(
|
||||
/datum/material/iron,
|
||||
/datum/material/glass,
|
||||
/datum/material/plastic
|
||||
)
|
||||
|
||||
/obj/machinery/autolathe/toy/hacked/Initialize()
|
||||
. = ..()
|
||||
adjust_hacked(TRUE)
|
||||
|
||||
@@ -1,415 +0,0 @@
|
||||
#define AUTOYLATHE_MAIN_MENU 1
|
||||
#define AUTOYLATHE_CATEGORY_MENU 2
|
||||
#define AUTOYLATHE_SEARCH_MENU 3
|
||||
|
||||
/obj/machinery/autoylathe
|
||||
name = "autoylathe"
|
||||
desc = "It produces toys using plastic, metal and glass."
|
||||
icon_state = "autolathe"
|
||||
density = TRUE
|
||||
use_power = IDLE_POWER_USE
|
||||
idle_power_usage = 10
|
||||
active_power_usage = 100
|
||||
circuit = /obj/item/circuitboard/machine/autoylathe
|
||||
layer = BELOW_OBJ_LAYER
|
||||
|
||||
var/operating = FALSE
|
||||
var/list/L = list()
|
||||
var/list/LL = list()
|
||||
var/hacked = FALSE
|
||||
var/disabled = 0
|
||||
var/shocked = FALSE
|
||||
var/hack_wire
|
||||
var/disable_wire
|
||||
var/shock_wire
|
||||
|
||||
var/busy = FALSE
|
||||
var/prod_coeff = 1
|
||||
|
||||
var/datum/design/being_built
|
||||
var/datum/techweb/stored_research
|
||||
var/list/datum/design/matching_designs
|
||||
var/selected_category
|
||||
var/screen = 1
|
||||
|
||||
var/list/categories = list(
|
||||
"Toys",
|
||||
"Figurines",
|
||||
"Pistols",
|
||||
"Rifles",
|
||||
"Heavy",
|
||||
"Melee",
|
||||
"Armor",
|
||||
"Adult",
|
||||
"Misc",
|
||||
"Imported"
|
||||
)
|
||||
|
||||
/obj/machinery/autoylathe/Initialize()
|
||||
var/static/list/allowed_materials = list(
|
||||
/datum/material/iron,
|
||||
/datum/material/glass,
|
||||
/datum/material/plastic
|
||||
)
|
||||
AddComponent(/datum/component/material_container, allowed_materials, 0, TRUE, null, null, CALLBACK(src, .proc/AfterMaterialInsert))
|
||||
. = ..()
|
||||
|
||||
wires = new /datum/wires/autoylathe(src)
|
||||
stored_research = new /datum/techweb/specialized/autounlocking/autoylathe
|
||||
matching_designs = list()
|
||||
|
||||
/obj/machinery/autoylathe/Destroy()
|
||||
QDEL_NULL(wires)
|
||||
return ..()
|
||||
|
||||
/obj/machinery/autoylathe/ui_interact(mob/user)
|
||||
. = ..()
|
||||
if(!is_operational())
|
||||
return
|
||||
|
||||
if(shocked && !(stat & NOPOWER))
|
||||
shock(user,50)
|
||||
|
||||
var/dat
|
||||
|
||||
switch(screen)
|
||||
if(AUTOYLATHE_MAIN_MENU)
|
||||
dat = main_win(user)
|
||||
if(AUTOYLATHE_CATEGORY_MENU)
|
||||
dat = category_win(user,selected_category)
|
||||
if(AUTOYLATHE_SEARCH_MENU)
|
||||
dat = search_win(user)
|
||||
|
||||
var/datum/browser/popup = new(user, "Autoylathe", name, 400, 500)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
|
||||
/obj/machinery/autoylathe/on_deconstruction()
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
materials.retrieve_all()
|
||||
|
||||
/obj/machinery/autoylathe/attackby(obj/item/O, mob/user, params)
|
||||
if (busy)
|
||||
to_chat(user, "<span class=\"alert\">The autoylathe is busy. Please wait for completion of previous operation.</span>")
|
||||
return TRUE
|
||||
|
||||
if(default_deconstruction_screwdriver(user, "autolathe_t", "autolathe", O))
|
||||
updateUsrDialog()
|
||||
return TRUE
|
||||
|
||||
if(default_deconstruction_crowbar(O))
|
||||
return TRUE
|
||||
|
||||
if(panel_open && is_wire_tool(O))
|
||||
wires.interact(user)
|
||||
return TRUE
|
||||
|
||||
if(user.a_intent == INTENT_HARM) //so we can hit the machine
|
||||
return ..()
|
||||
|
||||
if(stat)
|
||||
return TRUE
|
||||
|
||||
if(istype(O, /obj/item/disk/design_disk))
|
||||
user.visible_message("[user] begins to load \the [O] in \the [src]...",
|
||||
"You begin to load a design from \the [O]...",
|
||||
"You hear the chatter of a floppy drive.")
|
||||
busy = TRUE
|
||||
var/obj/item/disk/design_disk/D = O
|
||||
if(do_after(user, 14.4, target = src))
|
||||
for(var/B in D.blueprints)
|
||||
if(B)
|
||||
stored_research.add_design(B)
|
||||
busy = FALSE
|
||||
return TRUE
|
||||
|
||||
return ..()
|
||||
|
||||
/obj/machinery/autoylathe/proc/AfterMaterialInsert(obj/item/item_inserted, id_inserted, amount_inserted)
|
||||
if(item_inserted.custom_materials?.len && item_inserted.custom_materials[SSmaterials.GetMaterialRef(/datum/material/glass)])
|
||||
flick("autolathe_r",src)//plays glass insertion animation by default otherwise
|
||||
else
|
||||
flick("autolathe_o",src)//plays metal insertion animation
|
||||
|
||||
use_power(min(1000, amount_inserted / 100))
|
||||
updateUsrDialog()
|
||||
|
||||
/obj/machinery/autoylathe/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if (!busy)
|
||||
if(href_list["menu"])
|
||||
screen = text2num(href_list["menu"])
|
||||
updateUsrDialog()
|
||||
|
||||
if(href_list["category"])
|
||||
selected_category = href_list["category"]
|
||||
updateUsrDialog()
|
||||
|
||||
if(href_list["make"])
|
||||
|
||||
/////////////////
|
||||
//href protection
|
||||
being_built = stored_research.isDesignResearchedID(href_list["make"])
|
||||
if(!being_built)
|
||||
return
|
||||
|
||||
var/multiplier = text2num(href_list["multiplier"])
|
||||
var/is_stack = ispath(being_built.build_path, /obj/item/stack)
|
||||
multiplier = CLAMP(multiplier,1,50)
|
||||
|
||||
/////////////////
|
||||
|
||||
var/coeff = (is_stack ? 1 : prod_coeff) //stacks are unaffected by production coefficient
|
||||
var/total_amount = 0
|
||||
for(var/MAT in being_built.materials)
|
||||
total_amount += being_built.materials[MAT]
|
||||
var/power = max(2000, (total_amount)*multiplier/5) //Change this to use all materials
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
|
||||
var/list/materials_used = list()
|
||||
var/list/custom_materials = list() //These will apply their material effect, This should usually only be one.
|
||||
|
||||
for(var/MAT in being_built.materials)
|
||||
var/datum/material/used_material = MAT
|
||||
var/amount_needed = being_built.materials[MAT] * coeff * multiplier
|
||||
if(istext(used_material)) //This means its a category
|
||||
var/list/list_to_show = list()
|
||||
for(var/i in SSmaterials.materials_by_category[used_material])
|
||||
if(materials.materials[i] > 0)
|
||||
list_to_show += i
|
||||
|
||||
used_material = input("Choose [used_material]", "Custom Material") as null|anything in list_to_show
|
||||
if(!used_material)
|
||||
return //Didn't pick any material, so you can't build shit either.
|
||||
custom_materials[used_material] += amount_needed
|
||||
|
||||
materials_used[used_material] = amount_needed
|
||||
|
||||
if(materials.has_materials(materials_used))
|
||||
busy = TRUE
|
||||
use_power(power)
|
||||
icon_state = "autolathe_n"
|
||||
var/time = is_stack ? 32 : 32*coeff*multiplier
|
||||
addtimer(CALLBACK(src, .proc/make_item, power, materials_used, custom_materials, multiplier, coeff, is_stack), time)
|
||||
else
|
||||
to_chat(usr, "<span class=\"alert\">Not enough materials for this operation.</span>")
|
||||
|
||||
if(href_list["search"])
|
||||
matching_designs.Cut()
|
||||
|
||||
for(var/v in stored_research.researched_designs)
|
||||
var/datum/design/D = SSresearch.techweb_design_by_id(v)
|
||||
if(findtext(D.name,href_list["to_search"]))
|
||||
matching_designs.Add(D)
|
||||
updateUsrDialog()
|
||||
else
|
||||
to_chat(usr, "<span class=\"alert\">The autoylathe is busy. Please wait for completion of previous operation.</span>")
|
||||
|
||||
updateUsrDialog()
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/autoylathe/proc/make_item(power, list/materials_used, list/picked_materials, multiplier, coeff, is_stack)
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/atom/A = drop_location()
|
||||
use_power(power)
|
||||
materials.use_materials(materials_used)
|
||||
|
||||
if(is_stack)
|
||||
var/obj/item/stack/N = new being_built.build_path(A, multiplier)
|
||||
N.update_icon()
|
||||
N.autoylathe_crafted(src)
|
||||
else
|
||||
for(var/i=1, i<=multiplier, i++)
|
||||
var/obj/item/new_item = new being_built.build_path(A)
|
||||
new_item.autoylathe_crafted(src)
|
||||
if(length(picked_materials))
|
||||
new_item.set_custom_materials(picked_materials, 1 / multiplier) //Ensure we get the non multiplied amount
|
||||
icon_state = "autolathe"
|
||||
busy = FALSE
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/autoylathe/RefreshParts()
|
||||
var/T = 0
|
||||
for(var/obj/item/stock_parts/matter_bin/MB in component_parts)
|
||||
T += MB.rating*75000
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
materials.max_amount = T
|
||||
T=1.2
|
||||
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
||||
T -= M.rating*0.2
|
||||
prod_coeff = CLAMP(T,1,0) // Coeff going 1 -> 0,8 -> 0,6 -> 0,4
|
||||
|
||||
/obj/machinery/autoylathe/proc/main_win(mob/user)
|
||||
var/dat = "<div class='statusDisplay'><h3>Autoylathe Menu:</h3><br>"
|
||||
dat += materials_printout()
|
||||
|
||||
dat += "<form name='search' action='?src=[REF(src)]'>\
|
||||
<input type='hidden' name='src' value='[REF(src)]'>\
|
||||
<input type='hidden' name='search' value='to_search'>\
|
||||
<input type='hidden' name='menu' value='[AUTOYLATHE_SEARCH_MENU]'>\
|
||||
<input type='text' name='to_search'>\
|
||||
<input type='submit' value='Search'>\
|
||||
</form><hr>"
|
||||
|
||||
var/line_length = 1
|
||||
dat += "<table style='width:100%' align='center'><tr>"
|
||||
|
||||
for(var/C in categories)
|
||||
if(line_length > 2)
|
||||
dat += "</tr><tr>"
|
||||
line_length = 1
|
||||
|
||||
dat += "<td><A href='?src=[REF(src)];category=[C];menu=[AUTOYLATHE_CATEGORY_MENU]'>[C]</A></td>"
|
||||
line_length++
|
||||
|
||||
dat += "</tr></table></div>"
|
||||
return dat
|
||||
|
||||
/obj/machinery/autoylathe/proc/category_win(mob/user,selected_category)
|
||||
var/dat = "<A href='?src=[REF(src)];menu=[AUTOYLATHE_MAIN_MENU]'>Return to main menu</A>"
|
||||
dat += "<div class='statusDisplay'><h3>Browsing [selected_category]:</h3><br>"
|
||||
dat += materials_printout()
|
||||
|
||||
for(var/v in stored_research.researched_designs)
|
||||
var/datum/design/D = SSresearch.techweb_design_by_id(v)
|
||||
if(!(selected_category in D.category))
|
||||
continue
|
||||
|
||||
if(disabled || !can_build(D))
|
||||
dat += "<span class='linkOff'>[D.name]</span>"
|
||||
else
|
||||
dat += "<a href='?src=[REF(src)];make=[D.id];multiplier=1'>[D.name]</a>"
|
||||
|
||||
if(ispath(D.build_path, /obj/item/stack))
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/max_multiplier
|
||||
for(var/datum/material/mat in D.materials)
|
||||
max_multiplier = min(D.maxstack, round(materials.get_material_amount(mat)/D.materials[mat]))
|
||||
if (max_multiplier>10 && !disabled)
|
||||
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=10'>x10</a>"
|
||||
if (max_multiplier>25 && !disabled)
|
||||
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=25'>x25</a>"
|
||||
if(max_multiplier > 0 && !disabled)
|
||||
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=[max_multiplier]'>x[max_multiplier]</a>"
|
||||
else
|
||||
if(!disabled && can_build(D, 5))
|
||||
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=5'>x5</a>"
|
||||
if(!disabled && can_build(D, 10))
|
||||
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=10'>x10</a>"
|
||||
|
||||
dat += "[get_design_cost(D)]<br>"
|
||||
|
||||
dat += "</div>"
|
||||
return dat
|
||||
|
||||
/obj/machinery/autoylathe/proc/search_win(mob/user)
|
||||
var/dat = "<A href='?src=[REF(src)];menu=[AUTOYLATHE_MAIN_MENU]'>Return to main menu</A>"
|
||||
dat += "<div class='statusDisplay'><h3>Search results:</h3><br>"
|
||||
dat += materials_printout()
|
||||
|
||||
for(var/v in matching_designs)
|
||||
var/datum/design/D = v
|
||||
if(disabled || !can_build(D))
|
||||
dat += "<span class='linkOff'>[D.name]</span>"
|
||||
else
|
||||
dat += "<a href='?src=[REF(src)];make=[D.id];multiplier=1'>[D.name]</a>"
|
||||
|
||||
if(ispath(D.build_path, /obj/item/stack))
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
var/max_multiplier
|
||||
for(var/datum/material/mat in D.materials)
|
||||
max_multiplier = min(D.maxstack, round(materials.get_material_amount(mat)/D.materials[mat]))
|
||||
if (max_multiplier>10 && !disabled)
|
||||
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=10'>x10</a>"
|
||||
if (max_multiplier>25 && !disabled)
|
||||
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=25'>x25</a>"
|
||||
if(max_multiplier > 0 && !disabled)
|
||||
dat += " <a href='?src=[REF(src)];make=[D.id];multiplier=[max_multiplier]'>x[max_multiplier]</a>"
|
||||
|
||||
dat += "[get_design_cost(D)]<br>"
|
||||
|
||||
dat += "</div>"
|
||||
return dat
|
||||
|
||||
/obj/machinery/autoylathe/proc/materials_printout()
|
||||
var/datum/component/material_container/materials = GetComponent(/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 = mat_id
|
||||
var/mineral_amount = materials.materials[mat_id]
|
||||
if(mineral_amount > 0)
|
||||
dat += "<b>[M.name] amount:</b> [mineral_amount] cm<sup>3</sup><br>"
|
||||
return dat
|
||||
|
||||
/obj/machinery/autoylathe/proc/can_build(datum/design/D, amount = 1)
|
||||
if(D.make_reagents.len)
|
||||
return FALSE
|
||||
|
||||
var/coeff = (ispath(D.build_path, /obj/item/stack) ? 1 : prod_coeff)
|
||||
|
||||
var/list/required_materials = list()
|
||||
|
||||
for(var/i in D.materials)
|
||||
required_materials[i] = D.materials[i] * coeff * amount
|
||||
|
||||
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
|
||||
|
||||
return materials.has_materials(required_materials)
|
||||
|
||||
/obj/machinery/autoylathe/proc/get_design_cost(datum/design/D)
|
||||
var/coeff = (ispath(D.build_path, /obj/item/stack) ? 1 : prod_coeff)
|
||||
var/dat
|
||||
for(var/i in D.materials)
|
||||
if(istext(i)) //Category handling
|
||||
dat += "[D.materials[i] * coeff] [i]"
|
||||
else
|
||||
var/datum/material/M = i
|
||||
dat += "[D.materials[i] * coeff] [M.name] "
|
||||
return dat
|
||||
|
||||
/obj/machinery/autoylathe/proc/reset(wire)
|
||||
switch(wire)
|
||||
if(WIRE_HACK)
|
||||
if(!wires.is_cut(wire))
|
||||
adjust_hacked(FALSE)
|
||||
if(WIRE_SHOCK)
|
||||
if(!wires.is_cut(wire))
|
||||
shocked = FALSE
|
||||
if(WIRE_DISABLE)
|
||||
if(!wires.is_cut(wire))
|
||||
disabled = FALSE
|
||||
|
||||
/obj/machinery/autoylathe/proc/shock(mob/user, prb)
|
||||
if(stat & (BROKEN|NOPOWER)) // unpowered, no shock
|
||||
return FALSE
|
||||
if(!prob(prb))
|
||||
return FALSE
|
||||
var/datum/effect_system/spark_spread/s = new /datum/effect_system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
if (electrocute_mob(user, get_area(src), src, 0.7, TRUE))
|
||||
return TRUE
|
||||
else
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/autoylathe/proc/adjust_hacked(state)
|
||||
hacked = state
|
||||
for(var/id in SSresearch.techweb_designs)
|
||||
var/datum/design/D = SSresearch.techweb_designs[id]
|
||||
if((D.build_type & AUTOYLATHE) && ("hacked" in D.category))
|
||||
if(hacked)
|
||||
stored_research.add_design(D)
|
||||
else
|
||||
stored_research.remove_design(D)
|
||||
|
||||
/obj/machinery/autoylathe/hacked/Initialize()
|
||||
. = ..()
|
||||
adjust_hacked(TRUE)
|
||||
|
||||
//Called when the object is constructed by an autoylathe
|
||||
//Has a reference to the autoylathe so you can do !!FUN!! things with hacked lathes
|
||||
/obj/item/proc/autoylathe_crafted(obj/machinery/autoylathe/A)
|
||||
return
|
||||
@@ -1033,9 +1033,9 @@
|
||||
build_path = /obj/machinery/vending/kink
|
||||
req_components = list(/obj/item/vending_refill/kink = 1)
|
||||
|
||||
/obj/item/circuitboard/machine/autoylathe
|
||||
/obj/item/circuitboard/machine/autolathe/toy
|
||||
name = "Autoylathe (Machine Board)"
|
||||
build_path = /obj/machinery/autoylathe
|
||||
build_path = /obj/machinery/autolathe/toy
|
||||
req_components = list(
|
||||
/obj/item/stock_parts/matter_bin = 3,
|
||||
/obj/item/stock_parts/manipulator = 1,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/datum/design/autoylathe
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
|
||||
/datum/design/autoylathe/mech
|
||||
category = list("initial", "Figurines")
|
||||
@@ -558,7 +558,7 @@
|
||||
/datum/design/foam_x9
|
||||
name = "Foam Force X9 Rifle"
|
||||
id = "foam_x9"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 4000, /datum/material/iron = 500)
|
||||
build_path = /obj/item/gun/ballistic/automatic/x9/toy
|
||||
category = list("initial", "Rifles")
|
||||
@@ -566,7 +566,7 @@
|
||||
/datum/design/foam_dart
|
||||
name = "Box of Foam Darts"
|
||||
id = "foam_dart"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 500, /datum/material/iron = 100)
|
||||
build_path = /obj/item/ammo_box/foambox
|
||||
category = list("initial", "Misc")
|
||||
@@ -574,7 +574,7 @@
|
||||
/datum/design/foam_magpistol
|
||||
name = "Foam Force Magpistol"
|
||||
id = "magfoam_launcher"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 2000, /datum/material/iron = 250)
|
||||
build_path = /obj/item/gun/ballistic/shotgun/toy/mag
|
||||
category = list("initial", "Pistols")
|
||||
@@ -582,7 +582,7 @@
|
||||
/datum/design/foam_magrifle
|
||||
name = "Foam Force MagRifle"
|
||||
id = "foam_magrifle"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 4000, /datum/material/iron = 500)
|
||||
build_path = /obj/item/gun/ballistic/automatic/toy/magrifle
|
||||
category = list("initial", "Rifles")
|
||||
@@ -590,7 +590,7 @@
|
||||
/datum/design/foam_hyperburst
|
||||
name = "MagTag Hyper Rifle"
|
||||
id = "foam_hyperburst"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 4000, /datum/material/iron = 2000, /datum/material/glass = 1000)
|
||||
build_path = /obj/item/gun/energy/laser/practice/hyperburst
|
||||
category = list("initial", "Rifles")
|
||||
@@ -598,7 +598,7 @@
|
||||
/datum/design/foam_sp
|
||||
name = "Foam Force Stealth Pistol"
|
||||
id = "foam_sp"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 2000, /datum/material/iron = 1000)
|
||||
build_path = /obj/item/gun/ballistic/automatic/toy/pistol/stealth
|
||||
category = list("initial", "Pistols")
|
||||
@@ -606,7 +606,7 @@
|
||||
/datum/design/toyray
|
||||
name = "RayTag Gun"
|
||||
id = "toyray"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 2000, /datum/material/iron = 1000, /datum/material/glass = 1000)
|
||||
build_path = /obj/item/gun/energy/laser/practice/raygun
|
||||
category = list("initial", "Pistols")
|
||||
@@ -614,7 +614,7 @@
|
||||
/datum/design/am4c
|
||||
name = "Foam Force AM4-C Rifle"
|
||||
id = "foam_am4c"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 4000, /datum/material/iron = 500)
|
||||
build_path = /obj/item/gun/ballistic/automatic/AM4C
|
||||
category = list("initial", "Rifles")
|
||||
@@ -622,7 +622,7 @@
|
||||
/datum/design/foam_f3
|
||||
name = "Replica F3 Justicar"
|
||||
id = "foam_f3"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 2000, /datum/material/iron = 250)
|
||||
build_path = /obj/item/toy/gun/justicar
|
||||
category = list("initial", "Pistols")
|
||||
@@ -630,7 +630,7 @@
|
||||
/datum/design/toy_blaster
|
||||
name = "pump-action plastic blaster"
|
||||
id = "toy_blaster"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 2000, /datum/material/iron = 750, /datum/material/glass = 1000)
|
||||
build_path = /obj/item/gun/energy/pumpaction/toy
|
||||
category = list("initial", "Rifles")
|
||||
@@ -638,7 +638,7 @@
|
||||
/datum/design/capammo
|
||||
name = "Box of Caps"
|
||||
id = "capammo"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/iron = 10, /datum/material/glass = 10)
|
||||
build_path = /obj/item/toy/ammo/gun
|
||||
category = list("initial", "Misc")
|
||||
@@ -646,7 +646,7 @@
|
||||
/datum/design/foam_smg
|
||||
name = "Foam Force SMG"
|
||||
id = "foam_smg"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 2000, /datum/material/iron = 250)
|
||||
build_path = /obj/item/gun/ballistic/automatic/toy/unrestricted
|
||||
category = list("initial", "Pistols")
|
||||
@@ -654,7 +654,7 @@
|
||||
/datum/design/foam_pistol
|
||||
name = "Foam Force Pistol"
|
||||
id = "foam_pistol"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 2000, /datum/material/iron = 250)
|
||||
build_path = /obj/item/gun/ballistic/automatic/toy/pistol/unrestricted
|
||||
category = list("initial", "Pistols")
|
||||
@@ -662,7 +662,7 @@
|
||||
/datum/design/foam_shotgun
|
||||
name = "Foam Force Shotgun"
|
||||
id = "foam_shotgun"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 4000, /datum/material/iron = 500)
|
||||
build_path = /obj/item/gun/ballistic/shotgun/toy/unrestricted
|
||||
category = list("initial", "Rifles")
|
||||
@@ -670,7 +670,7 @@
|
||||
/datum/design/foam_dartred
|
||||
name = "Box of Lastag Red Foam Darts"
|
||||
id = "redfoam_dart"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 500, /datum/material/iron = 100)
|
||||
build_path = /obj/item/ammo_box/foambox/tag/red
|
||||
category = list("initial", "Misc")
|
||||
@@ -678,7 +678,7 @@
|
||||
/datum/design/foam_dartblue
|
||||
name = "Box of Lastag Blue Foam Darts"
|
||||
id = "bluefoam_dart"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 500, /datum/material/iron = 100)
|
||||
build_path = /obj/item/ammo_box/foambox/tag/blue
|
||||
category = list("initial", "Misc")
|
||||
@@ -686,7 +686,7 @@
|
||||
/datum/design/foam_bow
|
||||
name = "Foam Force Crossbow"
|
||||
id = "foam_bow"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 2000, /datum/material/iron = 250)
|
||||
build_path = /obj/item/gun/ballistic/shotgun/toy/crossbow
|
||||
category = list("initial", "Pistols")
|
||||
@@ -694,7 +694,7 @@
|
||||
/datum/design/foam_c20
|
||||
name = "Donksoft C20R"
|
||||
id = "foam_c20"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 4000, /datum/material/iron = 500)
|
||||
build_path = /obj/item/gun/ballistic/automatic/c20r/toy/unrestricted
|
||||
category = list("hacked", "Rifles")
|
||||
@@ -702,7 +702,7 @@
|
||||
/datum/design/foam_l6
|
||||
name = "Donksoft LMG"
|
||||
id = "foam_LMG"
|
||||
build_type = AUTOYLATHE
|
||||
build_type = TOYLATHE
|
||||
materials = list(/datum/material/plastic = 4000, /datum/material/iron = 500)
|
||||
build_path = /obj/item/gun/ballistic/automatic/l6_saw/toy/unrestricted
|
||||
category = list("hacked", "Rifles")
|
||||
|
||||
@@ -111,6 +111,6 @@
|
||||
name = "Machine Design (Autoylathe)"
|
||||
desc = "The circuit board for an autoylathe."
|
||||
id = "autoylathe"
|
||||
build_path = /obj/item/circuitboard/machine/autoylathe
|
||||
build_path = /obj/item/circuitboard/machine/autolathe/toy
|
||||
departmental_flags = DEPARTMENTAL_FLAG_ALL
|
||||
category = list("Misc. Machinery")
|
||||
|
||||
@@ -1026,7 +1026,7 @@ Nothing else in the console has ID requirements.
|
||||
autolathe_friendly = FALSE
|
||||
D.category -= "Imported"
|
||||
|
||||
if(D.build_type & (AUTOLATHE|PROTOLATHE|CRAFTLATHE)) // Specifically excludes circuit imprinter and mechfab
|
||||
if(D.build_type & (AUTOLATHE|PROTOLATHE|TOYLATHE)) // Specifically excludes circuit imprinter and mechfab
|
||||
D.build_type = autolathe_friendly ? (D.build_type | AUTOLATHE) : D.build_type
|
||||
D.category |= "Imported"
|
||||
d_disk.blueprints[slot] = D
|
||||
|
||||
@@ -344,6 +344,7 @@
|
||||
|
||||
/datum/techweb/specialized/autounlocking
|
||||
var/design_autounlock_buildtypes = NONE
|
||||
var/design_autounlock_skip_types = NONE
|
||||
var/design_autounlock_categories = list("initial") //if a design has a buildtype that matches the abovea and either has a category in this or this is null, unlock it.
|
||||
var/node_autounlock_ids = list() //autounlock nodes of this type.
|
||||
|
||||
@@ -356,7 +357,7 @@
|
||||
research_node_id(id, TRUE, FALSE)
|
||||
for(var/id in SSresearch.techweb_designs)
|
||||
var/datum/design/D = SSresearch.techweb_design_by_id(id)
|
||||
if(D.build_type & design_autounlock_buildtypes)
|
||||
if(D.build_type & (design_autounlock_buildtypes & allowed_buildtypes) && !(D.build_type & design_autounlock_skip_types))
|
||||
for(var/i in D.category)
|
||||
if(i in design_autounlock_categories)
|
||||
add_design_by_id(D.id)
|
||||
@@ -364,7 +365,16 @@
|
||||
|
||||
/datum/techweb/specialized/autounlocking/autolathe
|
||||
design_autounlock_buildtypes = AUTOLATHE
|
||||
allowed_buildtypes = AUTOLATHE
|
||||
allowed_buildtypes = AUTOLATHE|TOYLATHE
|
||||
|
||||
/datum/techweb/specialized/autounlocking/autolathe/public
|
||||
design_autounlock_skip_types = NO_PUBLIC_LATHE
|
||||
|
||||
/datum/techweb/specialized/autounlocking/autolathe/toy
|
||||
design_autounlock_buildtypes = TOYLATHE
|
||||
|
||||
/datum/techweb/specialized/autounlocking/autolathe/toy/public
|
||||
design_autounlock_skip_types = NO_PUBLIC_LATHE
|
||||
|
||||
/datum/techweb/specialized/autounlocking/limbgrower
|
||||
design_autounlock_buildtypes = LIMBGROWER
|
||||
@@ -381,10 +391,6 @@
|
||||
/datum/techweb/specialized/autounlocking/exofab
|
||||
allowed_buildtypes = MECHFAB
|
||||
|
||||
/datum/techweb/specialized/autounlocking/autoylathe
|
||||
design_autounlock_buildtypes = AUTOYLATHE
|
||||
allowed_buildtypes = AUTOYLATHE
|
||||
|
||||
/datum/techweb/specialized/autounlocking/autobottler
|
||||
design_autounlock_buildtypes = AUTOBOTTLER
|
||||
allowed_buildtypes = AUTOBOTTLER
|
||||
@@ -585,7 +585,6 @@
|
||||
#include "code\datums\wires\airlock.dm"
|
||||
#include "code\datums\wires\apc.dm"
|
||||
#include "code\datums\wires\autolathe.dm"
|
||||
#include "code\datums\wires\autoylathe.dm"
|
||||
#include "code\datums\wires\emitter.dm"
|
||||
#include "code\datums\wires\explosive.dm"
|
||||
#include "code\datums\wires\microwave.dm"
|
||||
@@ -722,7 +721,6 @@
|
||||
#include "code\game\machinery\syndicatebeacon.dm"
|
||||
#include "code\game\machinery\syndicatebomb.dm"
|
||||
#include "code\game\machinery\teleporter.dm"
|
||||
#include "code\game\machinery\toylathe.dm"
|
||||
#include "code\game\machinery\transformer.dm"
|
||||
#include "code\game\machinery\turnstile.dm"
|
||||
#include "code\game\machinery\washing_machine.dm"
|
||||
|
||||
Reference in New Issue
Block a user