Skip to content

Commit

Permalink
Automatic changelog compile, [ci skip] (tgstation#33393)
Browse files Browse the repository at this point in the history
  • Loading branch information
silicons authored and Cyberboss committed Dec 10, 2017
1 parent 165d53b commit 1f32d16
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 57 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/research.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

#define RDCONSOLE_UI_MODE_NORMAL 1
#define RDCONSOLE_UI_MODE_EXPERT 2
#define RDCONSOLE_UI_MODE_LIST 3

//RDSCREEN screens
#define RDSCREEN_MENU 0
#define RDSCREEN_TECHDISK 1
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/material_container.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
if(!has_space(material_amount))
to_chat(user, "<span class='warning'>[parent] is full. Please remove metal or glass from [parent] in order to insert more.</span>")
return
user_insert(I, user)
INVOKE_ASYNC(src, .proc/user_insert, I, user) //It wasn't returning COMPONENT_NO_AFTERATTACK properly without this being specifically asynced.

/datum/component/material_container/proc/user_insert(obj/item/I, mob/living/user)
var/requested_amount
Expand Down
3 changes: 1 addition & 2 deletions code/modules/research/circuitprinter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
circuit = /obj/item/circuitboard/machine/circuit_imprinter

var/efficiency_coeff
var/console_link = TRUE //can this link to a console?
var/requires_console = TRUE

var/datum/component/material_container/materials //Store for hyper speed!

Expand All @@ -36,6 +34,7 @@ using metal and glass, it uses glass and reagents (usually sulfuric acis).
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
create_reagents(0)
RefreshParts()
return ..()

/obj/machinery/rnd/circuit_imprinter/RefreshParts()
Expand Down
3 changes: 1 addition & 2 deletions code/modules/research/protolathe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Note: Must be placed west/left of and R&D console to function.
circuit = /obj/item/circuitboard/machine/protolathe

var/efficiency_coeff
var/console_link = TRUE //allow console link.
var/requires_console = TRUE
var/list/categories = list(
"Power Designs",
"Medical Designs",
Expand All @@ -39,6 +37,7 @@ Note: Must be placed west/left of and R&D console to function.
list(MAT_METAL, MAT_GLASS, MAT_SILVER, MAT_GOLD, MAT_DIAMOND, MAT_PLASMA, MAT_URANIUM, MAT_BANANIUM, MAT_TITANIUM, MAT_BLUESPACE), 0,
FALSE, list(/obj/item/stack, /obj/item/ore/bluespace_crystal), CALLBACK(src, .proc/is_insertion_ready), CALLBACK(src, .proc/AfterMaterialInsert))
materials.precise_insertion = TRUE
RefreshParts()
return ..()

/obj/machinery/rnd/protolathe/RefreshParts()
Expand Down
78 changes: 56 additions & 22 deletions code/modules/research/rdconsole.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ doesn't have toxins access.
var/disk_slot_selected
var/searchstring = ""
var/searchtype = ""
var/ui_mode = RDCONSOLE_UI_MODE_NORMAL

var/research_control = TRUE

Expand Down Expand Up @@ -220,6 +221,7 @@ doesn't have toxins access.
l += "Available points: [round(stored_research.research_points)] (+[round(stored_research.last_bitcoins * 60)] / minute)"
l += "Security protocols: [emagged? "<font color='red'>Disabled</font>" : "<font color='green'>Enabled</font>"]"
l += "<a href='?src=[REF(src)];switch_screen=[RDSCREEN_MENU]'>Main Menu</a> | <a href='?src=[REF(src)];switch_screen=[back]'>Back</a></div>[RDSCREEN_NOBREAK]"
l += "[ui_mode == 1? "<span class='linkOn'>Normal View</span>" : "<a href='?src=[REF(src)];ui_mode=1'>Normal View</a>"] | [ui_mode == 2? "<span class='linkOn'>Expert View</span>" : "<a href='?src=[REF(src)];ui_mode=2'>Expert View</a>"] | [ui_mode == 3? "<span class='linkOn'>List View</span>" : "<a href='?src=[REF(src)];ui_mode=3'>List View</a>"]"
return l

/obj/machinery/computer/rdconsole/proc/ui_main_menu()
Expand Down Expand Up @@ -598,23 +600,52 @@ doesn't have toxins access.
l += "</div>"
return l

/obj/machinery/computer/rdconsole/proc/ui_techweb() //Legacy code.
/obj/machinery/computer/rdconsole/proc/ui_techweb()
var/list/l = list()
var/list/columns = list()
var/max_tier = 0
for (var/node_ in stored_research.tiers)
var/datum/techweb_node/node = node_
var/tier = stored_research.tiers[node]
LAZYINITLIST(columns["[tier]"]) // String hackery to make the numbers associative
columns["[tier]"] += ui_techweb_single_node(node, minimal=(tier != 1))
max_tier = max(max_tier, tier)

l += "<table><tr><th align='left'>Researched</th><th align='left'>Available</th><th align='left'>Future</th></tr><tr>[RDSCREEN_NOBREAK]"
for(var/tier in 0 to max_tier)
l += "<td valign='top'>[RDSCREEN_NOBREAK]"
l += columns["[tier]"]
l += "</td>[RDSCREEN_NOBREAK]"
l += "</tr></table>[RDSCREEN_NOBREAK]"
if(ui_mode != RDCONSOLE_UI_MODE_LIST)
var/list/columns = list()
var/max_tier = 0
for (var/node_ in stored_research.tiers)
var/datum/techweb_node/node = node_
var/tier = stored_research.tiers[node]
LAZYINITLIST(columns["[tier]"]) // String hackery to make the numbers associative
columns["[tier]"] += ui_techweb_single_node(node, minimal=(tier != 1))
max_tier = max(max_tier, tier)

l += "<table><tr><th align='left'>Researched</th><th align='left'>Available</th><th align='left'>Future</th></tr><tr>[RDSCREEN_NOBREAK]"
for(var/tier in 0 to max_tier)
l += "<td valign='top'>[RDSCREEN_NOBREAK]"
l += columns["[tier]"]
l += "</td>[RDSCREEN_NOBREAK]"
l += "</tr></table>[RDSCREEN_NOBREAK]"
else
var/list/avail = list() //This could probably be optimized a bit later.
var/list/unavail = list()
var/list/res = list()
for(var/v in stored_research.researched_nodes)
res += stored_research.researched_nodes[v]
for(var/v in stored_research.available_nodes)
if(stored_research.researched_nodes[v])
continue
avail += stored_research.available_nodes[v]
for(var/v in stored_research.visible_nodes)
if(stored_research.available_nodes[v])
continue
unavail += stored_research.visible_nodes[v]
l += "<h2>Technology Nodes:</h2>[RDSCREEN_NOBREAK]"
l += "<div><h3>Available for Research:</h3>"
for(var/datum/techweb_node/N in avail)
var/not_unlocked = (stored_research.available_nodes[N.id] && !stored_research.researched_nodes[N.id])
var/has_points = (stored_research.research_points >= N.get_price(stored_research))
var/research_href = not_unlocked? (has_points? "<A href='?src=[REF(src)];research_node=[N.id]'>Research</A>" : "<span class='linkOff bad'>Not Enough Points</span>") : null
l += "<A href='?src=[REF(src)];view_node=[N.id];back_screen=[screen]'>[N.display_name]</A>[research_href]"
l += "</div><div><h3>Locked Nodes:</h3>"
for(var/datum/techweb_node/N in unavail)
l += "<A href='?src=[REF(src)];view_node=[N.id];back_screen=[screen]'>[N.display_name]</A>"
l += "</div><div><h3>Researched Nodes:</h3>"
for(var/datum/techweb_node/N in res)
l += "<A href='?src=[REF(src)];view_node=[N.id];back_screen=[screen]'>[N.display_name]</A>"
l += "</div>[RDSCREEN_NOBREAK]"
return l

/obj/machinery/computer/rdconsole/proc/machine_icon(atom/item)
Expand All @@ -629,7 +660,7 @@ doesn't have toxins access.
if (selflink)
display_name = "<A href='?src=[REF(src)];view_node=[node.id];back_screen=[screen]'>[display_name]</A>"
l += "<div class='statusDisplay technode'><b>[display_name]</b> [RDSCREEN_NOBREAK]"
if (minimal)
if(minimal)
l += "<br>[node.description]"
else
if(stored_research.researched_nodes[node.id])
Expand All @@ -641,14 +672,15 @@ doesn't have toxins access.
l += "<span class='linkOff'>[price]</span>" // gray - too expensive
else
l += "<span class='linkOff bad'>[price]</span>" // red - missing prereqs
l += "[node.description]"
for(var/i in node.designs)
var/datum/design/D = node.designs[i]
l += "<span data-tooltip='[D.name]' onclick='location=\"?src=[REF(src)];view_design=[i];back_screen=[screen]\"'>[D.icon_html(usr)]</span>[RDSCREEN_NOBREAK]"
if(ui_mode == RDCONSOLE_UI_MODE_NORMAL)
l += "[node.description]"
for(var/i in node.designs)
var/datum/design/D = node.designs[i]
l += "<span data-tooltip='[D.name]' onclick='location=\"?src=[REF(src)];view_design=[i];back_screen=[screen]\"'>[D.icon_html(usr)]</span>[RDSCREEN_NOBREAK]"
l += "</div>[RDSCREEN_NOBREAK]"
return l

/obj/machinery/computer/rdconsole/proc/ui_techweb_nodeview() //Legacy code
/obj/machinery/computer/rdconsole/proc/ui_techweb_nodeview()
RDSCREEN_UI_SNODE_CHECK
var/list/l = list()
if(stored_research.hidden_nodes[selected_node.id])
Expand Down Expand Up @@ -780,6 +812,8 @@ doesn't have toxins access.
if(ls["switch_screen"])
back = screen
screen = text2num(ls["switch_screen"])
if(ls["ui_mode"])
ui_mode = text2num(ls["ui_mode"])
if(ls["lock_console"])
if(allowed(usr))
lock_console(usr)
Expand Down
26 changes: 13 additions & 13 deletions code/modules/research/rdmachines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
use_power = IDLE_POWER_USE
var/busy = FALSE
var/hacked = FALSE
var/console_link = TRUE //allow console link.
var/requires_console = TRUE
var/disabled = FALSE
var/shocked = FALSE
var/obj/machinery/computer/rdconsole/linked_console
Expand Down Expand Up @@ -78,28 +80,26 @@
/obj/machinery/rnd/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
if (disabled)
return
if (!linked_console) // Try to auto-connect to new RnD consoles nearby.
if(!linked_console)
to_chat(user, "<span class='warning'>[src] must be linked to an R&D console first!</span>")
return
if (busy)
return FALSE
if(disabled)
return FALSE
if(requires_console && !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
return FALSE
if(stat & BROKEN)
to_chat(user, "<span class='warning'>[src] is broken.</span>")
return
return FALSE
if(stat & NOPOWER)
to_chat(user, "<span class='warning'>[src] has no power.</span>")
return
return FALSE
if(loaded_item)
to_chat(user, "<span class='warning'>[src] is already loaded.</span>")
return
return FALSE
return TRUE


//we eject the loaded item when deconstructing the machine
/obj/machinery/rnd/on_deconstruction()
if(loaded_item)
Expand Down
47 changes: 30 additions & 17 deletions code/modules/research/techweb/all_nodes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@
display_name = "Radioactive Weaponry"
description = "Weapons using radioactive technology."
prereq_ids = list("adv_engi", "adv_weaponry")
design_ids = list("nuclear_gun", "decloner")
design_ids = list("nuclear_gun")
research_cost = 2500
export_price = 10000

Expand Down Expand Up @@ -834,6 +834,35 @@
export_price = 20000
hidden = TRUE

/datum/techweb_node/syndicate_basic
id = "syndicate_basic"
display_name = "Illegal Technology"
description = "Dangerous research used to create dangerous objects."
prereq_ids = list("adv_engi", "adv_weaponry", "explosive_weapons")
design_ids = list("decloner", "borg_syndicate_module", "suppressor", "largecrossbow")
research_cost = 10000
export_price = 10000
hidden = TRUE

/datum/techweb_node/syndicate_basic/New() //Crappy way of making syndicate gear decon supported until there's another way.
. = ..()
boost_item_paths = list()
for(var/cat in GLOB.uplink_items)
var/list/l = cat
for(var/i in l)
var/datum/uplink_item/UI = i
boost_item_paths[UI.item] = 0 //allows deconning to unlock.

//HELPERS
/proc/total_techweb_exports()
var/list/datum/techweb_node/processing = list()
for(var/i in subtypesof(/datum/techweb_node))
processing += new i
. = 0
for(var/i in processing)
var/datum/techweb_node/TN = i
. += TN.export_price

/proc/total_techweb_points()
var/list/datum/techweb_node/processing = list()
for(var/i in subtypesof(/datum/techweb_node))
Expand All @@ -842,19 +871,3 @@
for(var/i in processing)
var/datum/techweb_node/TN = i
. += TN.research_cost

/*
/datum/design/borg_syndicate_module
name = "Cyborg Upgrade (Illegal Modules)"
id = "borg_syndicate_module"
construction_time = 120
/datum/design/suppressor
name = "Universal Suppressor"
id = "suppressor"
/datum/design/largecrossbow
name = "Energy Crossbow"
id = "largecrossbow"
build_path = /obj/item/gun/energy/kinetic_accelerator/crossbow/large
*/

0 comments on commit 1f32d16

Please sign in to comment.