This commit is contained in:
SplinterGP
2020-05-07 23:01:47 -03:00
parent 163c8665a0
commit c60d52d4ca
4 changed files with 22 additions and 17 deletions

View File

@@ -18,4 +18,4 @@
#define MECHFAB 0x0004 //Mechfab #define MECHFAB 0x0004 //Mechfab
#define CHASSIS 0x0008 //For protolathe, but differently #define CHASSIS 0x0008 //For protolathe, but differently
#define PROSFAB 0x0010 //For prosthetics fab #define PROSFAB 0x0010 //For prosthetics fab
#define AUTOLATHE 32 //YW add, for autolathe #define AUTOLATHE "AUTOLATHE" //YW add, for autolathe

View File

@@ -1,5 +1,5 @@
/datum/design/item/autolathe /datum/design/item/autolathe
var/hidden = 0 //var/hidden = 0
build_type = AUTOLATHE //Flag as to what kind machine the design is built in. See defines. build_type = AUTOLATHE //Flag as to what kind machine the design is built in. See defines.
/datum/design/item/autolathe/arms //Datum for object designs, used in construction //IDs of that techs the object originated from and the minimum level requirements. /datum/design/item/autolathe/arms //Datum for object designs, used in construction //IDs of that techs the object originated from and the minimum level requirements.

View File

@@ -39,7 +39,7 @@
var/temp_search var/temp_search
var/selected_category var/selected_category
var/screen = 1 var/screen = 1
var/list/categories = list("Arms and Ammunition", "Devices", "Engineering", "General", "Medical", "Tools") var/list/categories = list("Arms and Ammunition", "Devices", "Engineering", "General", "Medical", "Tools", "Imported")
var/datum/wires/autolathe/wires = null var/datum/wires/autolathe/wires = null
@@ -101,7 +101,7 @@
data["selected_category"] = selected_category data["selected_category"] = selected_category
var/list/designs = list() var/list/designs = list()
data["designs"] = designs data["designs"] = designs
for(var/datum/design/item/autolathe/D in files.known_designs) for(var/datum/design/item/D in files.known_designs)
if(!D.build_path || D.hidden && !hacked || selected_category != D.category) if(!D.build_path || D.hidden && !hacked || selected_category != D.category)
continue continue
var/list/design = list() var/list/design = list()
@@ -118,7 +118,7 @@
data["search"] = temp_search data["search"] = temp_search
var/list/designs = list() var/list/designs = list()
data["designs"] = designs data["designs"] = designs
for(var/datum/design/item/autolathe/D in matching_designs) for(var/datum/design/item/D in matching_designs)
var/list/design = list() var/list/design = list()
designs[++designs.len] = design designs[++designs.len] = design
design["name"] = D.name design["name"] = D.name
@@ -387,35 +387,37 @@
possible_designs += new D(src) possible_designs += new D(src)
// generate_integrated_circuit_designs() // generate_integrated_circuit_designs()
RefreshResearch() RefreshResearch()
known_designs.Add(/datum/design/item/engineering/t_scanner)//manually adds design because its from another machine
/datum/research/autolathe/DesignHasReqs(var/datum/design/D) /datum/research/autolathe/DesignHasReqs(var/datum/design/D)
if(D.req_tech.len == 0) if(D.req_tech.len == 0)
return 1 return 1
if((D.build_type && AUTOLATHE)) if(D.build_type == AUTOLATHE)
return 1 return 1
else else
return 0 return 0
/datum/research/autolathe/AddDesign2Known(var/datum/design/D) /datum/research/autolathe/AddDesign2Known(var/datum/design/D)
if(D.autolathe_build == 1) if(D.id in known_designs)
known_designs.Add(D)
return return
..() // Global datums make me nervous
known_designs.Add(D)
//datum/research/proc/FindDesignByID(var/id) /obj/machinery/autolathe/proc/AddDesignViaDisk(var/datum/design/D)
//return known_designs[id] for(var/datum/design/F in files.possible_designs)
if(F.autolathe_build != 1 || F.id != D.id)
continue
if(!F.category)
F.category = "Imported"
files.known_designs.Add(F)
///obj/machinery/autolathe/proc/FindDesignByID(var/id)
//return files.known_designs[id]
/obj/machinery/autolathe/proc/FindDesign(var/id) /obj/machinery/autolathe/proc/FindDesign(var/id)
for(var/datum/design/item/desired_design in files.known_designs) for(var/datum/design/item/desired_design in files.known_designs)
if(desired_design.id == id) if(desired_design.id == id)
return desired_design return desired_design
return return 0
/obj/machinery/autolathe/attackby(var/obj/item/O as obj, var/mob/user as mob) /obj/machinery/autolathe/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(busy) if(busy)
@@ -445,12 +447,14 @@
if(istype(O, /obj/item/weapon/disk)) if(istype(O, /obj/item/weapon/disk))
if(istype(O, /obj/item/weapon/disk/design_disk)) if(istype(O, /obj/item/weapon/disk/design_disk))
var/obj/item/weapon/disk/design_disk/D = O var/obj/item/weapon/disk/design_disk/D = O
var/datum/design/B = D.blueprint
if(D.blueprint) if(D.blueprint)
if(D.blueprint.autolathe_build == 1 || (D.blueprint.build_type && AUTOLATHE)) if(B.autolathe_build == 1 || B.build_type == AUTOLATHE)
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.") 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 = 1 busy = 1
files.AddDesign2Known(D.blueprint) AddDesignViaDisk(D.blueprint)
busy = 0 busy = 0
to_chat(user, "wewew4")
else else
to_chat(user, "<span class='warning'>That disk doens't have a compatible design</span>") to_chat(user, "<span class='warning'>That disk doens't have a compatible design</span>")
else else

View File

@@ -33,6 +33,7 @@ other types of metals and chemistry for reagents).
var/sort_string = "ZZZZZ" //Sorting order var/sort_string = "ZZZZZ" //Sorting order
var/maxstack = 1 // yw edit, used by autolathe, says how many stacks a item can have or the limit of how many you can spawn at once var/maxstack = 1 // yw edit, used by autolathe, says how many stacks a item can have or the limit of how many you can spawn at once
var/autolathe_build = 0 //YW Edit, makes other designs able to be built or added in autolathe, be via design disk or something else(added due to can't have two designs with same build_path without unit test getting angry) var/autolathe_build = 0 //YW Edit, makes other designs able to be built or added in autolathe, be via design disk or something else(added due to can't have two designs with same build_path without unit test getting angry)
var/hidden = 0
/datum/design/New() /datum/design/New()
..() ..()