[READY]Refactors techwebs to have different types of points - PR HAS NO GAMEPLAY IMPACT
This commit is contained in:
@@ -11,14 +11,14 @@
|
||||
var/list/datum/design/researched_designs = list() //Designs that are available for use. Assoc list, id = datum
|
||||
var/list/datum/techweb_node/boosted_nodes = list() //Already boosted nodes that can't be boosted again. node datum = path of boost object.
|
||||
var/list/datum/techweb_node/hidden_nodes = list() //Hidden nodes. id = datum. Used for unhiding nodes when requirements are met by removing the entry of the node.
|
||||
var/list/deconstructed_items = list() //items already deconstructed for a generic point boost
|
||||
var/research_points = 0 //Available research points.
|
||||
var/list/deconstructed_items = list() //items already deconstructed for a generic point boost. path = list(point_type = points)
|
||||
var/list/research_points = list() //Available research points. type = number
|
||||
var/list/obj/machinery/computer/rdconsole/consoles_accessing = list()
|
||||
var/id = "generic"
|
||||
var/list/research_logs = list() //IC logs.
|
||||
var/max_bomb_value = 0
|
||||
var/organization = "Third-Party" //Organization name, used for display.
|
||||
var/last_bitcoins = 0 //Current per-second production, used for display only.
|
||||
var/list/last_bitcoins = list() //Current per-second production, used for display only.
|
||||
var/list/tiers = list() //Assoc list, datum = number, 1 is available, 2 is all reqs are 1, so on
|
||||
|
||||
/datum/techweb/New()
|
||||
@@ -29,7 +29,6 @@
|
||||
return ..()
|
||||
|
||||
/datum/techweb/admin
|
||||
research_points = INFINITY //KEKKLES.
|
||||
id = "ADMIN"
|
||||
organization = "CentCom"
|
||||
|
||||
@@ -38,6 +37,8 @@
|
||||
for(var/i in SSresearch.techweb_nodes)
|
||||
var/datum/techweb_node/TN = SSresearch.techweb_nodes[i]
|
||||
research_node(TN, TRUE)
|
||||
for(var/i in SSresearch.point_types)
|
||||
research_points[i] = INFINITY
|
||||
hidden_nodes = list()
|
||||
|
||||
/datum/techweb/science //Global science techweb for RND consoles.
|
||||
@@ -72,6 +73,39 @@
|
||||
V.rescan_views()
|
||||
V.updateUsrDialog()
|
||||
|
||||
/datum/techweb/proc/add_point_list(list/pointlist)
|
||||
for(var/i in pointlist)
|
||||
if(SSresearch.point_types[i] && pointlist[i] > 0)
|
||||
research_points[i] += pointlist[i]
|
||||
|
||||
/datum/techweb/proc/add_points_all(amount)
|
||||
var/list/l = SSresearch.point_types.Copy()
|
||||
for(var/i in l)
|
||||
l[i] = amount
|
||||
add_point_list(l)
|
||||
|
||||
/datum/techweb/proc/remove_point_list(list/pointlist)
|
||||
for(var/i in pointlist)
|
||||
if(SSresearch.point_types[i] && pointlist[i] > 0)
|
||||
research_points[i] = max(0, research_points[i] - pointlist[i])
|
||||
|
||||
/datum/techweb/proc/remove_points_all(amount)
|
||||
var/list/l = SSresearch.point_types.Copy()
|
||||
for(var/i in l)
|
||||
l[i] = amount
|
||||
remove_point_list(l)
|
||||
|
||||
/datum/techweb/proc/modify_point_list(list/pointlist)
|
||||
for(var/i in pointlist)
|
||||
if(SSresearch.point_types[i] && pointlist[i] != 0)
|
||||
research_points[i] = max(0, research_points[i] + pointlist[i])
|
||||
|
||||
/datum/techweb/proc/modify_points_all(amount)
|
||||
var/list/l = SSresearch.point_types.Copy()
|
||||
for(var/i in l)
|
||||
l[i] = amount
|
||||
modify_point_list(l)
|
||||
|
||||
/datum/techweb/proc/copy_research_to(datum/techweb/reciever, unlock_hidden = TRUE) //Adds any missing research to theirs.
|
||||
for(var/i in researched_nodes)
|
||||
CHECK_TICK
|
||||
@@ -104,6 +138,24 @@
|
||||
/datum/techweb/proc/get_researched_nodes()
|
||||
return researched_nodes - hidden_nodes
|
||||
|
||||
/datum/techweb/proc/add_point_type(type, amount)
|
||||
if(!SSresearch.point_types[type] || (amount <= 0))
|
||||
return FALSE
|
||||
research_points[type] = amount
|
||||
return TRUE
|
||||
|
||||
/datum/techweb/proc/modify_point_type(type, amount)
|
||||
if(!SSresearch.point_types[type])
|
||||
return FALSE
|
||||
research_points[type] = max(0, research_points[type] - amount)
|
||||
return TRUE
|
||||
|
||||
/datum/techweb/proc/remove_point_type(type, amount)
|
||||
if(!SSresearch.point_types[type] || (amount <= 0))
|
||||
return FALSE
|
||||
research_points[type] = max(0, research_points[type] - amount)
|
||||
return TRUE
|
||||
|
||||
/datum/techweb/proc/add_design_by_id(id)
|
||||
return add_design(get_techweb_design_by_id(id))
|
||||
|
||||
@@ -122,6 +174,15 @@
|
||||
researched_designs -= design.id
|
||||
return TRUE
|
||||
|
||||
/datum/techweb/proc/can_afford(list/pointlist)
|
||||
for(var/i in pointlist)
|
||||
if(research_points[i] < pointlist[i])
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/techweb/proc/printout_points()
|
||||
return techweb_point_display_generic(research_points)
|
||||
|
||||
/datum/techweb/proc/research_node_id(id, force, auto_update_points)
|
||||
return research_node(get_techweb_node_by_id(id), force, auto_update_points)
|
||||
|
||||
@@ -130,10 +191,10 @@
|
||||
return FALSE
|
||||
update_node_status(node)
|
||||
if(!force)
|
||||
if(!available_nodes[node.id] || (auto_adjust_cost && (research_points < node.get_price(src))))
|
||||
if(!available_nodes[node.id] || (auto_adjust_cost && (!can_afford(node.get_price(src)))))
|
||||
return FALSE
|
||||
if(auto_adjust_cost)
|
||||
research_points -= node.get_price(src)
|
||||
remove_point_list(node.get_price(src))
|
||||
researched_nodes[node.id] = node //Add to our researched list
|
||||
for(var/i in node.unlocks)
|
||||
visible_nodes[i] = node.unlocks[i]
|
||||
@@ -155,7 +216,9 @@
|
||||
/datum/techweb/proc/boost_with_path(datum/techweb_node/N, itempath)
|
||||
if(!istype(N) || !ispath(itempath))
|
||||
return FALSE
|
||||
boosted_nodes[N] = max(boosted_nodes[N], N.boost_item_paths[itempath])
|
||||
LAZYINITLIST(boosted_nodes[N])
|
||||
for(var/i in N.boost_item_paths[itempath])
|
||||
boosted_nodes[N][i] = max(boosted_nodes[N][i], N.boost_item_paths[itempath][i])
|
||||
if(N.autounlock_by_boost)
|
||||
hidden_nodes -= N.id
|
||||
update_node_status(N)
|
||||
|
||||
Reference in New Issue
Block a user