Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion code/__DEFINES/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,57 @@
#define TECHWEB_POINT_TYPE_GENERIC "General Research"
#define TECHWEB_POINT_TYPE_NANITES "Nanite Research"

// Faction-specific point types - ONE per major faction
// Subfactions share their parent's point type
#define TECHWEB_POINT_TYPE_FACTION_NT "Nanotrasen Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_SYNDICATE "Syndicate Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_CLIP "CLIP Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_SRM "Saint-Roumain Militia Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_INTEQ "Inteq Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_INDEPENDENT "Independent Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_SOLGOV "SolGov Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_PGF "PGF Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_RAMZI "Ramzi Clique Faction Points"
#define TECHWEB_POINT_TYPE_FACTION_FRONTIERSMEN "Frontiersmen Faction Points"

// Cross-faction research cost markup
#define TECHWEB_CROSS_FACTION_MARKUP 2.5 // 2.5x cost when researching other faction's tech

// Department-specific point types
// Core Departments
#define TECHWEB_POINT_TYPE_DEPT_MEDICAL "Medical Department Research"
#define TECHWEB_POINT_TYPE_DEPT_ENGINEERING "Engineering Department Research"
#define TECHWEB_POINT_TYPE_DEPT_CARGO "Cargo Department Research"
#define TECHWEB_POINT_TYPE_DEPT_SECURITY "Security Department Research"
// Secondary Departments
#define TECHWEB_POINT_TYPE_DEPT_SERVICE "Service Department Research"
#define TECHWEB_POINT_TYPE_DEPT_SCIENCE "Science Department Research"
// Specialized Departments
#define TECHWEB_POINT_TYPE_DEPT_EXPLORATION "Exploration Department Research"

#define TECHWEB_POINT_TYPE_DEFAULT TECHWEB_POINT_TYPE_GENERIC

///Associative names for techweb point values, see: [/modules/research/techweb/all_nodes][all_nodes]
#define TECHWEB_POINT_TYPE_LIST_ASSOCIATIVE_NAMES list( \
TECHWEB_POINT_TYPE_GENERIC = "General Research", \
TECHWEB_POINT_TYPE_NANITES = "Nanite Research" \
TECHWEB_POINT_TYPE_NANITES = "Nanite Research", \
TECHWEB_POINT_TYPE_FACTION_NT = "Nanotrasen Faction Points", \
TECHWEB_POINT_TYPE_FACTION_SYNDICATE = "Syndicate Faction Points", \
TECHWEB_POINT_TYPE_FACTION_CLIP = "CLIP Faction Points", \
TECHWEB_POINT_TYPE_FACTION_SRM = "Saint-Roumain Militia Faction Points", \
TECHWEB_POINT_TYPE_FACTION_INTEQ = "Inteq Faction Points", \
TECHWEB_POINT_TYPE_FACTION_INDEPENDENT = "Independent Faction Points", \
TECHWEB_POINT_TYPE_FACTION_SOLGOV = "SolGov Faction Points", \
TECHWEB_POINT_TYPE_FACTION_PGF = "PGF Faction Points", \
TECHWEB_POINT_TYPE_FACTION_RAMZI = "Ramzi Clique Faction Points", \
TECHWEB_POINT_TYPE_FACTION_FRONTIERSMEN = "Frontiersmen Faction Points", \
TECHWEB_POINT_TYPE_DEPT_MEDICAL = "Medical Department Research", \
TECHWEB_POINT_TYPE_DEPT_ENGINEERING = "Engineering Department Research", \
TECHWEB_POINT_TYPE_DEPT_CARGO = "Cargo Department Research", \
TECHWEB_POINT_TYPE_DEPT_SECURITY = "Security Department Research", \
TECHWEB_POINT_TYPE_DEPT_SERVICE = "Service Department Research", \
TECHWEB_POINT_TYPE_DEPT_SCIENCE = "Science Department Research", \
TECHWEB_POINT_TYPE_DEPT_EXPLORATION = "Exploration Department Research" \
)

#define BOMB_TARGET_POINTS 50000 //Adjust as needed. Actual hard cap is double this, but will never be reached due to hyperbolic curve.
Expand Down
44 changes: 44 additions & 0 deletions code/controllers/subsystem/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,50 @@ SUBSYSTEM_DEF(research)
var/list/errored_datums = list()
var/list/point_types = list() //typecache style type = TRUE list

// Faction techwebs - shared research trees for each major faction
var/datum/techweb/faction/nanotrasen/faction_techweb_nt
var/datum/techweb/faction/nanotrasen/ns_logistics/faction_techweb_ns_logi
var/datum/techweb/faction/nanotrasen/vigilitas/faction_techweb_vigilitas
var/datum/techweb/faction/syndicate/faction_techweb_syndicate
var/datum/techweb/faction/syndicate/ngr/faction_techweb_ngr
var/datum/techweb/faction/syndicate/cybersun/faction_techweb_cybersun
var/datum/techweb/faction/syndicate/self/faction_techweb_self
var/datum/techweb/faction/syndicate/suns/faction_techweb_suns
var/datum/techweb/faction/syndicate/hardliners/faction_techweb_hardliners
var/datum/techweb/faction/clip/faction_techweb_clip
var/datum/techweb/faction/srm/faction_techweb_srm
var/datum/techweb/faction/inteq/faction_techweb_inteq
var/datum/techweb/faction/independent/faction_techweb_independent
var/datum/techweb/faction/solgov/faction_techweb_solgov
var/datum/techweb/faction/pgf/faction_techweb_pgf
var/datum/techweb/faction/ramzi/faction_techweb_ramzi
var/datum/techweb/faction/frontiersmen/faction_techweb_frontiersmen

/datum/controller/subsystem/research/Initialize()
point_types = TECHWEB_POINT_TYPE_LIST_ASSOCIATIVE_NAMES
initialize_all_techweb_designs()
initialize_all_techweb_nodes()
admin_tech = new /datum/techweb/admin

// Initialize faction techwebs
faction_techweb_nt = new /datum/techweb/faction/nanotrasen()
faction_techweb_ns_logi = new /datum/techweb/faction/nanotrasen/ns_logistics()
faction_techweb_vigilitas = new /datum/techweb/faction/nanotrasen/vigilitas()
faction_techweb_syndicate = new /datum/techweb/faction/syndicate()
faction_techweb_ngr = new /datum/techweb/faction/syndicate/ngr()
faction_techweb_cybersun = new /datum/techweb/faction/syndicate/cybersun()
faction_techweb_self = new /datum/techweb/faction/syndicate/self()
faction_techweb_suns = new /datum/techweb/faction/syndicate/suns()
faction_techweb_hardliners = new /datum/techweb/faction/syndicate/hardliners()
faction_techweb_clip = new /datum/techweb/faction/clip()
faction_techweb_srm = new /datum/techweb/faction/srm()
faction_techweb_inteq = new /datum/techweb/faction/inteq()
faction_techweb_independent = new /datum/techweb/faction/independent()
faction_techweb_solgov = new /datum/techweb/faction/solgov()
faction_techweb_pgf = new /datum/techweb/faction/pgf()
faction_techweb_ramzi = new /datum/techweb/faction/ramzi()
faction_techweb_frontiersmen = new /datum/techweb/faction/frontiersmen()

autosort_categories()
error_design = new
error_node = new
Expand Down Expand Up @@ -245,3 +284,8 @@ SUBSYSTEM_DEF(research)
else
techweb_boost_items[path] = list(node.id = node.boost_item_paths[path])
CHECK_TICK

/// Check if a point type is a faction-specific point type
/datum/controller/subsystem/research/proc/is_faction_point_type(point_type)
// Faction point types start with "TECHWEB_POINT_TYPE_FACTION_"
return findtext(point_type, "Faction Points") > 0
2 changes: 2 additions & 0 deletions code/datums/shuttles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
var/manufacturer = "Unknown"
/// The faction this ship belongs to.
var/datum/faction/faction
/// List of department roles this ship has for department-based research (e.g., "medical", "cargo", "engineering")
var/list/department_roles = list()
/// Whether or not players from other ships can open airlocks.
var/unique_ship_access = TRUE
/// Set by config JSON. If true, the template's ships' "default" spawn location (when bought by a player or loaded at roundstart)
Expand Down
64 changes: 64 additions & 0 deletions code/modules/overmap/ships/controlled_ship_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@
/// List of mob refs indexed by their job instance
var/list/datum/weakref/job_holder_refs = list()

/// The ship's techweb for research
var/datum/techweb/ship/ship_techweb
/// Reference to faction techweb (shared research tree)
var/datum/techweb/faction/faction_techweb_reference

var/list/datum/mind/owner_candidates

/// The mob of the current ship owner. Tracking mostly uses this; that lets us pick up on logouts, which let us
Expand Down Expand Up @@ -127,6 +132,14 @@
job_slots = source_template.job_slots?.Copy()
stationary_icon_state = creation_template.token_icon_state
alter_token_appearance()

// Initialize faction techweb reference
if(source_template.faction)
faction_techweb_reference = get_faction_techweb(source_template.faction)

// Initialize ship techweb with departments
ship_techweb = new /datum/techweb/ship(name, source_template.department_roles?.Copy(), faction_techweb_reference)

if(create_shuttle)
shuttle_port = SSshuttle.load_template(creation_template, src)
if(!shuttle_port) //Loading failed, if the shuttle is supposed to be created, we need to delete ourselves.
Expand Down Expand Up @@ -582,6 +595,57 @@
master_ship = null
return ..()

/**
* Helper proc to get the appropriate faction techweb based on a faction datum
* Returns the faction-specific techweb or null if not found
*/
/datum/overmap/ship/controlled/proc/get_faction_techweb(datum/faction/faction_datum)
if(!faction_datum)
return null

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add faction tag to each datum as a string, then initial() the variable without having to initialize/create the actual datum. Then pass the tag through a switch() instead of doing the if() chain and istype() checking.
I think it looks something like this, though it's been a bit since I've looked at the actual syntax:

var/datum/faction/this_faction = faction_datum
var/faction_tag = initial(faction_datum.faction_tag)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill be totally honest I did most of this draft stuff back in December but then started my modular ruin stuff.

I have not even really sat down to start testing it.

Really I just made it a PR since I never published it to my fork, and was probably going to lose it if I didnt.

// Check for specific faction techwebs - most specific first
// Nanotrasen subfactions
if(istype(faction_datum, /datum/faction/nt/ns_logi))
return SSresearch.faction_techweb_ns_logi
else if(istype(faction_datum, /datum/faction/nt/vigilitas))
return SSresearch.faction_techweb_vigilitas
else if(istype(faction_datum, /datum/faction/nt))
return SSresearch.faction_techweb_nt

// Syndicate subfactions
else if(istype(faction_datum, /datum/faction/syndicate/ngr))
return SSresearch.faction_techweb_ngr
else if(istype(faction_datum, /datum/faction/syndicate/cybersun))
return SSresearch.faction_techweb_cybersun
else if(istype(faction_datum, /datum/faction/syndicate/self))
return SSresearch.faction_techweb_self
else if(istype(faction_datum, /datum/faction/syndicate/suns))
return SSresearch.faction_techweb_suns
else if(istype(faction_datum, /datum/faction/syndicate/hardliners))
return SSresearch.faction_techweb_hardliners
else if(istype(faction_datum, /datum/faction/syndicate))
return SSresearch.faction_techweb_syndicate

// Other major factions
else if(istype(faction_datum, /datum/faction/clip))
return SSresearch.faction_techweb_clip
else if(istype(faction_datum, /datum/faction/srm))
return SSresearch.faction_techweb_srm
else if(istype(faction_datum, /datum/faction/inteq))
return SSresearch.faction_techweb_inteq
else if(istype(faction_datum, /datum/faction/independent))
return SSresearch.faction_techweb_independent
else if(istype(faction_datum, /datum/faction/solgov))
return SSresearch.faction_techweb_solgov
else if(istype(faction_datum, /datum/faction/pgf))
return SSresearch.faction_techweb_pgf
else if(istype(faction_datum, /datum/faction/ramzi))
return SSresearch.faction_techweb_ramzi
else if(istype(faction_datum, /datum/faction/frontiersmen))
return SSresearch.faction_techweb_frontiersmen

return null

/obj/item/key/ship/attack_self(mob/user)
if(!master_ship || !Adjacent(user))
return ..()
Expand Down
4 changes: 3 additions & 1 deletion code/modules/power/singularity/collector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
loaded_tank.air_contents.adjust_moles(GAS_CO2, gasdrained*2)
var/bitcoins_mined = RAD_COLLECTOR_OUTPUT
stored_research += bitcoins_mined*RAD_COLLECTOR_MINING_CONVERSION_RATE*PRIVATE_TECHWEB_GAIN
linked_techweb.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, bitcoins_mined*RAD_COLLECTOR_MINING_CONVERSION_RATE*PUBLIC_TECHWEB_GAIN)
// Rad collectors generate engineering department research
linked_techweb.add_point_type(TECHWEB_POINT_TYPE_DEPT_ENGINEERING, bitcoins_mined*RAD_COLLECTOR_MINING_CONVERSION_RATE*PUBLIC_TECHWEB_GAIN)
stored_energy-=bitcoins_mined

/obj/machinery/power/rad_collector/interact(mob/user)
Expand Down Expand Up @@ -132,6 +133,7 @@
return ..()
/obj/machinery/power/rad_collector/analyzer_act(mob/living/user, obj/item/I)
if(stored_research >= 1)
// Creates engineering department research notes
new /obj/item/research_notes(user.loc, stored_research, "engineering")
stored_research = 0
return TRUE
Expand Down
8 changes: 8 additions & 0 deletions code/modules/research/designs/comp_board_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
build_type = IMPRINTER
materials = list(/datum/material/glass = 250)

/datum/design/board/faction_contracts
name = "Computer Design (Faction Contract Terminal)"
desc = "Allows for the construction of a faction contract terminal for accessing research bounties."
id = "faction_contracts"
build_path = /obj/item/circuitboard/computer/faction_contracts
category = list("Computer Boards")
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE

/datum/design/board/arcade_battle
name = "Computer Design (Battle Arcade Machine)"
desc = "Allows for the construction of circuit boards used to build a new arcade machine."
Expand Down
8 changes: 8 additions & 0 deletions code/modules/research/designs/machine_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
//////////////MISC Boards///////////////
////////////////////////////////////////

/datum/design/board/faction_disk_printer
name = "Machine Design (Faction Research Compiler Board)"
desc = "The circuit board for a faction research compiler that converts generic research into faction-specific points."
id = "faction_disk_printer"
build_path = /obj/item/circuitboard/machine/faction_disk_printer
category = list("Research Machinery")
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE

/datum/design/board/smes
name = "Machine Design (SMES Board)"
desc = "The circuit board for a SMES."
Expand Down
8 changes: 8 additions & 0 deletions code/modules/research/designs/mining_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,11 @@
build_path = /obj/item/radio/weather_monitor
category = list("Mining Designs")
departmental_flags = DEPARTMENTAL_FLAG_CARGO

/datum/design/board/mining_research_drill
name = "Machine Design (Mining Research Drill Board)"
desc = "The circuit board for a mining research drill. Generates research points from geological core sampling."
id = "mining_research_drill"
build_path = /obj/item/circuitboard/machine/mining_research_drill
category = list("Mining Designs")
departmental_flags = DEPARTMENTAL_FLAG_CARGO
30 changes: 30 additions & 0 deletions code/modules/research/designs/misc_designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,36 @@
category = list("Equipment")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/security_scanner
name = "Tactical Threat Analyzer"
desc = "A specialized scanner for cataloging neutralized threats and generating tactical intelligence data."
id = "security_scanner"
build_type = PROTOLATHE
materials = list(/datum/material/iron = 1000, /datum/material/glass = 500, /datum/material/silver = 250)
build_path = /obj/item/security_scanner
category = list("Equipment")
departmental_flags = DEPARTMENTAL_FLAG_SECURITY

/datum/design/ruin_scanner
name = "Archaeological Survey Scanner"
desc = "A sophisticated scanner for analyzing xeno-archaeological sites and cataloging artifacts within ruins."
id = "ruin_scanner"
build_type = PROTOLATHE
materials = list(/datum/material/iron = 1500, /datum/material/glass = 1500, /datum/material/gold = 500)
build_path = /obj/item/ruin_scanner
category = list("Equipment")
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE

/datum/design/faction_research_disk
name = "Faction Research Disk"
desc = "A blank disk for storing compiled faction-specific research data."
id = "faction_research_disk"
build_type = PROTOLATHE
materials = list(/datum/material/iron = 300, /datum/material/glass = 100)
build_path = /obj/item/disk/faction_research_disk
category = list("Equipment")
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE

/datum/design/security_hud_night
name = "Night Vision Security HUD"
desc = "A heads-up display which provides id data and vision in complete darkness."
Expand Down
10 changes: 10 additions & 0 deletions code/modules/research/destructive_analyzer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ Note: Must be placed within 3 tiles of the R&D Console
var/list/point_value = techweb_item_point_check(loaded_item)
if(linked_console.stored_research.deconstructed_items[loaded_item.type])
point_value = list()
// If no predefined point value, check if item belongs to a department category
if(!length(point_value))
var/dept_type = techweb_item_department_type(loaded_item)
if(dept_type != TECHWEB_POINT_TYPE_GENERIC)
// Calculate points based on item value (materials + 100 base)
var/item_value = 100
for(var/mat in loaded_item.custom_materials)
item_value += loaded_item.custom_materials[mat] / 100
point_value = list()
point_value[dept_type] = round(item_value * (decon_mod / 10))
var/user_mode_string = ""
if(length(point_value))
user_mode_string = " for [json_encode(point_value)] points"
Expand Down
Loading
Loading