mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-08 05:34:30 +01:00
27b5079066
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:     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>
71 lines
2.3 KiB
Plaintext
71 lines
2.3 KiB
Plaintext
// A simple power outlet that lets people charge modular computers
|
|
|
|
/obj/machinery/power/outlet
|
|
name = "power outlet"
|
|
desc = "A simple power outlet. You can charge your PDA or other modular computer device here."
|
|
icon = 'icons/obj/power.dmi'
|
|
icon_state = "outlet"
|
|
density = FALSE
|
|
anchored = TRUE
|
|
use_power = POWER_USE_OFF // doesn't use power by default, only when drawing power
|
|
|
|
active_power_usage = 200 // this variable serves to indicate the extra amount of juice this outlet will provide the tesla charger, since it's a dedicated machine
|
|
|
|
component_types = list(
|
|
/obj/item/stack/cable_coil{amount = 5},
|
|
/obj/item/stock_parts/capacitor,
|
|
/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()
|
|
|
|
/obj/machinery/power/outlet/update_icon()
|
|
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
|
|
active_power_usage = initial(active_power_usage) * part_level
|
|
|
|
/obj/machinery/power/outlet/attackby(obj/item/attacking_item, mob/user, params)
|
|
if(istype(attacking_item, /obj/item/modular_computer))
|
|
var/obj/item/modular_computer/C = attacking_item
|
|
if(istype(C.tesla_link, /obj/item/computer_hardware/tesla_link/charging_cable))
|
|
var/obj/item/computer_hardware/tesla_link/charging_cable/CC = C.tesla_link
|
|
CC.toggle(src, user)
|
|
return
|
|
else if(default_part_replacement(user, attacking_item))
|
|
return
|
|
else if(default_deconstruction_screwdriver(user, attacking_item))
|
|
return
|
|
else if(default_deconstruction_crowbar(user, attacking_item))
|
|
return
|
|
|
|
// since we'll mostly be on tables, don't block putting things on them if it's not a computer
|
|
var/obj/structure/table/table_underneath = locate() in loc
|
|
if(table_underneath)
|
|
return table_underneath.attackby(attacking_item, user, params)
|
|
|
|
return ..()
|
|
|
|
/obj/item/circuitboard/outlet
|
|
name = T_BOARD("power outlet")
|
|
build_path = /obj/machinery/power/outlet
|
|
board_type = BOARD_MACHINE
|
|
origin_tech = list(
|
|
TECH_ENGINEERING = 1,
|
|
TECH_POWER = 1
|
|
)
|
|
req_components = list(
|
|
"/obj/item/stack/cable_coil" = 5,
|
|
"/obj/item/stock_parts/capacitor" = 1
|
|
)
|