mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-14 20:23:26 +00:00
Merge branch 'master' into izac-voreupdate
This commit is contained in:
@@ -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.
|
||||||
@@ -48,13 +48,14 @@
|
|||||||
materials = list(DEFAULT_WALL_MATERIAL = 450)
|
materials = list(DEFAULT_WALL_MATERIAL = 450)
|
||||||
hidden = 1
|
hidden = 1
|
||||||
|
|
||||||
/datum/design/item/autolathe/arms/stunshell
|
/*/datum/design/item/autolathe/arms/stunshell
|
||||||
name = "ammunition (stun cartridge, shotgun)"
|
name = "ammunition (stun cartridge, shotgun)"
|
||||||
id = "shotgun_stunshell"
|
id = "shotgun_stunshell"
|
||||||
build_path = /obj/item/ammo_casing/a12g/stunshell
|
build_path = /obj/item/ammo_casing/a12g/stunshell
|
||||||
time = 10
|
time = 10
|
||||||
materials = list(DEFAULT_WALL_MATERIAL = 450, "glass" = 900)
|
materials = list(DEFAULT_WALL_MATERIAL = 450, "glass" = 900)
|
||||||
hidden = 1
|
hidden = 1*/
|
||||||
|
//It Gotta be manually added by a Design_disk, uncomment in case it shall be constructed normally(or add it other way, this causes some irrelevant unit test errors)
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
/*Ammo magazines*/
|
/*Ammo magazines*/
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
var/disabled = 0
|
var/disabled = 0
|
||||||
var/shocked = 0
|
var/shocked = 0
|
||||||
var/busy = 0
|
var/busy = 0
|
||||||
|
var/input_dir_name = "North"
|
||||||
|
var/input_dir = NORTH
|
||||||
var/operating = 0.0
|
var/operating = 0.0
|
||||||
var/list/queue = list()
|
var/list/queue = list()
|
||||||
var/queue_max_len = 12
|
var/queue_max_len = 12
|
||||||
@@ -39,7 +41,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 +103,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 +120,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
|
||||||
@@ -161,8 +163,6 @@
|
|||||||
design_last_ordered = FindDesign(href_list["make"]) //check if it's a valid design
|
design_last_ordered = FindDesign(href_list["make"]) //check if it's a valid design
|
||||||
if(!design_last_ordered)
|
if(!design_last_ordered)
|
||||||
return
|
return
|
||||||
if(!(design_last_ordered.build_type & AUTOLATHE))
|
|
||||||
return
|
|
||||||
|
|
||||||
//multiplier checks : only stacks can have one and its value is 1, 10 ,25 or max_multiplier
|
//multiplier checks : only stacks can have one and its value is 1, 10 ,25 or max_multiplier
|
||||||
var/multiplier = text2num(href_list["multiplier"])
|
var/multiplier = text2num(href_list["multiplier"])
|
||||||
@@ -382,25 +382,42 @@
|
|||||||
|
|
||||||
/datum/research/autolathe
|
/datum/research/autolathe
|
||||||
|
|
||||||
|
/datum/research/autolathe/New() //Insert techs into possible_tech here. Known_tech automatically updated.
|
||||||
|
for(var/T in typesof(/datum/tech) - /datum/tech)
|
||||||
|
known_tech += new T(src)
|
||||||
|
for(var/D in typesof(/datum/design) - /datum/design)
|
||||||
|
possible_designs += new D(src)
|
||||||
|
// generate_integrated_circuit_designs()
|
||||||
|
RefreshResearch()
|
||||||
|
|
||||||
|
|
||||||
/datum/research/autolathe/DesignHasReqs(var/datum/design/D)
|
/datum/research/autolathe/DesignHasReqs(var/datum/design/D)
|
||||||
return D && (D.build_type & AUTOLATHE)
|
if(D.req_tech.len == 0)
|
||||||
|
return 1
|
||||||
|
if(D.build_type == AUTOLATHE)
|
||||||
|
return 1
|
||||||
|
|
||||||
/datum/research/autolathe/AddDesign2Known(var/datum/design/D)
|
else
|
||||||
if(!(D.build_type & AUTOLATHE))
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
/obj/machinery/autolathe/proc/AddDesignViaDisk(var/mob/user, var/datum/design/D)
|
||||||
|
for(var/datum/design/F in files.possible_designs)
|
||||||
|
if(F.autolathe_build != 1 || F.id != D.id)
|
||||||
|
continue
|
||||||
|
if(F in files.known_designs)
|
||||||
|
to_chat(user, "This design is already exists")
|
||||||
|
return
|
||||||
|
if(!F.category)
|
||||||
|
F.category = "Imported"
|
||||||
|
files.known_designs.Add(F)
|
||||||
return
|
return
|
||||||
..()
|
|
||||||
|
|
||||||
//datum/research/proc/FindDesignByID(var/id)
|
|
||||||
//return known_designs[id]
|
|
||||||
|
|
||||||
///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/autolathe/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)
|
||||||
@@ -427,6 +444,26 @@
|
|||||||
if(O.loc != user && !(istype(O,/obj/item/stack)))
|
if(O.loc != user && !(istype(O,/obj/item/stack)))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
if(istype(O, /obj/item/weapon/disk))
|
||||||
|
if(istype(O, /obj/item/weapon/disk/design_disk))
|
||||||
|
var/obj/item/weapon/disk/design_disk/D = O
|
||||||
|
var/datum/design/B = D.blueprint
|
||||||
|
if(D.blueprint)
|
||||||
|
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.")
|
||||||
|
busy = 1
|
||||||
|
AddDesignViaDisk(user, D.blueprint)
|
||||||
|
busy = 0
|
||||||
|
else
|
||||||
|
to_chat(user, "<span class='warning'>That disk doens't have a compatible design</span>")
|
||||||
|
else
|
||||||
|
to_chat(user, "<span class='warning'>That disk does not have a design on it!</span>")
|
||||||
|
return
|
||||||
|
else
|
||||||
|
// So that people who are bad at computers don't shred their disks
|
||||||
|
to_chat(user, "<span class='warning'>This is not the correct type of disk for the autolathe!</span>")
|
||||||
|
return
|
||||||
|
|
||||||
if(is_robot_module(O))
|
if(is_robot_module(O))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -500,3 +537,84 @@
|
|||||||
|
|
||||||
updateUsrDialog()
|
updateUsrDialog()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
/obj/machinery/autolathe/verb/eatmaterialsnearby()
|
||||||
|
set name = "Recycle nearby materials"
|
||||||
|
set category = "Object"
|
||||||
|
set src in oview(1)
|
||||||
|
|
||||||
|
var/filltype = 0 // Used to determine message.
|
||||||
|
var/total_used = 0 // Amount of material used.
|
||||||
|
if(busy)
|
||||||
|
visible_message("[bicon(src)]<b>\The [src]</b> beeps, \"Autolathe is busy. Please wait for completion of previous operation\"")
|
||||||
|
return
|
||||||
|
busy = 1
|
||||||
|
for(var/obj/item/eating in get_step(src,input_dir))
|
||||||
|
if(istype(eating,/obj/item/ammo_magazine/clip) || istype(eating,/obj/item/ammo_magazine/s357) || istype(eating,/obj/item/ammo_magazine/s38) || istype(eating,/obj/item/ammo_magazine/s44) || istype(eating,/obj/item/stack))
|
||||||
|
continue
|
||||||
|
|
||||||
|
if(!eating.matter)
|
||||||
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
var/mass_per_sheet = 0 // Amount of material constituting one sheet.
|
||||||
|
for(var/material in eating.matter)
|
||||||
|
|
||||||
|
if(isnull(stored_material[material]) || isnull(storage_capacity[material]))
|
||||||
|
continue
|
||||||
|
|
||||||
|
if(stored_material[material] >= storage_capacity[material])
|
||||||
|
continue
|
||||||
|
|
||||||
|
var/total_material = eating.matter[material]
|
||||||
|
|
||||||
|
|
||||||
|
if(stored_material[material] + total_material > storage_capacity[material])
|
||||||
|
total_material = storage_capacity[material] - stored_material[material]
|
||||||
|
filltype = 1
|
||||||
|
else
|
||||||
|
filltype = 2
|
||||||
|
|
||||||
|
stored_material[material] += total_material
|
||||||
|
total_used += total_material
|
||||||
|
mass_per_sheet += eating.matter[material]
|
||||||
|
|
||||||
|
if(!filltype)
|
||||||
|
visible_message("[bicon(src)]<b>\The [src]</b> beeps, \"Storage is full. Operation aborted\"")
|
||||||
|
return
|
||||||
|
|
||||||
|
flick("autolathe_o", src)
|
||||||
|
|
||||||
|
if(istype(eating,/obj/item/stack))
|
||||||
|
var/obj/item/stack/stack = eating
|
||||||
|
stack.use(max(1, round(total_used/mass_per_sheet))) // Always use at least 1 to prevent infinite materials.
|
||||||
|
else
|
||||||
|
qdel(eating)
|
||||||
|
sleep(10*mat_efficiency)
|
||||||
|
|
||||||
|
busy = 0
|
||||||
|
if(filltype == 1)
|
||||||
|
visible_message("[bicon(src)] <b>\The [src]</b> beeps, \"Storage capacity full. Operation terminated. Materials recycled: [total_used]\"")
|
||||||
|
else
|
||||||
|
visible_message("[bicon(src)] <b>\The [src]</b> beeps, \"All materials recycled. Operation terminated. Materials recycled: [total_used]\"")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/obj/machinery/autolathe/verb/setrecyclepos()
|
||||||
|
set name = "Set recycle input"
|
||||||
|
set category = "Object"
|
||||||
|
set src in oview(1)
|
||||||
|
|
||||||
|
input_dir_name = input("Which direction ?") in list("North", "South", "East", "West")
|
||||||
|
switch(input_dir_name)
|
||||||
|
if("North")
|
||||||
|
input_dir = NORTH
|
||||||
|
if("South")
|
||||||
|
input_dir = SOUTH
|
||||||
|
if("East")
|
||||||
|
input_dir = EAST
|
||||||
|
if("West")
|
||||||
|
input_dir = WEST
|
||||||
|
to_chat(src, "You set the material input to [input_dir_name]")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
/datum/design/item/autolathe/engineering //Datum for object designs, used in construction //IDs of that techs the object originated from and the minimum level requirements.
|
/datum/design/item/autolathe/engineering //Datum for object designs, used in construction //IDs of that techs the object originated from and the minimum level requirements.
|
||||||
category = "Engineering" //category item goes to
|
category = "Engineering" //category item goes to
|
||||||
|
|
||||||
|
/datum/design/item/autolathe/engineering/powercontrolmodule
|
||||||
|
name = "power control module"
|
||||||
|
id = "powercontrolmodule"
|
||||||
|
build_path = /obj/item/weapon/module/power_control
|
||||||
|
materials = list(DEFAULT_WALL_MATERIAL = 62, "glass" = 62)
|
||||||
|
|
||||||
/datum/design/item/autolathe/engineering/airlockmodule
|
/datum/design/item/autolathe/engineering/airlockmodule
|
||||||
name = "airlock electronics"
|
name = "airlock electronics"
|
||||||
id = "airlock_electronics"
|
id = "airlock_electronics"
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ other types of metals and chemistry for reagents).
|
|||||||
var/time = 10 //How many ticks it requires to build
|
var/time = 10 //How many ticks it requires to build
|
||||||
var/category = null //Primarily used for Mech Fabricators, but can be used for anything.
|
var/category = null //Primarily used for Mech Fabricators, but can be used for anything.
|
||||||
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/hidden = 0 //YW Edit, Used by autolathe, says if an item needs the autolathe to be hacked in order to appear
|
||||||
|
|
||||||
/datum/design/New()
|
/datum/design/New()
|
||||||
..()
|
..()
|
||||||
|
|||||||
@@ -107,6 +107,7 @@
|
|||||||
materials = list(DEFAULT_WALL_MATERIAL = 4000)
|
materials = list(DEFAULT_WALL_MATERIAL = 4000)
|
||||||
build_path = /obj/item/ammo_casing/a12g/stunshell
|
build_path = /obj/item/ammo_casing/a12g/stunshell
|
||||||
sort_string = "MABBB"
|
sort_string = "MABBB"
|
||||||
|
autolathe_build = 1 //Ywedit
|
||||||
|
|
||||||
// Phase weapons
|
// Phase weapons
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user