mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
- Standardized the code in code/modules/research
git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4243 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -13,91 +13,91 @@ Note: Must be placed within 3 tiles of the R&D Console
|
||||
var/obj/item/weapon/loaded_item = null
|
||||
var/decon_mod = 1
|
||||
|
||||
New()
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/destructive_analyzer(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/scanning_module(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(src)
|
||||
RefreshParts()
|
||||
|
||||
/obj/machinery/r_n_d/destructive_analyzer/New()
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/destructive_analyzer(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/scanning_module(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/micro_laser(src)
|
||||
RefreshParts()
|
||||
var/T = 0
|
||||
for(var/obj/item/weapon/stock_parts/S in src)
|
||||
T += S.rating * 0.1
|
||||
T = between (0, T, 1)
|
||||
decon_mod = T
|
||||
|
||||
meteorhit()
|
||||
del(src)
|
||||
/obj/machinery/r_n_d/destructive_analyzer/RefreshParts()
|
||||
var/T = 0
|
||||
for(var/obj/item/weapon/stock_parts/S in src)
|
||||
T += S.rating * 0.1
|
||||
T = between (0, T, 1)
|
||||
decon_mod = T
|
||||
|
||||
/obj/machinery/r_n_d/destructive_analyzer/meteorhit()
|
||||
del(src)
|
||||
return
|
||||
|
||||
/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/O as obj, var/mob/user as mob)
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if (istype(O, /obj/item/weapon/screwdriver))
|
||||
if (!opened)
|
||||
opened = 1
|
||||
if(linked_console)
|
||||
linked_console.linked_destroy = null
|
||||
linked_console = null
|
||||
icon_state = "d_analyzer_t"
|
||||
user << "You open the maintenance hatch of [src]."
|
||||
else
|
||||
opened = 0
|
||||
icon_state = "d_analyzer"
|
||||
user << "You close the maintenance hatch of [src]."
|
||||
return
|
||||
|
||||
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
|
||||
|
||||
|
||||
attackby(var/obj/O as obj, var/mob/user as mob)
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if (istype(O, /obj/item/weapon/screwdriver))
|
||||
if (!opened)
|
||||
opened = 1
|
||||
if(linked_console)
|
||||
linked_console.linked_destroy = null
|
||||
linked_console = null
|
||||
icon_state = "d_analyzer_t"
|
||||
user << "You open the maintenance hatch of [src]."
|
||||
else
|
||||
opened = 0
|
||||
icon_state = "d_analyzer"
|
||||
user << "You close the maintenance hatch of [src]."
|
||||
return
|
||||
if (opened)
|
||||
if(istype(O, /obj/item/weapon/crowbar))
|
||||
playsound(src.loc, 'Crowbar.ogg', 50, 1)
|
||||
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
|
||||
M.state = 2
|
||||
M.icon_state = "box_1"
|
||||
for(var/obj/I in component_parts)
|
||||
I.loc = src.loc
|
||||
del(src)
|
||||
return 1
|
||||
else
|
||||
user << "\red You can't load the [src.name] while it's opened."
|
||||
return 1
|
||||
if (disabled)
|
||||
return
|
||||
if (!linked_console)
|
||||
user << "\red The protolathe must be linked to an R&D console first!"
|
||||
return
|
||||
if (busy)
|
||||
user << "\red The protolathe is busy right now."
|
||||
return
|
||||
if (istype(O, /obj/item) && !loaded_item)
|
||||
if(!O.origin_tech)
|
||||
user << "\red This doesn't seem to have a tech origin!"
|
||||
return
|
||||
var/list/temp_tech = ConvertReqString2List(O.origin_tech)
|
||||
if (temp_tech.len == 0)
|
||||
user << "\red You cannot deconstruct this item!"
|
||||
return
|
||||
if(O.reliability < 90 && O.crit_fail == 0)
|
||||
usr << "\red Item is neither reliable enough or broken enough to learn from."
|
||||
return
|
||||
busy = 1
|
||||
loaded_item = O
|
||||
user.drop_item()
|
||||
O.loc = src
|
||||
user << "\blue You add the [O.name] to the machine!"
|
||||
flick("d_analyzer_la", src)
|
||||
spawn(10)
|
||||
icon_state = "d_analyzer_l"
|
||||
busy = 0
|
||||
if (opened)
|
||||
if(istype(O, /obj/item/weapon/crowbar))
|
||||
playsound(src.loc, 'Crowbar.ogg', 50, 1)
|
||||
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
|
||||
M.state = 2
|
||||
M.icon_state = "box_1"
|
||||
for(var/obj/I in component_parts)
|
||||
I.loc = src.loc
|
||||
del(src)
|
||||
return 1
|
||||
else
|
||||
user << "\red You can't load the [src.name] while it's opened."
|
||||
return 1
|
||||
if (disabled)
|
||||
return
|
||||
if (!linked_console)
|
||||
user << "\red The protolathe must be linked to an R&D console first!"
|
||||
return
|
||||
if (busy)
|
||||
user << "\red The protolathe is busy right now."
|
||||
return
|
||||
if (istype(O, /obj/item) && !loaded_item)
|
||||
if(!O.origin_tech)
|
||||
user << "\red This doesn't seem to have a tech origin!"
|
||||
return
|
||||
var/list/temp_tech = ConvertReqString2List(O.origin_tech)
|
||||
if (temp_tech.len == 0)
|
||||
user << "\red You cannot deconstruct this item!"
|
||||
return
|
||||
if(O.reliability < 90 && O.crit_fail == 0)
|
||||
usr << "\red Item is neither reliable enough or broken enough to learn from."
|
||||
return
|
||||
busy = 1
|
||||
loaded_item = O
|
||||
user.drop_item()
|
||||
O.loc = src
|
||||
user << "\blue You add the [O.name] to the machine!"
|
||||
flick("d_analyzer_la", src)
|
||||
spawn(10)
|
||||
icon_state = "d_analyzer_l"
|
||||
busy = 0
|
||||
return
|
||||
|
||||
//For testing purposes only.
|
||||
/*/obj/item/weapon/deconstruction_test
|
||||
|
||||
@@ -118,56 +118,56 @@ var/global/list/obj/machinery/message_server/message_servers = list()
|
||||
var/value
|
||||
var/details
|
||||
|
||||
New(var/param_variable,var/param_value = 0)
|
||||
variable = param_variable
|
||||
value = param_value
|
||||
/datum/feedback_variable/New(var/param_variable,var/param_value = 0)
|
||||
variable = param_variable
|
||||
value = param_value
|
||||
|
||||
proc/inc(var/num = 1)
|
||||
/datum/feedback_variable/proc/inc(var/num = 1)
|
||||
if(isnum(value))
|
||||
value += num
|
||||
else
|
||||
value = text2num(value)
|
||||
if(isnum(value))
|
||||
value += num
|
||||
else
|
||||
value = text2num(value)
|
||||
if(isnum(value))
|
||||
value += num
|
||||
else
|
||||
value = num
|
||||
value = num
|
||||
|
||||
proc/dec(var/num = 1)
|
||||
/datum/feedback_variable/proc/dec(var/num = 1)
|
||||
if(isnum(value))
|
||||
value -= num
|
||||
else
|
||||
value = text2num(value)
|
||||
if(isnum(value))
|
||||
value -= num
|
||||
else
|
||||
value = text2num(value)
|
||||
if(isnum(value))
|
||||
value -= num
|
||||
else
|
||||
value = -num
|
||||
value = -num
|
||||
|
||||
proc/set_value(var/num)
|
||||
if(isnum(num))
|
||||
value = num
|
||||
/datum/feedback_variable/proc/set_value(var/num)
|
||||
if(isnum(num))
|
||||
value = num
|
||||
|
||||
proc/get_value()
|
||||
return value
|
||||
/datum/feedback_variable/proc/get_value()
|
||||
return value
|
||||
|
||||
proc/get_variable()
|
||||
return variable
|
||||
/datum/feedback_variable/proc/get_variable()
|
||||
return variable
|
||||
|
||||
proc/set_details(var/text)
|
||||
if(istext(text))
|
||||
/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]"
|
||||
|
||||
proc/add_details(var/text)
|
||||
if(istext(text))
|
||||
if(!details)
|
||||
details = text
|
||||
else
|
||||
details += " [text]"
|
||||
/datum/feedback_variable/proc/get_details()
|
||||
return details
|
||||
|
||||
proc/get_details()
|
||||
return details
|
||||
|
||||
proc/get_parsed()
|
||||
return list(variable,value,details)
|
||||
/datum/feedback_variable/proc/get_parsed()
|
||||
return list(variable,value,details)
|
||||
|
||||
var/obj/machinery/blackbox_recorder/blackbox
|
||||
|
||||
@@ -197,109 +197,109 @@ var/obj/machinery/blackbox_recorder/blackbox
|
||||
var/list/datum/feedback_variable/feedback = new()
|
||||
|
||||
//Only one can exsist in the world!
|
||||
New()
|
||||
if(blackbox)
|
||||
if(istype(blackbox,/obj/machinery/blackbox_recorder))
|
||||
del(src)
|
||||
blackbox = src
|
||||
/obj/machinery/blackbox_recorder/New()
|
||||
if(blackbox)
|
||||
if(istype(blackbox,/obj/machinery/blackbox_recorder))
|
||||
del(src)
|
||||
blackbox = src
|
||||
|
||||
Del()
|
||||
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_mining = msg_mining
|
||||
BR.msg_cargo = msg_cargo
|
||||
BR.feedback = feedback
|
||||
BR.messages = messages
|
||||
BR.messages_admin = messages_admin
|
||||
if(blackbox != BR)
|
||||
blackbox = BR
|
||||
..()
|
||||
/obj/machinery/blackbox_recorder/Del()
|
||||
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_mining = msg_mining
|
||||
BR.msg_cargo = msg_cargo
|
||||
BR.feedback = feedback
|
||||
BR.messages = messages
|
||||
BR.messages_admin = messages_admin
|
||||
if(blackbox != BR)
|
||||
blackbox = BR
|
||||
..()
|
||||
|
||||
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/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
|
||||
|
||||
proc/get_round_feedback()
|
||||
return feedback
|
||||
/obj/machinery/blackbox_recorder/proc/get_round_feedback()
|
||||
return feedback
|
||||
|
||||
proc/round_end_data_gathering()
|
||||
/obj/machinery/blackbox_recorder/proc/round_end_data_gathering()
|
||||
|
||||
var/pda_msg_amt = 0
|
||||
var/rc_msg_amt = 0
|
||||
var/pda_msg_amt = 0
|
||||
var/rc_msg_amt = 0
|
||||
|
||||
for(var/obj/machinery/message_server/MS in world)
|
||||
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
|
||||
for(var/obj/machinery/message_server/MS in world)
|
||||
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_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","MIN-[msg_mining.len]")
|
||||
feedback_add_details("radio_usage","CAR-[msg_cargo.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_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","MIN-[msg_mining.len]")
|
||||
feedback_add_details("radio_usage","CAR-[msg_cargo.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.
|
||||
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.
|
||||
proc/save_all_data_to_sql()
|
||||
if(!feedback) return
|
||||
//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
|
||||
round_end_data_gathering() //round_end time logging and some other data processing
|
||||
|
||||
var/user = sqlfdbklogin
|
||||
var/pass = sqlfdbkpass
|
||||
var/db = sqlfdbkdb
|
||||
var/address = sqladdress
|
||||
var/port = sqlport
|
||||
var/user = sqlfdbklogin
|
||||
var/pass = sqlfdbkpass
|
||||
var/db = sqlfdbkdb
|
||||
var/address = sqladdress
|
||||
var/port = sqlport
|
||||
|
||||
var/DBConnection/dbcon = new()
|
||||
var/DBConnection/dbcon = new()
|
||||
|
||||
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
||||
if(!dbcon.IsConnected()) return
|
||||
var/round_id
|
||||
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
|
||||
if(!dbcon.IsConnected()) return
|
||||
var/round_id
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM erro_feedback")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
round_id = query.item[1]
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM erro_feedback")
|
||||
query.Execute()
|
||||
while(query.NextRow())
|
||||
round_id = query.item[1]
|
||||
|
||||
if(!isnum(round_id))
|
||||
round_id = text2num(round_id)
|
||||
round_id++
|
||||
if(!isnum(round_id))
|
||||
round_id = text2num(round_id)
|
||||
round_id++
|
||||
|
||||
for(var/datum/feedback_variable/FV in feedback)
|
||||
var/sql = "INSERT INTO erro_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()
|
||||
for(var/datum/feedback_variable/FV in feedback)
|
||||
var/sql = "INSERT INTO erro_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()
|
||||
|
||||
dbcon.Disconnect()
|
||||
dbcon.Disconnect()
|
||||
|
||||
// Sanitize inputs to avoid SQL injection attacks
|
||||
proc/sql_sanitize_text(var/text)
|
||||
|
||||
@@ -24,154 +24,154 @@ Note: Must be placed west/left of and R&D console to function.
|
||||
var/adamantine_amount = 0.0
|
||||
|
||||
|
||||
New()
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/protolathe(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
|
||||
component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src)
|
||||
component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src)
|
||||
RefreshParts()
|
||||
|
||||
proc/TotalMaterials() //returns the total of all the stored materials. Makes code neater.
|
||||
return m_amount + g_amount + gold_amount + silver_amount + plasma_amount + uranium_amount + diamond_amount + clown_amount
|
||||
|
||||
/obj/machinery/r_n_d/protolathe/New()
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/protolathe(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/matter_bin(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/manipulator(src)
|
||||
component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src)
|
||||
component_parts += new /obj/item/weapon/reagent_containers/glass/beaker(src)
|
||||
RefreshParts()
|
||||
var/T = 0
|
||||
for(var/obj/item/weapon/reagent_containers/glass/G in component_parts)
|
||||
T += G.reagents.maximum_volume
|
||||
var/datum/reagents/R = new/datum/reagents(T) //Holder for the reagents used as materials.
|
||||
reagents = R
|
||||
R.my_atom = src
|
||||
T = 0
|
||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||
T += M.rating
|
||||
max_material_storage = T * 75000
|
||||
|
||||
attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if (O.is_open_container())
|
||||
return 1
|
||||
if (istype(O, /obj/item/weapon/screwdriver))
|
||||
if (!opened)
|
||||
opened = 1
|
||||
if(linked_console)
|
||||
linked_console.linked_lathe = null
|
||||
linked_console = null
|
||||
icon_state = "protolathe_t"
|
||||
user << "You open the maintenance hatch of [src]."
|
||||
else
|
||||
opened = 0
|
||||
icon_state = "protolathe"
|
||||
user << "You close the maintenance hatch of [src]."
|
||||
return
|
||||
if (opened)
|
||||
if(istype(O, /obj/item/weapon/crowbar))
|
||||
playsound(src.loc, 'Crowbar.ogg', 50, 1)
|
||||
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
|
||||
M.state = 2
|
||||
M.icon_state = "box_1"
|
||||
for(var/obj/I in component_parts)
|
||||
if(istype(I, /obj/item/weapon/reagent_containers/glass/beaker))
|
||||
reagents.trans_to(I, reagents.total_volume)
|
||||
if(I.reliability != 100 && crit_fail)
|
||||
I.crit_fail = 1
|
||||
I.loc = src.loc
|
||||
if(m_amount >= 3750)
|
||||
var/obj/item/stack/sheet/metal/G = new /obj/item/stack/sheet/metal(src.loc)
|
||||
G.amount = round(m_amount / G.perunit)
|
||||
if(g_amount >= 3750)
|
||||
var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass(src.loc)
|
||||
G.amount = round(g_amount / G.perunit)
|
||||
if(plasma_amount >= 2000)
|
||||
var/obj/item/stack/sheet/plasma/G = new /obj/item/stack/sheet/plasma(src.loc)
|
||||
G.amount = round(plasma_amount / G.perunit)
|
||||
if(silver_amount >= 2000)
|
||||
var/obj/item/stack/sheet/silver/G = new /obj/item/stack/sheet/silver(src.loc)
|
||||
G.amount = round(silver_amount / G.perunit)
|
||||
if(gold_amount >= 2000)
|
||||
var/obj/item/stack/sheet/gold/G = new /obj/item/stack/sheet/gold(src.loc)
|
||||
G.amount = round(gold_amount / G.perunit)
|
||||
if(uranium_amount >= 2000)
|
||||
var/obj/item/stack/sheet/uranium/G = new /obj/item/stack/sheet/uranium(src.loc)
|
||||
G.amount = round(uranium_amount / G.perunit)
|
||||
if(diamond_amount >= 2000)
|
||||
var/obj/item/stack/sheet/diamond/G = new /obj/item/stack/sheet/diamond(src.loc)
|
||||
G.amount = round(diamond_amount / G.perunit)
|
||||
if(clown_amount >= 2000)
|
||||
var/obj/item/stack/sheet/clown/G = new /obj/item/stack/sheet/clown(src.loc)
|
||||
G.amount = round(clown_amount / G.perunit)
|
||||
if(adamantine_amount >= 2000)
|
||||
var/obj/item/stack/sheet/adamantine/G = new /obj/item/stack/sheet/adamantine(src.loc)
|
||||
G.amount = round(adamantine_amount / G.perunit)
|
||||
del(src)
|
||||
return 1
|
||||
else
|
||||
user << "\red You can't load the [src.name] while it's opened."
|
||||
return 1
|
||||
if (disabled)
|
||||
return
|
||||
if (!linked_console)
|
||||
user << "\The protolathe must be linked to an R&D console first!"
|
||||
return 1
|
||||
if (busy)
|
||||
user << "\red The protolathe is busy. Please wait for completion of previous operation."
|
||||
return 1
|
||||
if (!istype(O, /obj/item/stack/sheet))
|
||||
user << "\red You cannot insert this item into the protolathe!"
|
||||
return 1
|
||||
if (stat)
|
||||
return 1
|
||||
if(istype(O,/obj/item/stack/sheet))
|
||||
var/obj/item/stack/sheet/S = O
|
||||
if (TotalMaterials() + S.perunit > max_material_storage)
|
||||
user << "\red The protolathe's material bin is full. Please remove material before adding more."
|
||||
return 1
|
||||
/obj/machinery/r_n_d/protolathe/proc/TotalMaterials() //returns the total of all the stored materials. Makes code neater.
|
||||
return m_amount + g_amount + gold_amount + silver_amount + plasma_amount + uranium_amount + diamond_amount + clown_amount
|
||||
|
||||
var/obj/item/stack/sheet/stack = O
|
||||
var/amount = round(input("How many sheets do you want to add?") as num)//No decimals
|
||||
if(amount < 0)//No negative numbers
|
||||
amount = 0
|
||||
if(amount == 0)
|
||||
return
|
||||
if(amount > stack.amount)
|
||||
amount = stack.amount
|
||||
if(max_material_storage - TotalMaterials() < (amount*stack.perunit))//Can't overfill
|
||||
amount = min(stack.amount, round((max_material_storage-TotalMaterials())/stack.perunit))
|
||||
/obj/machinery/r_n_d/protolathe/RefreshParts()
|
||||
var/T = 0
|
||||
for(var/obj/item/weapon/reagent_containers/glass/G in component_parts)
|
||||
T += G.reagents.maximum_volume
|
||||
var/datum/reagents/R = new/datum/reagents(T) //Holder for the reagents used as materials.
|
||||
reagents = R
|
||||
R.my_atom = src
|
||||
T = 0
|
||||
for(var/obj/item/weapon/stock_parts/matter_bin/M in component_parts)
|
||||
T += M.rating
|
||||
max_material_storage = T * 75000
|
||||
|
||||
src.overlays += "protolathe_[stack.name]"
|
||||
sleep(10)
|
||||
src.overlays -= "protolathe_[stack.name]"
|
||||
|
||||
icon_state = "protolathe"
|
||||
busy = 1
|
||||
use_power(max(1000, (3750*amount/10)))
|
||||
spawn(16)
|
||||
user << "\blue You add [amount] sheets to the [src.name]."
|
||||
/obj/machinery/r_n_d/protolathe/attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if (O.is_open_container())
|
||||
return 1
|
||||
if (istype(O, /obj/item/weapon/screwdriver))
|
||||
if (!opened)
|
||||
opened = 1
|
||||
if(linked_console)
|
||||
linked_console.linked_lathe = null
|
||||
linked_console = null
|
||||
icon_state = "protolathe_t"
|
||||
user << "You open the maintenance hatch of [src]."
|
||||
else
|
||||
opened = 0
|
||||
icon_state = "protolathe"
|
||||
if(istype(stack, /obj/item/stack/sheet/metal))
|
||||
m_amount += amount * 3750
|
||||
else if(istype(stack, /obj/item/stack/sheet/glass))
|
||||
g_amount += amount * 3750
|
||||
else if(istype(stack, /obj/item/stack/sheet/gold))
|
||||
gold_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/silver))
|
||||
silver_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/plasma))
|
||||
plasma_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/uranium))
|
||||
uranium_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/diamond))
|
||||
diamond_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/clown))
|
||||
clown_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/adamantine))
|
||||
adamantine_amount += amount * 2000
|
||||
stack.use(amount)
|
||||
busy = 0
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
user << "You close the maintenance hatch of [src]."
|
||||
return
|
||||
if (opened)
|
||||
if(istype(O, /obj/item/weapon/crowbar))
|
||||
playsound(src.loc, 'Crowbar.ogg', 50, 1)
|
||||
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
|
||||
M.state = 2
|
||||
M.icon_state = "box_1"
|
||||
for(var/obj/I in component_parts)
|
||||
if(istype(I, /obj/item/weapon/reagent_containers/glass/beaker))
|
||||
reagents.trans_to(I, reagents.total_volume)
|
||||
if(I.reliability != 100 && crit_fail)
|
||||
I.crit_fail = 1
|
||||
I.loc = src.loc
|
||||
if(m_amount >= 3750)
|
||||
var/obj/item/stack/sheet/metal/G = new /obj/item/stack/sheet/metal(src.loc)
|
||||
G.amount = round(m_amount / G.perunit)
|
||||
if(g_amount >= 3750)
|
||||
var/obj/item/stack/sheet/glass/G = new /obj/item/stack/sheet/glass(src.loc)
|
||||
G.amount = round(g_amount / G.perunit)
|
||||
if(plasma_amount >= 2000)
|
||||
var/obj/item/stack/sheet/plasma/G = new /obj/item/stack/sheet/plasma(src.loc)
|
||||
G.amount = round(plasma_amount / G.perunit)
|
||||
if(silver_amount >= 2000)
|
||||
var/obj/item/stack/sheet/silver/G = new /obj/item/stack/sheet/silver(src.loc)
|
||||
G.amount = round(silver_amount / G.perunit)
|
||||
if(gold_amount >= 2000)
|
||||
var/obj/item/stack/sheet/gold/G = new /obj/item/stack/sheet/gold(src.loc)
|
||||
G.amount = round(gold_amount / G.perunit)
|
||||
if(uranium_amount >= 2000)
|
||||
var/obj/item/stack/sheet/uranium/G = new /obj/item/stack/sheet/uranium(src.loc)
|
||||
G.amount = round(uranium_amount / G.perunit)
|
||||
if(diamond_amount >= 2000)
|
||||
var/obj/item/stack/sheet/diamond/G = new /obj/item/stack/sheet/diamond(src.loc)
|
||||
G.amount = round(diamond_amount / G.perunit)
|
||||
if(clown_amount >= 2000)
|
||||
var/obj/item/stack/sheet/clown/G = new /obj/item/stack/sheet/clown(src.loc)
|
||||
G.amount = round(clown_amount / G.perunit)
|
||||
if(adamantine_amount >= 2000)
|
||||
var/obj/item/stack/sheet/adamantine/G = new /obj/item/stack/sheet/adamantine(src.loc)
|
||||
G.amount = round(adamantine_amount / G.perunit)
|
||||
del(src)
|
||||
return 1
|
||||
else
|
||||
user << "\red You can't load the [src.name] while it's opened."
|
||||
return 1
|
||||
if (disabled)
|
||||
return
|
||||
if (!linked_console)
|
||||
user << "\The protolathe must be linked to an R&D console first!"
|
||||
return 1
|
||||
if (busy)
|
||||
user << "\red The protolathe is busy. Please wait for completion of previous operation."
|
||||
return 1
|
||||
if (!istype(O, /obj/item/stack/sheet))
|
||||
user << "\red You cannot insert this item into the protolathe!"
|
||||
return 1
|
||||
if (stat)
|
||||
return 1
|
||||
if(istype(O,/obj/item/stack/sheet))
|
||||
var/obj/item/stack/sheet/S = O
|
||||
if (TotalMaterials() + S.perunit > max_material_storage)
|
||||
user << "\red The protolathe's material bin is full. Please remove material before adding more."
|
||||
return 1
|
||||
|
||||
var/obj/item/stack/sheet/stack = O
|
||||
var/amount = round(input("How many sheets do you want to add?") as num)//No decimals
|
||||
if(amount < 0)//No negative numbers
|
||||
amount = 0
|
||||
if(amount == 0)
|
||||
return
|
||||
if(amount > stack.amount)
|
||||
amount = stack.amount
|
||||
if(max_material_storage - TotalMaterials() < (amount*stack.perunit))//Can't overfill
|
||||
amount = min(stack.amount, round((max_material_storage-TotalMaterials())/stack.perunit))
|
||||
|
||||
src.overlays += "protolathe_[stack.name]"
|
||||
sleep(10)
|
||||
src.overlays -= "protolathe_[stack.name]"
|
||||
|
||||
icon_state = "protolathe"
|
||||
busy = 1
|
||||
use_power(max(1000, (3750*amount/10)))
|
||||
spawn(16)
|
||||
user << "\blue You add [amount] sheets to the [src.name]."
|
||||
icon_state = "protolathe"
|
||||
if(istype(stack, /obj/item/stack/sheet/metal))
|
||||
m_amount += amount * 3750
|
||||
else if(istype(stack, /obj/item/stack/sheet/glass))
|
||||
g_amount += amount * 3750
|
||||
else if(istype(stack, /obj/item/stack/sheet/gold))
|
||||
gold_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/silver))
|
||||
silver_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/plasma))
|
||||
plasma_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/uranium))
|
||||
uranium_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/diamond))
|
||||
diamond_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/clown))
|
||||
clown_amount += amount * 2000
|
||||
else if(istype(stack, /obj/item/stack/sheet/adamantine))
|
||||
adamantine_amount += amount * 2000
|
||||
stack.use(amount)
|
||||
busy = 0
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,88 +20,88 @@
|
||||
var/opened = 0
|
||||
var/obj/machinery/computer/rdconsole/linked_console
|
||||
|
||||
New()
|
||||
..()
|
||||
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/New()
|
||||
..()
|
||||
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
|
||||
|
||||
proc
|
||||
shock(mob/user, prb)
|
||||
if(stat & (BROKEN|NOPOWER)) // unpowered, no shock
|
||||
return 0
|
||||
if(!prob(prb))
|
||||
return 0
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
if (electrocute_mob(user, get_area(src), src, 0.7))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
/obj/machinery/r_n_d/proc/
|
||||
shock(mob/user, prb)
|
||||
if(stat & (BROKEN|NOPOWER)) // unpowered, no shock
|
||||
return 0
|
||||
if(!prob(prb))
|
||||
return 0
|
||||
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
|
||||
s.set_up(5, 1, src)
|
||||
s.start()
|
||||
if (electrocute_mob(user, get_area(src), src, 0.7))
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if(opened)
|
||||
var/dat as text
|
||||
dat += "[src.name] Wires:<BR>"
|
||||
for(var/wire in src.wires)
|
||||
dat += text("[wire] Wire: <A href='?src=\ref[src];wire=[wire];cut=1'>[src.wires[wire] ? "Mend" : "Cut"]</A> <A href='?src=\ref[src];wire=[wire];pulse=1'>Pulse</A><BR>")
|
||||
/obj/machinery/r_n_d/attack_hand(mob/user as mob)
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if(opened)
|
||||
var/dat as text
|
||||
dat += "[src.name] Wires:<BR>"
|
||||
for(var/wire in src.wires)
|
||||
dat += text("[wire] Wire: <A href='?src=\ref[src];wire=[wire];cut=1'>[src.wires[wire] ? "Mend" : "Cut"]</A> <A href='?src=\ref[src];wire=[wire];pulse=1'>Pulse</A><BR>")
|
||||
|
||||
dat += text("The red light is [src.disabled ? "off" : "on"].<BR>")
|
||||
dat += text("The green light is [src.shocked ? "off" : "on"].<BR>")
|
||||
dat += text("The blue light is [src.hacked ? "off" : "on"].<BR>")
|
||||
user << browse("<HTML><HEAD><TITLE>[src.name] Hacking</TITLE></HEAD><BODY>[dat]</BODY></HTML>","window=hack_win")
|
||||
dat += text("The red light is [src.disabled ? "off" : "on"].<BR>")
|
||||
dat += text("The green light is [src.shocked ? "off" : "on"].<BR>")
|
||||
dat += text("The blue light is [src.hacked ? "off" : "on"].<BR>")
|
||||
user << browse("<HTML><HEAD><TITLE>[src.name] Hacking</TITLE></HEAD><BODY>[dat]</BODY></HTML>","window=hack_win")
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/r_n_d/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["pulse"])
|
||||
var/temp_wire = href_list["wire"]
|
||||
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
usr << "You need a multitool!"
|
||||
usr.machine = src
|
||||
src.add_fingerprint(usr)
|
||||
if(href_list["pulse"])
|
||||
var/temp_wire = href_list["wire"]
|
||||
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
|
||||
usr << "You need a multitool!"
|
||||
else
|
||||
if(src.wires[temp_wire])
|
||||
usr << "You can't pulse a cut wire."
|
||||
else
|
||||
if(src.wires[temp_wire])
|
||||
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/weapon/wirecutters))
|
||||
usr << "You need wirecutters!"
|
||||
else
|
||||
var/temp_wire = href_list["wire"]
|
||||
wires[temp_wire] = !wires[temp_wire]
|
||||
if(src.hack_wire == temp_wire)
|
||||
if(src.hack_wire == href_list["wire"])
|
||||
src.hacked = !src.hacked
|
||||
if(src.disable_wire == temp_wire)
|
||||
spawn(100) src.hacked = !src.hacked
|
||||
if(src.disable_wire == href_list["wire"])
|
||||
src.disabled = !src.disabled
|
||||
src.shock(usr,50)
|
||||
if(src.shock_wire == temp_wire)
|
||||
spawn(100) src.disabled = !src.disabled
|
||||
if(src.shock_wire == href_list["wire"])
|
||||
src.shocked = !src.shocked
|
||||
src.shock(usr,50)
|
||||
src.updateUsrDialog()
|
||||
spawn(100) src.shocked = !src.shocked
|
||||
if(href_list["cut"])
|
||||
if (!istype(usr.get_active_hand(), /obj/item/weapon/wirecutters))
|
||||
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()
|
||||
|
||||
@@ -45,120 +45,120 @@ research holder datum.
|
||||
***************************************************************/
|
||||
|
||||
/datum/research //Holder for all the existing, archived, and known tech. Individual to console.
|
||||
var
|
||||
list //Datum/tech go here.
|
||||
possible_tech = list() //List of all tech in the game that players have access to (barring special events).
|
||||
known_tech = list() //List of locally known tech.
|
||||
possible_designs = list() //List of all designs (at base reliability).
|
||||
known_designs = list() //List of available designs (at base reliability).
|
||||
|
||||
New() //Insert techs into possible_tech here. Known_tech automatically updated.
|
||||
for(var/T in typesof(/datum/tech) - /datum/tech)
|
||||
possible_tech += new T(src)
|
||||
for(var/D in typesof(/datum/design) - /datum/design)
|
||||
possible_designs += new D(src)
|
||||
RefreshResearch()
|
||||
//Datum/tech go here.
|
||||
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 (at base reliability).
|
||||
var/list/known_designs = list() //List of available designs (at base reliability).
|
||||
|
||||
proc
|
||||
/datum/research/New() //Insert techs into possible_tech here. Known_tech automatically updated.
|
||||
for(var/T in typesof(/datum/tech) - /datum/tech)
|
||||
possible_tech += new T(src)
|
||||
for(var/D in typesof(/datum/design) - /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)
|
||||
TechHasReqs(var/datum/tech/T)
|
||||
if(T.req_tech.len == 0)
|
||||
return 1
|
||||
var/matches = 0
|
||||
for(var/req in T.req_tech)
|
||||
for(var/datum/tech/known in known_tech)
|
||||
if((req == known.id) && (known.level >= T.req_tech[req]))
|
||||
matches++
|
||||
break
|
||||
if(matches == T.req_tech.len)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
//Checks to see if design has all the required pre-reqs.
|
||||
//Input: datum/design; Output: 0/1 (false/true)
|
||||
DesignHasReqs(var/datum/design/D)
|
||||
if(D.req_tech.len == 0)
|
||||
return 1
|
||||
var/matches = 0
|
||||
var/list/k_tech = list()
|
||||
for(var/datum/tech/known in known_tech)
|
||||
k_tech[known.id] = known.level
|
||||
for(var/req in D.req_tech)
|
||||
if(!isnull(k_tech[req]) && k_tech[req] >= D.req_tech[req])
|
||||
matches++
|
||||
if(matches == D.req_tech.len)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
//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 1
|
||||
var/matches = 0
|
||||
for(var/req in T.req_tech)
|
||||
for(var/datum/tech/known in known_tech)
|
||||
if((req == known.id) && (known.level >= T.req_tech[req]))
|
||||
matches++
|
||||
break
|
||||
if(matches == T.req_tech.len)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
|
||||
//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 1
|
||||
var/matches = 0
|
||||
var/list/k_tech = list()
|
||||
for(var/datum/tech/known in known_tech)
|
||||
k_tech[known.id] = known.level
|
||||
for(var/req in D.req_tech)
|
||||
if(!isnull(k_tech[req]) && k_tech[req] >= D.req_tech[req])
|
||||
matches++
|
||||
if(matches == D.req_tech.len)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
/*
|
||||
//Checks to see if design has all the required pre-reqs.
|
||||
//Input: datum/design; Output: 0/1 (false/true)
|
||||
DesignHasReqs(var/datum/design/D)
|
||||
if(D.req_tech.len == 0)
|
||||
return 1
|
||||
var/matches = 0
|
||||
for(var/req in D.req_tech)
|
||||
for(var/datum/tech/known in known_tech)
|
||||
if((req == known.id) && (known.level >= D.req_tech[req]))
|
||||
matches++
|
||||
break
|
||||
if(matches == D.req_tech.len)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
//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 1
|
||||
var/matches = 0
|
||||
for(var/req in D.req_tech)
|
||||
for(var/datum/tech/known in known_tech)
|
||||
if((req == known.id) && (known.level >= D.req_tech[req]))
|
||||
matches++
|
||||
break
|
||||
if(matches == D.req_tech.len)
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
*/
|
||||
//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
|
||||
AddTech2Known(var/datum/tech/T)
|
||||
for(var/datum/tech/known in known_tech)
|
||||
if(T.id == known.id)
|
||||
if(T.level > known.level)
|
||||
known.level = T.level
|
||||
return
|
||||
known_tech += T
|
||||
//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)
|
||||
for(var/datum/tech/known in known_tech)
|
||||
if(T.id == known.id)
|
||||
if(T.level > known.level)
|
||||
known.level = T.level
|
||||
return
|
||||
known_tech += T
|
||||
return
|
||||
|
||||
AddDesign2Known(var/datum/design/D)
|
||||
for(var/datum/design/known in known_designs)
|
||||
if(D.id == known.id)
|
||||
if(D.reliability_mod > known.reliability_mod)
|
||||
known.reliability_mod = D.reliability_mod
|
||||
return
|
||||
known_designs += D
|
||||
/datum/research/proc/AddDesign2Known(var/datum/design/D)
|
||||
for(var/datum/design/known in known_designs)
|
||||
if(D.id == known.id)
|
||||
if(D.reliability_mod > known.reliability_mod)
|
||||
known.reliability_mod = D.reliability_mod
|
||||
return
|
||||
known_designs += D
|
||||
return
|
||||
|
||||
//Refreshes known_tech and known_designs list. Then updates the reliability vars of the designs in the known_designs list.
|
||||
//Input/Output: n/a
|
||||
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/datum/tech/T in known_tech)
|
||||
T = between(1,T.level,20)
|
||||
for(var/datum/design/D in known_designs)
|
||||
D.CalcReliability(known_tech)
|
||||
return
|
||||
//Refreshes known_tech and known_designs list. Then updates the reliability vars of the designs in the 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/datum/tech/T in known_tech)
|
||||
T = between(1,T.level,20)
|
||||
for(var/datum/design/D in known_designs)
|
||||
D.CalcReliability(known_tech)
|
||||
return
|
||||
|
||||
//Refreshes the levels of a given tech.
|
||||
//Input: Tech's ID and Level; Output: null
|
||||
UpdateTech(var/ID, var/level)
|
||||
for(var/datum/tech/KT in known_tech)
|
||||
if(KT.id == ID)
|
||||
if(KT.level <= level) KT.level = max((KT.level + 1), (level - 1))
|
||||
return
|
||||
//Refreshes the levels of a given tech.
|
||||
//Input: Tech's ID and Level; Output: null
|
||||
/datum/research/proc/UpdateTech(var/ID, var/level)
|
||||
for(var/datum/tech/KT in known_tech)
|
||||
if(KT.id == ID)
|
||||
if(KT.level <= level) KT.level = max((KT.level + 1), (level - 1))
|
||||
return
|
||||
|
||||
UpdateDesign(var/path)
|
||||
for(var/datum/design/KD in known_designs)
|
||||
if(KD.build_path == path)
|
||||
KD.reliability_mod += rand(1,2)
|
||||
break
|
||||
return
|
||||
/datum/research/proc/UpdateDesign(var/path)
|
||||
for(var/datum/design/KD in known_designs)
|
||||
if(KD.build_path == path)
|
||||
KD.reliability_mod += rand(1,2)
|
||||
break
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -168,92 +168,92 @@ research holder datum.
|
||||
** Includes all the various technoliges and what they make. **
|
||||
***************************************************************/
|
||||
|
||||
datum
|
||||
tech //Datum of individual technologies.
|
||||
var
|
||||
name = "name" //Name of the technology.
|
||||
desc = "description" //General description of what it does and what it makes.
|
||||
id = "id" //An easily referenced ID. Must be alphanumeric, lower-case, and no symbols.
|
||||
level = 1 //A simple number scale of the research level. Level 0 = Secret tech.
|
||||
list/req_tech = list() //List of ids associated values of techs required to research this tech. "id" = #
|
||||
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/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).
|
||||
|
||||
materials
|
||||
name = "Materials Research"
|
||||
desc = "Development of new and improved materials."
|
||||
id = "materials"
|
||||
datum/tech/materials
|
||||
name = "Materials Research"
|
||||
desc = "Development of new and improved materials."
|
||||
id = "materials"
|
||||
|
||||
engineering
|
||||
name = "Engineering Research"
|
||||
desc = "Development of new and improved engineering parts and."
|
||||
id = "engineering"
|
||||
datum/tech/engineering
|
||||
name = "Engineering Research"
|
||||
desc = "Development of new and improved engineering parts and."
|
||||
id = "engineering"
|
||||
|
||||
plasmatech
|
||||
name = "Plasma Research"
|
||||
desc = "Research into the mysterious substance colloqually known as 'plasma'."
|
||||
id = "plasmatech"
|
||||
datum/tech/plasmatech
|
||||
name = "Plasma Research"
|
||||
desc = "Research into the mysterious substance colloqually known as 'plasma'."
|
||||
id = "plasmatech"
|
||||
|
||||
powerstorage
|
||||
name = "Power Manipulation Technology"
|
||||
desc = "The various technologies behind the storage and generation of electicity."
|
||||
id = "powerstorage"
|
||||
datum/tech/powerstorage
|
||||
name = "Power Manipulation Technology"
|
||||
desc = "The various technologies behind the storage and generation of electicity."
|
||||
id = "powerstorage"
|
||||
|
||||
bluespace
|
||||
name = "'Blue-space' Research"
|
||||
desc = "Research into the sub-reality known as 'blue-space'"
|
||||
id = "bluespace"
|
||||
datum/tech/bluespace
|
||||
name = "'Blue-space' Research"
|
||||
desc = "Research into the sub-reality known as 'blue-space'"
|
||||
id = "bluespace"
|
||||
|
||||
biotech
|
||||
name = "Biological Technology"
|
||||
desc = "Research into the deeper mysteries of life and organic substances."
|
||||
id = "biotech"
|
||||
datum/tech/biotech
|
||||
name = "Biological Technology"
|
||||
desc = "Research into the deeper mysteries of life and organic substances."
|
||||
id = "biotech"
|
||||
|
||||
combat
|
||||
name = "Combat Systems Research"
|
||||
desc = "The development of offensive and defensive systems."
|
||||
id = "combat"
|
||||
datum/tech/combat
|
||||
name = "Combat Systems Research"
|
||||
desc = "The development of offensive and defensive systems."
|
||||
id = "combat"
|
||||
|
||||
magnets
|
||||
name = "Electromagnetic Spectrum Research"
|
||||
desc = "Research into the electromagnetic spectrum. No clue how they actually work, though."
|
||||
id = "magnets"
|
||||
datum/tech/magnets
|
||||
name = "Electromagnetic Spectrum Research"
|
||||
desc = "Research into the electromagnetic spectrum. No clue how they actually work, though."
|
||||
id = "magnets"
|
||||
|
||||
programming
|
||||
name = "Data Theory Research"
|
||||
desc = "The development of new computer and artificial intelligence and data storage systems."
|
||||
id = "programming"
|
||||
datum/tech/programming
|
||||
name = "Data Theory Research"
|
||||
desc = "The development of new computer and artificial intelligence and data storage systems."
|
||||
id = "programming"
|
||||
|
||||
syndicate
|
||||
name = "Illegal Technologies Research"
|
||||
desc = "The study of technologies that violate Nanotrassen regulations."
|
||||
id = "syndicate"
|
||||
datum/tech/syndicate
|
||||
name = "Illegal Technologies Research"
|
||||
desc = "The study of technologies that violate Nanotrassen regulations."
|
||||
id = "syndicate"
|
||||
|
||||
/* arcane
|
||||
name = "Arcane Research"
|
||||
desc = "Research into the acult and arcane field for use in practical science"
|
||||
id = "arcane"
|
||||
level = 0 //It didn't become "secret" as advertised.
|
||||
/*
|
||||
datum/tech/arcane
|
||||
name = "Arcane Research"
|
||||
desc = "Research into the acult and arcane field for use in practical science"
|
||||
id = "arcane"
|
||||
level = 0 //It didn't become "secret" as advertised.
|
||||
|
||||
//Branch Techs
|
||||
explosives
|
||||
name = "Explosives Research"
|
||||
desc = "The creation and application of explosive materials."
|
||||
id = "explosives"
|
||||
req_tech = list("materials" = 3)
|
||||
//Branch Techs
|
||||
datum/tech/explosives
|
||||
name = "Explosives Research"
|
||||
desc = "The creation and application of explosive materials."
|
||||
id = "explosives"
|
||||
req_tech = list("materials" = 3)
|
||||
|
||||
generators
|
||||
name = "Power Generation Technology"
|
||||
desc = "Research into more powerful and more reliable sources."
|
||||
id = "generators"
|
||||
req_tech = list("powerstorage" = 2)
|
||||
datum/tech/generators
|
||||
name = "Power Generation Technology"
|
||||
desc = "Research into more powerful and more reliable sources."
|
||||
id = "generators"
|
||||
req_tech = list("powerstorage" = 2)
|
||||
|
||||
robotics
|
||||
name = "Robotics Technology"
|
||||
desc = "The development of advanced automated, autonomous machines."
|
||||
id = "robotics"
|
||||
req_tech = list("materials" = 3, "programming" = 3)*/
|
||||
datum/tech/robotics
|
||||
name = "Robotics Technology"
|
||||
desc = "The development of advanced automated, autonomous machines."
|
||||
id = "robotics"
|
||||
req_tech = list("materials" = 3, "programming" = 3)
|
||||
*/
|
||||
|
||||
|
||||
/obj/item/weapon/disk/tech_disk
|
||||
@@ -266,6 +266,7 @@ datum
|
||||
m_amt = 30
|
||||
g_amt = 10
|
||||
var/datum/tech/stored
|
||||
New()
|
||||
src.pixel_x = rand(-5.0, 5)
|
||||
src.pixel_y = rand(-5.0, 5)
|
||||
|
||||
/obj/item/weapon/disk/tech_disk/New()
|
||||
src.pixel_x = rand(-5.0, 5)
|
||||
src.pixel_y = rand(-5.0, 5)
|
||||
@@ -2,371 +2,372 @@
|
||||
name = "R&D Server"
|
||||
icon = 'icons/obj/machines/research.dmi'
|
||||
icon_state = "server"
|
||||
var
|
||||
datum/research/files
|
||||
health = 100
|
||||
list
|
||||
id_with_upload = list() //List of R&D consoles with upload to server access.
|
||||
id_with_download = list() //List of R&D consoles with download from server access.
|
||||
id_with_upload_string = "" //String versions for easy editing in map editor.
|
||||
id_with_download_string = ""
|
||||
server_id = 0
|
||||
heat_gen = 100
|
||||
heating_power = 40000
|
||||
delay = 10
|
||||
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.
|
||||
|
||||
New()
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/rdserver(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/scanning_module(src)
|
||||
component_parts += new /obj/item/weapon/cable_coil(src)
|
||||
component_parts += new /obj/item/weapon/cable_coil(src)
|
||||
RefreshParts()
|
||||
src.initialize(); //Agouri
|
||||
|
||||
Del()
|
||||
griefProtection()
|
||||
..()
|
||||
|
||||
/obj/machinery/r_n_d/server/New()
|
||||
..()
|
||||
component_parts = list()
|
||||
component_parts += new /obj/item/weapon/circuitboard/rdserver(src)
|
||||
component_parts += new /obj/item/weapon/stock_parts/scanning_module(src)
|
||||
component_parts += new /obj/item/weapon/cable_coil(src)
|
||||
component_parts += new /obj/item/weapon/cable_coil(src)
|
||||
RefreshParts()
|
||||
var/tot_rating = 0
|
||||
for(var/obj/item/weapon/stock_parts/SP in src)
|
||||
tot_rating += SP.rating
|
||||
heat_gen /= max(1, tot_rating)
|
||||
src.initialize(); //Agouri
|
||||
|
||||
initialize()
|
||||
if(!files) files = new /datum/research(src)
|
||||
var/list/temp_list
|
||||
if(!id_with_upload.len)
|
||||
temp_list = list()
|
||||
temp_list = dd_text2list(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 = dd_text2list(id_with_download_string, ";")
|
||||
for(var/N in temp_list)
|
||||
id_with_download += text2num(N)
|
||||
/obj/machinery/r_n_d/server/Del()
|
||||
griefProtection()
|
||||
..()
|
||||
|
||||
process()
|
||||
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 = between(0, health, 100)
|
||||
if((T20C + 20) to (T0C + 70))
|
||||
health = max(0, health - 1)
|
||||
if(health <= 0)
|
||||
griefProtection() //I dont like putting this in process() but it's the best I can do without re-writing a chunk of rd servers.
|
||||
files.known_designs = list()
|
||||
for(var/datum/tech/T in files.known_tech)
|
||||
if(prob(1))
|
||||
T.level--
|
||||
files.RefreshResearch()
|
||||
if(delay)
|
||||
delay--
|
||||
else
|
||||
produce_heat(heat_gen)
|
||||
delay = initial(delay)
|
||||
/obj/machinery/r_n_d/server/RefreshParts()
|
||||
var/tot_rating = 0
|
||||
for(var/obj/item/weapon/stock_parts/SP in src)
|
||||
tot_rating += SP.rating
|
||||
heat_gen /= max(1, tot_rating)
|
||||
|
||||
meteorhit(var/obj/O as obj)
|
||||
griefProtection()
|
||||
..()
|
||||
/obj/machinery/r_n_d/server/initialize()
|
||||
if(!files) files = new /datum/research(src)
|
||||
var/list/temp_list
|
||||
if(!id_with_upload.len)
|
||||
temp_list = list()
|
||||
temp_list = dd_text2list(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 = dd_text2list(id_with_download_string, ";")
|
||||
for(var/N in temp_list)
|
||||
id_with_download += text2num(N)
|
||||
|
||||
/obj/machinery/r_n_d/server/process()
|
||||
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 = between(0, health, 100)
|
||||
if((T20C + 20) to (T0C + 70))
|
||||
health = max(0, health - 1)
|
||||
if(health <= 0)
|
||||
griefProtection() //I dont like putting this in process() but it's the best I can do without re-writing a chunk of rd servers.
|
||||
files.known_designs = list()
|
||||
for(var/datum/tech/T in files.known_tech)
|
||||
if(prob(1))
|
||||
T.level--
|
||||
files.RefreshResearch()
|
||||
if(delay)
|
||||
delay--
|
||||
else
|
||||
produce_heat(heat_gen)
|
||||
delay = initial(delay)
|
||||
|
||||
/obj/machinery/r_n_d/server/meteorhit(var/obj/O as obj)
|
||||
griefProtection()
|
||||
..()
|
||||
|
||||
|
||||
emp_act(severity)
|
||||
griefProtection()
|
||||
..()
|
||||
/obj/machinery/r_n_d/server/emp_act(severity)
|
||||
griefProtection()
|
||||
..()
|
||||
|
||||
|
||||
ex_act(severity)
|
||||
griefProtection()
|
||||
..()
|
||||
/obj/machinery/r_n_d/server/ex_act(severity)
|
||||
griefProtection()
|
||||
..()
|
||||
|
||||
|
||||
blob_act()
|
||||
griefProtection()
|
||||
..()
|
||||
/obj/machinery/r_n_d/server/blob_act()
|
||||
griefProtection()
|
||||
..()
|
||||
|
||||
|
||||
proc
|
||||
//Backup files to centcomm to help admins recover data after greifer attacks
|
||||
griefProtection()
|
||||
for(var/obj/machinery/r_n_d/server/centcom/C in world)
|
||||
for(var/datum/tech/T in files.known_tech)
|
||||
C.files.AddTech2Known(T)
|
||||
for(var/datum/design/D in files.known_designs)
|
||||
C.files.AddDesign2Known(D)
|
||||
C.files.RefreshResearch()
|
||||
/obj/machinery/r_n_d/server/proc/
|
||||
//Backup files to centcomm to help admins recover data after greifer attacks
|
||||
/obj/machinery/r_n_d/server/proc/griefProtection()
|
||||
for(var/obj/machinery/r_n_d/server/centcom/C in world)
|
||||
for(var/datum/tech/T in files.known_tech)
|
||||
C.files.AddTech2Known(T)
|
||||
for(var/datum/design/D in files.known_designs)
|
||||
C.files.AddDesign2Known(D)
|
||||
C.files.RefreshResearch()
|
||||
|
||||
produce_heat(heat_amt)
|
||||
if(!(stat & (NOPOWER|BROKEN))) //Blatently 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))
|
||||
/obj/machinery/r_n_d/server/proc/produce_heat(heat_amt)
|
||||
if(!(stat & (NOPOWER|BROKEN))) //Blatently 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/transfer_moles = 0.25 * env.total_moles()
|
||||
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
var/datum/gas_mixture/removed = env.remove(transfer_moles)
|
||||
|
||||
if(removed)
|
||||
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)
|
||||
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)
|
||||
env.merge(removed)
|
||||
|
||||
attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
if (disabled)
|
||||
return
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if (istype(O, /obj/item/weapon/screwdriver))
|
||||
if (!opened)
|
||||
opened = 1
|
||||
icon_state = "server_o"
|
||||
user << "You open the maintenance hatch of [src]."
|
||||
else
|
||||
opened = 0
|
||||
icon_state = "server"
|
||||
user << "You close the maintenance hatch of [src]."
|
||||
return
|
||||
if (opened)
|
||||
if(istype(O, /obj/item/weapon/crowbar))
|
||||
griefProtection()
|
||||
playsound(src.loc, 'Crowbar.ogg', 50, 1)
|
||||
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
|
||||
M.state = 2
|
||||
M.icon_state = "box_1"
|
||||
for(var/obj/I in component_parts)
|
||||
if(I.reliability != 100 && crit_fail)
|
||||
I.crit_fail = 1
|
||||
I.loc = src.loc
|
||||
del(src)
|
||||
return 1
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if (disabled)
|
||||
return
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if(ishuman(user))
|
||||
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
|
||||
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("RESEARCH",src,user:wear_suit)
|
||||
/obj/machinery/r_n_d/server/attackby(var/obj/item/O as obj, var/mob/user as mob)
|
||||
if (disabled)
|
||||
return
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if (istype(O, /obj/item/weapon/screwdriver))
|
||||
if (!opened)
|
||||
opened = 1
|
||||
icon_state = "server_o"
|
||||
user << "You open the maintenance hatch of [src]."
|
||||
else
|
||||
opened = 0
|
||||
icon_state = "server"
|
||||
user << "You close the maintenance hatch of [src]."
|
||||
return
|
||||
if (opened)
|
||||
if(istype(O, /obj/item/weapon/crowbar))
|
||||
griefProtection()
|
||||
playsound(src.loc, 'Crowbar.ogg', 50, 1)
|
||||
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
|
||||
M.state = 2
|
||||
M.icon_state = "box_1"
|
||||
for(var/obj/I in component_parts)
|
||||
if(I.reliability != 100 && crit_fail)
|
||||
I.crit_fail = 1
|
||||
I.loc = src.loc
|
||||
del(src)
|
||||
return 1
|
||||
|
||||
/obj/machinery/r_n_d/server/attack_hand(mob/user as mob)
|
||||
if (disabled)
|
||||
return
|
||||
if (shocked)
|
||||
shock(user,50)
|
||||
if(ishuman(user))
|
||||
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
|
||||
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("RESEARCH",src,user:wear_suit)
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
/obj/machinery/r_n_d/server/centcom
|
||||
name = "Centcom Central R&D Database"
|
||||
server_id = -1
|
||||
|
||||
initialize()
|
||||
..()
|
||||
var/list/no_id_servers = list()
|
||||
var/list/server_ids = list()
|
||||
for(var/obj/machinery/r_n_d/server/S in world)
|
||||
switch(S.server_id)
|
||||
if(-1)
|
||||
continue
|
||||
if(0)
|
||||
no_id_servers += S
|
||||
else
|
||||
server_ids += S.server_id
|
||||
/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 world)
|
||||
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
|
||||
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()
|
||||
return
|
||||
|
||||
/obj/machinery/computer/rdservercontrol
|
||||
name = "R&D Server Controller"
|
||||
icon_state = "rdcomp"
|
||||
var
|
||||
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.machine = src
|
||||
if(!src.allowed(usr) && !emagged)
|
||||
usr << "\red You do not have the required access level"
|
||||
return
|
||||
|
||||
if(href_list["main"])
|
||||
screen = 0
|
||||
obj/machinery/r_n_d/server/temp_server
|
||||
list
|
||||
servers = list()
|
||||
consoles = list()
|
||||
badmin = 0
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
add_fingerprint(usr)
|
||||
usr.machine = src
|
||||
if(!src.allowed(usr) && !emagged)
|
||||
usr << "\red You do not have the required access level"
|
||||
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()
|
||||
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 world)
|
||||
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 world)
|
||||
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 world)
|
||||
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
|
||||
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 Rest", "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/datum/tech/T in temp_server.files.known_tech)
|
||||
if(T.id == href_list["reset_tech"])
|
||||
T.level = 1
|
||||
break
|
||||
if(href_list["access"])
|
||||
screen = 1
|
||||
for(var/obj/machinery/computer/rdconsole/C in world)
|
||||
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 world)
|
||||
if(S == src)
|
||||
continue
|
||||
servers += S
|
||||
temp_server.files.RefreshResearch()
|
||||
|
||||
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["reset_design"])
|
||||
var/choice = alert("Design Data Deletion", "Are you sure you want to delete this design? If you still have the prerequisites for the design, it'll reset to its base reliability. Data lost cannot be recovered.", "Continue", "Cancel")
|
||||
if(choice == "Continue")
|
||||
for(var/datum/design/D in temp_server.files.known_designs)
|
||||
if(D.id == href_list["reset_design"])
|
||||
D.reliability_mod = 0
|
||||
temp_server.files.known_designs -= D
|
||||
break
|
||||
temp_server.files.RefreshResearch()
|
||||
|
||||
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
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
else if(href_list["reset_tech"])
|
||||
var/choice = alert("Technology Data Rest", "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/datum/tech/T in temp_server.files.known_tech)
|
||||
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? If you still have the prerequisites for the design, it'll reset to its base reliability. Data lost cannot be recovered.", "Continue", "Cancel")
|
||||
if(choice == "Continue")
|
||||
for(var/datum/design/D in temp_server.files.known_designs)
|
||||
if(D.id == href_list["reset_design"])
|
||||
D.reliability_mod = 0
|
||||
temp_server.files.known_designs -= D
|
||||
break
|
||||
temp_server.files.RefreshResearch()
|
||||
|
||||
updateUsrDialog()
|
||||
/obj/machinery/computer/rdservercontrol/attack_hand(mob/user as mob)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
user.machine = src
|
||||
var/dat = ""
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
user.machine = src
|
||||
var/dat = ""
|
||||
switch(screen)
|
||||
if(0) //Main Menu
|
||||
dat += "Connected Servers:<BR><BR>"
|
||||
|
||||
switch(screen)
|
||||
if(0) //Main Menu
|
||||
dat += "Connected Servers:<BR><BR>"
|
||||
for(var/obj/machinery/r_n_d/server/S in world)
|
||||
if(istype(S, /obj/machinery/r_n_d/server/centcom) && !badmin)
|
||||
continue
|
||||
dat += "[S.name] || "
|
||||
dat += "<A href='?src=\ref[src];access=[S.server_id]'> Access Rights</A> | "
|
||||
dat += "<A href='?src=\ref[src];data=[S.server_id]'>Data Management</A>"
|
||||
if(badmin) dat += " | <A href='?src=\ref[src];transfer=[S.server_id]'>Server-to-Server Transfer</A>"
|
||||
dat += "<BR>"
|
||||
|
||||
for(var/obj/machinery/r_n_d/server/S in world)
|
||||
if(istype(S, /obj/machinery/r_n_d/server/centcom) && !badmin)
|
||||
continue
|
||||
dat += "[S.name] || "
|
||||
dat += "<A href='?src=\ref[src];access=[S.server_id]'> Access Rights</A> | "
|
||||
dat += "<A href='?src=\ref[src];data=[S.server_id]'>Data Management</A>"
|
||||
if(badmin) dat += " | <A href='?src=\ref[src];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=\ref[src];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=\ref[src];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=\ref[src];main=1'>Main Menu</A>"
|
||||
|
||||
if(2) //Data Management menu
|
||||
dat += "[temp_server.name] Data ManagementP<BR><BR>"
|
||||
dat += "Known Technologies<BR>"
|
||||
for(var/datum/tech/T in temp_server.files.known_tech)
|
||||
dat += "* [T.name] "
|
||||
dat += "<A href='?src=\ref[src];reset_tech=[T.id]'>(Reset)</A><BR>" //FYI, these are all strings.
|
||||
dat += "Known Designs<BR>"
|
||||
for(var/datum/design/D in temp_server.files.known_designs)
|
||||
dat += "* [D.name] "
|
||||
dat += "<A href='?src=\ref[src];reset_design=[D.id]'>(Delete)</A><BR>"
|
||||
dat += "<HR><A href='?src=\ref[src];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=\ref[src];send_to=[S.server_id]'> (Transfer)</A><BR>"
|
||||
dat += "<HR><A href='?src=\ref[src];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
|
||||
|
||||
attackby(var/obj/item/weapon/D as obj, var/mob/user as mob)
|
||||
if(istype(D, /obj/item/weapon/screwdriver))
|
||||
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
|
||||
if(do_after(user, 20))
|
||||
if (src.stat & BROKEN)
|
||||
user << "\blue The broken glass falls out."
|
||||
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
||||
new /obj/item/weapon/shard( src.loc )
|
||||
var/obj/item/weapon/circuitboard/rdservercontrol/M = new /obj/item/weapon/circuitboard/rdservercontrol( A )
|
||||
for (var/obj/C in src)
|
||||
C.loc = src.loc
|
||||
A.circuit = M
|
||||
A.state = 3
|
||||
A.icon_state = "3"
|
||||
A.anchored = 1
|
||||
del(src)
|
||||
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=\ref[src];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
|
||||
user << "\blue You disconnect the monitor."
|
||||
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
||||
var/obj/item/weapon/circuitboard/rdservercontrol/M = new /obj/item/weapon/circuitboard/rdservercontrol( A )
|
||||
for (var/obj/C in src)
|
||||
C.loc = src.loc
|
||||
A.circuit = M
|
||||
A.state = 4
|
||||
A.icon_state = "4"
|
||||
A.anchored = 1
|
||||
del(src)
|
||||
else if(istype(D, /obj/item/weapon/card/emag) && !emagged)
|
||||
playsound(src.loc, 'sparks4.ogg', 75, 1)
|
||||
emagged = 1
|
||||
user << "\blue You you disable the security protocols"
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
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=\ref[src];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=\ref[src];main=1'>Main Menu</A>"
|
||||
|
||||
if(2) //Data Management menu
|
||||
dat += "[temp_server.name] Data ManagementP<BR><BR>"
|
||||
dat += "Known Technologies<BR>"
|
||||
for(var/datum/tech/T in temp_server.files.known_tech)
|
||||
dat += "* [T.name] "
|
||||
dat += "<A href='?src=\ref[src];reset_tech=[T.id]'>(Reset)</A><BR>" //FYI, these are all strings.
|
||||
dat += "Known Designs<BR>"
|
||||
for(var/datum/design/D in temp_server.files.known_designs)
|
||||
dat += "* [D.name] "
|
||||
dat += "<A href='?src=\ref[src];reset_design=[D.id]'>(Delete)</A><BR>"
|
||||
dat += "<HR><A href='?src=\ref[src];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=\ref[src];send_to=[S.server_id]'> (Transfer)</A><BR>"
|
||||
dat += "<HR><A href='?src=\ref[src];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/attackby(var/obj/item/weapon/D as obj, var/mob/user as mob)
|
||||
if(istype(D, /obj/item/weapon/screwdriver))
|
||||
playsound(src.loc, 'Screwdriver.ogg', 50, 1)
|
||||
if(do_after(user, 20))
|
||||
if (src.stat & BROKEN)
|
||||
user << "\blue The broken glass falls out."
|
||||
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
||||
new /obj/item/weapon/shard( src.loc )
|
||||
var/obj/item/weapon/circuitboard/rdservercontrol/M = new /obj/item/weapon/circuitboard/rdservercontrol( A )
|
||||
for (var/obj/C in src)
|
||||
C.loc = src.loc
|
||||
A.circuit = M
|
||||
A.state = 3
|
||||
A.icon_state = "3"
|
||||
A.anchored = 1
|
||||
del(src)
|
||||
else
|
||||
user << "\blue You disconnect the monitor."
|
||||
var/obj/structure/computerframe/A = new /obj/structure/computerframe( src.loc )
|
||||
var/obj/item/weapon/circuitboard/rdservercontrol/M = new /obj/item/weapon/circuitboard/rdservercontrol( A )
|
||||
for (var/obj/C in src)
|
||||
C.loc = src.loc
|
||||
A.circuit = M
|
||||
A.state = 4
|
||||
A.icon_state = "4"
|
||||
A.anchored = 1
|
||||
del(src)
|
||||
else if(istype(D, /obj/item/weapon/card/emag) && !emagged)
|
||||
playsound(src.loc, 'sparks4.ogg', 75, 1)
|
||||
emagged = 1
|
||||
user << "\blue You you disable the security protocols"
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
|
||||
/obj/machinery/r_n_d/server/robotics
|
||||
name = "Robotics R&D Server"
|
||||
@@ -374,6 +375,7 @@
|
||||
id_with_download_string = "1;2"
|
||||
server_id = 2
|
||||
|
||||
|
||||
/obj/machinery/r_n_d/server/core
|
||||
name = "Core R&D Server"
|
||||
id_with_upload_string = "1"
|
||||
|
||||
Reference in New Issue
Block a user