Stock parts power usage and examine handling (#20892)

In preparation for future development, both A.) increased the power draw
of upgraded machines in more predictable ways and B.) reformated Examine
text output to handle displaying machines' upgradeable parts and what
they do in a more user-friendly way.

A.) is important because it opens the door to adding upgrade components
available for more machines.

B.) is important because not only do we need to communicate those sorts
of mechanics in a clean, clear, consistent way, but it also opens the
doors to being able to communicate more types of interaction mechanics
similarly well (such as assembly/disassembly tips).

Examples of new Examine boxes:
![Screenshot 2025-06-26
102050](https://github.com/user-attachments/assets/d7aa8b4c-b35f-4477-a1a2-b2846e92e06c)
![Screenshot 2025-06-26
102140](https://github.com/user-attachments/assets/0abb0a4c-a373-4427-af47-cadd192dfdc7)
![Screenshot 2025-06-26
102109](https://github.com/user-attachments/assets/886e4298-8a60-4cbb-be69-3de4cc8254d5)
![Screenshot 2025-06-26
102030](https://github.com/user-attachments/assets/5752da8c-b567-4337-94d4-b2ac2ca7ac36)

Note- while updating, made get_examine_text() also give Antagonism text
boxes to ghosts and storytellers, not just active Antags. This seemed
like a no-brainer thing but can be split into a separate PR if
requested.

---------

Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>
This commit is contained in:
Batrachophreno
2025-06-30 18:02:57 +00:00
committed by GitHub
co-authored by SleepyGemmy
parent 145fac654b
commit 27b5079066
33 changed files with 362 additions and 71 deletions
@@ -31,6 +31,12 @@
/obj/item/stack/cable_coil{amount = 2}
)
component_hint_bin = "Upgraded <b>matter bins</b> will improve cooling efficiency and increase the volume of air it can cool at once."
component_hint_cap = "Upgraded <b>capacitors</b> will increase maximum power setting."
component_hint_servo = "Upgraded <b>manipulators</b> will improve cooling efficiency."
parts_power_mgmt = FALSE
/obj/machinery/atmospherics/unary/freezer/Initialize()
initialize_directions = dir
. = ..()
@@ -30,6 +30,9 @@
/obj/item/stack/cable_coil{amount = 5}
)
component_hint_bin = "Upgraded <b>matter bins</b> will increase maximum temperature setting and the volume of air it can heat at once."
component_hint_cap = "Upgraded <b>capacitors</b> will increase maximum power setting and maximum temperature setting."
/obj/machinery/atmospherics/unary/heater/Initialize()
initialize_directions = dir
. = ..()
@@ -27,6 +27,8 @@
/obj/item/stock_parts/scanning_module = 1,
/obj/item/stock_parts/matter_bin = 2)
parts_power_mgmt = FALSE
var/cooking_power = 0 // Effectiveness/speed at cooking
var/cooking_coeff = 0 // Part-based cooking power multiplier
var/heating_power = 1000 // Effectiveness at heating up; not used for mixers, should be equal to active_power_usage
@@ -53,6 +55,9 @@
var/place_verb = "into"
var/combine_first = FALSE//If 1, this appliance will do combination cooking before checking recipes
component_hint_cap = "Upgraded <b>capacitors</b> will increase heating power."
component_hint_scan = "Upgraded <b>scanning modules</b> will increase heating power and improve power efficiency."
/obj/machinery/appliance/Initialize()
. = ..()
if(length(output_options))
+6
View File
@@ -58,6 +58,12 @@
/obj/item/cell/high
)
component_hint_bin = "Upgraded <b>matter bins</b> will increase ore capacity."
component_hint_cap = "Upgraded <b>capacitors</b> will improve power efficiency."
component_hint_laser = "Upgraded <b>micro-lasers</b> will increase the amount of ore harvested."
parts_power_mgmt = FALSE
/// The list of ores currently held within the mining drill
var/list/stored_ores = list()
@@ -36,6 +36,10 @@
/obj/item/stock_parts/console_screen
)
component_hint_cap = "Upgraded <b>capacitors</b> will increase the amount of ore smelted per second."
component_hint_laser = "Upgraded <b>micro-lasers</b> will increase the amount of ore smelted per second."
component_hint_scan = "Upgraded <b>scanning modules</b> will increase the amount of ore smelted per second."
/obj/machinery/mineral/processing_unit_console/Initialize(mapload, d, populate_components)
. = ..()
var/mutable_appearance/screen_overlay = mutable_appearance(icon, "production_console-screen", plane = EFFECTS_ABOVE_LIGHTING_PLANE)
@@ -19,6 +19,9 @@
/obj/item/stack/cable_coil{amount = 5}
)
component_hint_bin = "Upgraded <b>matter bins</b> will increase slime capacity."
component_hint_laser = "Upgraded <b>micro-lasers</b> will increase extraction speed."
/obj/machinery/slime_extractor/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
. = ..()
. += FONT_SMALL(SPAN_NOTICE("It can hold <b>[slime_limit] slime\s</b> at a time."))
+3
View File
@@ -17,7 +17,10 @@
/obj/item/cell/high = 3
)
parts_power_mgmt = FALSE
/obj/machinery/power/smes/batteryrack/RefreshParts()
..()
capacitors_amount = 0
cells_amount = 0
+6
View File
@@ -26,6 +26,11 @@
/obj/item/circuitboard/crystal_agitator
)
component_hint_cap = "Upgraded <b>capacitors</b> will reduce active power usage."
component_hint_servo = "Upgraded <b>manipulators</b> will increase agitation speed."
parts_power_mgmt = FALSE
/obj/machinery/power/crystal_agitator/Initialize()
. = ..()
connect_to_network()
@@ -87,6 +92,7 @@
last_agitation = world.time
/obj/machinery/power/crystal_agitator/RefreshParts()
..()
for(var/obj/item/stock_parts/SP in component_parts)
if(ismanipulator(SP))
agitation_rate = initial(agitation_rate) - (SP.rating * 5)
+5
View File
@@ -17,6 +17,10 @@
/obj/item/circuitboard/outlet
)
component_hint_cap = "Upgraded <b>capacitors</b> will increase the rate at which connected devices charge."
parts_power_mgmt = FALSE
/obj/machinery/power/outlet/Initialize()
. = ..()
connect_to_network()
@@ -25,6 +29,7 @@
icon_state = panel_open ? "[initial(icon_state)]-open" : initial(icon_state)
/obj/machinery/power/outlet/RefreshParts()
..()
var/part_level = 0
for(var/obj/item/stock_parts/SP in component_parts)
part_level += SP.rating
+5
View File
@@ -15,6 +15,8 @@
var/portgen_lightcolour = "#000000"
var/datum/looping_sound/generator/soundloop
component_hint_cap = "Upgraded <b>capacitors</b> will increase maximum power output."
/obj/machinery/power/portgen/Initialize()
. = ..()
soundloop = new(src, active)
@@ -137,6 +139,8 @@
/obj/item/stock_parts/capacitor
)
parts_power_mgmt = FALSE
/obj/machinery/power/portgen/basic/Initialize()
component_types += board_path
. = ..()
@@ -149,6 +153,7 @@
return ..()
/obj/machinery/power/portgen/basic/RefreshParts()
..()
var/temp_rating = 0
for(var/obj/item/stock_parts/SP in component_parts)
+5
View File
@@ -26,6 +26,10 @@
/obj/item/circuitboard/rtg
)
component_hint_cap = "Upgraded <b>capacitors</b> will increase maximum power output."
parts_power_mgmt = FALSE
/obj/machinery/power/rtg/Initialize()
. = ..()
connect_to_network()
@@ -41,6 +45,7 @@
icon_state = panel_open ? "[initial(icon_state)]-open" : initial(icon_state)
/obj/machinery/power/rtg/RefreshParts()
..()
var/part_level = 0
for(var/obj/item/stock_parts/SP in component_parts)
part_level += SP.rating
+4
View File
@@ -44,7 +44,11 @@ using metal and glass, it uses glass and reagents (usually sulphuric acid).
///The timer id for the build callback, if we're building something
var/build_callback_timer
component_hint_bin = "Upgraded <b>matter bins</b> will increase material storage capacity."
component_hint_servo = "Upgraded <b>manipulators</b> will improve material use efficiency and increase fabrication speed."
/obj/machinery/r_n_d/circuit_imprinter/RefreshParts()
..()
// Adjust reagent container volume to match combined volume of the inserted beakers
var/T = 0
for(var/obj/item/reagent_containers/glass/G in component_parts)
@@ -23,7 +23,12 @@ Note: Must be placed within 3 tiles of the R&D Console
/obj/item/stock_parts/micro_laser
)
component_hint_laser = "Upgraded <b>micro-lasers</b> will increase data gathered from destructive analysis."
component_hint_scan = "Upgraded <b>scanning modules</b> will increase data gathered from destructive analysis."
component_hint_servo = "Upgraded <b>manipulators</b> will increase data gathered from destructive analysis."
/obj/machinery/r_n_d/destructive_analyzer/RefreshParts()
..()
var/T = 0
for(var/obj/item/stock_parts/S in component_parts)
+4
View File
@@ -35,6 +35,9 @@
/obj/item/reagent_containers/glass/beaker = 2
)
component_hint_bin = "Upgraded <b>matter bins</b> will increase material storage capacity."
component_hint_servo = "Upgraded <b>manipulators</b> will improve material use efficiency and increase fabrication speed."
///Returns the total of all the stored materials
/obj/machinery/r_n_d/protolathe/proc/TotalMaterials()
var/t = 0
@@ -43,6 +46,7 @@
return t
/obj/machinery/r_n_d/protolathe/RefreshParts()
..()
// Adjust reagent container volume to match combined volume of the inserted beakers
var/T = 0
for(var/obj/item/reagent_containers/glass/G in component_parts)
+5
View File
@@ -22,6 +22,10 @@
/obj/item/stack/cable_coil = 2
)
component_hint_scan = "Upgraded <b>scanning modules</b> will reduce active power usage."
parts_power_mgmt = FALSE
/obj/machinery/r_n_d/server/Destroy()
for(var/obj/machinery/r_n_d/tech_processor/TP as anything in linked_processors)
TP.set_server(null)
@@ -29,6 +33,7 @@
return ..()
/obj/machinery/r_n_d/server/RefreshParts()
..()
var/tot_rating = 0
for(var/obj/item/stock_parts/SP in component_parts)
+40 -3
View File
@@ -2,6 +2,27 @@
#define STOCK_PART_ADVANCED 2
#define STOCK_PART_SUPER 3
/*
Stock parts (as of 2025/06) are only able to be installed in machinery objects.
They improve the functionality of the machine in various ways, scaling with their rating. The
impact any given part type has on a machine should be described in a var/hint_[parttype].
By default, higher-rated parts will also increase machine power usage- refer to energy_rating()
to see the multiplier the total energy rating will apply to power usage.
By assigning a machinery the variable "parts_power_mgmt = FALSE", bespoke power usage code can
be applied (i.e. upgrades that reduce power usage). This should be modified in the future to
accommodate more flexible and intuitive power draw changes due to stock parts, but was implemented
this way by Bat just to accommodate existing machine upgrades. Future changes will entail a more
in-depth balance pass.
Tcomms stock parts are somewhat weirder, not following the same 'rank' behavior as the standard
cluster of ranked five. They are also no longer used exclusively in Tcomms machinery- for example,
the Hull Shield Generator requires both standard and Tcomms stock parts. This should also be
addressed in future.
*/
/obj/item/storage/bag/stockparts_box
name = "stock parts box"
desc = "A low-tech method of storing stock parts used in machinery."
@@ -82,6 +103,17 @@
. = ..()
randpixel_xy()
/obj/item/stock_parts/proc/energy_rating()
switch(rating)
if(STOCK_PART_BASIC)
return 1
if(STOCK_PART_ADVANCED)
return 3
if(STOCK_PART_SUPER)
return 5
else
return 0
//Rank 1
/obj/item/stock_parts/console_screen
@@ -112,7 +144,7 @@
/obj/item/stock_parts/manipulator
name = "micro-manipulator"
parent_stock_name = "micro-manipulator"
desc = "A tiny little manipulator used in the construction of certain devices."
desc = "A tiny micrometer-scale manipulator used in the construction of certain devices."
icon_state = "micro_mani"
origin_tech = list(TECH_MATERIAL = 1, TECH_DATA = 1)
matter = list(DEFAULT_WALL_MATERIAL = 30)
@@ -141,7 +173,7 @@
/obj/item/stock_parts/capacitor/adv
name = "advanced capacitor"
desc = "An advanced capacitor used in the construction of a variety of devices."
desc = "A compact, ultra-high resolution scanning module used in the construction of certain devices."
icon_state = "adv_capacitor"
origin_tech = list(TECH_POWER = 3)
rating = STOCK_PART_ADVANCED
@@ -157,6 +189,7 @@
/obj/item/stock_parts/manipulator/nano
name = "nano-manipulator"
desc = "A tiny nanometer-scale manipulator used in the construction of certain devices."
icon_state = "nano_mani"
origin_tech = list(TECH_MATERIAL = 3, TECH_DATA = 2)
rating = STOCK_PART_ADVANCED
@@ -164,6 +197,7 @@
/obj/item/stock_parts/micro_laser/high
name = "high-power micro-laser"
desc = "A tiny, high-powered laser used in certain devices."
icon_state = "high_micro_laser"
origin_tech = list(TECH_MAGNET = 3)
rating = STOCK_PART_ADVANCED
@@ -188,7 +222,7 @@
/obj/item/stock_parts/scanning_module/phasic
name = "phasic scanning module"
desc = "A compact, high resolution phasic scanning module used in the construction of certain devices."
desc = "A compact, ultra-high resolution phasic scanning module used in the construction of certain devices."
icon_state = "super_scan_module"
origin_tech = list(TECH_MAGNET = 5)
rating = STOCK_PART_SUPER
@@ -196,6 +230,7 @@
/obj/item/stock_parts/manipulator/pico
name = "pico-manipulator"
desc = "A tiny picometer-scale manipulator used in the construction of certain devices."
icon_state = "pico_mani"
origin_tech = list(TECH_MATERIAL = 5, TECH_DATA = 2)
rating = STOCK_PART_SUPER
@@ -203,6 +238,7 @@
/obj/item/stock_parts/micro_laser/ultra
name = "ultra-high-power micro-laser"
desc = "A tiny, alarmingly high-powered laser used in certain devices."
icon_state = "ultra_high_micro_laser"
origin_tech = list(TECH_MAGNET = 5)
rating = STOCK_PART_SUPER
@@ -210,6 +246,7 @@
/obj/item/stock_parts/matter_bin/super
name = "super matter bin"
desc = "A container for holding compressed matter awaiting reconstruction. Fortunately, this is a super 'matter bin', not a 'super matter' bin."
icon_state = "super_matter_bin"
origin_tech = list(TECH_MATERIAL = 5)
rating = STOCK_PART_SUPER
+5
View File
@@ -18,11 +18,16 @@
var/heat_delay = 10
component_hint_scan = "Upgraded <b>scanning modules</b> will increase speed at which research calculations are made and reduce active power usage."
parts_power_mgmt = FALSE
/obj/machinery/r_n_d/tech_processor/Destroy()
set_server(null)
return ..()
/obj/machinery/r_n_d/tech_processor/RefreshParts()
..()
tech_rate = 0
for(var/obj/item/stock_parts/scanning_module/SM in component_parts)
tech_rate += SM.rating / 2
+4
View File
@@ -18,7 +18,11 @@
/obj/item/stack/cable_coil{amount = 1}
)
component_hint_cap = "Upgraded <b>capacitors</b> will improve the power efficiency of the telepad."
parts_power_mgmt = FALSE
/obj/machinery/telepad/RefreshParts()
..()
var/E
for(var/obj/item/stock_parts/capacitor/C in component_parts)
E += C.rating