File standardisation (#13131)

* Adds the check components

* Adds in trailing newlines

* Converts all CRLF to LF

* Post merge EOF

* Post merge line endings

* Final commit
This commit is contained in:
AffectedArc07
2020-03-17 22:08:51 +00:00
committed by GitHub
parent ec19ea3d2d
commit 04ba5c1cc9
1451 changed files with 183694 additions and 183593 deletions
+105 -105
View File
@@ -1,105 +1,105 @@
/*///////////////Circuit Imprinter (By Darem)////////////////////////
Used to print new circuit boards (for computers and similar systems) and AI modules. Each circuit board pattern are stored in
a /datum/desgin on the linked R&D console. You can then print them out in a fasion similar to a regular lathe. However, instead of
using metal and glass, it uses glass and reagents (usually sulfuric acis).
*/
/obj/machinery/r_n_d/circuit_imprinter
name = "Circuit Imprinter"
desc = "Manufactures circuit boards for the construction of machines."
icon_state = "circuit_imprinter"
container_type = OPENCONTAINER
var/efficiency_coeff
var/list/categories = list(
"AI Modules",
"Computer Boards",
"Computer Parts",
"Engineering Machinery",
"Exosuit Modules",
"Hydroponics Machinery",
"Medical Machinery",
"Misc. Machinery",
"Research Machinery",
"Subspace Telecomms",
"Teleportation Machinery"
)
reagents = new()
/obj/machinery/r_n_d/circuit_imprinter/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/circuit_imprinter(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/manipulator(null)
component_parts += new /obj/item/reagent_containers/glass/beaker(null)
component_parts += new /obj/item/reagent_containers/glass/beaker(null)
RefreshParts()
reagents.my_atom = src
/obj/machinery/r_n_d/circuit_imprinter/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/circuit_imprinter(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
RefreshParts()
reagents.my_atom = src
/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)
materials.max_amount = 0
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
materials.max_amount += M.rating * 75000
var/T = 0
for(var/obj/item/stock_parts/manipulator/M in component_parts)
T += M.rating
efficiency_coeff = 2 ** (T - 1) //Only 1 manipulator here, you're making runtimes Razharas
/obj/machinery/r_n_d/circuit_imprinter/proc/check_mat(datum/design/being_built, var/M)
var/list/all_materials = being_built.reagents_list + being_built.materials
var/A = materials.amount(M)
if(!A)
A = reagents.get_reagent_amount(M)
return round(A / max(1, (all_materials[M]/efficiency_coeff)))
/obj/machinery/r_n_d/circuit_imprinter/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(shocked)
if(shock(user,50))
return TRUE
if(default_deconstruction_screwdriver(user, "circuit_imprinter_t", "circuit_imprinter", O))
if(linked_console)
linked_console.linked_imprinter = null
linked_console = null
return
if(exchange_parts(user, O))
return
if(panel_open)
if(istype(O, /obj/item/crowbar))
for(var/obj/I in component_parts)
if(istype(I, /obj/item/reagent_containers/glass/beaker))
reagents.trans_to(I, reagents.total_volume)
I.loc = src.loc
materials.retrieve_all()
default_deconstruction_crowbar(user, O)
return
else
to_chat(user, "<span class='warning'>You can't load the [src.name] while it's opened.</span>")
return
if(O.is_open_container())
return FALSE
else
return ..()
/*///////////////Circuit Imprinter (By Darem)////////////////////////
Used to print new circuit boards (for computers and similar systems) and AI modules. Each circuit board pattern are stored in
a /datum/desgin on the linked R&D console. You can then print them out in a fasion similar to a regular lathe. However, instead of
using metal and glass, it uses glass and reagents (usually sulfuric acis).
*/
/obj/machinery/r_n_d/circuit_imprinter
name = "Circuit Imprinter"
desc = "Manufactures circuit boards for the construction of machines."
icon_state = "circuit_imprinter"
container_type = OPENCONTAINER
var/efficiency_coeff
var/list/categories = list(
"AI Modules",
"Computer Boards",
"Computer Parts",
"Engineering Machinery",
"Exosuit Modules",
"Hydroponics Machinery",
"Medical Machinery",
"Misc. Machinery",
"Research Machinery",
"Subspace Telecomms",
"Teleportation Machinery"
)
reagents = new()
/obj/machinery/r_n_d/circuit_imprinter/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/circuit_imprinter(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/manipulator(null)
component_parts += new /obj/item/reagent_containers/glass/beaker(null)
component_parts += new /obj/item/reagent_containers/glass/beaker(null)
RefreshParts()
reagents.my_atom = src
/obj/machinery/r_n_d/circuit_imprinter/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/circuit_imprinter(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
RefreshParts()
reagents.my_atom = src
/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)
materials.max_amount = 0
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
materials.max_amount += M.rating * 75000
var/T = 0
for(var/obj/item/stock_parts/manipulator/M in component_parts)
T += M.rating
efficiency_coeff = 2 ** (T - 1) //Only 1 manipulator here, you're making runtimes Razharas
/obj/machinery/r_n_d/circuit_imprinter/proc/check_mat(datum/design/being_built, var/M)
var/list/all_materials = being_built.reagents_list + being_built.materials
var/A = materials.amount(M)
if(!A)
A = reagents.get_reagent_amount(M)
return round(A / max(1, (all_materials[M]/efficiency_coeff)))
/obj/machinery/r_n_d/circuit_imprinter/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(shocked)
if(shock(user,50))
return TRUE
if(default_deconstruction_screwdriver(user, "circuit_imprinter_t", "circuit_imprinter", O))
if(linked_console)
linked_console.linked_imprinter = null
linked_console = null
return
if(exchange_parts(user, O))
return
if(panel_open)
if(istype(O, /obj/item/crowbar))
for(var/obj/I in component_parts)
if(istype(I, /obj/item/reagent_containers/glass/beaker))
reagents.trans_to(I, reagents.total_volume)
I.loc = src.loc
materials.retrieve_all()
default_deconstruction_crowbar(user, O)
return
else
to_chat(user, "<span class='warning'>You can't load the [src.name] while it's opened.</span>")
return
if(O.is_open_container())
return FALSE
else
return ..()
+47 -47
View File
@@ -1,47 +1,47 @@
/***************************************************************
** Design Datums **
** All the data for building stuff. **
***************************************************************/
/*
For the materials datum, it assumes you need reagents unless specified otherwise. To designate a material that isn't a reagent,
you use one of the material IDs below. These are NOT ids in the usual sense (they aren't defined in the object or part of a datum),
they are simply references used as part of a "has materials?" type proc. They all start with a $ to denote that they aren't reagents.
The currently supporting non-reagent materials:
- MAT_METAL (/obj/item/stack/metal).
- MAT_GLASS (/obj/item/stack/glass).
- MAT_PLASMA (/obj/item/stack/plasma).
- MAT_SILVER (/obj/item/stack/silver).
- MAT_GOLD (/obj/item/stack/gold).
- MAT_URANIUM (/obj/item/stack/uranium).
- MAT_DIAMOND (/obj/item/stack/diamond).
- MAT_BANANIUM (/obj/item/stack/bananium).
- MAT_TRANQUILLITE (/obj/item/stack/tranquillite).
(Insert new ones here)
Don't add new keyword/IDs if they are made from an existing one (such as rods which are made from metal). Only add raw materials.
Design Guidlines
- When adding new designs, check rdreadme.dm to see what kind of things have already been made and where new stuff is needed.
- A single sheet of anything is 2000 units of material. Materials besides metal/glass require help from other jobs (mining for
other types of metals and chemistry for reagents).
- Add the AUTOLATHE tag to
*/
/datum/design //Datum for object designs, used in construction
var/name = "Name" //Name of the created object.
var/desc = "Desc" //Description of the created object.
var/id = "id" //ID of the created object for easy refernece. Alphanumeric, lower-case, no symbols
var/list/req_tech = list() //IDs of that techs the object originated from and the minimum level requirements.
var/build_type = null //Flag as to what kind machine the design is built in. See defines.
var/list/materials = list() //List of materials. Format: "id" = amount.
var/construction_time //Amount of time required for building the object
var/build_path = null //The file path of the object that gets created
var/list/make_reagents = list() //Reagents produced. Format: "id" = amount. Currently only supported by the biogenerator.
var/locked = 0 //If true it will spawn inside a lockbox with currently sec access
var/access_requirement = list(ACCESS_ARMORY) //What special access requirements will the lockbox have? Defaults to armory.
var/category = null //Primarily used for Mech Fabricators, but can be used for anything
var/list/reagents_list = list() //List of reagents. Format: "id" = amount.
var/maxstack = 1
var/lathe_time_factor = 1 //How many times faster than normal is this to build on the protolathe
/***************************************************************
** Design Datums **
** All the data for building stuff. **
***************************************************************/
/*
For the materials datum, it assumes you need reagents unless specified otherwise. To designate a material that isn't a reagent,
you use one of the material IDs below. These are NOT ids in the usual sense (they aren't defined in the object or part of a datum),
they are simply references used as part of a "has materials?" type proc. They all start with a $ to denote that they aren't reagents.
The currently supporting non-reagent materials:
- MAT_METAL (/obj/item/stack/metal).
- MAT_GLASS (/obj/item/stack/glass).
- MAT_PLASMA (/obj/item/stack/plasma).
- MAT_SILVER (/obj/item/stack/silver).
- MAT_GOLD (/obj/item/stack/gold).
- MAT_URANIUM (/obj/item/stack/uranium).
- MAT_DIAMOND (/obj/item/stack/diamond).
- MAT_BANANIUM (/obj/item/stack/bananium).
- MAT_TRANQUILLITE (/obj/item/stack/tranquillite).
(Insert new ones here)
Don't add new keyword/IDs if they are made from an existing one (such as rods which are made from metal). Only add raw materials.
Design Guidlines
- When adding new designs, check rdreadme.dm to see what kind of things have already been made and where new stuff is needed.
- A single sheet of anything is 2000 units of material. Materials besides metal/glass require help from other jobs (mining for
other types of metals and chemistry for reagents).
- Add the AUTOLATHE tag to
*/
/datum/design //Datum for object designs, used in construction
var/name = "Name" //Name of the created object.
var/desc = "Desc" //Description of the created object.
var/id = "id" //ID of the created object for easy refernece. Alphanumeric, lower-case, no symbols
var/list/req_tech = list() //IDs of that techs the object originated from and the minimum level requirements.
var/build_type = null //Flag as to what kind machine the design is built in. See defines.
var/list/materials = list() //List of materials. Format: "id" = amount.
var/construction_time //Amount of time required for building the object
var/build_path = null //The file path of the object that gets created
var/list/make_reagents = list() //Reagents produced. Format: "id" = amount. Currently only supported by the biogenerator.
var/locked = 0 //If true it will spawn inside a lockbox with currently sec access
var/access_requirement = list(ACCESS_ARMORY) //What special access requirements will the lockbox have? Defaults to armory.
var/category = null //Primarily used for Mech Fabricators, but can be used for anything
var/list/reagents_list = list() //List of reagents. Format: "id" = amount.
var/maxstack = 1
var/lathe_time_factor = 1 //How many times faster than normal is this to build on the protolathe
@@ -177,4 +177,4 @@
build_type = BIOGENERATOR
materials = list(MAT_BIOMASS = 300)
build_path = /obj/item/clothing/head/rice_hat
category = list("initial","Leather and Cloth")
category = list("initial","Leather and Cloth")
@@ -248,4 +248,4 @@
build_type = IMPRINTER
materials = list(MAT_GLASS = 3200, MAT_GOLD = 1000)
build_path = /obj/item/computer_hardware/processor_unit/photonic/small
category = list("Computer Parts")
category = list("Computer Parts")
+112 -112
View File
@@ -1,112 +1,112 @@
/////////////////////////////////////////
/////////////////Mining//////////////////
/////////////////////////////////////////
/datum/design/drill
name = "Mining Drill"
desc = "Yours is the drill that will pierce through the rock walls."
id = "drill"
req_tech = list("materials" = 2, "powerstorage" = 2, "engineering" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 6000, MAT_GLASS = 1000)
build_path = /obj/item/pickaxe/drill
category = list("Mining")
/datum/design/drill_diamond
name = "Diamond Mining Drill"
desc = "Yours is the drill that will pierce the heavens!"
id = "drill_diamond"
req_tech = list("materials" = 6, "powerstorage" = 5, "engineering" = 5)
build_type = PROTOLATHE
materials = list(MAT_METAL = 3000, MAT_GLASS = 1000, MAT_DIAMOND = 2000) //Yes, a whole diamond is needed.
build_path = /obj/item/pickaxe/drill/diamonddrill
category = list("Mining")
/datum/design/plasmacutter
name = "Plasma Cutter"
desc = "You could use it to cut limbs off of xenos! Or, you know, mine stuff."
id = "plasmacutter"
req_tech = list("materials" = 3, "plasmatech" = 3, "magnets" = 2)
build_type = PROTOLATHE
materials = list(MAT_METAL = 1500, MAT_GLASS = 500, MAT_PLASMA = 400)
build_path = /obj/item/gun/energy/plasmacutter
category = list("Mining")
/datum/design/plasmacutter_adv
name = "Advanced Plasma Cutter"
desc = "It's an advanced plasma cutter, oh my god."
id = "plasmacutter_adv"
req_tech = list("materials" = 4, "plasmatech" = 4, "engineering" = 2, "combat" = 3, "magnets" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 3000, MAT_GLASS = 1000, MAT_PLASMA = 2000, MAT_GOLD = 500)
build_path = /obj/item/gun/energy/plasmacutter/adv
category = list("Mining")
/datum/design/jackhammer
name = "Sonic Jackhammer"
desc = "Essentially a handheld planet-cracker. Can drill through walls with ease as well."
id = "jackhammer"
req_tech = list("materials" = 7, "powerstorage" = 5, "engineering" = 6, "magnets" = 5)
build_type = PROTOLATHE
materials = list(MAT_METAL = 6000, MAT_GLASS = 2000, MAT_SILVER = 2000, MAT_DIAMOND = 6000)
build_path = /obj/item/pickaxe/drill/jackhammer
category = list("Mining")
/datum/design/superresonator
name = "Upgraded Resonator"
desc = "An upgraded version of the resonator that allows more fields to be active at once."
id = "superresonator"
req_tech = list("materials" = 4, "powerstorage" = 3, "engineering" = 3, "magnets" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 4000, MAT_GLASS = 1500, MAT_SILVER = 1000, MAT_URANIUM = 1000)
build_path = /obj/item/resonator/upgraded
category = list("Mining")
/datum/design/trigger_guard_mod
name = "Kinetic Accelerator Trigger Guard Mod"
desc = "A device which allows kinetic accelerators to be wielded by any organism."
id = "triggermod"
req_tech = list("materials" = 5, "powerstorage" = 4, "engineering" = 4, "magnets" = 4, "combat" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 2000, MAT_GLASS = 1500, MAT_GOLD = 1500, MAT_URANIUM = 1000)
build_path = /obj/item/borg/upgrade/modkit/trigger_guard
category = list("Mining")
/datum/design/damage_mod
name = "Kinetic Accelerator Damage Mod"
desc = "A device which allows kinetic accelerators to deal more damage."
id = "damagemod"
req_tech = list("materials" = 5, "powerstorage" = 4, "engineering" = 4, "magnets" = 4, "combat" = 3)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 2000, MAT_GLASS = 1500, MAT_GOLD = 1500, MAT_URANIUM = 1000)
build_path = /obj/item/borg/upgrade/modkit/damage
category = list("Mining", "Cyborg Upgrade Modules")
/datum/design/cooldown_mod
name = "Kinetic Accelerator Cooldown Mod"
desc = "A device which decreases the cooldown of a Kinetic Accelerator."
id = "cooldownmod"
req_tech = list("materials" = 5, "powerstorage" = 4, "engineering" = 4, "magnets" = 4, "combat" = 3)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 2000, MAT_GLASS = 1500, MAT_GOLD = 1500, MAT_URANIUM = 1000)
build_path = /obj/item/borg/upgrade/modkit/cooldown
category = list("Mining", "Cyborg Upgrade Modules")
/datum/design/range_mod
name = "Kinetic Accelerator Range Mod"
desc = "A device which allows kinetic accelerators to fire at a further range."
id = "rangemod"
req_tech = list("materials" = 5, "powerstorage" = 4, "engineering" = 4, "magnets" = 4, "combat" = 3)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 2000, MAT_GLASS = 1500, MAT_GOLD = 1500, MAT_URANIUM = 1000)
build_path = /obj/item/borg/upgrade/modkit/range
category = list("Mining", "Cyborg Upgrade Modules")
/datum/design/hyperaccelerator
name = "Kinetic Accelerator Mining AoE Mod"
desc = "A modification kit for Kinetic Accelerators which causes it to fire AoE blasts that destroy rock."
id = "hypermod"
req_tech = list("materials" = 7, "powerstorage" = 5, "engineering" = 5, "magnets" = 5, "combat" = 4)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 8000, MAT_GLASS = 1500, MAT_SILVER = 2000, MAT_GOLD = 2000, MAT_DIAMOND = 2000)
build_path = /obj/item/borg/upgrade/modkit/aoe/turfs
category = list("Mining", "Cyborg Upgrade Modules")
/////////////////////////////////////////
/////////////////Mining//////////////////
/////////////////////////////////////////
/datum/design/drill
name = "Mining Drill"
desc = "Yours is the drill that will pierce through the rock walls."
id = "drill"
req_tech = list("materials" = 2, "powerstorage" = 2, "engineering" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 6000, MAT_GLASS = 1000)
build_path = /obj/item/pickaxe/drill
category = list("Mining")
/datum/design/drill_diamond
name = "Diamond Mining Drill"
desc = "Yours is the drill that will pierce the heavens!"
id = "drill_diamond"
req_tech = list("materials" = 6, "powerstorage" = 5, "engineering" = 5)
build_type = PROTOLATHE
materials = list(MAT_METAL = 3000, MAT_GLASS = 1000, MAT_DIAMOND = 2000) //Yes, a whole diamond is needed.
build_path = /obj/item/pickaxe/drill/diamonddrill
category = list("Mining")
/datum/design/plasmacutter
name = "Plasma Cutter"
desc = "You could use it to cut limbs off of xenos! Or, you know, mine stuff."
id = "plasmacutter"
req_tech = list("materials" = 3, "plasmatech" = 3, "magnets" = 2)
build_type = PROTOLATHE
materials = list(MAT_METAL = 1500, MAT_GLASS = 500, MAT_PLASMA = 400)
build_path = /obj/item/gun/energy/plasmacutter
category = list("Mining")
/datum/design/plasmacutter_adv
name = "Advanced Plasma Cutter"
desc = "It's an advanced plasma cutter, oh my god."
id = "plasmacutter_adv"
req_tech = list("materials" = 4, "plasmatech" = 4, "engineering" = 2, "combat" = 3, "magnets" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 3000, MAT_GLASS = 1000, MAT_PLASMA = 2000, MAT_GOLD = 500)
build_path = /obj/item/gun/energy/plasmacutter/adv
category = list("Mining")
/datum/design/jackhammer
name = "Sonic Jackhammer"
desc = "Essentially a handheld planet-cracker. Can drill through walls with ease as well."
id = "jackhammer"
req_tech = list("materials" = 7, "powerstorage" = 5, "engineering" = 6, "magnets" = 5)
build_type = PROTOLATHE
materials = list(MAT_METAL = 6000, MAT_GLASS = 2000, MAT_SILVER = 2000, MAT_DIAMOND = 6000)
build_path = /obj/item/pickaxe/drill/jackhammer
category = list("Mining")
/datum/design/superresonator
name = "Upgraded Resonator"
desc = "An upgraded version of the resonator that allows more fields to be active at once."
id = "superresonator"
req_tech = list("materials" = 4, "powerstorage" = 3, "engineering" = 3, "magnets" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 4000, MAT_GLASS = 1500, MAT_SILVER = 1000, MAT_URANIUM = 1000)
build_path = /obj/item/resonator/upgraded
category = list("Mining")
/datum/design/trigger_guard_mod
name = "Kinetic Accelerator Trigger Guard Mod"
desc = "A device which allows kinetic accelerators to be wielded by any organism."
id = "triggermod"
req_tech = list("materials" = 5, "powerstorage" = 4, "engineering" = 4, "magnets" = 4, "combat" = 3)
build_type = PROTOLATHE
materials = list(MAT_METAL = 2000, MAT_GLASS = 1500, MAT_GOLD = 1500, MAT_URANIUM = 1000)
build_path = /obj/item/borg/upgrade/modkit/trigger_guard
category = list("Mining")
/datum/design/damage_mod
name = "Kinetic Accelerator Damage Mod"
desc = "A device which allows kinetic accelerators to deal more damage."
id = "damagemod"
req_tech = list("materials" = 5, "powerstorage" = 4, "engineering" = 4, "magnets" = 4, "combat" = 3)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 2000, MAT_GLASS = 1500, MAT_GOLD = 1500, MAT_URANIUM = 1000)
build_path = /obj/item/borg/upgrade/modkit/damage
category = list("Mining", "Cyborg Upgrade Modules")
/datum/design/cooldown_mod
name = "Kinetic Accelerator Cooldown Mod"
desc = "A device which decreases the cooldown of a Kinetic Accelerator."
id = "cooldownmod"
req_tech = list("materials" = 5, "powerstorage" = 4, "engineering" = 4, "magnets" = 4, "combat" = 3)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 2000, MAT_GLASS = 1500, MAT_GOLD = 1500, MAT_URANIUM = 1000)
build_path = /obj/item/borg/upgrade/modkit/cooldown
category = list("Mining", "Cyborg Upgrade Modules")
/datum/design/range_mod
name = "Kinetic Accelerator Range Mod"
desc = "A device which allows kinetic accelerators to fire at a further range."
id = "rangemod"
req_tech = list("materials" = 5, "powerstorage" = 4, "engineering" = 4, "magnets" = 4, "combat" = 3)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 2000, MAT_GLASS = 1500, MAT_GOLD = 1500, MAT_URANIUM = 1000)
build_path = /obj/item/borg/upgrade/modkit/range
category = list("Mining", "Cyborg Upgrade Modules")
/datum/design/hyperaccelerator
name = "Kinetic Accelerator Mining AoE Mod"
desc = "A modification kit for Kinetic Accelerators which causes it to fire AoE blasts that destroy rock."
id = "hypermod"
req_tech = list("materials" = 7, "powerstorage" = 5, "engineering" = 5, "magnets" = 5, "combat" = 4)
build_type = PROTOLATHE | MECHFAB
materials = list(MAT_METAL = 8000, MAT_GLASS = 1500, MAT_SILVER = 2000, MAT_GOLD = 2000, MAT_DIAMOND = 2000)
build_path = /obj/item/borg/upgrade/modkit/aoe/turfs
category = list("Mining", "Cyborg Upgrade Modules")
@@ -50,4 +50,4 @@
materials = list(MAT_METAL = 4000, MAT_PLASMA = 4000)
build_path = /obj/item/stack/sheet/mineral/abductor
category = list("Stock Parts")
lathe_time_factor = 5
lathe_time_factor = 5
@@ -248,4 +248,4 @@
build_type = PROTOLATHE
materials = list(MAT_METAL = 15000, MAT_GLASS = 5000, MAT_SILVER = 2500) //hardcore
build_path = /obj/item/storage/part_replacer/bluespace
category = list("Stock Parts")
category = list("Stock Parts")
+88 -88
View File
@@ -1,88 +1,88 @@
/*
Destructive Analyzer
It is used to destroy hand-held objects and advance technological research. Controls are in the linked R&D console.
Note: Must be placed within 3 tiles of the R&D Console
*/
/obj/machinery/r_n_d/destructive_analyzer
name = "Destructive Analyzer"
desc = "Learn science by destroying things!"
icon_state = "d_analyzer"
var/decon_mod = 0
/obj/machinery/r_n_d/destructive_analyzer/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/destructive_analyzer(null)
component_parts += new /obj/item/stock_parts/scanning_module(null)
component_parts += new /obj/item/stock_parts/manipulator(null)
component_parts += new /obj/item/stock_parts/micro_laser(null)
RefreshParts()
/obj/machinery/r_n_d/destructive_analyzer/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/destructive_analyzer(null)
component_parts += new /obj/item/stock_parts/scanning_module/phasic(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/stock_parts/micro_laser/ultra(null)
RefreshParts()
/obj/machinery/r_n_d/destructive_analyzer/RefreshParts()
var/T = 0
for(var/obj/item/stock_parts/S in component_parts)
T += S.rating
decon_mod = T
/obj/machinery/r_n_d/destructive_analyzer/proc/ConvertReqString2List(var/list/source_list)
var/list/temp_list = params2list(source_list)
for(var/O in temp_list)
temp_list[O] = text2num(temp_list[O])
return temp_list
/obj/machinery/r_n_d/destructive_analyzer/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(shocked)
if(shock(user,50))
return TRUE
if(default_deconstruction_screwdriver(user, "d_analyzer_t", "d_analyzer", O))
if(linked_console)
linked_console.linked_destroy = null
linked_console = null
return
if(exchange_parts(user, O))
return
if(default_deconstruction_crowbar(user, O))
return
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
if(busy)
to_chat(user, "<span class='warning'>The [src.name] is busy right now.</span>")
return
if(istype(O, /obj/item) && !loaded_item)
if(!O.origin_tech)
to_chat(user, "<span class='warning'>This doesn't seem to have a tech origin!</span>")
return
var/list/temp_tech = ConvertReqString2List(O.origin_tech)
if(temp_tech.len == 0)
to_chat(user, "<span class='warning'>You cannot deconstruct this item!</span>")
return
if(!user.drop_item())
to_chat(user, "<span class='warning'>\The [O] is stuck to your hand, you cannot put it in the [src.name]!</span>")
return
busy = 1
loaded_item = O
O.loc = src
to_chat(user, "<span class='notice'>You add the [O.name] to the [src.name]!</span>")
flick("d_analyzer_la", src)
spawn(10)
icon_state = "d_analyzer_l"
busy = 0
/*
Destructive Analyzer
It is used to destroy hand-held objects and advance technological research. Controls are in the linked R&D console.
Note: Must be placed within 3 tiles of the R&D Console
*/
/obj/machinery/r_n_d/destructive_analyzer
name = "Destructive Analyzer"
desc = "Learn science by destroying things!"
icon_state = "d_analyzer"
var/decon_mod = 0
/obj/machinery/r_n_d/destructive_analyzer/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/destructive_analyzer(null)
component_parts += new /obj/item/stock_parts/scanning_module(null)
component_parts += new /obj/item/stock_parts/manipulator(null)
component_parts += new /obj/item/stock_parts/micro_laser(null)
RefreshParts()
/obj/machinery/r_n_d/destructive_analyzer/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/destructive_analyzer(null)
component_parts += new /obj/item/stock_parts/scanning_module/phasic(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/stock_parts/micro_laser/ultra(null)
RefreshParts()
/obj/machinery/r_n_d/destructive_analyzer/RefreshParts()
var/T = 0
for(var/obj/item/stock_parts/S in component_parts)
T += S.rating
decon_mod = T
/obj/machinery/r_n_d/destructive_analyzer/proc/ConvertReqString2List(var/list/source_list)
var/list/temp_list = params2list(source_list)
for(var/O in temp_list)
temp_list[O] = text2num(temp_list[O])
return temp_list
/obj/machinery/r_n_d/destructive_analyzer/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(shocked)
if(shock(user,50))
return TRUE
if(default_deconstruction_screwdriver(user, "d_analyzer_t", "d_analyzer", O))
if(linked_console)
linked_console.linked_destroy = null
linked_console = null
return
if(exchange_parts(user, O))
return
if(default_deconstruction_crowbar(user, O))
return
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
if(busy)
to_chat(user, "<span class='warning'>The [src.name] is busy right now.</span>")
return
if(istype(O, /obj/item) && !loaded_item)
if(!O.origin_tech)
to_chat(user, "<span class='warning'>This doesn't seem to have a tech origin!</span>")
return
var/list/temp_tech = ConvertReqString2List(O.origin_tech)
if(temp_tech.len == 0)
to_chat(user, "<span class='warning'>You cannot deconstruct this item!</span>")
return
if(!user.drop_item())
to_chat(user, "<span class='warning'>\The [O] is stuck to your hand, you cannot put it in the [src.name]!</span>")
return
busy = 1
loaded_item = O
O.loc = src
to_chat(user, "<span class='notice'>You add the [O.name] to the [src.name]!</span>")
flick("d_analyzer_la", src)
spawn(10)
icon_state = "d_analyzer_l"
busy = 0
+380 -380
View File
@@ -1,380 +1,380 @@
var/global/list/obj/machinery/message_server/message_servers = list()
/datum/data_pda_msg
var/recipient = "Unspecified" //name of the person
var/sender = "Unspecified" //name of the sender
var/message = "Blank" //transferred message
/datum/data_pda_msg/New(var/param_rec = "",var/param_sender = "",var/param_message = "")
if(param_rec)
recipient = param_rec
if(param_sender)
sender = param_sender
if(param_message)
message = param_message
/datum/data_rc_msg
var/rec_dpt = "Unspecified" //name of the person
var/send_dpt = "Unspecified" //name of the sender
var/message = "Blank" //transferred message
var/stamp = "Unstamped"
var/id_auth = "Unauthenticated"
var/priority = "Normal"
/datum/data_rc_msg/New(var/param_rec = "",var/param_sender = "",var/param_message = "",var/param_stamp = "",var/param_id_auth = "",var/param_priority)
if(param_rec)
rec_dpt = param_rec
if(param_sender)
send_dpt = param_sender
if(param_message)
message = param_message
if(param_stamp)
stamp = param_stamp
if(param_id_auth)
id_auth = param_id_auth
if(param_priority)
switch(param_priority)
if(1)
priority = "Normal"
if(2)
priority = "High"
if(3)
priority = "Extreme"
else
priority = "Undetermined"
/obj/machinery/message_server
icon = 'icons/obj/machines/research.dmi'
icon_state = "server"
name = "Messaging Server"
density = 1
anchored = 1.0
use_power = IDLE_POWER_USE
idle_power_usage = 10
active_power_usage = 100
var/list/datum/data_pda_msg/pda_msgs = list()
var/list/datum/data_rc_msg/rc_msgs = list()
var/active = 1
var/decryptkey = "password"
/obj/machinery/message_server/New()
message_servers += src
decryptkey = GenerateKey()
send_pda_message("System Administrator", "system", "This is an automated message. The messaging system is functioning correctly.")
..()
return
/obj/machinery/message_server/Destroy()
message_servers -= src
return ..()
/obj/machinery/message_server/process()
//if(decryptkey == "password")
// decryptkey = generateKey()
if(active && (stat & (BROKEN|NOPOWER)))
active = 0
return
if(prob(3))
playsound(loc, "computer_ambience", 50, 1)
update_icon()
return
/obj/machinery/message_server/proc/send_pda_message(var/recipient = "",var/sender = "",var/message = "")
pda_msgs += new/datum/data_pda_msg(recipient,sender,message)
/obj/machinery/message_server/proc/send_rc_message(var/recipient = "",var/sender = "",var/message = "",var/stamp = "", var/id_auth = "", var/priority = 1)
rc_msgs += new/datum/data_rc_msg(recipient,sender,message,stamp,id_auth)
var/authmsg = "[message]<br>"
if(id_auth)
authmsg += "[id_auth]<br>"
if(stamp)
authmsg += "[stamp]<br>"
for(var/obj/machinery/requests_console/Console in allConsoles)
if(ckey(Console.department) == ckey(recipient))
if(Console.inoperable())
Console.message_log += "<B>Message lost due to console failure.</B><BR>Please contact [station_name()] system adminsitrator or AI for technical assistance.<BR>"
continue
if(Console.newmessagepriority < priority)
Console.newmessagepriority = priority
Console.icon_state = "req_comp[priority]"
switch(priority)
if(2)
if(!Console.silent)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
Console.audible_message(text("[bicon(Console)] *The Requests Console beeps: 'PRIORITY Alert in [sender]'"),,5)
Console.message_log += "<B><FONT color='red'>High Priority message from <A href='?src=[Console.UID()];write=[sender]'>[sender]</A></FONT></B><BR>[authmsg]"
else
if(!Console.silent)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
Console.audible_message(text("[bicon(Console)] *The Requests Console beeps: 'Message from [sender]'"),,4)
Console.message_log += "<B>Message from <A href='?src=[Console.UID()];write=[sender]'>[sender]</A></B><BR>[authmsg]"
Console.set_light(2)
/obj/machinery/message_server/attack_hand(user as mob)
// to_chat(user, "<span class='notice'>There seem to be some parts missing from this server. They should arrive on the station in a few days, give or take a few CentComm delays.</span>")
to_chat(user, "You toggle PDA message passing from [active ? "On" : "Off"] to [active ? "Off" : "On"]")
active = !active
update_icon()
return
/obj/machinery/message_server/update_icon()
if((stat & (BROKEN|NOPOWER)))
icon_state = "server-nopower"
else if(!active)
icon_state = "server-off"
else
icon_state = "server-on"
return
/datum/feedback_variable
var/variable
var/value
var/details
/datum/feedback_variable/New(var/param_variable,var/param_value = 0)
variable = param_variable
value = param_value
/datum/feedback_variable/vv_edit_var(var_name, var_value)
return FALSE // come on guys don't break the stats
/datum/feedback_variable/proc/inc(var/num = 1)
if(isnum(value))
value += num
else
value = text2num(value)
if(isnum(value))
value += num
else
value = num
/datum/feedback_variable/proc/dec(var/num = 1)
if(isnum(value))
value -= num
else
value = text2num(value)
if(isnum(value))
value -= num
else
value = -num
/datum/feedback_variable/proc/set_value(var/num)
if(isnum(num))
value = num
/datum/feedback_variable/proc/get_value()
return value
/datum/feedback_variable/proc/get_variable()
return variable
/datum/feedback_variable/proc/set_details(var/text)
if(istext(text))
details = text
/datum/feedback_variable/proc/add_details(var/text)
if(istext(text))
if(!details)
details = text
else
details += " [text]"
/datum/feedback_variable/proc/get_details()
return details
/datum/feedback_variable/proc/get_parsed()
return list(variable,value,details)
var/obj/machinery/blackbox_recorder/blackbox
//TODO: kill whoever designed this cancer
/obj/machinery/blackbox_recorder
icon = 'icons/obj/stationobjs.dmi'
icon_state = "blackbox"
name = "Blackbox Recorder"
density = 1
anchored = 1.0
use_power = IDLE_POWER_USE
idle_power_usage = 10
active_power_usage = 100
var/list/messages = list() //Stores messages of non-standard frequencies
var/list/messages_admin = list()
var/list/msg_common = list()
var/list/msg_science = list()
var/list/msg_command = list()
var/list/msg_medical = list()
var/list/msg_engineering = list()
var/list/msg_security = list()
var/list/msg_deathsquad = list()
var/list/msg_syndicate = list()
var/list/msg_syndteam = list()
var/list/msg_mining = list()
var/list/msg_cargo = list()
var/list/msg_service = list()
var/list/datum/feedback_variable/feedback = new()
//Only one can exsist in the world!
/obj/machinery/blackbox_recorder/New()
if(blackbox)
if(istype(blackbox,/obj/machinery/blackbox_recorder))
qdel(src)
blackbox = src
/obj/machinery/blackbox_recorder/Destroy()
var/turf/T = locate(1,1,2)
if(T)
blackbox = null
var/obj/machinery/blackbox_recorder/BR = new/obj/machinery/blackbox_recorder(T)
BR.msg_common = msg_common
BR.msg_science = msg_science
BR.msg_command = msg_command
BR.msg_medical = msg_medical
BR.msg_engineering = msg_engineering
BR.msg_security = msg_security
BR.msg_deathsquad = msg_deathsquad
BR.msg_syndicate = msg_syndicate
BR.msg_syndteam = msg_syndteam
BR.msg_mining = msg_mining
BR.msg_cargo = msg_cargo
BR.msg_service = msg_service
BR.feedback = feedback
BR.messages = messages
BR.messages_admin = messages_admin
if(blackbox != BR)
blackbox = BR
return ..()
/obj/machinery/blackbox_recorder/proc/find_feedback_datum(var/variable)
for(var/datum/feedback_variable/FV in feedback)
if(FV.get_variable() == variable)
return FV
var/datum/feedback_variable/FV = new(variable)
feedback += FV
return FV
/obj/machinery/blackbox_recorder/proc/get_round_feedback()
return feedback
/obj/machinery/blackbox_recorder/proc/round_end_data_gathering()
var/pda_msg_amt = 0
var/rc_msg_amt = 0
for(var/obj/machinery/message_server/MS in GLOB.machines)
if(MS.pda_msgs.len > pda_msg_amt)
pda_msg_amt = MS.pda_msgs.len
if(MS.rc_msgs.len > rc_msg_amt)
rc_msg_amt = MS.rc_msgs.len
feedback_set_details("radio_usage","")
feedback_add_details("radio_usage","COM-[msg_common.len]")
feedback_add_details("radio_usage","SCI-[msg_science.len]")
feedback_add_details("radio_usage","HEA-[msg_command.len]")
feedback_add_details("radio_usage","MED-[msg_medical.len]")
feedback_add_details("radio_usage","ENG-[msg_engineering.len]")
feedback_add_details("radio_usage","SEC-[msg_security.len]")
feedback_add_details("radio_usage","DTH-[msg_deathsquad.len]")
feedback_add_details("radio_usage","SYN-[msg_syndicate.len]")
feedback_add_details("radio_usage","SYT-[msg_syndteam.len]")
feedback_add_details("radio_usage","MIN-[msg_mining.len]")
feedback_add_details("radio_usage","CAR-[msg_cargo.len]")
feedback_add_details("radio_usage","SRV-[msg_service.len]")
feedback_add_details("radio_usage","OTH-[messages.len]")
feedback_add_details("radio_usage","PDA-[pda_msg_amt]")
feedback_add_details("radio_usage","RC-[rc_msg_amt]")
feedback_set_details("round_end","[time2text(world.realtime)]") //This one MUST be the last one that gets set.
//This proc is only to be called at round end.
/obj/machinery/blackbox_recorder/proc/save_all_data_to_sql()
if(!feedback) return
round_end_data_gathering() //round_end time logging and some other data processing
establish_db_connection()
if(!dbcon.IsConnected()) return
var/round_id
var/DBQuery/query = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
query.Execute()
while(query.NextRow())
round_id = query.item[1]
if(!isnum(round_id))
round_id = text2num(round_id)
round_id++
for(var/datum/feedback_variable/FV in feedback)
var/sql = "INSERT INTO [format_table_name("feedback")] VALUES (null, Now(), [round_id], \"[FV.get_variable()]\", [FV.get_value()], \"[FV.get_details()]\")"
var/DBQuery/query_insert = dbcon.NewQuery(sql)
query_insert.Execute()
/obj/machinery/blackbox_recorder/vv_edit_var(var_name, var_value)
return FALSE // don't fuck with the stupid blackbox shit
proc/feedback_set(var/variable,var/value)
if(!blackbox) return
variable = sanitizeSQL(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.set_value(value)
proc/feedback_inc(var/variable,var/value)
if(!blackbox) return
variable = sanitizeSQL(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.inc(value)
proc/feedback_dec(var/variable,var/value)
if(!blackbox) return
variable = sanitizeSQL(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.dec(value)
proc/feedback_set_details(var/variable,var/details)
if(!blackbox) return
variable = sanitizeSQL(variable)
details = sanitizeSQL(details)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.set_details(details)
proc/feedback_add_details(var/variable,var/details)
if(!blackbox) return
variable = sanitizeSQL(variable)
details = sanitizeSQL(details)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.add_details(details)
var/global/list/obj/machinery/message_server/message_servers = list()
/datum/data_pda_msg
var/recipient = "Unspecified" //name of the person
var/sender = "Unspecified" //name of the sender
var/message = "Blank" //transferred message
/datum/data_pda_msg/New(var/param_rec = "",var/param_sender = "",var/param_message = "")
if(param_rec)
recipient = param_rec
if(param_sender)
sender = param_sender
if(param_message)
message = param_message
/datum/data_rc_msg
var/rec_dpt = "Unspecified" //name of the person
var/send_dpt = "Unspecified" //name of the sender
var/message = "Blank" //transferred message
var/stamp = "Unstamped"
var/id_auth = "Unauthenticated"
var/priority = "Normal"
/datum/data_rc_msg/New(var/param_rec = "",var/param_sender = "",var/param_message = "",var/param_stamp = "",var/param_id_auth = "",var/param_priority)
if(param_rec)
rec_dpt = param_rec
if(param_sender)
send_dpt = param_sender
if(param_message)
message = param_message
if(param_stamp)
stamp = param_stamp
if(param_id_auth)
id_auth = param_id_auth
if(param_priority)
switch(param_priority)
if(1)
priority = "Normal"
if(2)
priority = "High"
if(3)
priority = "Extreme"
else
priority = "Undetermined"
/obj/machinery/message_server
icon = 'icons/obj/machines/research.dmi'
icon_state = "server"
name = "Messaging Server"
density = 1
anchored = 1.0
use_power = IDLE_POWER_USE
idle_power_usage = 10
active_power_usage = 100
var/list/datum/data_pda_msg/pda_msgs = list()
var/list/datum/data_rc_msg/rc_msgs = list()
var/active = 1
var/decryptkey = "password"
/obj/machinery/message_server/New()
message_servers += src
decryptkey = GenerateKey()
send_pda_message("System Administrator", "system", "This is an automated message. The messaging system is functioning correctly.")
..()
return
/obj/machinery/message_server/Destroy()
message_servers -= src
return ..()
/obj/machinery/message_server/process()
//if(decryptkey == "password")
// decryptkey = generateKey()
if(active && (stat & (BROKEN|NOPOWER)))
active = 0
return
if(prob(3))
playsound(loc, "computer_ambience", 50, 1)
update_icon()
return
/obj/machinery/message_server/proc/send_pda_message(var/recipient = "",var/sender = "",var/message = "")
pda_msgs += new/datum/data_pda_msg(recipient,sender,message)
/obj/machinery/message_server/proc/send_rc_message(var/recipient = "",var/sender = "",var/message = "",var/stamp = "", var/id_auth = "", var/priority = 1)
rc_msgs += new/datum/data_rc_msg(recipient,sender,message,stamp,id_auth)
var/authmsg = "[message]<br>"
if(id_auth)
authmsg += "[id_auth]<br>"
if(stamp)
authmsg += "[stamp]<br>"
for(var/obj/machinery/requests_console/Console in allConsoles)
if(ckey(Console.department) == ckey(recipient))
if(Console.inoperable())
Console.message_log += "<B>Message lost due to console failure.</B><BR>Please contact [station_name()] system adminsitrator or AI for technical assistance.<BR>"
continue
if(Console.newmessagepriority < priority)
Console.newmessagepriority = priority
Console.icon_state = "req_comp[priority]"
switch(priority)
if(2)
if(!Console.silent)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
Console.audible_message(text("[bicon(Console)] *The Requests Console beeps: 'PRIORITY Alert in [sender]'"),,5)
Console.message_log += "<B><FONT color='red'>High Priority message from <A href='?src=[Console.UID()];write=[sender]'>[sender]</A></FONT></B><BR>[authmsg]"
else
if(!Console.silent)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
Console.audible_message(text("[bicon(Console)] *The Requests Console beeps: 'Message from [sender]'"),,4)
Console.message_log += "<B>Message from <A href='?src=[Console.UID()];write=[sender]'>[sender]</A></B><BR>[authmsg]"
Console.set_light(2)
/obj/machinery/message_server/attack_hand(user as mob)
// to_chat(user, "<span class='notice'>There seem to be some parts missing from this server. They should arrive on the station in a few days, give or take a few CentComm delays.</span>")
to_chat(user, "You toggle PDA message passing from [active ? "On" : "Off"] to [active ? "Off" : "On"]")
active = !active
update_icon()
return
/obj/machinery/message_server/update_icon()
if((stat & (BROKEN|NOPOWER)))
icon_state = "server-nopower"
else if(!active)
icon_state = "server-off"
else
icon_state = "server-on"
return
/datum/feedback_variable
var/variable
var/value
var/details
/datum/feedback_variable/New(var/param_variable,var/param_value = 0)
variable = param_variable
value = param_value
/datum/feedback_variable/vv_edit_var(var_name, var_value)
return FALSE // come on guys don't break the stats
/datum/feedback_variable/proc/inc(var/num = 1)
if(isnum(value))
value += num
else
value = text2num(value)
if(isnum(value))
value += num
else
value = num
/datum/feedback_variable/proc/dec(var/num = 1)
if(isnum(value))
value -= num
else
value = text2num(value)
if(isnum(value))
value -= num
else
value = -num
/datum/feedback_variable/proc/set_value(var/num)
if(isnum(num))
value = num
/datum/feedback_variable/proc/get_value()
return value
/datum/feedback_variable/proc/get_variable()
return variable
/datum/feedback_variable/proc/set_details(var/text)
if(istext(text))
details = text
/datum/feedback_variable/proc/add_details(var/text)
if(istext(text))
if(!details)
details = text
else
details += " [text]"
/datum/feedback_variable/proc/get_details()
return details
/datum/feedback_variable/proc/get_parsed()
return list(variable,value,details)
var/obj/machinery/blackbox_recorder/blackbox
//TODO: kill whoever designed this cancer
/obj/machinery/blackbox_recorder
icon = 'icons/obj/stationobjs.dmi'
icon_state = "blackbox"
name = "Blackbox Recorder"
density = 1
anchored = 1.0
use_power = IDLE_POWER_USE
idle_power_usage = 10
active_power_usage = 100
var/list/messages = list() //Stores messages of non-standard frequencies
var/list/messages_admin = list()
var/list/msg_common = list()
var/list/msg_science = list()
var/list/msg_command = list()
var/list/msg_medical = list()
var/list/msg_engineering = list()
var/list/msg_security = list()
var/list/msg_deathsquad = list()
var/list/msg_syndicate = list()
var/list/msg_syndteam = list()
var/list/msg_mining = list()
var/list/msg_cargo = list()
var/list/msg_service = list()
var/list/datum/feedback_variable/feedback = new()
//Only one can exsist in the world!
/obj/machinery/blackbox_recorder/New()
if(blackbox)
if(istype(blackbox,/obj/machinery/blackbox_recorder))
qdel(src)
blackbox = src
/obj/machinery/blackbox_recorder/Destroy()
var/turf/T = locate(1,1,2)
if(T)
blackbox = null
var/obj/machinery/blackbox_recorder/BR = new/obj/machinery/blackbox_recorder(T)
BR.msg_common = msg_common
BR.msg_science = msg_science
BR.msg_command = msg_command
BR.msg_medical = msg_medical
BR.msg_engineering = msg_engineering
BR.msg_security = msg_security
BR.msg_deathsquad = msg_deathsquad
BR.msg_syndicate = msg_syndicate
BR.msg_syndteam = msg_syndteam
BR.msg_mining = msg_mining
BR.msg_cargo = msg_cargo
BR.msg_service = msg_service
BR.feedback = feedback
BR.messages = messages
BR.messages_admin = messages_admin
if(blackbox != BR)
blackbox = BR
return ..()
/obj/machinery/blackbox_recorder/proc/find_feedback_datum(var/variable)
for(var/datum/feedback_variable/FV in feedback)
if(FV.get_variable() == variable)
return FV
var/datum/feedback_variable/FV = new(variable)
feedback += FV
return FV
/obj/machinery/blackbox_recorder/proc/get_round_feedback()
return feedback
/obj/machinery/blackbox_recorder/proc/round_end_data_gathering()
var/pda_msg_amt = 0
var/rc_msg_amt = 0
for(var/obj/machinery/message_server/MS in GLOB.machines)
if(MS.pda_msgs.len > pda_msg_amt)
pda_msg_amt = MS.pda_msgs.len
if(MS.rc_msgs.len > rc_msg_amt)
rc_msg_amt = MS.rc_msgs.len
feedback_set_details("radio_usage","")
feedback_add_details("radio_usage","COM-[msg_common.len]")
feedback_add_details("radio_usage","SCI-[msg_science.len]")
feedback_add_details("radio_usage","HEA-[msg_command.len]")
feedback_add_details("radio_usage","MED-[msg_medical.len]")
feedback_add_details("radio_usage","ENG-[msg_engineering.len]")
feedback_add_details("radio_usage","SEC-[msg_security.len]")
feedback_add_details("radio_usage","DTH-[msg_deathsquad.len]")
feedback_add_details("radio_usage","SYN-[msg_syndicate.len]")
feedback_add_details("radio_usage","SYT-[msg_syndteam.len]")
feedback_add_details("radio_usage","MIN-[msg_mining.len]")
feedback_add_details("radio_usage","CAR-[msg_cargo.len]")
feedback_add_details("radio_usage","SRV-[msg_service.len]")
feedback_add_details("radio_usage","OTH-[messages.len]")
feedback_add_details("radio_usage","PDA-[pda_msg_amt]")
feedback_add_details("radio_usage","RC-[rc_msg_amt]")
feedback_set_details("round_end","[time2text(world.realtime)]") //This one MUST be the last one that gets set.
//This proc is only to be called at round end.
/obj/machinery/blackbox_recorder/proc/save_all_data_to_sql()
if(!feedback) return
round_end_data_gathering() //round_end time logging and some other data processing
establish_db_connection()
if(!dbcon.IsConnected()) return
var/round_id
var/DBQuery/query = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM [format_table_name("feedback")]")
query.Execute()
while(query.NextRow())
round_id = query.item[1]
if(!isnum(round_id))
round_id = text2num(round_id)
round_id++
for(var/datum/feedback_variable/FV in feedback)
var/sql = "INSERT INTO [format_table_name("feedback")] VALUES (null, Now(), [round_id], \"[FV.get_variable()]\", [FV.get_value()], \"[FV.get_details()]\")"
var/DBQuery/query_insert = dbcon.NewQuery(sql)
query_insert.Execute()
/obj/machinery/blackbox_recorder/vv_edit_var(var_name, var_value)
return FALSE // don't fuck with the stupid blackbox shit
proc/feedback_set(var/variable,var/value)
if(!blackbox) return
variable = sanitizeSQL(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.set_value(value)
proc/feedback_inc(var/variable,var/value)
if(!blackbox) return
variable = sanitizeSQL(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.inc(value)
proc/feedback_dec(var/variable,var/value)
if(!blackbox) return
variable = sanitizeSQL(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.dec(value)
proc/feedback_set_details(var/variable,var/details)
if(!blackbox) return
variable = sanitizeSQL(variable)
details = sanitizeSQL(details)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.set_details(details)
proc/feedback_add_details(var/variable,var/details)
if(!blackbox) return
variable = sanitizeSQL(variable)
details = sanitizeSQL(details)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.add_details(details)
+113 -113
View File
@@ -1,113 +1,113 @@
/*
Protolathe
Similar to an autolathe, you load glass and metal sheets (but not other objects) into it to be used as raw materials for the stuff
it creates. All the menus and other manipulation commands are in the R&D console.
Note: Must be placed west/left of and R&D console to function.
*/
/obj/machinery/r_n_d/protolathe
name = "Protolathe"
desc = "Converts raw materials into useful objects."
icon_state = "protolathe"
container_type = OPENCONTAINER
var/efficiency_coeff
var/list/categories = list(
"Bluespace",
"Computer Parts",
"Equipment",
"Janitorial",
"Medical",
"Mining",
"Miscellaneous",
"Power",
"Stock Parts",
"Weapons"
)
reagents = new()
/obj/machinery/r_n_d/protolathe/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/protolathe(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/manipulator(null)
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)
RefreshParts()
reagents.my_atom = src
/obj/machinery/r_n_d/protolathe/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/protolathe(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
RefreshParts()
reagents.my_atom = src
/obj/machinery/r_n_d/protolathe/RefreshParts()
var/T = 0
for(var/obj/item/reagent_containers/glass/G in component_parts)
G.reagents.trans_to(src, G.reagents.total_volume)
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
T += M.rating
materials.max_amount = T * 75000
T = 1.2
for(var/obj/item/stock_parts/manipulator/M in component_parts)
T -= M.rating/10
efficiency_coeff = min(max(0, T), 1)
/obj/machinery/r_n_d/protolathe/proc/check_mat(datum/design/being_built, var/M) // now returns how many times the item can be built with the material
var/A = materials.amount(M)
if(!A)
A = reagents.get_reagent_amount(M)
A = A / max(1, (being_built.reagents_list[M]))
else
A = A / max(1, (being_built.materials[M]))
return A
/obj/machinery/r_n_d/protolathe/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(shocked)
if(shock(user,50))
return TRUE
if(default_deconstruction_screwdriver(user, "protolathe_t", "protolathe", O))
if(linked_console)
linked_console.linked_lathe = null
linked_console = null
return
if(exchange_parts(user, O))
return
if(panel_open)
if(istype(O, /obj/item/crowbar))
for(var/obj/I in component_parts)
if(istype(I, /obj/item/reagent_containers/glass/beaker))
reagents.trans_to(I, reagents.total_volume)
I.loc = src.loc
for(var/obj/item/reagent_containers/glass/G in component_parts)
reagents.trans_to(G, G.reagents.maximum_volume)
materials.retrieve_all()
default_deconstruction_crowbar(user, O)
return 1
else
to_chat(user, "<span class='warning'>You can't load the [src.name] while it's opened.</span>")
return 1
if(O.is_open_container())
return FALSE
else
return ..()
/*
Protolathe
Similar to an autolathe, you load glass and metal sheets (but not other objects) into it to be used as raw materials for the stuff
it creates. All the menus and other manipulation commands are in the R&D console.
Note: Must be placed west/left of and R&D console to function.
*/
/obj/machinery/r_n_d/protolathe
name = "Protolathe"
desc = "Converts raw materials into useful objects."
icon_state = "protolathe"
container_type = OPENCONTAINER
var/efficiency_coeff
var/list/categories = list(
"Bluespace",
"Computer Parts",
"Equipment",
"Janitorial",
"Medical",
"Mining",
"Miscellaneous",
"Power",
"Stock Parts",
"Weapons"
)
reagents = new()
/obj/machinery/r_n_d/protolathe/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/protolathe(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/matter_bin(null)
component_parts += new /obj/item/stock_parts/manipulator(null)
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)
RefreshParts()
reagents.my_atom = src
/obj/machinery/r_n_d/protolathe/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/protolathe(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/stock_parts/matter_bin/super(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/stock_parts/manipulator/pico(null)
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
component_parts += new /obj/item/reagent_containers/glass/beaker/large(null)
RefreshParts()
reagents.my_atom = src
/obj/machinery/r_n_d/protolathe/RefreshParts()
var/T = 0
for(var/obj/item/reagent_containers/glass/G in component_parts)
G.reagents.trans_to(src, G.reagents.total_volume)
for(var/obj/item/stock_parts/matter_bin/M in component_parts)
T += M.rating
materials.max_amount = T * 75000
T = 1.2
for(var/obj/item/stock_parts/manipulator/M in component_parts)
T -= M.rating/10
efficiency_coeff = min(max(0, T), 1)
/obj/machinery/r_n_d/protolathe/proc/check_mat(datum/design/being_built, var/M) // now returns how many times the item can be built with the material
var/A = materials.amount(M)
if(!A)
A = reagents.get_reagent_amount(M)
A = A / max(1, (being_built.reagents_list[M]))
else
A = A / max(1, (being_built.materials[M]))
return A
/obj/machinery/r_n_d/protolathe/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(shocked)
if(shock(user,50))
return TRUE
if(default_deconstruction_screwdriver(user, "protolathe_t", "protolathe", O))
if(linked_console)
linked_console.linked_lathe = null
linked_console = null
return
if(exchange_parts(user, O))
return
if(panel_open)
if(istype(O, /obj/item/crowbar))
for(var/obj/I in component_parts)
if(istype(I, /obj/item/reagent_containers/glass/beaker))
reagents.trans_to(I, reagents.total_volume)
I.loc = src.loc
for(var/obj/item/reagent_containers/glass/G in component_parts)
reagents.trans_to(G, G.reagents.maximum_volume)
materials.retrieve_all()
default_deconstruction_crowbar(user, O)
return 1
else
to_chat(user, "<span class='warning'>You can't load the [src.name] while it's opened.</span>")
return 1
if(O.is_open_container())
return FALSE
else
return ..()
+239 -239
View File
@@ -1,239 +1,239 @@
/*
Research and Development System. (Designed specifically for the /tg/station 13 (Space Station 13) open source project)
///////////////Overview///////////////////
This system is a "tech tree" research and development system designed for SS13. It allows a "researcher" job (this document assumes
the "scientist" job is given this role) the tools necessiary to research new and better technologies. In general, the system works
by breaking existing technology and using what you learn from to advance your knowledge of SCIENCE! As your knowledge progresses,
you can build newer (and better?) devices (which you can also, eventually, deconstruct to advance your knowledge).
A brief overview is below. For more details, see the related files.
////////////Game Use/////////////
The major research and development is performed using a combination of four machines:
- R&D Console: A computer console that allows you to manipulate the other devices that are linked to it and view/manipulate the
technologies you have researched so far.
- Protolathe: Used to make new hand-held devices and parts for larger devices. All metals and reagents as raw materials.
- Destructive Analyzer: You can put hand-held objects into it and it'll analyze them for technological advancements but it destroys
them in the process. Destroyed items will send their raw materials to a linked Protolathe (if any)
- Circuit Imprinter: Similar to the Protolathe, it allows for the construction of circuit boards. Uses glass and acid as the raw
materials.
While researching you are dealing with two different types of information: Technology Paths and Device Designs. Technology Paths
are the "Tech Trees" of the game. You start out with a number of them at the game start and they are improved by using the
Destructive Analyzer. By themselves, they don't do a whole lot. However, they unlock Device Designs. This is the information used
by the circuit imprinter and the protolathe to produce objects.
//EXISTING TECH
Each tech path should have at LEAST one item at every level (levels 1 - 20). This is to allow for a more fluid progression of the
researching. Existing tech (ie, anything you can find on the station or get from the quartermaster) shouldn't go higher then
level 5 or 7. Everything past that should be stuff you research.
Below is a checklist to make sure every tree is filled. As new items get added to R&D, add them here if there is an empty slot.
When thinking about new stuff, check here to see if there are any slots unfilled.
//MATERIALS
1 | Metal
2 | Solid Plasma
3 | Silver
4 | Gold, Super Capacitor
5 | Uranium, Nuclear Gun, SUPERPACMAN
6 | Diamond, MRSPACMAN
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//PLASMA TECH
1 |
2 | Solid Plasma
3 | Pacman Generator
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//POWER TECH
1 | Basic Capacitor, Basic Cell
2 | High-Capacity Cell (10,000)
3 | Super-Capacity Cell (20,000), Powersink, PACMAN
4 | SUPERPACMAN
5 | MRSPACMAN, Super Capacitor
6 | Hyper-Capacity Cell (30,000)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//BLUE SPACE
1 |
2 | Teleporter Console Board
3 | Teleport Gun, Hand Tele
4 | Teleportation Scroll
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//BIOTECH
1 | Bruise Pack, Scalple
2 | PANDEMIC Board, Mass Spectrometer
3 | AI Core, Brains (MMI)
4 | MMI+Radio
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//MAGNETS
1 | Basic Sensor
2 | Comm Console Board
3 | Adv Sensor
4 | Adv Mass Spectrometer, Chameleon Projector
5 | Phasic Sensor
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//PROGRAMMING
1 | Arcade Board
2 | Sec Camera
3 | Cloning Machine Console Board
4 | AI Core, Intellicard
5 | Pico-Manipulator, Ultra-Micro-Laser
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//SYNDICATE
1 | Sleepypen
2 | TYRANT Module, Emag
3 | Cloaking Device, Power Sink
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//COMBAT
1 | Flashbang, Mousetrap, Nettle
2 | Stun Baton
3 | Power Axe, Death Nettle, Nuclear Gun
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
*/
/*
Research and Development System. (Designed specifically for the /tg/station 13 (Space Station 13) open source project)
///////////////Overview///////////////////
This system is a "tech tree" research and development system designed for SS13. It allows a "researcher" job (this document assumes
the "scientist" job is given this role) the tools necessiary to research new and better technologies. In general, the system works
by breaking existing technology and using what you learn from to advance your knowledge of SCIENCE! As your knowledge progresses,
you can build newer (and better?) devices (which you can also, eventually, deconstruct to advance your knowledge).
A brief overview is below. For more details, see the related files.
////////////Game Use/////////////
The major research and development is performed using a combination of four machines:
- R&D Console: A computer console that allows you to manipulate the other devices that are linked to it and view/manipulate the
technologies you have researched so far.
- Protolathe: Used to make new hand-held devices and parts for larger devices. All metals and reagents as raw materials.
- Destructive Analyzer: You can put hand-held objects into it and it'll analyze them for technological advancements but it destroys
them in the process. Destroyed items will send their raw materials to a linked Protolathe (if any)
- Circuit Imprinter: Similar to the Protolathe, it allows for the construction of circuit boards. Uses glass and acid as the raw
materials.
While researching you are dealing with two different types of information: Technology Paths and Device Designs. Technology Paths
are the "Tech Trees" of the game. You start out with a number of them at the game start and they are improved by using the
Destructive Analyzer. By themselves, they don't do a whole lot. However, they unlock Device Designs. This is the information used
by the circuit imprinter and the protolathe to produce objects.
//EXISTING TECH
Each tech path should have at LEAST one item at every level (levels 1 - 20). This is to allow for a more fluid progression of the
researching. Existing tech (ie, anything you can find on the station or get from the quartermaster) shouldn't go higher then
level 5 or 7. Everything past that should be stuff you research.
Below is a checklist to make sure every tree is filled. As new items get added to R&D, add them here if there is an empty slot.
When thinking about new stuff, check here to see if there are any slots unfilled.
//MATERIALS
1 | Metal
2 | Solid Plasma
3 | Silver
4 | Gold, Super Capacitor
5 | Uranium, Nuclear Gun, SUPERPACMAN
6 | Diamond, MRSPACMAN
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//PLASMA TECH
1 |
2 | Solid Plasma
3 | Pacman Generator
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//POWER TECH
1 | Basic Capacitor, Basic Cell
2 | High-Capacity Cell (10,000)
3 | Super-Capacity Cell (20,000), Powersink, PACMAN
4 | SUPERPACMAN
5 | MRSPACMAN, Super Capacitor
6 | Hyper-Capacity Cell (30,000)
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//BLUE SPACE
1 |
2 | Teleporter Console Board
3 | Teleport Gun, Hand Tele
4 | Teleportation Scroll
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//BIOTECH
1 | Bruise Pack, Scalple
2 | PANDEMIC Board, Mass Spectrometer
3 | AI Core, Brains (MMI)
4 | MMI+Radio
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//MAGNETS
1 | Basic Sensor
2 | Comm Console Board
3 | Adv Sensor
4 | Adv Mass Spectrometer, Chameleon Projector
5 | Phasic Sensor
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//PROGRAMMING
1 | Arcade Board
2 | Sec Camera
3 | Cloning Machine Console Board
4 | AI Core, Intellicard
5 | Pico-Manipulator, Ultra-Micro-Laser
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//SYNDICATE
1 | Sleepypen
2 | TYRANT Module, Emag
3 | Cloaking Device, Power Sink
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
//COMBAT
1 | Flashbang, Mousetrap, Nettle
2 | Stun Baton
3 | Power Axe, Death Nettle, Nuclear Gun
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
*/
File diff suppressed because it is too large Load Diff
+133 -133
View File
@@ -1,133 +1,133 @@
//All devices that link into the R&D console fall into thise type for easy identification and some shared procs.
/obj/machinery/r_n_d
name = "R&D Device"
icon = 'icons/obj/machines/research.dmi'
density = 1
anchored = 1
use_power = IDLE_POWER_USE
var/busy = 0
var/hacked = 0
var/disabled = 0
var/shocked = 0
var/list/wires = list()
var/hack_wire
var/disable_wire
var/shock_wire
var/obj/machinery/computer/rdconsole/linked_console
var/obj/item/loaded_item = null
var/datum/component/material_container/materials //Store for hyper speed!
/obj/machinery/r_n_d/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,
TRUE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
..()
wires["Red"] = 0
wires["Blue"] = 0
wires["Green"] = 0
wires["Yellow"] = 0
wires["Black"] = 0
wires["White"] = 0
var/list/w = list("Red","Blue","Green","Yellow","Black","White")
src.hack_wire = pick(w)
w -= src.hack_wire
src.shock_wire = pick(w)
w -= src.shock_wire
src.disable_wire = pick(w)
w -= src.disable_wire
/obj/machinery/r_n_d/attack_hand(mob/user as mob)
if(shocked)
shock(user,50)
if(panel_open)
var/list/dat = list()
dat += "[src.name] Wires:<BR>"
for(var/wire in wires)
dat += "[wire] Wire: <A href='?src=[UID()];wire=[wire];cut=1'>[src.wires[wire] ? "Mend" : "Cut"]</A> <A href='?src=[UID()];wire=[wire];pulse=1'>Pulse</A><BR>"
dat += "The red light is [src.disabled ? "off" : "on"].<BR>"
dat += "The green light is [src.shocked ? "off" : "on"].<BR>"
dat += "The blue light is [src.hacked ? "off" : "on"].<BR>"
user << browse("<HTML><HEAD><TITLE>[src.name] Hacking</TITLE></HEAD><BODY>[dat.Join("")]</BODY></HTML>","window=hack_win")
return
/obj/machinery/r_n_d/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["pulse"])
var/temp_wire = href_list["wire"]
if(!istype(usr.get_active_hand(), /obj/item/multitool))
to_chat(usr, "You need a multitool!")
else
if(src.wires[temp_wire])
to_chat(usr, "You can't pulse a cut wire.")
else
if(src.hack_wire == href_list["wire"])
src.hacked = !src.hacked
spawn(100) src.hacked = !src.hacked
if(src.disable_wire == href_list["wire"])
src.disabled = !src.disabled
src.shock(usr,50)
spawn(100) src.disabled = !src.disabled
if(src.shock_wire == href_list["wire"])
src.shocked = !src.shocked
src.shock(usr,50)
spawn(100) src.shocked = !src.shocked
if(href_list["cut"])
if(!istype(usr.get_active_hand(), /obj/item/wirecutters))
to_chat(usr, "You need wirecutters!")
else
var/temp_wire = href_list["wire"]
wires[temp_wire] = !wires[temp_wire]
if(src.hack_wire == temp_wire)
src.hacked = !src.hacked
if(src.disable_wire == temp_wire)
src.disabled = !src.disabled
src.shock(usr,50)
if(src.shock_wire == temp_wire)
src.shocked = !src.shocked
src.shock(usr,50)
src.updateUsrDialog()
//whether the machine can have an item inserted in its current state.
/obj/machinery/r_n_d/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
if(loaded_item)
to_chat(user, "<span class='warning'>[src] is already loaded.</span>")
return FALSE
return TRUE
/obj/machinery/r_n_d/proc/AfterMaterialInsert(type_inserted, id_inserted, amount_inserted)
var/stack_name
if(ispath(type_inserted, /obj/item/stack/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 += "[initial(name)]_[stack_name]"
sleep(10)
overlays -= "[initial(name)]_[stack_name]"
//All devices that link into the R&D console fall into thise type for easy identification and some shared procs.
/obj/machinery/r_n_d
name = "R&D Device"
icon = 'icons/obj/machines/research.dmi'
density = 1
anchored = 1
use_power = IDLE_POWER_USE
var/busy = 0
var/hacked = 0
var/disabled = 0
var/shocked = 0
var/list/wires = list()
var/hack_wire
var/disable_wire
var/shock_wire
var/obj/machinery/computer/rdconsole/linked_console
var/obj/item/loaded_item = null
var/datum/component/material_container/materials //Store for hyper speed!
/obj/machinery/r_n_d/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,
TRUE, /obj/item/stack, CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
..()
wires["Red"] = 0
wires["Blue"] = 0
wires["Green"] = 0
wires["Yellow"] = 0
wires["Black"] = 0
wires["White"] = 0
var/list/w = list("Red","Blue","Green","Yellow","Black","White")
src.hack_wire = pick(w)
w -= src.hack_wire
src.shock_wire = pick(w)
w -= src.shock_wire
src.disable_wire = pick(w)
w -= src.disable_wire
/obj/machinery/r_n_d/attack_hand(mob/user as mob)
if(shocked)
shock(user,50)
if(panel_open)
var/list/dat = list()
dat += "[src.name] Wires:<BR>"
for(var/wire in wires)
dat += "[wire] Wire: <A href='?src=[UID()];wire=[wire];cut=1'>[src.wires[wire] ? "Mend" : "Cut"]</A> <A href='?src=[UID()];wire=[wire];pulse=1'>Pulse</A><BR>"
dat += "The red light is [src.disabled ? "off" : "on"].<BR>"
dat += "The green light is [src.shocked ? "off" : "on"].<BR>"
dat += "The blue light is [src.hacked ? "off" : "on"].<BR>"
user << browse("<HTML><HEAD><TITLE>[src.name] Hacking</TITLE></HEAD><BODY>[dat.Join("")]</BODY></HTML>","window=hack_win")
return
/obj/machinery/r_n_d/Topic(href, href_list)
if(..())
return
usr.set_machine(src)
src.add_fingerprint(usr)
if(href_list["pulse"])
var/temp_wire = href_list["wire"]
if(!istype(usr.get_active_hand(), /obj/item/multitool))
to_chat(usr, "You need a multitool!")
else
if(src.wires[temp_wire])
to_chat(usr, "You can't pulse a cut wire.")
else
if(src.hack_wire == href_list["wire"])
src.hacked = !src.hacked
spawn(100) src.hacked = !src.hacked
if(src.disable_wire == href_list["wire"])
src.disabled = !src.disabled
src.shock(usr,50)
spawn(100) src.disabled = !src.disabled
if(src.shock_wire == href_list["wire"])
src.shocked = !src.shocked
src.shock(usr,50)
spawn(100) src.shocked = !src.shocked
if(href_list["cut"])
if(!istype(usr.get_active_hand(), /obj/item/wirecutters))
to_chat(usr, "You need wirecutters!")
else
var/temp_wire = href_list["wire"]
wires[temp_wire] = !wires[temp_wire]
if(src.hack_wire == temp_wire)
src.hacked = !src.hacked
if(src.disable_wire == temp_wire)
src.disabled = !src.disabled
src.shock(usr,50)
if(src.shock_wire == temp_wire)
src.shocked = !src.shocked
src.shock(usr,50)
src.updateUsrDialog()
//whether the machine can have an item inserted in its current state.
/obj/machinery/r_n_d/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
if(loaded_item)
to_chat(user, "<span class='warning'>[src] is already loaded.</span>")
return FALSE
return TRUE
/obj/machinery/r_n_d/proc/AfterMaterialInsert(type_inserted, id_inserted, amount_inserted)
var/stack_name
if(ispath(type_inserted, /obj/item/stack/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 += "[initial(name)]_[stack_name]"
sleep(10)
overlays -= "[initial(name)]_[stack_name]"
+400 -400
View File
@@ -1,400 +1,400 @@
/*
General Explination:
The research datum is the "folder" where all the research information is stored in a R&D console. It's also a holder for all the
various procs used to manipulate it. It has four variables and seven procs:
Variables:
- possible_tech is a list of all the /datum/tech that can potentially be researched by the player. The RefreshResearch() proc
(explained later) only goes through those when refreshing what you know. Generally, possible_tech contains ALL of the existing tech
but it is possible to add tech to the game that DON'T start in it (example: Xeno tech). Generally speaking, you don't want to mess
with these since they should be the default version of the datums. They're actually stored in a list rather then using typesof to
refer to them since it makes it a bit easier to search through them for specific information.
- know_tech is the companion list to possible_tech. It's the tech you can actually research and improve. Until it's added to this
list, it can't be improved. All the tech in this list are visible to the player.
- possible_designs is functionally identical to possbile_tech except it's for /datum/design.
- known_designs is functionally identical to known_tech except it's for /datum/design
Procs:
- TechHasReqs: Used by other procs (specifically RefreshResearch) to see whether all of a tech's requirements are currently in
known_tech and at a high enough level.
- DesignHasReqs: Same as TechHasReqs but for /datum/design and known_design.
- AddTech2Known: Adds a /datum/tech to known_tech. It checks to see whether it already has that tech (if so, it just replaces it). If
it doesn't have it, it adds it. Note: It does NOT check possible_tech at all. So if you want to add something strange to it (like
a player made tech?) you can.
- AddDesign2Known: Same as AddTech2Known except for /datum/design and known_designs.
- RefreshResearch: This is the workhorse of the R&D system. It updates the /datum/research holder and adds any unlocked tech paths
and designs you have reached the requirements for. It only checks through possible_tech and possible_designs, however, so it won't
accidentally add "secret" tech to it.
- UpdateTech is used as part of the actual researching process. It takes an ID and finds techs with that same ID in known_tech. When
it finds it, it checks to see whether it can improve it at all. If the known_tech's level is less then or equal to
the inputted level, it increases the known tech's level to the inputted level -1 or know tech's level +1 (whichever is higher).
The tech datums are the actual "tech trees" that you improve through researching. Each one has five variables:
- Name: Pretty obvious. This is often viewable to the players.
- Desc: Pretty obvious. Also player viewable.
- ID: This is the unique ID of the tech that is used by the various procs to find and/or maniuplate it.
- Level: This is the current level of the tech. All techs start at 1 and have a max of 20. Devices and some techs require a certain
level in specific techs before you can produce them.
- Req_tech: This is a list of the techs required to unlock this tech path. If left blank, it'll automatically be loaded into the
research holder datum.
*/
/***************************************************************
** Master Types **
** Includes all the helper procs and basic tech processing. **
***************************************************************/
/datum/research //Holder for all the existing, archived, and known tech. Individual to console.
//Datum/tech go here.
// Possible is a list of direct datum references
// known is a list of id -> datum mappings
var/list/possible_tech = list() //List of all tech in the game that players have access to (barring special events).
var/list/known_tech = list() //List of locally known tech.
var/list/possible_designs = list() //List of all designs
var/list/known_designs = list() //List of available designs
/datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated.
// MON DIEU!!!
// These are semi-global, but not TOTALLY global?
// Using research disks, you can get techs/designs from one research datum
// onto another. What consequences this could have, I am presently unsure, but
// I imagine nothing good.
for(var/T in subtypesof(/datum/tech))
possible_tech += new T(src)
for(var/D in subtypesof(/datum/design))
possible_designs += new D(src)
RefreshResearch()
//Checks to see if tech has all the required pre-reqs.
//Input: datum/tech; Output: 0/1 (false/true)
/datum/research/proc/TechHasReqs(var/datum/tech/T)
if(T.req_tech.len == 0)
return TRUE
for(var/req in T.req_tech)
var/datum/tech/known = known_tech[req]
if(!known || known.level < T.req_tech[req])
return FALSE
return TRUE
//Checks to see if design has all the required pre-reqs.
//Input: datum/design; Output: 0/1 (false/true)
/datum/research/proc/DesignHasReqs(var/datum/design/D)
if(D.req_tech.len == 0)
return TRUE
for(var/req in D.req_tech)
var/datum/tech/known = known_tech[req]
if(!known || known.level < D.req_tech[req])
return FALSE
return TRUE
//Adds a tech to known_tech list. Checks to make sure there aren't duplicates and updates existing tech's levels if needed.
//Input: datum/tech; Output: Null
/datum/research/proc/AddTech2Known(var/datum/tech/T)
if(T.id in known_tech)
var/datum/tech/known = known_tech[T.id]
if(T.level > known.level)
known.level = T.level
return
known_tech[T.id] = T
/datum/research/proc/AddDesign2Known(var/datum/design/D)
if(D.id in known_designs)
return
// Global datums make me nervous
known_designs[D.id] = D
//Refreshes known_tech and known_designs list.
//Input/Output: n/a
/datum/research/proc/RefreshResearch()
for(var/datum/tech/PT in possible_tech)
if(TechHasReqs(PT))
AddTech2Known(PT)
for(var/datum/design/PD in possible_designs)
if(DesignHasReqs(PD))
AddDesign2Known(PD)
for(var/v in known_tech)
var/datum/tech/T = known_tech[v]
T.level = Clamp(T.level, 0, 20)
//Refreshes the levels of a given tech.
//Input: Tech's ID and Level; Output: null
/datum/research/proc/UpdateTech(var/ID, var/level)
var/datum/tech/KT = known_tech[ID]
if(KT)
if(KT.level <= level)
// Will bump the tech to (value_of_target) automatically -
// after that it'll bump it up by 1 until it's greater
// than the source tech
KT.level = max((KT.level + 1), level)
//Checks if the origin level can raise current tech levels
//Input: Tech's ID and Level; Output: TRUE for yes, FALSE for no
/datum/research/proc/IsTechHigher(ID, level)
var/datum/tech/KT = known_tech[ID]
if(KT)
if(KT.level <= level)
return TRUE
else
return FALSE
/datum/research/proc/FindDesignByID(var/id)
return known_designs[id]
// A common task is for one research datum to copy over its techs and designs
// and update them on another research datum.
// Arguments:
// `other` - The research datum to send designs and techs to
/datum/research/proc/push_data(datum/research/other)
for(var/v in known_tech)
var/datum/tech/T = known_tech[v]
other.AddTech2Known(T)
for(var/v in known_designs)
var/datum/design/D = known_designs[v]
other.AddDesign2Known(D)
other.RefreshResearch()
//Autolathe files
/datum/research/autolathe
/datum/research/autolathe/DesignHasReqs(var/datum/design/D)
return D && (D.build_type & AUTOLATHE) && ("initial" in D.category)
/datum/research/autolathe/AddDesign2Known(var/datum/design/D)
if(!(D.build_type & AUTOLATHE))
return
..()
//Biogenerator files
/datum/research/biogenerator/New()
for(var/T in (subtypesof(/datum/tech)))
possible_tech += new T(src)
for(var/path in subtypesof(/datum/design))
var/datum/design/D = new path(src)
possible_designs += D
if((D.build_type & BIOGENERATOR) && ("initial" in D.category))
AddDesign2Known(D)
/datum/research/biogenerator/AddDesign2Known(datum/design/D)
if(!(D.build_type & BIOGENERATOR))
return
..()
//Smelter files
/datum/research/smelter/New()
for(var/T in (subtypesof(/datum/tech)))
possible_tech += new T(src)
for(var/path in subtypesof(/datum/design))
var/datum/design/D = new path(src)
possible_designs += D
if((D.build_type & SMELTER) && ("initial" in D.category))
AddDesign2Known(D)
/datum/research/smelter/AddDesign2Known(datum/design/D)
if(!(D.build_type & SMELTER))
return
..()
/***************************************************************
** Technology Datums **
** Includes all the various technoliges and what they make. **
***************************************************************/
/datum/tech //Datum of individual technologies.
var/name = "name" //Name of the technology.
var/desc = "description" //General description of what it does and what it makes.
var/id = "id" //An easily referenced ID. Must be alphanumeric, lower-case, and no symbols.
var/level = 1 //A simple number scale of the research level. Level 0 = Secret tech.
var/max_level = 1 // Maximum level this can be at (for job objectives)
var/rare = 1 //How much CentCom wants to get that tech. Used in supply shuttle tech cost calculation.
var/list/req_tech = list() //List of ids associated values of techs required to research this tech. "id" = #
//Trunk Technologies (don't require any other techs and you start knowning them).
/datum/tech/materials
name = "Materials Research"
desc = "Development of new and improved materials."
id = "materials"
max_level = 7
/datum/tech/engineering
name = "Engineering Research"
desc = "Development of new and improved engineering parts and methods."
id = "engineering"
max_level = 7
/datum/tech/plasmatech
name = "Plasma Research"
desc = "Research into the mysterious substance colloqually known as 'plasma'."
id = "plasmatech"
max_level = 7
rare = 3
/datum/tech/powerstorage
name = "Power Manipulation Technology"
desc = "The various technologies behind the storage and generation of electicity."
id = "powerstorage"
max_level = 7
/datum/tech/bluespace
name = "'Blue-space' Research"
desc = "Research into the sub-reality known as 'blue-space'."
id = "bluespace"
max_level = 7
rare = 2
/datum/tech/biotech
name = "Biological Technology"
desc = "Research into the deeper mysteries of life and organic substances."
id = "biotech"
max_level = 7
/datum/tech/combat
name = "Combat Systems Research"
desc = "The development of offensive and defensive systems."
id = "combat"
max_level = 7
/datum/tech/magnets
name = "Electromagnetic Spectrum Research"
desc = "Research into the electromagnetic spectrum. No clue how they actually work, though."
id = "magnets"
max_level = 7
/datum/tech/programming
name = "Data Theory Research"
desc = "The development of new computer and artificial intelligence and data storage systems."
id = "programming"
max_level = 7
/datum/tech/toxins //not meant to be raised by deconstruction, do not give objects toxins as an origin_tech
name = "Toxins Research"
desc = "Research into plasma based explosive devices. Upgrade through testing explosives in the toxins lab."
id = "toxins"
max_level = 7
rare = 2
/datum/tech/syndicate
name = "Illegal Technologies Research"
desc = "The study of technologies that violate standard Nanotrasen regulations."
id = "syndicate"
max_level = 0 // Don't count towards maxed research, since it's illegal.
rare = 4
/datum/tech/abductor
name = "Alien Technologies Research"
desc = "The study of technologies used by the advanced alien race known as Abductors."
id = "abductor"
rare = 5
level = 0
/*
datum/tech/arcane
name = "Arcane Research"
desc = "Research into the occult and arcane field for use in practical science"
id = "arcane"
level = 0 //It didn't become "secret" as advertised.
//Branch Techs
datum/tech/explosives
name = "Explosives Research"
desc = "The creation and application of explosive materials."
id = "explosives"
req_tech = list("materials" = 3)
datum/tech/generators
name = "Power Generation Technology"
desc = "Research into more powerful and more reliable sources."
id = "generators"
req_tech = list("powerstorage" = 2)
datum/tech/robotics
name = "Robotics Technology"
desc = "The development of advanced automated, autonomous machines."
id = "robotics"
req_tech = list("materials" = 3, "programming" = 3)
*/
/datum/tech/proc/getCost(var/current_level = null)
// Calculates tech disk's supply points sell cost
if(!current_level)
current_level = initial(level)
if(current_level >= level)
return 0
var/cost = 0
for(var/i=current_level+1, i<=level, i++)
if(i == initial(level))
continue
cost += i*5*rare
return cost
/obj/item/disk/tech_disk
name = "\improper Technology Disk"
desc = "A disk for storing technology data for further research."
icon_state = "datadisk2"
materials = list(MAT_METAL=30, MAT_GLASS=10)
var/datum/tech/stored
var/default_name = "\improper Technology Disk"
var/default_desc = "A disk for storing technology data for further research."
/obj/item/disk/tech_disk/New()
..()
src.pixel_x = rand(-5.0, 5)
src.pixel_y = rand(-5.0, 5)
/obj/item/disk/tech_disk/proc/load_tech(datum/tech/T)
name = "[default_name] \[[T]\]"
desc = T.desc + " Level: '[T.level]'"
// NOTE: This is just a reference to the tech on the system it grabbed it from
// This seems highly fragile
stored = T
/obj/item/disk/tech_disk/proc/wipe_tech()
name = default_name
desc = default_desc
stored = null
/obj/item/disk/design_disk
name = "\improper Component Design Disk"
desc = "A disk for storing device design data for construction in lathes."
icon_state = "datadisk2"
materials = list(MAT_METAL=100, MAT_GLASS=100)
var/datum/design/blueprint
// I'm doing this so that disk paths with pre-loaded designs don't get weird names
// Otherwise, I'd use "initial()"
var/default_name = "\improper Component Design Disk"
var/default_desc = "A disk for storing device design data for construction in lathes."
/obj/item/disk/design_disk/New()
..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
/obj/item/disk/design_disk/proc/load_blueprint(datum/design/D)
name = "[default_name] \[[D]\]"
desc = D.desc
// NOTE: This is just a reference to the design on the system it grabbed it from
// This seems highly fragile
blueprint = D
/obj/item/disk/design_disk/proc/wipe_blueprint()
name = default_name
desc = default_desc
blueprint = null
/obj/item/disk/design_disk/golem_shell
name = "golem creation disk"
desc = "A gift from the Liberator."
icon_state = "datadisk1"
/obj/item/disk/design_disk/golem_shell/Initialize()
. = ..()
var/datum/design/golem_shell/G = new
blueprint = G
/*
General Explination:
The research datum is the "folder" where all the research information is stored in a R&D console. It's also a holder for all the
various procs used to manipulate it. It has four variables and seven procs:
Variables:
- possible_tech is a list of all the /datum/tech that can potentially be researched by the player. The RefreshResearch() proc
(explained later) only goes through those when refreshing what you know. Generally, possible_tech contains ALL of the existing tech
but it is possible to add tech to the game that DON'T start in it (example: Xeno tech). Generally speaking, you don't want to mess
with these since they should be the default version of the datums. They're actually stored in a list rather then using typesof to
refer to them since it makes it a bit easier to search through them for specific information.
- know_tech is the companion list to possible_tech. It's the tech you can actually research and improve. Until it's added to this
list, it can't be improved. All the tech in this list are visible to the player.
- possible_designs is functionally identical to possbile_tech except it's for /datum/design.
- known_designs is functionally identical to known_tech except it's for /datum/design
Procs:
- TechHasReqs: Used by other procs (specifically RefreshResearch) to see whether all of a tech's requirements are currently in
known_tech and at a high enough level.
- DesignHasReqs: Same as TechHasReqs but for /datum/design and known_design.
- AddTech2Known: Adds a /datum/tech to known_tech. It checks to see whether it already has that tech (if so, it just replaces it). If
it doesn't have it, it adds it. Note: It does NOT check possible_tech at all. So if you want to add something strange to it (like
a player made tech?) you can.
- AddDesign2Known: Same as AddTech2Known except for /datum/design and known_designs.
- RefreshResearch: This is the workhorse of the R&D system. It updates the /datum/research holder and adds any unlocked tech paths
and designs you have reached the requirements for. It only checks through possible_tech and possible_designs, however, so it won't
accidentally add "secret" tech to it.
- UpdateTech is used as part of the actual researching process. It takes an ID and finds techs with that same ID in known_tech. When
it finds it, it checks to see whether it can improve it at all. If the known_tech's level is less then or equal to
the inputted level, it increases the known tech's level to the inputted level -1 or know tech's level +1 (whichever is higher).
The tech datums are the actual "tech trees" that you improve through researching. Each one has five variables:
- Name: Pretty obvious. This is often viewable to the players.
- Desc: Pretty obvious. Also player viewable.
- ID: This is the unique ID of the tech that is used by the various procs to find and/or maniuplate it.
- Level: This is the current level of the tech. All techs start at 1 and have a max of 20. Devices and some techs require a certain
level in specific techs before you can produce them.
- Req_tech: This is a list of the techs required to unlock this tech path. If left blank, it'll automatically be loaded into the
research holder datum.
*/
/***************************************************************
** Master Types **
** Includes all the helper procs and basic tech processing. **
***************************************************************/
/datum/research //Holder for all the existing, archived, and known tech. Individual to console.
//Datum/tech go here.
// Possible is a list of direct datum references
// known is a list of id -> datum mappings
var/list/possible_tech = list() //List of all tech in the game that players have access to (barring special events).
var/list/known_tech = list() //List of locally known tech.
var/list/possible_designs = list() //List of all designs
var/list/known_designs = list() //List of available designs
/datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated.
// MON DIEU!!!
// These are semi-global, but not TOTALLY global?
// Using research disks, you can get techs/designs from one research datum
// onto another. What consequences this could have, I am presently unsure, but
// I imagine nothing good.
for(var/T in subtypesof(/datum/tech))
possible_tech += new T(src)
for(var/D in subtypesof(/datum/design))
possible_designs += new D(src)
RefreshResearch()
//Checks to see if tech has all the required pre-reqs.
//Input: datum/tech; Output: 0/1 (false/true)
/datum/research/proc/TechHasReqs(var/datum/tech/T)
if(T.req_tech.len == 0)
return TRUE
for(var/req in T.req_tech)
var/datum/tech/known = known_tech[req]
if(!known || known.level < T.req_tech[req])
return FALSE
return TRUE
//Checks to see if design has all the required pre-reqs.
//Input: datum/design; Output: 0/1 (false/true)
/datum/research/proc/DesignHasReqs(var/datum/design/D)
if(D.req_tech.len == 0)
return TRUE
for(var/req in D.req_tech)
var/datum/tech/known = known_tech[req]
if(!known || known.level < D.req_tech[req])
return FALSE
return TRUE
//Adds a tech to known_tech list. Checks to make sure there aren't duplicates and updates existing tech's levels if needed.
//Input: datum/tech; Output: Null
/datum/research/proc/AddTech2Known(var/datum/tech/T)
if(T.id in known_tech)
var/datum/tech/known = known_tech[T.id]
if(T.level > known.level)
known.level = T.level
return
known_tech[T.id] = T
/datum/research/proc/AddDesign2Known(var/datum/design/D)
if(D.id in known_designs)
return
// Global datums make me nervous
known_designs[D.id] = D
//Refreshes known_tech and known_designs list.
//Input/Output: n/a
/datum/research/proc/RefreshResearch()
for(var/datum/tech/PT in possible_tech)
if(TechHasReqs(PT))
AddTech2Known(PT)
for(var/datum/design/PD in possible_designs)
if(DesignHasReqs(PD))
AddDesign2Known(PD)
for(var/v in known_tech)
var/datum/tech/T = known_tech[v]
T.level = Clamp(T.level, 0, 20)
//Refreshes the levels of a given tech.
//Input: Tech's ID and Level; Output: null
/datum/research/proc/UpdateTech(var/ID, var/level)
var/datum/tech/KT = known_tech[ID]
if(KT)
if(KT.level <= level)
// Will bump the tech to (value_of_target) automatically -
// after that it'll bump it up by 1 until it's greater
// than the source tech
KT.level = max((KT.level + 1), level)
//Checks if the origin level can raise current tech levels
//Input: Tech's ID and Level; Output: TRUE for yes, FALSE for no
/datum/research/proc/IsTechHigher(ID, level)
var/datum/tech/KT = known_tech[ID]
if(KT)
if(KT.level <= level)
return TRUE
else
return FALSE
/datum/research/proc/FindDesignByID(var/id)
return known_designs[id]
// A common task is for one research datum to copy over its techs and designs
// and update them on another research datum.
// Arguments:
// `other` - The research datum to send designs and techs to
/datum/research/proc/push_data(datum/research/other)
for(var/v in known_tech)
var/datum/tech/T = known_tech[v]
other.AddTech2Known(T)
for(var/v in known_designs)
var/datum/design/D = known_designs[v]
other.AddDesign2Known(D)
other.RefreshResearch()
//Autolathe files
/datum/research/autolathe
/datum/research/autolathe/DesignHasReqs(var/datum/design/D)
return D && (D.build_type & AUTOLATHE) && ("initial" in D.category)
/datum/research/autolathe/AddDesign2Known(var/datum/design/D)
if(!(D.build_type & AUTOLATHE))
return
..()
//Biogenerator files
/datum/research/biogenerator/New()
for(var/T in (subtypesof(/datum/tech)))
possible_tech += new T(src)
for(var/path in subtypesof(/datum/design))
var/datum/design/D = new path(src)
possible_designs += D
if((D.build_type & BIOGENERATOR) && ("initial" in D.category))
AddDesign2Known(D)
/datum/research/biogenerator/AddDesign2Known(datum/design/D)
if(!(D.build_type & BIOGENERATOR))
return
..()
//Smelter files
/datum/research/smelter/New()
for(var/T in (subtypesof(/datum/tech)))
possible_tech += new T(src)
for(var/path in subtypesof(/datum/design))
var/datum/design/D = new path(src)
possible_designs += D
if((D.build_type & SMELTER) && ("initial" in D.category))
AddDesign2Known(D)
/datum/research/smelter/AddDesign2Known(datum/design/D)
if(!(D.build_type & SMELTER))
return
..()
/***************************************************************
** Technology Datums **
** Includes all the various technoliges and what they make. **
***************************************************************/
/datum/tech //Datum of individual technologies.
var/name = "name" //Name of the technology.
var/desc = "description" //General description of what it does and what it makes.
var/id = "id" //An easily referenced ID. Must be alphanumeric, lower-case, and no symbols.
var/level = 1 //A simple number scale of the research level. Level 0 = Secret tech.
var/max_level = 1 // Maximum level this can be at (for job objectives)
var/rare = 1 //How much CentCom wants to get that tech. Used in supply shuttle tech cost calculation.
var/list/req_tech = list() //List of ids associated values of techs required to research this tech. "id" = #
//Trunk Technologies (don't require any other techs and you start knowning them).
/datum/tech/materials
name = "Materials Research"
desc = "Development of new and improved materials."
id = "materials"
max_level = 7
/datum/tech/engineering
name = "Engineering Research"
desc = "Development of new and improved engineering parts and methods."
id = "engineering"
max_level = 7
/datum/tech/plasmatech
name = "Plasma Research"
desc = "Research into the mysterious substance colloqually known as 'plasma'."
id = "plasmatech"
max_level = 7
rare = 3
/datum/tech/powerstorage
name = "Power Manipulation Technology"
desc = "The various technologies behind the storage and generation of electicity."
id = "powerstorage"
max_level = 7
/datum/tech/bluespace
name = "'Blue-space' Research"
desc = "Research into the sub-reality known as 'blue-space'."
id = "bluespace"
max_level = 7
rare = 2
/datum/tech/biotech
name = "Biological Technology"
desc = "Research into the deeper mysteries of life and organic substances."
id = "biotech"
max_level = 7
/datum/tech/combat
name = "Combat Systems Research"
desc = "The development of offensive and defensive systems."
id = "combat"
max_level = 7
/datum/tech/magnets
name = "Electromagnetic Spectrum Research"
desc = "Research into the electromagnetic spectrum. No clue how they actually work, though."
id = "magnets"
max_level = 7
/datum/tech/programming
name = "Data Theory Research"
desc = "The development of new computer and artificial intelligence and data storage systems."
id = "programming"
max_level = 7
/datum/tech/toxins //not meant to be raised by deconstruction, do not give objects toxins as an origin_tech
name = "Toxins Research"
desc = "Research into plasma based explosive devices. Upgrade through testing explosives in the toxins lab."
id = "toxins"
max_level = 7
rare = 2
/datum/tech/syndicate
name = "Illegal Technologies Research"
desc = "The study of technologies that violate standard Nanotrasen regulations."
id = "syndicate"
max_level = 0 // Don't count towards maxed research, since it's illegal.
rare = 4
/datum/tech/abductor
name = "Alien Technologies Research"
desc = "The study of technologies used by the advanced alien race known as Abductors."
id = "abductor"
rare = 5
level = 0
/*
datum/tech/arcane
name = "Arcane Research"
desc = "Research into the occult and arcane field for use in practical science"
id = "arcane"
level = 0 //It didn't become "secret" as advertised.
//Branch Techs
datum/tech/explosives
name = "Explosives Research"
desc = "The creation and application of explosive materials."
id = "explosives"
req_tech = list("materials" = 3)
datum/tech/generators
name = "Power Generation Technology"
desc = "Research into more powerful and more reliable sources."
id = "generators"
req_tech = list("powerstorage" = 2)
datum/tech/robotics
name = "Robotics Technology"
desc = "The development of advanced automated, autonomous machines."
id = "robotics"
req_tech = list("materials" = 3, "programming" = 3)
*/
/datum/tech/proc/getCost(var/current_level = null)
// Calculates tech disk's supply points sell cost
if(!current_level)
current_level = initial(level)
if(current_level >= level)
return 0
var/cost = 0
for(var/i=current_level+1, i<=level, i++)
if(i == initial(level))
continue
cost += i*5*rare
return cost
/obj/item/disk/tech_disk
name = "\improper Technology Disk"
desc = "A disk for storing technology data for further research."
icon_state = "datadisk2"
materials = list(MAT_METAL=30, MAT_GLASS=10)
var/datum/tech/stored
var/default_name = "\improper Technology Disk"
var/default_desc = "A disk for storing technology data for further research."
/obj/item/disk/tech_disk/New()
..()
src.pixel_x = rand(-5.0, 5)
src.pixel_y = rand(-5.0, 5)
/obj/item/disk/tech_disk/proc/load_tech(datum/tech/T)
name = "[default_name] \[[T]\]"
desc = T.desc + " Level: '[T.level]'"
// NOTE: This is just a reference to the tech on the system it grabbed it from
// This seems highly fragile
stored = T
/obj/item/disk/tech_disk/proc/wipe_tech()
name = default_name
desc = default_desc
stored = null
/obj/item/disk/design_disk
name = "\improper Component Design Disk"
desc = "A disk for storing device design data for construction in lathes."
icon_state = "datadisk2"
materials = list(MAT_METAL=100, MAT_GLASS=100)
var/datum/design/blueprint
// I'm doing this so that disk paths with pre-loaded designs don't get weird names
// Otherwise, I'd use "initial()"
var/default_name = "\improper Component Design Disk"
var/default_desc = "A disk for storing device design data for construction in lathes."
/obj/item/disk/design_disk/New()
..()
pixel_x = rand(-5, 5)
pixel_y = rand(-5, 5)
/obj/item/disk/design_disk/proc/load_blueprint(datum/design/D)
name = "[default_name] \[[D]\]"
desc = D.desc
// NOTE: This is just a reference to the design on the system it grabbed it from
// This seems highly fragile
blueprint = D
/obj/item/disk/design_disk/proc/wipe_blueprint()
name = default_name
desc = default_desc
blueprint = null
/obj/item/disk/design_disk/golem_shell
name = "golem creation disk"
desc = "A gift from the Liberator."
icon_state = "datadisk1"
/obj/item/disk/design_disk/golem_shell/Initialize()
. = ..()
var/datum/design/golem_shell/G = new
blueprint = G
+360 -360
View File
@@ -1,360 +1,360 @@
/obj/machinery/r_n_d/server
name = "R&D Server"
icon = 'icons/obj/machines/research.dmi'
icon_state = "server"
var/datum/research/files
var/health = 100
var/list/id_with_upload = list() //List of R&D consoles with upload to server access.
var/list/id_with_download = list() //List of R&D consoles with download from server access.
var/id_with_upload_string = "" //String versions for easy editing in map editor.
var/id_with_download_string = ""
var/server_id = 0
var/heat_gen = 100
var/heating_power = 40000
var/delay = 10
req_access = list(ACCESS_RD) //Only the R&D can change server settings.
var/plays_sound = 0
/obj/machinery/r_n_d/server/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/rdserver(null)
component_parts += new /obj/item/stock_parts/scanning_module(null)
component_parts += new /obj/item/stack/cable_coil(null,1)
component_parts += new /obj/item/stack/cable_coil(null,1)
RefreshParts()
initialize_serv(); //Agouri // fuck you agouri
/obj/machinery/r_n_d/server/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/rdserver(null)
component_parts += new /obj/item/stock_parts/scanning_module/phasic(null)
component_parts += new /obj/item/stack/cable_coil(null,1)
component_parts += new /obj/item/stack/cable_coil(null,1)
RefreshParts()
/obj/machinery/r_n_d/server/Destroy()
griefProtection()
return ..()
/obj/machinery/r_n_d/server/RefreshParts()
var/tot_rating = 0
for(var/obj/item/stock_parts/SP in src)
tot_rating += SP.rating
heat_gen /= max(1, tot_rating)
/obj/machinery/r_n_d/server/proc/initialize_serv()
if(!files)
files = new /datum/research(src)
var/list/temp_list
if(!id_with_upload.len)
temp_list = list()
temp_list = splittext(id_with_upload_string, ";")
for(var/N in temp_list)
id_with_upload += text2num(N)
if(!id_with_download.len)
temp_list = list()
temp_list = splittext(id_with_download_string, ";")
for(var/N in temp_list)
id_with_download += text2num(N)
/obj/machinery/r_n_d/server/process()
if(prob(3) && plays_sound)
playsound(loc, "computer_ambience", 50, 1)
var/datum/gas_mixture/environment = loc.return_air()
switch(environment.temperature)
if(0 to T0C)
health = min(100, health + 1)
if(T0C to (T20C + 20))
health = Clamp(health, 0, 100)
if((T20C + 20) to (T0C + 70))
health = max(0, health - 1)
if(health <= 0)
/*griefProtection() This seems to get called twice before running any code that deletes/damages the server or it's files anwyay.
refreshParts and the hasReq procs that get called by this are laggy and do not need to be called by every server on the map every tick */
var/updateRD = 0
files.known_designs = list()
for(var/v in files.known_tech)
var/datum/tech/T = files.known_tech[v]
// Slowly decrease research if health drops below 0
if(prob(1))
updateRD++
T.level--
if(updateRD)
files.RefreshResearch()
if(delay)
delay--
else
produce_heat(heat_gen)
delay = initial(delay)
/obj/machinery/r_n_d/server/emp_act(severity)
griefProtection()
..()
/obj/machinery/r_n_d/server/ex_act(severity)
griefProtection()
return ..()
/obj/machinery/r_n_d/server/blob_act(obj/structure/blob/B)
griefProtection()
return ..()
// Backup files to CentComm to help admins recover data after griefer attacks
/obj/machinery/r_n_d/server/proc/griefProtection()
for(var/obj/machinery/r_n_d/server/centcom/C in GLOB.machines)
files.push_data(C.files)
/obj/machinery/r_n_d/server/proc/produce_heat(heat_amt)
if(!(stat & (NOPOWER|BROKEN))) // Blatantly stolen from space heater.
var/turf/simulated/L = loc
if(istype(L))
var/datum/gas_mixture/env = L.return_air()
if(env.temperature < (heat_amt+T0C))
var/transfer_moles = 0.25 * env.total_moles()
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
var/heat_capacity = removed.heat_capacity()
if(heat_capacity == 0 || heat_capacity == null)
heat_capacity = 1
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
env.merge(removed)
air_update_turf()
/obj/machinery/r_n_d/server/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(disabled)
return
if(shocked)
shock(user,50)
if(istype(O, /obj/item/screwdriver))
default_deconstruction_screwdriver(user, "server_o", "server", O)
return 1
if(exchange_parts(user, O))
return 1
if(panel_open)
if(istype(O, /obj/item/crowbar))
griefProtection()
default_deconstruction_crowbar(user, O)
return 1
else
return ..()
/obj/machinery/r_n_d/server/attack_hand(mob/user as mob)
if(disabled)
return
if(shocked)
shock(user,50)
return
/obj/machinery/r_n_d/server/centcom
name = "CentComm. Central R&D Database"
server_id = -1
/obj/machinery/r_n_d/server/centcom/Initialize()
..()
var/list/no_id_servers = list()
var/list/server_ids = list()
for(var/obj/machinery/r_n_d/server/S in GLOB.machines)
switch(S.server_id)
if(-1)
continue
if(0)
no_id_servers += S
else
server_ids += S.server_id
for(var/obj/machinery/r_n_d/server/S in no_id_servers)
var/num = 1
while(!S.server_id)
if(num in server_ids)
num++
else
S.server_id = num
server_ids += num
no_id_servers -= S
/obj/machinery/r_n_d/server/centcom/process()
return PROCESS_KILL //don't need process()
/obj/machinery/computer/rdservercontrol
name = "\improper R&D server controller"
icon_screen = "rdcomp"
icon_keyboard = "rd_key"
light_color = LIGHT_COLOR_FADEDPURPLE
circuit = /obj/item/circuitboard/rdservercontrol
var/screen = 0
var/obj/machinery/r_n_d/server/temp_server
var/list/servers = list()
var/list/consoles = list()
var/badmin = 0
/obj/machinery/computer/rdservercontrol/Topic(href, href_list)
if(..())
return
add_fingerprint(usr)
usr.set_machine(src)
if(!src.allowed(usr) && !emagged)
to_chat(usr, "<span class='warning'>You do not have the required access level</span>")
return
if(href_list["main"])
screen = 0
else if(href_list["access"] || href_list["data"] || href_list["transfer"])
temp_server = null
consoles = list()
servers = list()
for(var/obj/machinery/r_n_d/server/S in GLOB.machines)
if(S.server_id == text2num(href_list["access"]) || S.server_id == text2num(href_list["data"]) || S.server_id == text2num(href_list["transfer"]))
temp_server = S
break
if(href_list["access"])
screen = 1
for(var/obj/machinery/computer/rdconsole/C in GLOB.machines)
if(C.sync)
consoles += C
else if(href_list["data"])
screen = 2
else if(href_list["transfer"])
screen = 3
for(var/obj/machinery/r_n_d/server/S in GLOB.machines)
if(S == src)
continue
servers += S
else if(href_list["upload_toggle"])
var/num = text2num(href_list["upload_toggle"])
if(num in temp_server.id_with_upload)
temp_server.id_with_upload -= num
else
temp_server.id_with_upload += num
else if(href_list["download_toggle"])
var/num = text2num(href_list["download_toggle"])
if(num in temp_server.id_with_download)
temp_server.id_with_download -= num
else
temp_server.id_with_download += num
else if(href_list["reset_tech"])
var/choice = alert("Technology Data Reset", "Are you sure you want to reset this technology to its default data? Data lost cannot be recovered.", "Continue", "Cancel")
if(choice == "Continue")
for(var/I in temp_server.files.known_tech)
var/datum/tech/T = temp_server.files.known_tech[I]
if(T.id == href_list["reset_tech"])
T.level = 1
break
temp_server.files.RefreshResearch()
else if(href_list["reset_design"])
var/choice = alert("Design Data Deletion", "Are you sure you want to delete this design? Data lost cannot be recovered.", "Continue", "Cancel")
if(choice == "Continue")
for(var/I in temp_server.files.known_designs)
var/datum/design/D = temp_server.files.known_designs[I]
if(D.id == href_list["reset_design"])
temp_server.files.known_designs -= D.id
break
temp_server.files.RefreshResearch()
updateUsrDialog()
return
/obj/machinery/computer/rdservercontrol/attack_hand(mob/user as mob)
if(stat & (BROKEN|NOPOWER))
return
user.set_machine(src)
var/dat = ""
switch(screen)
if(0) //Main Menu
dat += "Connected Servers:<BR><BR>"
for(var/obj/machinery/r_n_d/server/S in GLOB.machines)
if(istype(S, /obj/machinery/r_n_d/server/centcom) && !badmin)
continue
dat += "[S.name] || "
dat += "<A href='?src=[UID()];access=[S.server_id]'>Access Rights</A> | "
dat += "<A href='?src=[UID()];data=[S.server_id]'>Data Management</A>"
if(badmin) dat += " | <A href='?src=[UID()];transfer=[S.server_id]'>Server-to-Server Transfer</A>"
dat += "<BR>"
if(1) //Access rights menu
dat += "[temp_server.name] Access Rights<BR><BR>"
dat += "Consoles with Upload Access<BR>"
for(var/obj/machinery/computer/rdconsole/C in consoles)
var/turf/console_turf = get_turf(C)
dat += "* <A href='?src=[UID()];upload_toggle=[C.id]'>[console_turf.loc]" //FYI, these are all numeric ids, eventually.
if(C.id in temp_server.id_with_upload)
dat += " (Remove)</A><BR>"
else
dat += " (Add)</A><BR>"
dat += "Consoles with Download Access<BR>"
for(var/obj/machinery/computer/rdconsole/C in consoles)
var/turf/console_turf = get_turf(C)
dat += "* <A href='?src=[UID()];download_toggle=[C.id]'>[console_turf.loc]"
if(C.id in temp_server.id_with_download)
dat += " (Remove)</A><BR>"
else
dat += " (Add)</A><BR>"
dat += "<HR><A href='?src=[UID()];main=1'>Main Menu</A>"
if(2) //Data Management menu
dat += "[temp_server.name] Data Management<BR><BR>"
dat += "Known Technologies<BR>"
for(var/I in temp_server.files.known_tech)
var/datum/tech/T = temp_server.files.known_tech[I]
if(T.level <= 0)
continue
dat += "* [T.name] "
dat += "<A href='?src=[UID()];reset_tech=[T.id]'>(Reset)</A><BR>" //FYI, these are all strings.
dat += "Known Designs<BR>"
for(var/I in temp_server.files.known_designs)
var/datum/design/D = temp_server.files.known_designs[I]
dat += "* [D.name] "
dat += "<A href='?src=[UID()];reset_design=[D.id]'>(Delete)</A><BR>"
dat += "<HR><A href='?src=[UID()];main=1'>Main Menu</A>"
if(3) //Server Data Transfer
dat += "[temp_server.name] Server to Server Transfer<BR><BR>"
dat += "Send Data to what server?<BR>"
for(var/obj/machinery/r_n_d/server/S in servers)
dat += "[S.name] <A href='?src=[UID()];send_to=[S.server_id]'> (Transfer)</A><BR>"
dat += "<HR><A href='?src=[UID()];main=1'>Main Menu</A>"
user << browse("<TITLE>R&D Server Control</TITLE><HR>[dat]", "window=server_control;size=575x400")
onclose(user, "server_control")
return
/obj/machinery/computer/rdservercontrol/emag_act(user as mob)
if(!emagged)
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
emagged = 1
to_chat(user, "<span class='notice'>You you disable the security protocols</span>")
src.updateUsrDialog()
/obj/machinery/r_n_d/server/core
name = "Core R&D Server"
id_with_upload_string = "1;3"
id_with_download_string = "1;3"
server_id = 1
plays_sound = 1
/obj/machinery/r_n_d/server/robotics
name = "Robotics and Mechanic R&D Server"
id_with_upload_string = "1;2;4"
id_with_download_string = "1;2;4"
server_id = 2
/obj/machinery/r_n_d/server
name = "R&D Server"
icon = 'icons/obj/machines/research.dmi'
icon_state = "server"
var/datum/research/files
var/health = 100
var/list/id_with_upload = list() //List of R&D consoles with upload to server access.
var/list/id_with_download = list() //List of R&D consoles with download from server access.
var/id_with_upload_string = "" //String versions for easy editing in map editor.
var/id_with_download_string = ""
var/server_id = 0
var/heat_gen = 100
var/heating_power = 40000
var/delay = 10
req_access = list(ACCESS_RD) //Only the R&D can change server settings.
var/plays_sound = 0
/obj/machinery/r_n_d/server/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/rdserver(null)
component_parts += new /obj/item/stock_parts/scanning_module(null)
component_parts += new /obj/item/stack/cable_coil(null,1)
component_parts += new /obj/item/stack/cable_coil(null,1)
RefreshParts()
initialize_serv(); //Agouri // fuck you agouri
/obj/machinery/r_n_d/server/upgraded/New()
..()
component_parts = list()
component_parts += new /obj/item/circuitboard/rdserver(null)
component_parts += new /obj/item/stock_parts/scanning_module/phasic(null)
component_parts += new /obj/item/stack/cable_coil(null,1)
component_parts += new /obj/item/stack/cable_coil(null,1)
RefreshParts()
/obj/machinery/r_n_d/server/Destroy()
griefProtection()
return ..()
/obj/machinery/r_n_d/server/RefreshParts()
var/tot_rating = 0
for(var/obj/item/stock_parts/SP in src)
tot_rating += SP.rating
heat_gen /= max(1, tot_rating)
/obj/machinery/r_n_d/server/proc/initialize_serv()
if(!files)
files = new /datum/research(src)
var/list/temp_list
if(!id_with_upload.len)
temp_list = list()
temp_list = splittext(id_with_upload_string, ";")
for(var/N in temp_list)
id_with_upload += text2num(N)
if(!id_with_download.len)
temp_list = list()
temp_list = splittext(id_with_download_string, ";")
for(var/N in temp_list)
id_with_download += text2num(N)
/obj/machinery/r_n_d/server/process()
if(prob(3) && plays_sound)
playsound(loc, "computer_ambience", 50, 1)
var/datum/gas_mixture/environment = loc.return_air()
switch(environment.temperature)
if(0 to T0C)
health = min(100, health + 1)
if(T0C to (T20C + 20))
health = Clamp(health, 0, 100)
if((T20C + 20) to (T0C + 70))
health = max(0, health - 1)
if(health <= 0)
/*griefProtection() This seems to get called twice before running any code that deletes/damages the server or it's files anwyay.
refreshParts and the hasReq procs that get called by this are laggy and do not need to be called by every server on the map every tick */
var/updateRD = 0
files.known_designs = list()
for(var/v in files.known_tech)
var/datum/tech/T = files.known_tech[v]
// Slowly decrease research if health drops below 0
if(prob(1))
updateRD++
T.level--
if(updateRD)
files.RefreshResearch()
if(delay)
delay--
else
produce_heat(heat_gen)
delay = initial(delay)
/obj/machinery/r_n_d/server/emp_act(severity)
griefProtection()
..()
/obj/machinery/r_n_d/server/ex_act(severity)
griefProtection()
return ..()
/obj/machinery/r_n_d/server/blob_act(obj/structure/blob/B)
griefProtection()
return ..()
// Backup files to CentComm to help admins recover data after griefer attacks
/obj/machinery/r_n_d/server/proc/griefProtection()
for(var/obj/machinery/r_n_d/server/centcom/C in GLOB.machines)
files.push_data(C.files)
/obj/machinery/r_n_d/server/proc/produce_heat(heat_amt)
if(!(stat & (NOPOWER|BROKEN))) // Blatantly stolen from space heater.
var/turf/simulated/L = loc
if(istype(L))
var/datum/gas_mixture/env = L.return_air()
if(env.temperature < (heat_amt+T0C))
var/transfer_moles = 0.25 * env.total_moles()
var/datum/gas_mixture/removed = env.remove(transfer_moles)
if(removed)
var/heat_capacity = removed.heat_capacity()
if(heat_capacity == 0 || heat_capacity == null)
heat_capacity = 1
removed.temperature = min((removed.temperature*heat_capacity + heating_power)/heat_capacity, 1000)
env.merge(removed)
air_update_turf()
/obj/machinery/r_n_d/server/attackby(var/obj/item/O as obj, var/mob/user as mob, params)
if(disabled)
return
if(shocked)
shock(user,50)
if(istype(O, /obj/item/screwdriver))
default_deconstruction_screwdriver(user, "server_o", "server", O)
return 1
if(exchange_parts(user, O))
return 1
if(panel_open)
if(istype(O, /obj/item/crowbar))
griefProtection()
default_deconstruction_crowbar(user, O)
return 1
else
return ..()
/obj/machinery/r_n_d/server/attack_hand(mob/user as mob)
if(disabled)
return
if(shocked)
shock(user,50)
return
/obj/machinery/r_n_d/server/centcom
name = "CentComm. Central R&D Database"
server_id = -1
/obj/machinery/r_n_d/server/centcom/Initialize()
..()
var/list/no_id_servers = list()
var/list/server_ids = list()
for(var/obj/machinery/r_n_d/server/S in GLOB.machines)
switch(S.server_id)
if(-1)
continue
if(0)
no_id_servers += S
else
server_ids += S.server_id
for(var/obj/machinery/r_n_d/server/S in no_id_servers)
var/num = 1
while(!S.server_id)
if(num in server_ids)
num++
else
S.server_id = num
server_ids += num
no_id_servers -= S
/obj/machinery/r_n_d/server/centcom/process()
return PROCESS_KILL //don't need process()
/obj/machinery/computer/rdservercontrol
name = "\improper R&D server controller"
icon_screen = "rdcomp"
icon_keyboard = "rd_key"
light_color = LIGHT_COLOR_FADEDPURPLE
circuit = /obj/item/circuitboard/rdservercontrol
var/screen = 0
var/obj/machinery/r_n_d/server/temp_server
var/list/servers = list()
var/list/consoles = list()
var/badmin = 0
/obj/machinery/computer/rdservercontrol/Topic(href, href_list)
if(..())
return
add_fingerprint(usr)
usr.set_machine(src)
if(!src.allowed(usr) && !emagged)
to_chat(usr, "<span class='warning'>You do not have the required access level</span>")
return
if(href_list["main"])
screen = 0
else if(href_list["access"] || href_list["data"] || href_list["transfer"])
temp_server = null
consoles = list()
servers = list()
for(var/obj/machinery/r_n_d/server/S in GLOB.machines)
if(S.server_id == text2num(href_list["access"]) || S.server_id == text2num(href_list["data"]) || S.server_id == text2num(href_list["transfer"]))
temp_server = S
break
if(href_list["access"])
screen = 1
for(var/obj/machinery/computer/rdconsole/C in GLOB.machines)
if(C.sync)
consoles += C
else if(href_list["data"])
screen = 2
else if(href_list["transfer"])
screen = 3
for(var/obj/machinery/r_n_d/server/S in GLOB.machines)
if(S == src)
continue
servers += S
else if(href_list["upload_toggle"])
var/num = text2num(href_list["upload_toggle"])
if(num in temp_server.id_with_upload)
temp_server.id_with_upload -= num
else
temp_server.id_with_upload += num
else if(href_list["download_toggle"])
var/num = text2num(href_list["download_toggle"])
if(num in temp_server.id_with_download)
temp_server.id_with_download -= num
else
temp_server.id_with_download += num
else if(href_list["reset_tech"])
var/choice = alert("Technology Data Reset", "Are you sure you want to reset this technology to its default data? Data lost cannot be recovered.", "Continue", "Cancel")
if(choice == "Continue")
for(var/I in temp_server.files.known_tech)
var/datum/tech/T = temp_server.files.known_tech[I]
if(T.id == href_list["reset_tech"])
T.level = 1
break
temp_server.files.RefreshResearch()
else if(href_list["reset_design"])
var/choice = alert("Design Data Deletion", "Are you sure you want to delete this design? Data lost cannot be recovered.", "Continue", "Cancel")
if(choice == "Continue")
for(var/I in temp_server.files.known_designs)
var/datum/design/D = temp_server.files.known_designs[I]
if(D.id == href_list["reset_design"])
temp_server.files.known_designs -= D.id
break
temp_server.files.RefreshResearch()
updateUsrDialog()
return
/obj/machinery/computer/rdservercontrol/attack_hand(mob/user as mob)
if(stat & (BROKEN|NOPOWER))
return
user.set_machine(src)
var/dat = ""
switch(screen)
if(0) //Main Menu
dat += "Connected Servers:<BR><BR>"
for(var/obj/machinery/r_n_d/server/S in GLOB.machines)
if(istype(S, /obj/machinery/r_n_d/server/centcom) && !badmin)
continue
dat += "[S.name] || "
dat += "<A href='?src=[UID()];access=[S.server_id]'>Access Rights</A> | "
dat += "<A href='?src=[UID()];data=[S.server_id]'>Data Management</A>"
if(badmin) dat += " | <A href='?src=[UID()];transfer=[S.server_id]'>Server-to-Server Transfer</A>"
dat += "<BR>"
if(1) //Access rights menu
dat += "[temp_server.name] Access Rights<BR><BR>"
dat += "Consoles with Upload Access<BR>"
for(var/obj/machinery/computer/rdconsole/C in consoles)
var/turf/console_turf = get_turf(C)
dat += "* <A href='?src=[UID()];upload_toggle=[C.id]'>[console_turf.loc]" //FYI, these are all numeric ids, eventually.
if(C.id in temp_server.id_with_upload)
dat += " (Remove)</A><BR>"
else
dat += " (Add)</A><BR>"
dat += "Consoles with Download Access<BR>"
for(var/obj/machinery/computer/rdconsole/C in consoles)
var/turf/console_turf = get_turf(C)
dat += "* <A href='?src=[UID()];download_toggle=[C.id]'>[console_turf.loc]"
if(C.id in temp_server.id_with_download)
dat += " (Remove)</A><BR>"
else
dat += " (Add)</A><BR>"
dat += "<HR><A href='?src=[UID()];main=1'>Main Menu</A>"
if(2) //Data Management menu
dat += "[temp_server.name] Data Management<BR><BR>"
dat += "Known Technologies<BR>"
for(var/I in temp_server.files.known_tech)
var/datum/tech/T = temp_server.files.known_tech[I]
if(T.level <= 0)
continue
dat += "* [T.name] "
dat += "<A href='?src=[UID()];reset_tech=[T.id]'>(Reset)</A><BR>" //FYI, these are all strings.
dat += "Known Designs<BR>"
for(var/I in temp_server.files.known_designs)
var/datum/design/D = temp_server.files.known_designs[I]
dat += "* [D.name] "
dat += "<A href='?src=[UID()];reset_design=[D.id]'>(Delete)</A><BR>"
dat += "<HR><A href='?src=[UID()];main=1'>Main Menu</A>"
if(3) //Server Data Transfer
dat += "[temp_server.name] Server to Server Transfer<BR><BR>"
dat += "Send Data to what server?<BR>"
for(var/obj/machinery/r_n_d/server/S in servers)
dat += "[S.name] <A href='?src=[UID()];send_to=[S.server_id]'> (Transfer)</A><BR>"
dat += "<HR><A href='?src=[UID()];main=1'>Main Menu</A>"
user << browse("<TITLE>R&D Server Control</TITLE><HR>[dat]", "window=server_control;size=575x400")
onclose(user, "server_control")
return
/obj/machinery/computer/rdservercontrol/emag_act(user as mob)
if(!emagged)
playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
emagged = 1
to_chat(user, "<span class='notice'>You you disable the security protocols</span>")
src.updateUsrDialog()
/obj/machinery/r_n_d/server/core
name = "Core R&D Server"
id_with_upload_string = "1;3"
id_with_download_string = "1;3"
server_id = 1
plays_sound = 1
/obj/machinery/r_n_d/server/robotics
name = "Robotics and Mechanic R&D Server"
id_with_upload_string = "1;2;4"
id_with_download_string = "1;2;4"
server_id = 2