diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm index 5b7ffde0763..ba435980e28 100644 --- a/_maps/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm +++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_syndicate_base1.dmm @@ -134,6 +134,7 @@ anchored = 1 }, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer4, +/obj/structure/cable, /turf/open/floor/circuit/red, /area/ruin/syndicate_lava_base/main) "bC" = ( @@ -1573,6 +1574,7 @@ /obj/effect/turf_decal/tile/red{ dir = 8 }, +/obj/structure/cable, /turf/open/floor/iron, /area/ruin/syndicate_lava_base/main) "iM" = ( @@ -1611,6 +1613,7 @@ dir = 8 }, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer4, +/obj/structure/cable, /turf/open/floor/circuit/red, /area/ruin/syndicate_lava_base/main) "iZ" = ( @@ -1622,6 +1625,7 @@ /obj/effect/turf_decal/tile/red{ dir = 8 }, +/obj/structure/cable, /turf/open/floor/iron, /area/ruin/syndicate_lava_base/main) "jb" = ( @@ -1953,6 +1957,12 @@ /obj/machinery/portable_atmospherics/canister/tier_3, /turf/open/floor/iron, /area/ruin/syndicate_lava_base/engineering) +"lc" = ( +/obj/machinery/power/rtg/lavaland, +/obj/structure/lattice/catwalk, +/obj/structure/cable, +/turf/open/lava/smooth/lava_land_surface, +/area/ruin/syndicate_lava_base/main) "ld" = ( /turf/open/floor/engine/co2, /area/ruin/syndicate_lava_base/engineering) @@ -2506,6 +2516,7 @@ pixel_x = 32 }, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer4, +/obj/structure/cable, /turf/open/floor/circuit/red, /area/ruin/syndicate_lava_base/main) "ox" = ( @@ -2909,6 +2920,7 @@ }, /obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer2, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer4, +/obj/structure/cable, /turf/open/floor/iron, /area/ruin/syndicate_lava_base/main) "vA" = ( @@ -3560,6 +3572,11 @@ /obj/machinery/atmospherics/components/unary/vent_pump/on/layer2, /turf/open/floor/iron/grimy, /area/ruin/syndicate_lava_base/dormitories) +"FP" = ( +/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer4, +/obj/structure/cable, +/turf/closed/wall/mineral/plastitanium/nodiagonal, +/area/ruin/syndicate_lava_base/main) "FW" = ( /obj/effect/turf_decal/tile/red, /obj/effect/turf_decal/tile/red{ @@ -4382,6 +4399,7 @@ /obj/effect/turf_decal/tile/neutral/fourcorners, /obj/effect/mapping_helpers/airlock/locked, /obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer4, +/obj/structure/cable, /turf/open/floor/iron/dark, /area/ruin/syndicate_lava_base/main) "Uk" = ( @@ -6679,7 +6697,7 @@ gQ hV ha Dx -Dx +FP ha ha ju @@ -6729,8 +6747,8 @@ hD dy dy wi -si -si +lc +lc ju ld JV @@ -6777,8 +6795,8 @@ dy eF eF dy -ab -ab +si +si ab ab ju @@ -6824,10 +6842,10 @@ ab dy gg dy -ab -ab -ab -ab +si +si +si +si ab ab ab @@ -6874,7 +6892,7 @@ ab fx gh fx -ab +si ab ab ab @@ -6922,9 +6940,9 @@ ab ab ab ab -ab -ab -ab +si +si +si ab ab ab diff --git a/_maps/RandomRuins/SpaceRuins/oldstation.dmm b/_maps/RandomRuins/SpaceRuins/oldstation.dmm index 03e659468a8..2c4ec370eb6 100644 --- a/_maps/RandomRuins/SpaceRuins/oldstation.dmm +++ b/_maps/RandomRuins/SpaceRuins/oldstation.dmm @@ -6617,6 +6617,11 @@ }, /turf/open/floor/iron, /area/ruin/space/has_grav/ancientstation/beta/atmos) +"Dt" = ( +/obj/structure/lattice/catwalk, +/obj/structure/cable, +/turf/template_noop, +/area/template_noop) "Dw" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, @@ -6712,6 +6717,12 @@ }, /turf/open/floor/iron/airless, /area/ruin/space/has_grav/ancientstation/beta/hall) +"FP" = ( +/obj/machinery/power/rtg/old_station, +/obj/structure/lattice/catwalk, +/obj/structure/cable, +/turf/template_noop, +/area/template_noop) "FV" = ( /obj/effect/decal/cleanable/dirt, /obj/effect/decal/cleanable/dirt, @@ -8378,8 +8389,8 @@ aa aa aa aa -aa -aa +FP +FP aa dF aa @@ -8428,7 +8439,7 @@ aa aa aa aa -aa +Dt aa dF aa diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index 4201979ccbd..b137fadbb21 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -27,6 +27,9 @@ #define IDLE_POWER_USE 1 #define ACTIVE_POWER_USE 2 +#define BASE_MACHINE_IDLE_CONSUMPTION 100 +#define BASE_MACHINE_ACTIVE_CONSUMPTION (BASE_MACHINE_IDLE_CONSUMPTION * 10) + /// Bitflags for a machine's preferences on when it should start processing. For use with machinery's `processing_flags` var. #define START_PROCESSING_ON_INIT (1<<0) /// Indicates the machine will automatically start processing right after it's `Initialize()` is ran. #define START_PROCESSING_MANUALLY (1<<1) /// Machines with this flag will not start processing when it's spawned. Use this if you want to manually control when a machine starts processing. diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 3997ff65f30..7f28327131a 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -41,6 +41,7 @@ reset_chem_buttons() /obj/machinery/sleeper/RefreshParts() + . = ..() var/E for(var/obj/item/stock_parts/matter_bin/B in component_parts) E += B.rating @@ -161,6 +162,7 @@ /obj/machinery/sleeper/process() ..() check_nap_violations() + use_power(active_power_usage) /obj/machinery/sleeper/nap_violation(mob/violator) open_machine() @@ -283,7 +285,6 @@ desc = "'Sleeper' units were once known for their healing properties, until a lengthy investigation revealed they were also dosing patients with deadly lead acetate. This appears to be one of those old 'sleeper' units repurposed as a 'Party Pod'. It’s probably not a good idea to use it." icon_state = "partypod" base_icon_state = "partypod" - idle_power_usage = 3000 circuit = /obj/item/circuitboard/machine/sleeper/party var/leddit = FALSE //Get it like reddit and lead alright fine diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 41d7d23870b..64f0193b365 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -107,9 +107,9 @@ //1 = use idle_power_usage //2 = use active_power_usage ///the amount of static power load this machine adds to its area's power_usage list when use_power = IDLE_POWER_USE - var/idle_power_usage = 0 + var/idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION ///the amount of static power load this machine adds to its area's power_usage list when use_power = ACTIVE_POWER_USE - var/active_power_usage = 0 + var/active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION ///the current amount of static power usage this machine is taking from its area var/static_power_usage = 0 var/power_channel = AREA_USAGE_EQUIP @@ -677,8 +677,20 @@ ..() RefreshParts() -/obj/machinery/proc/RefreshParts() //Placeholder proc for machines that are built using frames. - return +/obj/machinery/proc/RefreshParts() + SHOULD_CALL_PARENT(TRUE) + //reset to baseline + idle_power_usage = initial(idle_power_usage) + active_power_usage = initial(active_power_usage) + if(!component_parts || !component_parts.len) + return + var/parts_energy_rating = 0 + for(var/obj/item/stock_parts/part in component_parts) + parts_energy_rating += part.energy_rating + + idle_power_usage = initial(idle_power_usage) * (1 + parts_energy_rating) + active_power_usage = initial(active_power_usage) * (1 + parts_energy_rating) + update_current_power_usage() /obj/machinery/proc/default_pry_open(obj/item/crowbar) . = !(state_open || panel_open || is_operational || (flags_1 & NODECONSTRUCT_1)) && crowbar.tool_behaviour == TOOL_CROWBAR diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index ed851d21bbd..a7c8f08064e 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -12,8 +12,7 @@ GLOBAL_LIST_EMPTY(announcement_systems) verb_ask = "queries" verb_exclaim = "alarms" - idle_power_usage = 20 - active_power_usage = 50 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.05 circuit = /obj/item/circuitboard/machine/announcement_system @@ -100,6 +99,7 @@ GLOBAL_LIST_EMPTY(announcement_systems) /// Sends a message to the appropriate channels. /obj/machinery/announcement_system/proc/broadcast(message, list/channels) + use_power(active_power_usage) if(channels.len == 0) radio.talk_into(src, message, null) else diff --git a/code/game/machinery/autolathe.dm b/code/game/machinery/autolathe.dm index 35072f830c8..c4500940339 100644 --- a/code/game/machinery/autolathe.dm +++ b/code/game/machinery/autolathe.dm @@ -3,9 +3,7 @@ desc = "It produces items using iron, glass, plastic and maybe some more." icon_state = "autolathe" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.5 circuit = /obj/item/circuitboard/machine/autolathe layer = BELOW_OBJ_LAYER @@ -190,7 +188,7 @@ for(var/MAT in being_built.materials) total_amount += being_built.materials[MAT] - var/power = max(2000, (total_amount)*multiplier/5) //Change this to use all materials + var/power = max(active_power_usage, (total_amount)*multiplier/5) //Change this to use all materials var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) @@ -307,7 +305,7 @@ else flick("autolathe_o", src)//plays metal insertion animation - use_power(min(1000, amount_inserted / 100)) + use_power(min(active_power_usage * 0.25, amount_inserted / 100)) /obj/machinery/autolathe/proc/make_item(power, list/materials_used, list/picked_materials, multiplier, coeff, is_stack, mob/user) var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) @@ -337,6 +335,7 @@ busy = FALSE /obj/machinery/autolathe/RefreshParts() + . = ..() var/mat_capacity = 0 for(var/obj/item/stock_parts/matter_bin/new_matter_bin in component_parts) mat_capacity += new_matter_bin.rating*75000 diff --git a/code/game/machinery/bank_machine.dm b/code/game/machinery/bank_machine.dm index abc6a2a187d..670d6b55cbe 100644 --- a/code/game/machinery/bank_machine.dm +++ b/code/game/machinery/bank_machine.dm @@ -3,8 +3,6 @@ desc = "A machine used to deposit and withdraw station funds." icon_screen = "vault" icon_keyboard = "security_key" - idle_power_usage = 100 - var/siphoning = FALSE var/next_warning = 0 var/obj/item/radio/radio @@ -66,6 +64,7 @@ next_warning = world.time + minimum_time_between_warnings /obj/machinery/computer/bank_machine/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "BankMachine", name) diff --git a/code/game/machinery/buttons.dm b/code/game/machinery/buttons.dm index e06f3cd14df..5f3e69c93e7 100644 --- a/code/game/machinery/buttons.dm +++ b/code/game/machinery/buttons.dm @@ -12,8 +12,7 @@ var/initialized_button = 0 var/silicon_access_disabled = FALSE armor = list(MELEE = 50, BULLET = 50, LASER = 50, ENERGY = 50, BOMB = 10, BIO = 100, FIRE = 90, ACID = 70) - use_power = IDLE_POWER_USE - idle_power_usage = 2 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.02 resistance_flags = LAVA_PROOF | FIRE_PROOF /obj/machinery/button/indestructible diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index b7849522e05..196bea159ca 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -8,8 +8,7 @@ icon = 'icons/obj/machines/camera.dmi' icon_state = "camera" //mapping icon to represent upgrade states. if you want a different base icon, update default_camera_icon as well as this. use_power = ACTIVE_POWER_USE - idle_power_usage = 5 - active_power_usage = 10 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.02 layer = WALL_OBJ_LAYER plane = GAME_PLANE_UPPER resistance_flags = FIRE_PROOF diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm index 805e2aea792..287e6cc842a 100644 --- a/code/game/machinery/cell_charger.dm +++ b/code/game/machinery/cell_charger.dm @@ -3,9 +3,6 @@ desc = "It charges power cells." icon = 'icons/obj/power.dmi' icon_state = "ccharger" - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 60 power_channel = AREA_USAGE_EQUIP circuit = /obj/item/circuitboard/machine/cell_charger pass_flags = PASSTABLE @@ -128,6 +125,7 @@ charging.emp_act(severity) /obj/machinery/cell_charger/RefreshParts() + . = ..() charge_rate = 250 for(var/obj/item/stock_parts/capacitor/C in component_parts) charge_rate *= C.rating diff --git a/code/game/machinery/civilian_bounties.dm b/code/game/machinery/civilian_bounties.dm index 6a5d7ec73a1..f798a0a852c 100644 --- a/code/game/machinery/civilian_bounties.dm +++ b/code/game/machinery/civilian_bounties.dm @@ -18,6 +18,7 @@ icon_keyboard = "id_key" warmup_time = 3 SECONDS circuit = /obj/item/circuitboard/computer/bountypad + interface_type = "CivCargoHoldTerminal" ///Typecast of an inserted, scanned ID card inside the console, as bounties are held within the ID card. var/obj/item/card/id/inserted_scan_id @@ -143,13 +144,6 @@ return FALSE id_eject(user, inserted_scan_id) -/obj/machinery/computer/piratepad_control/civilian/ui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "CivCargoHoldTerminal", name) - ui.open() - - /obj/machinery/computer/piratepad_control/civilian/ui_data(mob/user) var/list/data = list() data["points"] = points diff --git a/code/game/machinery/computer/Operating.dm b/code/game/machinery/computer/Operating.dm index c0f83dffa49..04c9442dcb1 100644 --- a/code/game/machinery/computer/Operating.dm +++ b/code/game/machinery/computer/Operating.dm @@ -68,6 +68,7 @@ return GLOB.not_incapacitated_state /obj/machinery/computer/operating/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "OperatingComputer", name) diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index 423f2802661..0850164c06f 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -3,9 +3,6 @@ icon = 'icons/obj/computer.dmi' icon_state = "computer" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 300 - active_power_usage = 300 max_integrity = 200 integrity_failure = 0.5 armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 40, ACID = 20) @@ -126,3 +123,13 @@ return if(!user.canUseTopic(src, !issilicon(user)) || !is_operational) return + +/obj/machinery/computer/ui_interact(mob/user, datum/tgui/ui) + SHOULD_CALL_PARENT(TRUE) + . = ..() + update_use_power(ACTIVE_POWER_USE) + +/obj/machinery/computer/ui_close(mob/user) + SHOULD_CALL_PARENT(TRUE) + . = ..() + update_use_power(IDLE_POWER_USE) diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm index 083e856e871..8d921487dcc 100644 --- a/code/game/machinery/computer/aifixer.dm +++ b/code/game/machinery/computer/aifixer.dm @@ -22,6 +22,7 @@ return ..() /obj/machinery/computer/aifixer/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "AiRestorer", name) diff --git a/code/game/machinery/computer/apc_control.dm b/code/game/machinery/computer/apc_control.dm index 379aa665079..5dca8f71661 100644 --- a/code/game/machinery/computer/apc_control.dm +++ b/code/game/machinery/computer/apc_control.dm @@ -40,6 +40,7 @@ return APC.z == z && !APC.malfhack && !APC.aidisabled && !(APC.obj_flags & EMAGGED) && !APC.machine_stat && !istype(APC.area, /area/ai_monitored) && !(APC.area.area_flags & NO_ALERTS) /obj/machinery/computer/apc_control/ui_interact(mob/user, datum/tgui/ui) + . = ..() operator = user ui = SStgui.try_update_ui(user, src, ui) if(!ui) diff --git a/code/game/machinery/computer/atmos_alert.dm b/code/game/machinery/computer/atmos_alert.dm index e0c9b1af1f1..83088595c55 100644 --- a/code/game/machinery/computer/atmos_alert.dm +++ b/code/game/machinery/computer/atmos_alert.dm @@ -20,6 +20,7 @@ return ..() /obj/machinery/computer/atmos_alert/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "AtmosAlertConsole", name) diff --git a/code/game/machinery/computer/atmos_computers/_atmos_control.dm b/code/game/machinery/computer/atmos_computers/_atmos_control.dm index 05ec46307a6..659f881f2bf 100644 --- a/code/game/machinery/computer/atmos_computers/_atmos_control.dm +++ b/code/game/machinery/computer/atmos_computers/_atmos_control.dm @@ -17,8 +17,8 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) /// Which sensors/input/outlets do we want to listen to. /// Assoc of list[chamber_id] = readable_chamber_name var/list/atmos_chambers - - // The list where received signals about devices are written into. + + // The list where received signals about devices are written into. // Assoc of list[atmos_chambers_string] var/list/sensor_info var/list/input_info @@ -57,7 +57,7 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) if(!(tag_data[1] in atmos_chambers)) return - + var/list/info_list switch(tag_data[2]) if("sensor") @@ -102,7 +102,7 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) if(isnull(new_id)) return FALSE - + atmos_chambers = list() atmos_chambers[new_id] = new_name sensor_info = list() @@ -122,6 +122,7 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) return TRUE /obj/machinery/computer/atmos_control/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "AtmosControlConsole", name) @@ -190,7 +191,7 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers) return FALSE target = clamp(target, 0, MAX_OUTPUT_PRESSURE) signal.data += list("tag" = params["chamber"] + "_out", "set_internal_pressure" = target) - + radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) return TRUE diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index f3a078d538d..37637187b7a 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -64,6 +64,7 @@ network += "[port.id]_[i]" /obj/machinery/computer/security/ui_interact(mob/user, datum/tgui/ui) + . = ..() // Update UI ui = SStgui.try_update_ui(user, src, ui) @@ -174,6 +175,7 @@ cam_background.fill_rect(1, 1, size_x, size_y) /obj/machinery/computer/security/ui_close(mob/user) + . = ..() var/user_ref = REF(user) var/is_living = isliving(user) // Living creature or not, we remove you anyway. diff --git a/code/game/machinery/computer/chef_orders/chef_order.dm b/code/game/machinery/computer/chef_orders/chef_order.dm index 303ae382d8e..0492566858e 100644 --- a/code/game/machinery/computer/chef_orders/chef_order.dm +++ b/code/game/machinery/computer/chef_orders/chef_order.dm @@ -36,6 +36,7 @@ . += grocery_list[item] * item.cost_per_order /obj/machinery/computer/chef_order/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "ProduceConsole", name) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index ab3a22ac153..cc5f048525c 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -602,6 +602,7 @@ return data /obj/machinery/computer/communications/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if (!ui) ui = new(user, src, "CommunicationsConsole") diff --git a/code/game/machinery/computer/crew.dm b/code/game/machinery/computer/crew.dm index 60228cc07fe..67c2f076bc7 100644 --- a/code/game/machinery/computer/crew.dm +++ b/code/game/machinery/computer/crew.dm @@ -8,9 +8,6 @@ desc = "Used to monitor active health sensors built into most of the crew's uniforms." icon_screen = "crew" icon_keyboard = "med_key" - use_power = IDLE_POWER_USE - idle_power_usage = 250 - active_power_usage = 500 circuit = /obj/item/circuitboard/computer/crew light_color = LIGHT_COLOR_BLUE @@ -82,6 +79,7 @@ icon_keyboard = "syndie_key" /obj/machinery/computer/crew/ui_interact(mob/user) + . = ..() GLOB.crewmonitor.show(user,src) GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new) diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm index 8079046ab56..7e190d3870f 100644 --- a/code/game/machinery/computer/dna_console.dm +++ b/code/game/machinery/computer/dna_console.dm @@ -55,9 +55,6 @@ density = TRUE circuit = /obj/item/circuitboard/computer/scan_consolenew - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 400 light_color = LIGHT_COLOR_BLUE /// Link to the techweb's stored research. Used to retrieve stored mutations @@ -236,6 +233,7 @@ stored_research = SSresearch.science_tech /obj/machinery/computer/scan_consolenew/ui_interact(mob/user, datum/tgui/ui) + . = ..() // Most of ui_interact is spent setting variables for passing to the tgui // interface. // We can also do some general state processing here too as it's a good @@ -431,6 +429,7 @@ scrambleready = world.time + SCRAMBLE_TIMEOUT to_chat(usr,span_notice("DNA scrambled.")) scanner_occupant.AddComponent(/datum/component/genetic_damage, GENETIC_DAMAGE_STRENGTH_MULTIPLIER*50/(connected_scanner.damage_coeff ** 2)) + connected_scanner.use_power(connected_scanner.active_power_usage) return // Check whether a specific mutation is eligible for discovery within the @@ -564,7 +563,7 @@ // Check if we cracked a mutation check_discovery(alias) - + connected_scanner.use_power(connected_scanner.active_power_usage) return // Apply a chromosome to a specific mutation. @@ -598,7 +597,7 @@ if(CM.can_apply(HM) && (CM.name == params["chromo"])) stored_chromosomes -= CM CM.apply(HM) - + connected_scanner.use_power(connected_scanner.active_power_usage) return // Attempt overwriting Base DNA : The pairs are instead the top row vs the top row of the new code. @@ -734,6 +733,7 @@ //Not sure what this does but it seems to be a sanity check and this needs a sanity check scanner_occupant.domutcheck() + connected_scanner.use_power(connected_scanner.active_power_usage) return @@ -814,7 +814,7 @@ injectorready = world.time + INJECTOR_TIMEOUT * 5 * (1 - 0.1 * connected_scanner.precision_coeff) else injectorready = world.time + INJECTOR_TIMEOUT * 5 - + connected_scanner.use_power(connected_scanner.active_power_usage) return // Save a mutation to the console's storage buffer. @@ -1025,6 +1025,7 @@ var/datum/mutation/human/HM = GET_INITIALIZED_MUTATION(result_path) stored_research.discovered_mutations += result_path say("Successfully mutated [HM.name].") + connected_scanner.use_power(connected_scanner.active_power_usage) return // Combines two mutations from the disk to try and create a new mutation @@ -1087,6 +1088,7 @@ var/datum/mutation/human/HM = GET_INITIALIZED_MUTATION(result_path) stored_research.discovered_mutations += result_path say("Successfully mutated [HM.name].") + connected_scanner.use_power(connected_scanner.active_power_usage) return // Sets the Genetic Makeup pulse strength. @@ -1322,7 +1324,7 @@ // ready timer. if(I) injectorready = world.time + INJECTOR_TIMEOUT - + connected_scanner.use_power(connected_scanner.active_power_usage) return // Applies a genetic makeup buffer to the scanner occupant @@ -1359,6 +1361,7 @@ var/type = params["type"] apply_genetic_makeup(type, buffer_slot) + connected_scanner.use_power(connected_scanner.active_power_usage) return // Applies a genetic makeup buffer to the next scanner occupant. This sets @@ -1424,6 +1427,7 @@ genetic_damage_pulse_timer = world.time + (pulse_duration*10) genetic_damage_pulse_index = WRAP(text2num(params["index"]), 1, len+1) begin_processing() + connected_scanner.use_power(connected_scanner.active_power_usage) return // Cancels the delayed action - In this context it is not the genetic damage @@ -1584,6 +1588,7 @@ A.copy_mutation(HM) injector_selection[adv_inj] += A to_chat(usr,span_notice("Mutation successfully added to advanced injector.")) + connected_scanner.use_power(connected_scanner.active_power_usage) return // Deletes a mutation from an advanced injector diff --git a/code/game/machinery/computer/launchpad_control.dm b/code/game/machinery/computer/launchpad_control.dm index 796a24a7f51..32f60992ee8 100644 --- a/code/game/machinery/computer/launchpad_control.dm +++ b/code/game/machinery/computer/launchpad_control.dm @@ -151,6 +151,7 @@ return pad /obj/machinery/computer/launchpad/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "LaunchpadConsole", name) diff --git a/code/game/machinery/computer/mechlaunchpad.dm b/code/game/machinery/computer/mechlaunchpad.dm index 53a8dcbfaaa..f6703f86b5f 100644 --- a/code/game/machinery/computer/mechlaunchpad.dm +++ b/code/game/machinery/computer/mechlaunchpad.dm @@ -108,6 +108,7 @@ return pad /obj/machinery/computer/mechpad/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "MechpadConsole", name) diff --git a/code/game/machinery/computer/pod.dm b/code/game/machinery/computer/pod.dm index e52c8d7959c..9f8eedb0cc5 100644 --- a/code/game/machinery/computer/pod.dm +++ b/code/game/machinery/computer/pod.dm @@ -56,6 +56,7 @@ M.close() /obj/machinery/computer/pod/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "MassDriverControl", name) diff --git a/code/game/machinery/computer/prisoner/gulag_teleporter.dm b/code/game/machinery/computer/prisoner/gulag_teleporter.dm index e0b45c5e043..d7128612dd7 100644 --- a/code/game/machinery/computer/prisoner/gulag_teleporter.dm +++ b/code/game/machinery/computer/prisoner/gulag_teleporter.dm @@ -20,6 +20,7 @@ scan_machinery() /obj/machinery/computer/prisoner/gulag_teleporter_computer/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "GulagTeleporterConsole", name) diff --git a/code/game/machinery/computer/robot.dm b/code/game/machinery/computer/robot.dm index fe38e375795..9b4fc6de73b 100644 --- a/code/game/machinery/computer/robot.dm +++ b/code/game/machinery/computer/robot.dm @@ -22,6 +22,7 @@ return TRUE /obj/machinery/computer/robotics/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "RoboticsControlConsole", name) diff --git a/code/game/machinery/computer/station_alert.dm b/code/game/machinery/computer/station_alert.dm index aca7eb25e47..a0bb4122023 100644 --- a/code/game/machinery/computer/station_alert.dm +++ b/code/game/machinery/computer/station_alert.dm @@ -18,6 +18,7 @@ return ..() /obj/machinery/computer/station_alert/ui_interact(mob/user) + . = ..() alert_control.ui_interact(user) /obj/machinery/computer/station_alert/on_set_machine_stat(old_value) diff --git a/code/game/machinery/computer/teleporter.dm b/code/game/machinery/computer/teleporter.dm index 2473bcdbfe6..300fb564d8c 100644 --- a/code/game/machinery/computer/teleporter.dm +++ b/code/game/machinery/computer/teleporter.dm @@ -39,6 +39,7 @@ return power_station /obj/machinery/computer/teleporter/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "Teleporter", name) diff --git a/code/game/machinery/computer/tram_controls.dm b/code/game/machinery/computer/tram_controls.dm index bf61d47f832..957547569be 100644 --- a/code/game/machinery/computer/tram_controls.dm +++ b/code/game/machinery/computer/tram_controls.dm @@ -47,6 +47,7 @@ return ..() /obj/machinery/computer/tram_controls/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "TramControl", name) diff --git a/code/game/machinery/dance_machine.dm b/code/game/machinery/dance_machine.dm index eecb80df4ff..06242b070a2 100644 --- a/code/game/machinery/dance_machine.dm +++ b/code/game/machinery/dance_machine.dm @@ -174,6 +174,7 @@ /obj/machinery/jukebox/proc/activate_music() active = TRUE + update_use_power(ACTIVE_POWER_USE) update_appearance() START_PROCESSING(SSobj, src) stop = world.time + selection.song_length @@ -466,6 +467,7 @@ L.stop_sound_channel(CHANNEL_JUKEBOX) else if(active) active = FALSE + update_use_power(IDLE_POWER_USE) STOP_PROCESSING(SSobj, src) dance_over() playsound(src,'sound/machines/terminal_off.ogg',50,TRUE) diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index 0e05cd2f2e5..b42dd190775 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -181,7 +181,6 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount, 28) desc = "Holds defibrillators. You can grab the paddles if one is mounted. This PENLITE variant also allows for slow, passive recharging of the defibrillator." icon_state = "penlite_mount" use_power = IDLE_POWER_USE - idle_power_usage = 1 wallframe_type = /obj/item/wallframe/defib_mount/charging @@ -203,7 +202,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount, 28) if(!C || !is_operational) return PROCESS_KILL if(C.charge < C.maxcharge) - use_power(50 * delta_time) + use_power(active_power_usage * delta_time) C.give(40 * delta_time) defib.update_power() diff --git a/code/game/machinery/dish_drive.dm b/code/game/machinery/dish_drive.dm index afa533d6be2..d93375c8148 100644 --- a/code/game/machinery/dish_drive.dm +++ b/code/game/machinery/dish_drive.dm @@ -5,8 +5,7 @@ Or you can just drop your plates on the floor, like civilized folk." icon = 'icons/obj/kitchen.dmi' icon_state = "synthesizer" - idle_power_usage = 8 //5 with default parts - active_power_usage = 13 //10 with default parts + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.04 density = FALSE circuit = /obj/item/circuitboard/machine/dish_drive pass_flags = PASSTABLE @@ -68,6 +67,7 @@ ..() /obj/machinery/dish_drive/RefreshParts() + . = ..() var/total_rating = 0 for(var/obj/item/stock_parts/S in component_parts) total_rating += S.rating @@ -81,7 +81,6 @@ suction_enabled = board.suction transmit_enabled = board.transmit - /obj/machinery/dish_drive/process() if(time_since_dishes <= world.time && transmit_enabled) do_the_dishes() diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index 921631cea54..63630952491 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -6,9 +6,6 @@ base_icon_state = "scanner" density = TRUE obj_flags = NO_BUILD // Becomes undense when the door is open - use_power = IDLE_POWER_USE - idle_power_usage = 50 - active_power_usage = 300 occupant_typecache = list(/mob/living, /obj/item/bodypart/head, /obj/item/organ/brain) circuit = /obj/item/circuitboard/machine/dnascanner var/locked = FALSE @@ -20,6 +17,7 @@ var/obj/machinery/computer/scan_consolenew/linked_console = null /obj/machinery/dna_scannernew/RefreshParts() + . = ..() scan_level = 0 damage_coeff = 0 precision_coeff = 0 diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index ab7943b5c57..d061564be02 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -21,6 +21,9 @@ interaction_flags_atom = INTERACT_ATOM_UI_INTERACT blocks_emissive = EMISSIVE_BLOCK_UNIQUE + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.1 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.2 + var/secondsElectrified = MACHINE_NOT_ELECTRIFIED var/shockedby var/visible = TRUE @@ -183,7 +186,7 @@ /obj/machinery/door/proc/bumpopen(mob/user) if(operating || !can_open_with_hands) return - + add_fingerprint(user) if(!density || (obj_flags & EMAGGED)) return @@ -343,6 +346,7 @@ if(operating) return operating = TRUE + use_power(active_power_usage) do_animate("opening") set_opacity(0) sleep(5) diff --git a/code/game/machinery/ecto_sniffer.dm b/code/game/machinery/ecto_sniffer.dm index b081e05b8c6..250e95446f0 100644 --- a/code/game/machinery/ecto_sniffer.dm +++ b/code/game/machinery/ecto_sniffer.dm @@ -31,7 +31,7 @@ /obj/machinery/ecto_sniffer/proc/activate(mob/activator) flick("ecto_sniffer_flick", src) playsound(loc, 'sound/machines/ectoscope_beep.ogg', 75) - use_power(10) + use_power(active_power_usage) say("Reporting [pick(world.file2list("strings/spook_levels.txt"))] levels of paranormal activity!") if(activator?.ckey) ectoplasmic_residues += activator.ckey diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index bd7b237b20d..916eb25f914 100644 --- a/code/game/machinery/embedded_controller/access_controller.dm +++ b/code/game/machinery/embedded_controller/access_controller.dm @@ -7,8 +7,8 @@ /obj/machinery/door_buttons power_channel = AREA_USAGE_ENVIRON use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 4 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.04 resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF var/idSelf @@ -79,6 +79,7 @@ controller.cycleClose(door) else controller.onlyClose(door) + use_power(active_power_usage) addtimer(CALLBACK(src, .proc/not_busy), 2 SECONDS) /obj/machinery/door_buttons/access_button/proc/not_busy() diff --git a/code/game/machinery/fat_sucker.dm b/code/game/machinery/fat_sucker.dm index 9bbeb928e71..48755ef34ff 100644 --- a/code/game/machinery/fat_sucker.dm +++ b/code/game/machinery/fat_sucker.dm @@ -37,7 +37,7 @@ . = ..() /obj/machinery/fat_sucker/RefreshParts() - ..() + . = ..() var/rating = 0 for(var/obj/item/stock_parts/micro_laser/L in component_parts) rating += L.rating @@ -153,7 +153,7 @@ playsound(loc, 'sound/machines/chime.ogg', 30, FALSE) else next_fact-- - use_power(500) + use_power(active_power_usage) /obj/machinery/fat_sucker/proc/start_extracting() if(state_open || !occupant || processing || !powered()) diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm index b766b8c04c2..4d00c47071d 100644 --- a/code/game/machinery/firealarm.dm +++ b/code/game/machinery/firealarm.dm @@ -18,9 +18,8 @@ max_integrity = 250 integrity_failure = 0.4 armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 100, FIRE = 90, ACID = 30) - use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 6 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.02 power_channel = AREA_USAGE_ENVIRON resistance_flags = FIRE_PROOF @@ -185,6 +184,7 @@ log_game("[user] triggered a fire alarm at [COORD(src)]") soundloop.start() //Manually pulled fire alarms will make the sound, rather than the doors. SEND_SIGNAL(src, COMSIG_FIREALARM_ON_TRIGGER) + update_use_power(ACTIVE_POWER_USE) /** * Resets all firelocks in the area. Also tells the area to disable alarm lighting, if it was enabled. @@ -203,6 +203,7 @@ log_game("[user] reset a fire alarm at [COORD(src)]") soundloop.stop() SEND_SIGNAL(src, COMSIG_FIREALARM_ON_RESET) + update_use_power(IDLE_POWER_USE) /obj/machinery/firealarm/attack_hand(mob/user, list/modifiers) if(buildstage != 2) diff --git a/code/game/machinery/gulag_item_reclaimer.dm b/code/game/machinery/gulag_item_reclaimer.dm index 3cd3efad6f2..6a36cb344fc 100644 --- a/code/game/machinery/gulag_item_reclaimer.dm +++ b/code/game/machinery/gulag_item_reclaimer.dm @@ -5,9 +5,6 @@ icon_state = "dorm_taken" req_access = list(ACCESS_BRIG) //REQACCESS TO ACCESS ALL STORED ITEMS density = FALSE - use_power = IDLE_POWER_USE - idle_power_usage = 100 - active_power_usage = 2500 var/list/stored_items = list() var/obj/machinery/gulag_teleporter/linked_teleporter = null @@ -88,3 +85,4 @@ stored_items[user] -= W W.forceMove(drop_location) stored_items -= user + use_power(active_power_usage) diff --git a/code/game/machinery/gulag_teleporter.dm b/code/game/machinery/gulag_teleporter.dm index d164a2c8542..0d44d795f17 100644 --- a/code/game/machinery/gulag_teleporter.dm +++ b/code/game/machinery/gulag_teleporter.dm @@ -15,9 +15,7 @@ The console is located at computer/gulag_teleporter.dm state_open = FALSE density = TRUE obj_flags = NO_BUILD // Becomes undense when the door is open - use_power = IDLE_POWER_USE - idle_power_usage = 200 - active_power_usage = 5000 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 5 circuit = /obj/item/circuitboard/machine/gulag_teleporter var/locked = FALSE var/message_cooldown @@ -167,6 +165,8 @@ The console is located at computer/gulag_teleporter.dm if(R) R.fields["criminal"] = "Incarcerated" + use_power(active_power_usage) + /obj/item/circuitboard/machine/gulag_teleporter name = "labor camp teleporter (Machine Board)" build_path = /obj/machinery/gulag_teleporter diff --git a/code/game/machinery/harvester.dm b/code/game/machinery/harvester.dm index 3e4bd98dd6d..c56295feed4 100644 --- a/code/game/machinery/harvester.dm +++ b/code/game/machinery/harvester.dm @@ -7,7 +7,6 @@ base_icon_state = "harvester" verb_say = "states" state_open = FALSE - idle_power_usage = 50 circuit = /obj/item/circuitboard/machine/harvester light_color = LIGHT_COLOR_BLUE var/interval = 20 @@ -23,6 +22,7 @@ name = "auto-autopsy" /obj/machinery/harvester/RefreshParts() + . = ..() interval = 0 var/max_time = 40 for(var/obj/item/stock_parts/micro_laser/L in component_parts) @@ -132,7 +132,7 @@ O.forceMove(target) //Some organs, like chest ones, are different so we need to manually move them operation_order.Remove(BP) break - use_power(5000) + use_power(active_power_usage) addtimer(CALLBACK(src, .proc/harvest), interval) /obj/machinery/harvester/proc/end_harvesting() diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index e763a9cd870..1ea0ead9e69 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -41,9 +41,6 @@ Possible to do for anyone motivated enough: layer = LOW_OBJ_LAYER plane = FLOOR_PLANE req_access = list(ACCESS_KEYCARD_AUTH) //Used to allow for forced connecting to other (not secure) holopads. Anyone can make a call, though. - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 100 max_integrity = 300 armor = list(MELEE = 50, BULLET = 20, LASER = 20, ENERGY = 20, BOMB = 0, BIO = 0, FIRE = 50, ACID = 0) circuit = /obj/item/circuitboard/machine/holopad @@ -196,6 +193,7 @@ Possible to do for anyone motivated enough: outgoing_call.ConnectionFailure(src) /obj/machinery/holopad/RefreshParts() + . = ..() var/holograph_range = 4 for(var/obj/item/stock_parts/capacitor/B in component_parts) holograph_range += 1 * B.rating @@ -549,7 +547,7 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/ /obj/machinery/holopad/proc/SetLightsAndPower() var/total_users = LAZYLEN(masters) + LAZYLEN(holo_calls) update_use_power(total_users > 0 ? ACTIVE_POWER_USE : IDLE_POWER_USE) - update_mode_power_usage(ACTIVE_POWER_USE, HOLOPAD_PASSIVE_POWER_USAGE + (HOLOGRAM_POWER_USAGE * total_users)) + update_mode_power_usage(ACTIVE_POWER_USE, active_power_usage + HOLOPAD_PASSIVE_POWER_USAGE + (HOLOGRAM_POWER_USAGE * total_users)) if(total_users || replay_mode) set_light(2) else diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm index 93faf6f0620..9ba728cf48a 100644 --- a/code/game/machinery/hypnochair.dm +++ b/code/game/machinery/hypnochair.dm @@ -115,6 +115,8 @@ "...an annoying buzz in your ears..."\ )]") + use_power(active_power_usage * delta_time) + /obj/machinery/hypnochair/proc/finish_interrogation() interrogating = FALSE STOP_PROCESSING(SSobj, src) diff --git a/code/game/machinery/igniter.dm b/code/game/machinery/igniter.dm index 01612da120d..9cc0b0ab0e3 100644 --- a/code/game/machinery/igniter.dm +++ b/code/game/machinery/igniter.dm @@ -5,9 +5,6 @@ icon_state = "igniter0" base_icon_state = "igniter" plane = FLOOR_PLANE - use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 4 max_integrity = 300 armor = list(MELEE = 50, BULLET = 30, LASER = 70, ENERGY = 50, BOMB = 20, BIO = 0, FIRE = 100, ACID = 70) resistance_flags = FIRE_PROOF @@ -33,7 +30,7 @@ return add_fingerprint(user) - use_power(50) + use_power(active_power_usage) on = !( on ) update_appearance() @@ -124,7 +121,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/sparker, 26) flick("[initial(icon_state)]-spark", src) spark_system.start() last_spark = world.time - use_power(1000) + use_power(active_power_usage) var/turf/location = loc if (isturf(location)) location.hotspot_expose(1000,2500,1) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 6c0dc124a74..90a8fc6ad26 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -13,6 +13,7 @@ base_icon_state = "iv_drip" anchored = FALSE mouse_drag_pointer = MOUSE_ACTIVE_POINTER + use_power = NO_POWER_USE ///Who are we sticking our needle in? var/mob/living/carbon/attached ///Are we donating or injecting? diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index 298e2802d20..a0ee702722b 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -5,9 +5,7 @@ desc = "A bluespace pad able to thrust matter through bluespace, teleporting it to or from nearby locations." icon = 'icons/obj/telescience.dmi' icon_state = "lpad-idle" - use_power = IDLE_POWER_USE - idle_power_usage = 200 - active_power_usage = 2500 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2.5 hud_possible = list(DIAG_LAUNCHPAD_HUD) circuit = /obj/item/circuitboard/machine/launchpad var/icon_teleport = "lpad-beam" @@ -26,11 +24,12 @@ var/teleport_beam = "sm_arc_supercharged" /obj/machinery/launchpad/RefreshParts() - var/E = 0 + . = ..() + var/max_range_multiplier = 0 for(var/obj/item/stock_parts/manipulator/M in component_parts) - E += M.rating + max_range_multiplier += M.rating range = initial(range) - range *= E + range *= max_range_multiplier /obj/machinery/launchpad/Initialize(mapload) . = ..() @@ -165,7 +164,7 @@ playsound(target, 'sound/weapons/emitter2.ogg', 25, TRUE) // use a lot of power - use_power(1000) + use_power(active_power_usage) var/turf/source = target var/list/log_msg = list() @@ -232,9 +231,7 @@ icon_state = "blpad-idle" icon_teleport = "blpad-beam" anchored = FALSE - use_power = IDLE_POWER_USE - idle_power_usage = 0 - active_power_usage = 0 + use_power = NO_POWER_USE teleport_speed = 20 range = 8 stationary = FALSE diff --git a/code/game/machinery/lightswitch.dm b/code/game/machinery/lightswitch.dm index 019b38abfa9..c992fedb40e 100644 --- a/code/game/machinery/lightswitch.dm +++ b/code/game/machinery/lightswitch.dm @@ -6,6 +6,7 @@ base_icon_state = "light" desc = "Make dark." power_channel = AREA_USAGE_LIGHT + use_power = NO_POWER_USE /// Set this to a string, path, or area instance to control that area /// instead of the switch's location. var/area/area = null diff --git a/code/game/machinery/limbgrower.dm b/code/game/machinery/limbgrower.dm index 067c64e6340..efbe2e0ab79 100644 --- a/code/game/machinery/limbgrower.dm +++ b/code/game/machinery/limbgrower.dm @@ -6,9 +6,6 @@ icon = 'icons/obj/machines/limbgrower.dmi' icon_state = "limbgrower_idleoff" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 circuit = /obj/item/circuitboard/machine/limbgrower /// The category of limbs we're browing in our UI. @@ -163,7 +160,7 @@ playsound(src, 'sound/machines/buzz-sigh.ogg', 50, FALSE) return - power = max(2000, (power + consumed_reagents_list[reagent_id])) + power = max(active_power_usage, (power + consumed_reagents_list[reagent_id])) busy = TRUE use_power(power) @@ -234,6 +231,7 @@ return text2path(path) /obj/machinery/limbgrower/RefreshParts() + . = ..() reagents.maximum_volume = 0 for(var/obj/item/reagent_containers/glass/our_beaker in component_parts) reagents.maximum_volume += our_beaker.volume diff --git a/code/game/machinery/mass_driver.dm b/code/game/machinery/mass_driver.dm index 00670d1f8aa..7cc2a0753d7 100644 --- a/code/game/machinery/mass_driver.dm +++ b/code/game/machinery/mass_driver.dm @@ -3,9 +3,6 @@ desc = "The finest in spring-loaded piston toy technology, now on a space station near you." icon = 'icons/obj/stationobjs.dmi' icon_state = "mass_driver" - use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 50 var/power = 1 var/code = 1 var/id = 1 @@ -36,7 +33,7 @@ /obj/machinery/mass_driver/proc/drive(amount) if(machine_stat & (BROKEN|NOPOWER)) return - use_power(500) + use_power(active_power_usage) var/O_limit var/atom/target = get_edge_target_turf(src, dir) for(var/atom/movable/O in loc) @@ -47,7 +44,7 @@ if(O_limit >= 20) audible_message(span_notice("[src] lets out a screech, it doesn't seem to be able to handle the load.")) break - use_power(500) + use_power(active_power_usage) O.throw_at(target, drive_range * power, power) flick("mass_driver1", src) diff --git a/code/game/machinery/mechlaunchpad.dm b/code/game/machinery/mechlaunchpad.dm index b10f2cc7ae2..76f4f444bc0 100644 --- a/code/game/machinery/mechlaunchpad.dm +++ b/code/game/machinery/mechlaunchpad.dm @@ -60,6 +60,7 @@ "style" = STYLE_SEETHROUGH, "reverse_dropoff_coords" = list(reverse_turf.x, reverse_turf.y, reverse_turf.z) )) + use_power(active_power_usage) /obj/structure/closet/supplypod/mechpod style = STYLE_SEETHROUGH diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index b1db20259ca..a1b73287b5d 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -55,7 +55,7 @@ var/obj/item/card/id/card = paying.get_idcard(TRUE) if(card?.registered_account?.account_job?.paycheck_department == payment_department) - use_power(20) + use_power(active_power_usage) paying_customer = TRUE say("Hello, esteemed medical staff!") RefreshParts() @@ -63,7 +63,7 @@ var/bonus_fee = pandemonium ? rand(10,30) : 0 if(attempt_charge(src, paying, bonus_fee) & COMPONENT_OBJ_CANCEL_CHARGE ) return - use_power(20) + use_power(active_power_usage) paying_customer = TRUE icon_state = "[base_icon_state]_active" say("Thank you for your patronage!") @@ -91,6 +91,7 @@ return TOOL_ACT_TOOLTYPE_SUCCESS /obj/machinery/medical_kiosk/RefreshParts() + . = ..() var/obj/item/circuitboard/machine/medical_kiosk/board = circuit if(board) active_price = board.custom_cost diff --git a/code/game/machinery/medipen_refiller.dm b/code/game/machinery/medipen_refiller.dm index ad319824297..1650434c301 100644 --- a/code/game/machinery/medipen_refiller.dm +++ b/code/game/machinery/medipen_refiller.dm @@ -5,7 +5,6 @@ icon_state = "medipen_refiller" density = TRUE circuit = /obj/item/circuitboard/machine/medipen_refiller - idle_power_usage = 100 /// list of medipen subtypes it can refill var/list/allowed = list(/obj/item/reagent_containers/hypospray/medipen = /datum/reagent/medicine/epinephrine, /obj/item/reagent_containers/hypospray/medipen/atropine = /datum/reagent/medicine/atropine, @@ -25,6 +24,7 @@ /obj/machinery/medipen_refiller/RefreshParts() + . = ..() var/new_volume = 100 for(var/obj/item/stock_parts/matter_bin/B in component_parts) new_volume += 100 * B.rating @@ -94,3 +94,4 @@ cut_overlays() busy = FALSE to_chat(user, span_notice("Medipen refilled.")) + use_power(active_power_usage) diff --git a/code/game/machinery/porta_turret/portable_turret.dm b/code/game/machinery/porta_turret/portable_turret.dm index 8e28586274e..34e79c90014 100644 --- a/code/game/machinery/porta_turret/portable_turret.dm +++ b/code/game/machinery/porta_turret/portable_turret.dm @@ -32,11 +32,9 @@ DEFINE_BITFIELD(turret_flags, list( invisibility = INVISIBILITY_OBSERVER //the turret is invisible if it's inside its cover density = TRUE desc = "A covered turret that shoots at its enemies." - use_power = IDLE_POWER_USE //this turret uses and requires power - idle_power_usage = 50 //when inactive, this turret takes up constant 50 Equipment power - active_power_usage = 300 //when active, this turret takes up constant 300 Equipment power req_access = list(ACCESS_SECURITY) /// Only people with Security access power_channel = AREA_USAGE_EQUIP //drains power from the EQUIPMENT channel + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.15 max_integrity = 160 //the turret's health integrity_failure = 0.5 armor = list(MELEE = 50, BULLET = 30, LASER = 30, ENERGY = 30, BOMB = 30, BIO = 0, FIRE = 90, ACID = 90) diff --git a/code/game/machinery/porta_turret/portable_turret_construct.dm b/code/game/machinery/porta_turret/portable_turret_construct.dm index 3716832b55b..c70fdbf490a 100644 --- a/code/game/machinery/porta_turret/portable_turret_construct.dm +++ b/code/game/machinery/porta_turret/portable_turret_construct.dm @@ -15,6 +15,7 @@ desc = "An unfinished covered turret frame." anchored = FALSE density = TRUE + use_power = NO_POWER_USE var/build_step = PTURRET_UNSECURED //the current step in the building process var/finish_name = "turret" //the name applied to the product turret var/obj/item/gun/installed_gun = null diff --git a/code/game/machinery/porta_turret/portable_turret_cover.dm b/code/game/machinery/porta_turret/portable_turret_cover.dm index 438aa5f00c3..8586dd5f0c3 100644 --- a/code/game/machinery/porta_turret/portable_turret_cover.dm +++ b/code/game/machinery/porta_turret/portable_turret_cover.dm @@ -10,6 +10,7 @@ layer = HIGH_OBJ_LAYER density = FALSE max_integrity = 80 + use_power = NO_POWER_USE var/obj/machinery/porta_turret/parent_turret = null /obj/machinery/porta_turret_cover/Destroy() diff --git a/code/game/machinery/prisongate.dm b/code/game/machinery/prisongate.dm index 303263bde10..8237959f543 100644 --- a/code/game/machinery/prisongate.dm +++ b/code/game/machinery/prisongate.dm @@ -11,8 +11,8 @@ armor = list(MELEE = 30, BULLET = 30, LASER = 20, ENERGY = 20, BOMB = 10, BIO = 100, FIRE = 80, ACID = 70) use_power = IDLE_POWER_USE power_channel = AREA_USAGE_EQUIP - idle_power_usage = 5 - active_power_usage = 30 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.03 anchored = TRUE /// dictates whether the gate barrier is up or not var/gate_active = TRUE @@ -25,11 +25,13 @@ gate_active = FALSE flick("prisongate_turningoff", src) icon_state = "prisongate_off" + update_use_power(IDLE_POWER_USE) else gate_active = TRUE visible_message(span_notice("[src] whirrs back to life as its hardlight barrier fills the space between it.")) flick("prisongate_turningon", src) icon_state = "prisongate_on" + update_use_power(ACTIVE_POWER_USE) /obj/machinery/prisongate/CanAllowThrough(atom/movable/gate_toucher, border_dir) . = ..() diff --git a/code/game/machinery/prisonlabor.dm b/code/game/machinery/prisonlabor.dm index 20ee5d09aa0..2144b957326 100644 --- a/code/game/machinery/prisonlabor.dm +++ b/code/game/machinery/prisonlabor.dm @@ -4,8 +4,8 @@ icon = 'icons/obj/machines/prison.dmi' icon_state = "offline" use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 50 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.02 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.05 var/obj/item/stack/license_plates/empty/current_plate var/pressing = FALSE @@ -58,7 +58,7 @@ update_appearance() return FALSE - use_power(100) + use_power(active_power_usage) to_chat(user, span_notice("You finish pressing a new license plate!")) pressing = FALSE diff --git a/code/game/machinery/quantum_pad.dm b/code/game/machinery/quantum_pad.dm index 69f80340d99..97cef3170c1 100644 --- a/code/game/machinery/quantum_pad.dm +++ b/code/game/machinery/quantum_pad.dm @@ -3,9 +3,7 @@ desc = "A bluespace quantum-linked telepad used for teleporting objects to other quantum pads." icon = 'icons/obj/telescience.dmi' icon_state = "qpad-idle" - use_power = IDLE_POWER_USE - idle_power_usage = 200 - active_power_usage = 5000 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 10 obj_flags = CAN_BE_HIT | UNIQUE_RENAME circuit = /obj/item/circuitboard/machine/quantumpad var/teleport_cooldown = 400 //30 seconds base due to base parts @@ -42,6 +40,7 @@ . += span_notice("The linking device is now able to be scanned with a multitool.") /obj/machinery/quantumpad/RefreshParts() + . = ..() var/E = 0 for(var/obj/item/stock_parts/capacitor/C in component_parts) E += C.rating @@ -158,7 +157,7 @@ last_teleport = world.time // use a lot of power - use_power(10000 / power_efficiency) + use_power(active_power_usage / power_efficiency) sparks() target_pad.sparks() diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm index bb1461e1a65..0cfd500f7c1 100755 --- a/code/game/machinery/recharger.dm +++ b/code/game/machinery/recharger.dm @@ -4,9 +4,6 @@ icon_state = "recharger" base_icon_state = "recharger" desc = "A charging dock for energy based weaponry." - use_power = IDLE_POWER_USE - idle_power_usage = 4 - active_power_usage = 250 circuit = /obj/item/circuitboard/machine/recharger pass_flags = PASSTABLE var/obj/item/charging = null @@ -23,6 +20,7 @@ )) /obj/machinery/recharger/RefreshParts() + . = ..() for(var/obj/item/stock_parts/capacitor/C in component_parts) recharge_coeff = C.rating @@ -138,7 +136,7 @@ if(C) if(C.charge < C.maxcharge) C.give(C.chargerate * recharge_coeff * delta_time / 2) - use_power(125 * recharge_coeff * delta_time) + use_power(active_power_usage * recharge_coeff * delta_time) using_power = TRUE update_appearance() @@ -146,7 +144,7 @@ var/obj/item/ammo_box/magazine/recharge/R = charging if(R.stored_ammo.len < R.max_ammo) R.stored_ammo += new R.ammo_type(R) - use_power(100 * recharge_coeff * delta_time) + use_power(active_power_usage * recharge_coeff * delta_time) using_power = TRUE update_appearance() return diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index ec0b93987ae..f9ebe95de9e 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -4,9 +4,6 @@ icon = 'icons/obj/objects.dmi' icon_state = "borgcharger0" density = FALSE - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 1000 req_access = list(ACCESS_ROBOTICS) state_open = TRUE circuit = /obj/item/circuitboard/machine/cyborgrecharger @@ -35,6 +32,7 @@ GLOB.roundstart_station_borgcharger_areas += area_name /obj/machinery/recharge_station/RefreshParts() + . = ..() recharge_speed = 0 repairs = 0 for(var/obj/item/stock_parts/capacitor/C in component_parts) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index fd6da3c9c63..a8a28b71d33 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -47,6 +47,7 @@ AddElement(/datum/element/connect_loc, loc_connections) /obj/machinery/recycler/RefreshParts() + . = ..() var/amt_made = 0 var/mat_mod = 0 for(var/obj/item/stock_parts/matter_bin/B in component_parts) @@ -139,17 +140,20 @@ else if(isliving(AM)) living_detected = TRUE crunchy_nom += AM + var/not_eaten = to_eat.len - nom.len - crunchy_nom.len if(living_detected) // First, check if we have any living beings detected. if(obj_flags & EMAGGED) for(var/CRUNCH in crunchy_nom) // Eat them and keep going because we don't care about safety. if(isliving(CRUNCH)) // MMIs and brains will get eaten like normal items crush_living(CRUNCH) + use_power(active_power_usage) else // Stop processing right now without eating anything. emergency_stop() return for(var/nommed in nom) recycle_item(nommed) + use_power(active_power_usage) if(nom.len && sound) playsound(src, item_recycle_sound, (50 + nom.len*5), TRUE, nom.len, ignore_walls = (nom.len - 10)) // As a substitute for playing 50 sounds at once. if(not_eaten) diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 04bc8115d72..d6bb6e4199d 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -30,6 +30,7 @@ GLOBAL_LIST_EMPTY(req_console_ckey_departments) icon = 'icons/obj/terminals.dmi' icon_state = "req_comp_off" base_icon_state = "req_comp" + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.15 var/department = "Unknown" //The list of all departments on the station (Determined from this variable on each unit) Set this to the same thing if you want several consoles in one department var/list/messages = list() //List of all messages var/departmentType = 0 //bitflag diff --git a/code/game/machinery/roulette_machine.dm b/code/game/machinery/roulette_machine.dm index 55c11d5b476..0524cf1f683 100644 --- a/code/game/machinery/roulette_machine.dm +++ b/code/game/machinery/roulette_machine.dm @@ -24,10 +24,7 @@ icon = 'icons/obj/machines/roulette.dmi' icon_state = "idle" density = TRUE - use_power = IDLE_POWER_USE anchored = FALSE - idle_power_usage = 10 - active_power_usage = 100 max_integrity = 500 armor = list(MELEE = 45, BULLET = 30, LASER = 30, ENERGY = 30, BOMB = 10, BIO = 30, FIRE = 30, ACID = 30) var/static/list/numbers = list("0" = "green", "1" = "red", "3" = "red", "5" = "red", "7" = "red", "9" = "red", "12" = "red", "14" = "red", "16" = "red",\ @@ -210,6 +207,8 @@ addtimer(CALLBACK(src, .proc/finish_play, player_id, bet_type, bet_amount, payout, rolled_number), 34) //4 deciseconds more so the animation can play addtimer(CALLBACK(src, .proc/finish_play_animation), 30) + use_power(active_power_usage) + /obj/machinery/roulette/proc/finish_play_animation() icon_state = "idle" flick("flick_down", src) diff --git a/code/game/machinery/scan_gate.dm b/code/game/machinery/scan_gate.dm index 0e23bb05399..26d7da32cb4 100644 --- a/code/game/machinery/scan_gate.dm +++ b/code/game/machinery/scan_gate.dm @@ -22,8 +22,6 @@ desc = "A gate able to perform mid-depth scans on any organisms who pass under it." icon = 'icons/obj/machines/scangate.dmi' icon_state = "scangate" - use_power = IDLE_POWER_USE - idle_power_usage = 50 circuit = /obj/item/circuitboard/machine/scanner_gate var/scanline_timer @@ -194,6 +192,8 @@ assembly?.activate() set_scanline("scanning", 10) + use_power(active_power_usage) + /obj/machinery/scanner_gate/proc/alarm_beep() if(next_beep <= world.time) next_beep = world.time + 20 diff --git a/code/game/machinery/sheetifier.dm b/code/game/machinery/sheetifier.dm index f08fb476e6e..93b27ab4288 100644 --- a/code/game/machinery/sheetifier.dm +++ b/code/game/machinery/sheetifier.dm @@ -4,9 +4,6 @@ icon = 'icons/obj/machines/sheetifier.dmi' icon_state = "base_machine" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 circuit = /obj/item/circuitboard/machine/sheetifier layer = BELOW_OBJ_LAYER var/busy_processing = FALSE @@ -44,6 +41,7 @@ update_appearance() var/datum/component/material_container/materials = GetComponent(/datum/component/material_container) materials.retrieve_all() //Returns all as sheets + use_power(active_power_usage) /obj/machinery/sheetifier/wrench_act(mob/living/user, obj/item/tool) . = ..() diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 17fc788ca5e..b602d9244b4 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -265,8 +265,6 @@ req_access = list(ACCESS_TELEPORTER) flags_1 = CONDUCT_1 use_power = NO_POWER_USE - idle_power_usage = 10 - active_power_usage = 50 max_integrity = 300 var/active = FALSE var/locked = TRUE diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 4e33d5affe7..e06bed0829e 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -22,8 +22,6 @@ icon_keyboard = null icon_screen = "slots_screen" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 50 circuit = /obj/item/circuitboard/computer/slot_machine light_color = LIGHT_COLOR_BROWN var/money = 3000 //How much money it has CONSUMED @@ -220,6 +218,7 @@ /obj/machinery/computer/slot_machine/proc/do_spin() randomize_reels() updateDialog() + use_power(active_power_usage) /obj/machinery/computer/slot_machine/proc/finish_spinning(spin_loop, mob/user, the_name) toggle_reel_spin(0, REEL_DEACTIVATE_DELAY) diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 7233be61c25..1266fbdef85 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -129,6 +129,7 @@ cell.use(required_energy / efficiency) /obj/machinery/space_heater/RefreshParts() + . = ..() var/laser = 0 var/cap = 0 for(var/obj/item/stock_parts/micro_laser/M in component_parts) @@ -415,6 +416,7 @@ icon_state = "sheater-off" /obj/machinery/space_heater/improvised_chem_heater/RefreshParts() + . = ..() var/lasers_rating = 0 var/capacitors_rating = 0 for(var/obj/item/stock_parts/micro_laser/laser in component_parts) diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm index c3c35b18b4b..d3f7a5966eb 100644 --- a/code/game/machinery/stasis.dm +++ b/code/game/machinery/stasis.dm @@ -10,8 +10,6 @@ can_buckle = TRUE buckle_lying = 90 circuit = /obj/item/circuitboard/machine/stasis - idle_power_usage = 40 - active_power_usage = 340 fair_market_price = 10 payment_department = ACCOUNT_MED var/stasis_enabled = TRUE diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 9b6dfd5fed9..b9762f2308c 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -25,8 +25,6 @@ verb_ask = "beeps" verb_exclaim = "beeps" density = FALSE - use_power = IDLE_POWER_USE - idle_power_usage = 10 layer = ABOVE_WINDOW_LAYER var/obj/effect/overlay/status_display_text/message1_overlay diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 95cb8a5e9fd..7fa56c56c8c 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -5,8 +5,6 @@ icon = 'icons/obj/machines/suit_storage.dmi' icon_state = "classic" base_icon_state = "classic" - use_power = ACTIVE_POWER_USE - active_power_usage = 60 power_channel = AREA_USAGE_EQUIP density = TRUE obj_flags = NO_BUILD // Becomes undense when the unit is open @@ -439,12 +437,12 @@ cell = suit.cell if(mod) cell = mod.get_cell() - if(!cell) + if(!cell || cell.charge == cell.maxcharge) return var/cell_charged = cell.give(charge_rate * delta_time) if(cell_charged) - use_power(cell_charged) + use_power((active_power_usage + charge_rate) * delta_time) /obj/machinery/suit_storage_unit/proc/shock(mob/user, prb) if(!prob(prb)) diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index 377ef390ee1..098287110dc 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -16,6 +16,7 @@ interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_OFFLINE + use_power = NO_POWER_USE var/minimum_timer = 90 var/timer_set = 90 var/maximum_timer = 60000 diff --git a/code/game/machinery/teambuilder.dm b/code/game/machinery/teambuilder.dm index eee3dba2d54..c8b55bf5b52 100644 --- a/code/game/machinery/teambuilder.dm +++ b/code/game/machinery/teambuilder.dm @@ -9,6 +9,7 @@ density = FALSE can_buckle = FALSE resistance_flags = INDESTRUCTIBLE // Just to be safe. + use_power = NO_POWER_USE ///Are non-humans allowed to use this? var/humans_only = FALSE ///What color is your mob set to when crossed? diff --git a/code/game/machinery/telecomms/computers/logbrowser.dm b/code/game/machinery/telecomms/computers/logbrowser.dm index 06c3575b427..3d2dbb5e673 100644 --- a/code/game/machinery/telecomms/computers/logbrowser.dm +++ b/code/game/machinery/telecomms/computers/logbrowser.dm @@ -158,6 +158,7 @@ return FALSE /obj/machinery/computer/telecomms/server/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if (!ui) ui = new(user, src, "ServerMonitor", name) diff --git a/code/game/machinery/telecomms/machines/broadcaster.dm b/code/game/machinery/telecomms/machines/broadcaster.dm index 6f0a2fcf7c1..2e66f7cec62 100644 --- a/code/game/machinery/telecomms/machines/broadcaster.dm +++ b/code/game/machinery/telecomms/machines/broadcaster.dm @@ -14,8 +14,7 @@ GLOBAL_VAR_INIT(message_delay, 0) // To make sure restarting the recentmessages desc = "A dish-shaped machine used to broadcast processed subspace signals." telecomms_type = /obj/machinery/telecomms/broadcaster density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 25 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.01 circuit = /obj/item/circuitboard/machine/telecomms/broadcaster /obj/machinery/telecomms/broadcaster/receive_information(datum/signal/subspace/signal, obj/machinery/telecomms/machine_from) @@ -54,6 +53,8 @@ GLOBAL_VAR_INIT(message_delay, 0) // To make sure restarting the recentmessages /* --- Do a snazzy animation! --- */ flick("broadcaster_send", src) + use_power(idle_power_usage) + /proc/end_message_delay() GLOB.message_delay = FALSE GLOB.recentmessages = list() diff --git a/code/game/machinery/telecomms/machines/bus.dm b/code/game/machinery/telecomms/machines/bus.dm index 76c89063dfd..8ff91e570a8 100644 --- a/code/game/machinery/telecomms/machines/bus.dm +++ b/code/game/machinery/telecomms/machines/bus.dm @@ -14,8 +14,7 @@ desc = "A mighty piece of hardware used to send massive amounts of data quickly." telecomms_type = /obj/machinery/telecomms/bus density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 50 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.01 netspeed = 40 circuit = /obj/item/circuitboard/machine/telecomms/bus var/change_frequency = 0 @@ -46,6 +45,8 @@ if(relay_information(signal, send)) break + use_power(idle_power_usage) + //Preset Buses /obj/machinery/telecomms/bus/preset_one diff --git a/code/game/machinery/telecomms/machines/hub.dm b/code/game/machinery/telecomms/machines/hub.dm index 290cb094e7d..7831056c81e 100644 --- a/code/game/machinery/telecomms/machines/hub.dm +++ b/code/game/machinery/telecomms/machines/hub.dm @@ -14,8 +14,7 @@ desc = "A mighty piece of hardware used to send/receive massive amounts of data." telecomms_type = /obj/machinery/telecomms/hub density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 80 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.01 long_range_link = TRUE netspeed = 40 circuit = /obj/item/circuitboard/machine/telecomms/hub @@ -33,6 +32,8 @@ // Then broadcast that signal to relay_information(signal, /obj/machinery/telecomms/broadcaster) + use_power(idle_power_usage) + //Preset HUB /obj/machinery/telecomms/hub/preset diff --git a/code/game/machinery/telecomms/machines/message_server.dm b/code/game/machinery/telecomms/machines/message_server.dm index fbf385a9044..c683ff510c8 100644 --- a/code/game/machinery/telecomms/machines/message_server.dm +++ b/code/game/machinery/telecomms/machines/message_server.dm @@ -11,9 +11,6 @@ icon_state = "blackbox" name = "Blackbox Recorder" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 armor = list(MELEE = 25, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 50, ACID = 70) var/obj/item/stored @@ -77,9 +74,6 @@ desc = "A machine that processes and routes PDA and request console messages." telecomms_type = /obj/machinery/telecomms/message_server density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 circuit = /obj/item/circuitboard/machine/telecomms/message_server var/list/datum/data_tablet_msg/pda_msgs = list() diff --git a/code/game/machinery/telecomms/machines/processor.dm b/code/game/machinery/telecomms/machines/processor.dm index 02db6748971..906635d67ab 100644 --- a/code/game/machinery/telecomms/machines/processor.dm +++ b/code/game/machinery/telecomms/machines/processor.dm @@ -12,8 +12,7 @@ desc = "This machine is used to process large quantities of information." telecomms_type = /obj/machinery/telecomms/processor density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 30 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.01 circuit = /obj/item/circuitboard/machine/telecomms/processor var/process_mode = 1 // 1 = Uncompress Signals, 0 = Compress Signals diff --git a/code/game/machinery/telecomms/machines/receiver.dm b/code/game/machinery/telecomms/machines/receiver.dm index f9abd5972db..d34de916d9a 100644 --- a/code/game/machinery/telecomms/machines/receiver.dm +++ b/code/game/machinery/telecomms/machines/receiver.dm @@ -12,8 +12,7 @@ desc = "This machine has a dish-like shape and green lights. It is designed to detect and process subspace radio activity." telecomms_type = /obj/machinery/telecomms/receiver density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 30 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 circuit = /obj/item/circuitboard/machine/telecomms/receiver /obj/machinery/telecomms/receiver/receive_signal(datum/signal/subspace/signal) @@ -28,6 +27,8 @@ if(!relay_information(signal, /obj/machinery/telecomms/hub)) relay_information(signal, /obj/machinery/telecomms/bus) + use_power(idle_power_usage) + /obj/machinery/telecomms/receiver/proc/check_receive_level(datum/signal/subspace/signal) if (z in signal.levels) return TRUE diff --git a/code/game/machinery/telecomms/machines/relay.dm b/code/game/machinery/telecomms/machines/relay.dm index 5744c8086fa..668d30b5bb8 100644 --- a/code/game/machinery/telecomms/machines/relay.dm +++ b/code/game/machinery/telecomms/machines/relay.dm @@ -12,8 +12,7 @@ desc = "A mighty piece of hardware used to send massive amounts of data far away." telecomms_type = /obj/machinery/telecomms/relay density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 30 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.01 netspeed = 5 long_range_link = 1 circuit = /obj/item/circuitboard/machine/telecomms/relay @@ -31,6 +30,8 @@ else signal.levels |= relay_turf.z + use_power(idle_power_usage) + /// Checks to see if it can send/receive. /obj/machinery/telecomms/relay/proc/can(datum/signal/signal) if(!on) diff --git a/code/game/machinery/telecomms/machines/server.dm b/code/game/machinery/telecomms/machines/server.dm index e38c8c6bb85..edfbbbe0ca3 100644 --- a/code/game/machinery/telecomms/machines/server.dm +++ b/code/game/machinery/telecomms/machines/server.dm @@ -11,8 +11,7 @@ desc = "A machine used to store data and network statistics." telecomms_type = /obj/machinery/telecomms/server density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 15 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.01 circuit = /obj/item/circuitboard/machine/telecomms/server var/list/log_entries = list() var/totaltraffic = 0 // gigabytes (if > 1024, divide by 1024 -> terrabytes) @@ -54,6 +53,7 @@ if(!can_send) relay_information(signal, /obj/machinery/telecomms/broadcaster) + use_power(idle_power_usage) // Simple log entry datum /datum/comm_log_entry diff --git a/code/game/machinery/teleporter.dm b/code/game/machinery/teleporter.dm index 75403cd2487..9765b36d384 100644 --- a/code/game/machinery/teleporter.dm +++ b/code/game/machinery/teleporter.dm @@ -8,9 +8,6 @@ desc = "It's the hub of a teleporting machine." icon_state = "tele0" base_icon_state = "tele" - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 2000 circuit = /obj/item/circuitboard/machine/teleporter_hub var/accuracy = 0 var/obj/machinery/teleport/station/power_station @@ -27,6 +24,7 @@ return ..() /obj/machinery/teleport/hub/RefreshParts() + . = ..() var/A = 0 for(var/obj/item/stock_parts/matter_bin/M in component_parts) A += M.rating @@ -77,7 +75,7 @@ return if (ismovable(M)) if(do_teleport(M, target, channel = TELEPORT_CHANNEL_BLUESPACE)) - use_power(5000) + use_power(active_power_usage) if(!calibrated && prob(30 - ((accuracy) * 10))) //oh dear a problem if(ishuman(M))//don't remove people from the round randomly you jerks var/mob/living/carbon/human/human = M @@ -110,9 +108,6 @@ desc = "The power control station for a bluespace teleporter. Used for toggling power, and can activate a test-fire to prevent malfunctions." icon_state = "controller" base_icon_state = "controller" - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 2000 circuit = /obj/item/circuitboard/machine/teleporter_station var/engaged = FALSE var/obj/machinery/computer/teleporter/teleporter_console @@ -125,6 +120,7 @@ link_console_and_hub() /obj/machinery/teleport/station/RefreshParts() + . = ..() var/E for(var/obj/item/stock_parts/capacitor/C in component_parts) E += C.rating @@ -200,7 +196,7 @@ to_chat(user, span_alert("The teleporter hub isn't responding.")) else engaged = !engaged - use_power(5000) + use_power(active_power_usage) to_chat(user, span_notice("Teleporter [engaged ? "" : "dis"]engaged!")) else teleporter_console.target_ref = null diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 516cffa7361..dab14d0c366 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -8,6 +8,7 @@ layer = ABOVE_ALL_MOB_LAYER // Overhead plane = ABOVE_GAME_PLANE density = FALSE + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 5 var/transform_dead = 0 var/transform_standing = 0 var/cooldown_duration = 600 // 1 minute @@ -92,7 +93,7 @@ // Sleep for a couple of ticks to allow the human to see the pain sleep(5) - use_power(5000) // Use a lot of power. + use_power(active_power_usage) // Use a lot of power. var/mob/living/silicon/robot/R = H.Robotize() R.cell = new /obj/item/stock_parts/cell/upgraded/plus(R, robot_cell_charge) diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index d8d65133335..851b7a2c916 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -224,6 +224,7 @@ GLOBAL_LIST_INIT(dye_registry, list( qdel(color_source) color_source = null update_appearance() + use_power(active_power_usage) /obj/item/proc/dye_item(dye_color, dye_key_override) var/dye_key_selector = dye_key_override ? dye_key_override : dying_key diff --git a/code/modules/NTNet/relays.dm b/code/modules/NTNet/relays.dm index 4f044cb90f3..63cca33c0c2 100644 --- a/code/modules/NTNet/relays.dm +++ b/code/modules/NTNet/relays.dm @@ -3,8 +3,7 @@ name = "NTNet Quantum Relay" desc = "A very complex router and transmitter capable of connecting electronic devices together. Looks fragile." use_power = ACTIVE_POWER_USE - active_power_usage = 10000 //10kW, apropriate for machine that keeps massive cross-Zlevel wireless network operational. Used to be 20 but that actually drained the smes one round - idle_power_usage = 100 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 10 //10kW, apropriate for machine that keeps massive cross-Zlevel wireless network operational. Used to be 20 but that actually drained the smes one round icon = 'icons/obj/machines/telecomms.dmi' icon_state = "bus" density = TRUE diff --git a/code/modules/antagonists/abductor/machinery/console.dm b/code/modules/antagonists/abductor/machinery/console.dm index 6aefc37e68f..c73a735f4fa 100644 --- a/code/modules/antagonists/abductor/machinery/console.dm +++ b/code/modules/antagonists/abductor/machinery/console.dm @@ -7,6 +7,7 @@ /obj/machinery/abductor resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF + use_power = NO_POWER_USE var/team_number = 0 //Console diff --git a/code/modules/antagonists/fugitive/fugitive_ship.dm b/code/modules/antagonists/fugitive/fugitive_ship.dm index f6a9fd5edea..0f5d0de7370 100644 --- a/code/modules/antagonists/fugitive/fugitive_ship.dm +++ b/code/modules/antagonists/fugitive/fugitive_ship.dm @@ -31,6 +31,7 @@ antag.is_captured = TRUE to_chat(fugitive, span_userdanger("You are thrown into a vast void of bluespace, and as you fall further into oblivion the comparatively small entrance to reality gets smaller and smaller until you cannot see it anymore. You have failed to avoid capture.")) fugitive.ghostize(TRUE) //so they cannot suicide, round end stuff. + use_power(active_power_usage) /obj/machinery/computer/shuttle/hunter name = "shuttle console" diff --git a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm index cb331aac9e8..7f43464b01f 100644 --- a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm +++ b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm @@ -297,6 +297,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) desc = "A weapon which disintegrates all organic life in a large area." density = TRUE verb_exclaim = "blares" + use_power = NO_POWER_USE var/timing = FALSE var/obj/effect/countdown/doomsday/countdown var/detonation_timer diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index acc3b5714f5..214f803c052 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -68,9 +68,8 @@ desc = "A machine that monitors atmosphere levels. Goes off if the area is dangerous." icon = 'icons/obj/monitors.dmi' icon_state = "alarmp" - use_power = IDLE_POWER_USE - idle_power_usage = 4 - active_power_usage = 8 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.02 power_channel = AREA_USAGE_ENVIRON req_access = list(ACCESS_ATMOSPHERICS) max_integrity = 250 diff --git a/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm b/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm index 82da03a4124..31d7c04caa8 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm @@ -3,6 +3,7 @@ dir = SOUTH initialize_directions = SOUTH|NORTH use_power = IDLE_POWER_USE + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.25 device_type = BINARY layer = GAS_PUMP_LAYER pipe_flags = PIPING_BRIDGE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index 4c82f903a49..f149ccfd6d6 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -16,6 +16,7 @@ Passive gate is similar to the regular pump except: interaction_flags_machine = INTERACT_MACHINE_OFFLINE | INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | INTERACT_MACHINE_SET_MACHINE construction_type = /obj/item/pipe/directional pipe_state = "passivegate" + use_power = NO_POWER_USE ///Set the target pressure the component should arrive to var/target_pressure = ONE_ATMOSPHERE ///Variable for radio frequency diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm index c5b3a43dc50..e0cb334b048 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm @@ -6,6 +6,7 @@ shift_underlay_only = FALSE construction_type = /obj/item/pipe/directional pipe_state = "pvalve" + use_power = NO_POWER_USE ///Amount of pressure needed before the valve for it to open var/target_pressure = ONE_ATMOSPHERE ///Frequency for radio signaling diff --git a/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm index 620d9bb9f5a..15761a31b59 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm @@ -88,6 +88,7 @@ return ..() /obj/machinery/atmospherics/components/binary/thermomachine/RefreshParts() + . = ..() var/calculated_bin_rating for(var/obj/item/stock_parts/matter_bin/bin in component_parts) calculated_bin_rating += bin.rating diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm index 40fc7f5f761..1c829649b64 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm @@ -15,6 +15,7 @@ It's like a regular ol' straight pipe, but you can turn it on and off. construction_type = /obj/item/pipe/binary pipe_state = "mvalve" custom_reconcilation = TRUE + use_power = NO_POWER_USE ///Type of valve (manual or digital), used to set the icon of the component in update_icon_nopipes() var/valve_type = MANUAL_VALVE ///Bool to stop interactions while the opening/closing animation is going diff --git a/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm b/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm index 65af7ccd181..97ae989e1d7 100644 --- a/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm +++ b/code/modules/atmospherics/machinery/components/electrolyzer/electrolyzer.dm @@ -118,6 +118,7 @@ env.garbage_collect() /obj/machinery/electrolyzer/RefreshParts() + . = ..() var/manipulator = 0 var/cap = 0 for(var/obj/item/stock_parts/manipulator/M in component_parts) diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm index cde55b10a35..d51fbdbefee 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm @@ -8,7 +8,7 @@ icon_state = "core_off" circuit = /obj/item/circuitboard/machine/HFR_core use_power = IDLE_POWER_USE - idle_power_usage = 50 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION ///Vars for the state of the icon of the object (open, off, active) icon_state_open = "core_open" icon_state_off = "core_off" @@ -171,7 +171,7 @@ radio.set_listening(FALSE) radio.recalculateChannels() investigate_log("has been created.", INVESTIGATE_HYPERTORUS) - + RegisterSignal(src.loc, COMSIG_ATOM_ENTERED, .proc/on_entered) for(var/atom/movable/movable_object in src.loc) diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm index d9d26724d94..5acd1acce8d 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm @@ -3,6 +3,7 @@ dir = SOUTH initialize_directions = SOUTH|NORTH|WEST use_power = IDLE_POWER_USE + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION device_type = TRINARY layer = GAS_FILTER_LAYER pipe_flags = PIPING_ONE_PER_TURF diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index c172844d47c..0d82c43f5ad 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -78,6 +78,10 @@ occupant_typecache = list(/mob/living/carbon, /mob/living/simple_animal) processing_flags = NONE + use_power = IDLE_POWER_USE + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.75 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 1.5 + showpipe = FALSE var/autoeject = TRUE @@ -132,6 +136,7 @@ ..(dir, dir) /obj/machinery/atmospherics/components/unary/cryo_cell/RefreshParts() + . = ..() var/C for(var/obj/item/stock_parts/matter_bin/M in component_parts) C += M.rating @@ -215,6 +220,10 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics SEND_SIGNAL(src, COMSIG_CRYO_SET_ON, active) . = on on = active + if(on) + update_use_power(ACTIVE_POWER_USE) + else + update_use_power(IDLE_POWER_USE) update_appearance() /obj/machinery/atmospherics/components/unary/cryo_cell/on_set_is_operational(old_value) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index a4883ada87c..2b29c650fc3 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -12,6 +12,8 @@ pipe_state = "injector" resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF //really helpful in building gas chambers for xenomorphs + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.25 + ///Rate of operation of the device var/volume_rate = 50 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm index 94880577f26..8a25fd86da3 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -12,6 +12,7 @@ desc = "Has a valve and pump attached to it." use_power = IDLE_POWER_USE + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.15 can_unwrench = TRUE welded = FALSE layer = GAS_SCRUBBER_LAYER diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index d2b1d4bfee4..5cbb5185176 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -7,8 +7,8 @@ name = "air scrubber" desc = "Has a valve and pump attached to it." use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 60 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.1 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.15 can_unwrench = TRUE welded = FALSE layer = GAS_SCRUBBER_LAYER diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index 192c8ff2458..5a337707c57 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -5,9 +5,8 @@ icon_state = "meter" layer = HIGH_PIPE_LAYER power_channel = AREA_USAGE_ENVIRON - use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 9 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.03 max_integrity = 150 armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, FIRE = 40, ACID = 0) greyscale_config = /datum/greyscale_config/meter diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm index 457352b6ab8..56552eeedf0 100644 --- a/code/modules/atmospherics/machinery/other/miner.dm +++ b/code/modules/atmospherics/machinery/other/miner.dm @@ -26,8 +26,8 @@ var/power_draw_dynamic_kpa_coeff = 0.5 var/broken = FALSE var/broken_message = "ERROR" - idle_power_usage = 150 - active_power_usage = 2000 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 1.5 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 /obj/machinery/atmospherics/miner/Initialize(mapload) . = ..() diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index 399a35a083d..1f907236f97 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -177,8 +177,7 @@ name = "huge air scrubber" icon_state = "hugescrubber" anchored = TRUE - active_power_usage = 500 - idle_power_usage = 10 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.5 overpressure_m = 200 volume_rate = 1500 diff --git a/code/modules/awaymissions/gateway.dm b/code/modules/awaymissions/gateway.dm index d5b8c5fc5a6..0149ad62e98 100644 --- a/code/modules/awaymissions/gateway.dm +++ b/code/modules/awaymissions/gateway.dm @@ -156,9 +156,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations) bound_y = 0 density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 100 - active_power_usage = 5000 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 5 var/calibrated = TRUE /// Type of instanced gateway destination, needs to be subtype of /datum/gateway_destination/gateway @@ -281,6 +279,7 @@ GLOBAL_LIST_EMPTY(gateway_destinations) try_to_linkup() /obj/machinery/computer/gateway_control/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "Gateway", name) diff --git a/code/modules/awaymissions/mission_code/challenge.dm b/code/modules/awaymissions/mission_code/challenge.dm index 05d07922015..b296d894064 100644 --- a/code/modules/awaymissions/mission_code/challenge.dm +++ b/code/modules/awaymissions/mission_code/challenge.dm @@ -34,4 +34,5 @@ welded = TRUE /obj/machinery/power/emitter/energycannon/RefreshParts() + SHOULD_CALL_PARENT(FALSE) return diff --git a/code/modules/cargo/department_order.dm b/code/modules/cargo/department_order.dm index 9bc663ddaf3..f2a4f2c3fc6 100644 --- a/code/modules/cargo/department_order.dm +++ b/code/modules/cargo/department_order.dm @@ -33,6 +33,7 @@ GLOBAL_LIST_INIT(department_order_cooldowns, list( department_delivery_areas = list(/area/hallway/primary/central) //if this doesn't exist like honestly fuck your map man /obj/machinery/computer/department_orders/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "DepartmentOrders") diff --git a/code/modules/cargo/expressconsole.dm b/code/modules/cargo/expressconsole.dm index 28f5496189c..1c15fac6da9 100644 --- a/code/modules/cargo/expressconsole.dm +++ b/code/modules/cargo/expressconsole.dm @@ -16,6 +16,7 @@ blockade_warning = "Bluespace instability detected. Delivery impossible." req_access = list(ACCESS_QM) is_express = TRUE + interface_type = "CargoExpress" var/message var/printed_beacons = 0 //number of beacons printed. Used to determine beacon names. @@ -93,12 +94,6 @@ "desc" = P.desc || P.name // If there is a description, use it. Otherwise use the pack's name. )) -/obj/machinery/computer/cargo/express/ui_interact(mob/living/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "CargoExpress", name) - ui.open() - /obj/machinery/computer/cargo/express/ui_data(mob/user) var/canBeacon = beacon && (isturf(beacon.loc) || ismob(beacon.loc))//is the beacon in a valid location? var/list/data = list() diff --git a/code/modules/cargo/markets/market_telepad.dm b/code/modules/cargo/markets/market_telepad.dm index a8ecb11d383..1c433f48584 100644 --- a/code/modules/cargo/markets/market_telepad.dm +++ b/code/modules/cargo/markets/market_telepad.dm @@ -16,7 +16,7 @@ circuit = /obj/item/circuitboard/machine/ltsrbt density = TRUE - idle_power_usage = 200 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 2 /// Divider for power_usage_per_teleport. var/power_efficiency = 1 @@ -48,6 +48,7 @@ . = ..() /obj/machinery/ltsrbt/RefreshParts() + . = ..() recharge_time = base_recharge_time // On tier 4 recharge_time should be 20 and by default it is 80 as scanning modules should be tier 1. for(var/obj/item/stock_parts/scanning_module/scan in component_parts) diff --git a/code/modules/cargo/orderconsole.dm b/code/modules/cargo/orderconsole.dm index c8e302ee8ec..31a4550dfdf 100644 --- a/code/modules/cargo/orderconsole.dm +++ b/code/modules/cargo/orderconsole.dm @@ -34,7 +34,8 @@ var/stationcargo = TRUE ///The account this console processes and displays. Independent from the account the shuttle processes. var/cargo_account = ACCOUNT_CAR - + ///Interface name for the ui_interact call for different subtypes. + var/interface_type = "Cargo" /obj/machinery/computer/cargo/request name = "supply request console" @@ -89,9 +90,10 @@ circuit.configure_machine(src) /obj/machinery/computer/cargo/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, "Cargo", name) + ui = new(user, src, interface_type, name) ui.open() /obj/machinery/computer/cargo/ui_data() diff --git a/code/modules/events/pirates.dm b/code/modules/events/pirates.dm index 6fb07f4829c..2a76e1df709 100644 --- a/code/modules/events/pirates.dm +++ b/code/modules/events/pirates.dm @@ -292,6 +292,8 @@ var/sending_timer ///This is the cargo hold ID used by the piratepad machine. Match these two to link them together. var/cargo_hold_id + ///Interface name for the ui_interact call for different subtypes. + var/interface_type = "CargoHoldTerminal" /obj/machinery/computer/piratepad_control/Initialize(mapload) ..() @@ -316,9 +318,10 @@ pad_ref = WEAKREF(pad) /obj/machinery/computer/piratepad_control/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, "CargoHoldTerminal", name) + ui = new(user, src, interface_type, name) ui.open() /obj/machinery/computer/piratepad_control/ui_data(mob/user) diff --git a/code/modules/experisci/destructive_scanner.dm b/code/modules/experisci/destructive_scanner.dm index f4fa42289e6..0be450ff6bd 100644 --- a/code/modules/experisci/destructive_scanner.dm +++ b/code/modules/experisci/destructive_scanner.dm @@ -35,6 +35,7 @@ return aggressive = TRUE start_closing(aggressive) + use_power(idle_power_usage) ///Closes the machine to kidnap everything in the turf into it. /obj/machinery/destructive_scanner/proc/start_closing(aggressive) @@ -47,6 +48,7 @@ scanning = TRUE update_icon() playsound(src, 'sound/machines/destructive_scanner/TubeDown.ogg', 100) + use_power(idle_power_usage) addtimer(CALLBACK(src, .proc/start_scanning, aggressive), 1.2 SECONDS) ///Starts scanning the fancy scanning effects @@ -55,6 +57,7 @@ playsound(src, 'sound/machines/destructive_scanner/ScanDangerous.ogg', 100, extrarange = 5) else playsound(src, 'sound/machines/destructive_scanner/ScanSafe.ogg', 100) + use_power(active_power_usage) addtimer(CALLBACK(src, .proc/finish_scanning, aggressive), 6 SECONDS) diff --git a/code/modules/explorer_drone/scanner_array.dm b/code/modules/explorer_drone/scanner_array.dm index 66a272bc688..968beb9d3cf 100644 --- a/code/modules/explorer_drone/scanner_array.dm +++ b/code/modules/explorer_drone/scanner_array.dm @@ -195,8 +195,6 @@ GLOBAL_LIST_INIT(scan_conditions,init_scan_conditions()) icon = 'icons/obj/exploration.dmi' icon_state = "scanner_off" desc = "Sophisticated scanning array. Easily influenced by enviroment." - idle_power_usage = 0 - active_power_usage = 500 /obj/machinery/exoscanner/Initialize(mapload) . = ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm index ac9480d99b7..6d5a10cc6da 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/deep_fryer.dm @@ -17,8 +17,7 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( icon_state = "fryer_off" density = TRUE pass_flags_self = PASSMACHINE | LETPASSTHROW - use_power = IDLE_POWER_USE - idle_power_usage = 5 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 layer = BELOW_OBJ_LAYER circuit = /obj/item/circuitboard/machine/deep_fryer var/obj/item/food/deepfryholder/frying //What's being fried RIGHT NOW? @@ -47,6 +46,7 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( return ..() /obj/machinery/deepfryer/RefreshParts() + . = ..() var/oil_efficiency for(var/obj/item/stock_parts/micro_laser/M in component_parts) oil_efficiency += M.rating @@ -108,6 +108,8 @@ GLOBAL_LIST_INIT(oilfry_blacklisted_items, typecacheof(list( frying_burnt = TRUE visible_message(span_warning("[src] emits an acrid smell!")) + use_power(active_power_usage) + /obj/machinery/deepfryer/attack_ai(mob/user) return diff --git a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm index 34b143524cf..edb82137449 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/gibber.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/gibber.dm @@ -4,9 +4,6 @@ icon = 'icons/obj/kitchen.dmi' icon_state = "grinder" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 500 circuit = /obj/item/circuitboard/machine/gibber var/operating = FALSE //Is it on? @@ -21,6 +18,7 @@ add_overlay("grjam") /obj/machinery/gibber/RefreshParts() + . = ..() gibtime = 40 meat_produced = initial(meat_produced) for(var/obj/item/stock_parts/matter_bin/B in component_parts) @@ -144,7 +142,7 @@ audible_message(span_hear("You hear a loud metallic grinding sound.")) return - use_power(1000) + use_power(active_power_usage) audible_message(span_hear("You hear a loud squelchy grinding sound.")) playsound(loc, 'sound/machines/juicer.ogg', 50, TRUE) operating = TRUE diff --git a/code/modules/food_and_drinks/kitchen_machinery/griddle.dm b/code/modules/food_and_drinks/kitchen_machinery/griddle.dm index 19fc4f6e5a5..40421e50a35 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/griddle.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/griddle.dm @@ -5,8 +5,7 @@ icon_state = "griddle1_off" density = TRUE pass_flags_self = PASSMACHINE | PASSTABLE| LETPASSTHROW // It's roughly the height of a table. - use_power = IDLE_POWER_USE - idle_power_usage = 5 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 layer = BELOW_OBJ_LAYER circuit = /obj/item/circuitboard/machine/griddle processing_flags = START_PROCESSING_MANUALLY @@ -142,6 +141,8 @@ if(prob(10)) visible_message(span_danger("[griddled_item] doesn't seem to be doing too great on the [src]!")) + use_power(active_power_usage) + /obj/machinery/griddle/update_icon_state() icon_state = "griddle[variant]_[on ? "on" : "off"]" return ..() diff --git a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm index 7aa66eac327..d48ec43eae6 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/microwave.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/microwave.dm @@ -7,9 +7,6 @@ icon_state = "mw" layer = BELOW_OBJ_LAYER density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 100 circuit = /obj/item/circuitboard/machine/microwave pass_flags = PASSTABLE light_color = LIGHT_COLOR_YELLOW @@ -46,6 +43,7 @@ . = ..() /obj/machinery/microwave/RefreshParts() + . = ..() efficiency = 0 for(var/obj/item/stock_parts/micro_laser/M in component_parts) efficiency += M.rating @@ -319,7 +317,7 @@ pre_success() return time-- - use_power(500) + use_power(active_power_usage) addtimer(CALLBACK(src, .proc/loop, type, time, wait), wait) /obj/machinery/microwave/power_change() diff --git a/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm b/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm index 2da23768bbd..20137d7476b 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/monkeyrecycler.dm @@ -7,9 +7,6 @@ GLOBAL_LIST_EMPTY(monkey_recyclers) icon_state = "grinder" layer = BELOW_OBJ_LAYER density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 50 circuit = /obj/item/circuitboard/machine/monkey_recycler var/stored_matter = 0 var/cube_production = 0.2 @@ -29,6 +26,7 @@ GLOBAL_LIST_EMPTY(monkey_recyclers) return ..() /obj/machinery/monkey_recycler/RefreshParts() //Ranges from 0.2 to 0.8 per monkey recycled + . = ..() cube_production = 0 for(var/obj/item/stock_parts/manipulator/B in component_parts) cube_production += B.rating * 0.1 @@ -81,7 +79,7 @@ GLOBAL_LIST_EMPTY(monkey_recyclers) playsound(src.loc, 'sound/machines/juicer.ogg', 50, TRUE) var/offset = prob(50) ? -2 : 2 animate(src, pixel_x = pixel_x + offset, time = 0.2, loop = 200) //start shaking - use_power(500) + use_power(active_power_usage) stored_matter += cube_production addtimer(VARSET_CALLBACK(src, pixel_x, base_pixel_x)) addtimer(CALLBACK(GLOBAL_PROC, /proc/to_chat, user, span_notice("The machine now has [stored_matter] monkey\s worth of material stored."))) diff --git a/code/modules/food_and_drinks/kitchen_machinery/oven.dm b/code/modules/food_and_drinks/kitchen_machinery/oven.dm index 1bec3cdfba6..fa666f8479b 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/oven.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/oven.dm @@ -15,8 +15,6 @@ icon_state = "oven_off" density = TRUE pass_flags_self = PASSMACHINE | LETPASSTHROW - use_power = IDLE_POWER_USE - idle_power_usage = 5 layer = BELOW_OBJ_LAYER circuit = /obj/item/circuitboard/machine/oven processing_flags = START_PROCESSING_MANUALLY @@ -84,6 +82,7 @@ visible_message(span_danger("You smell a burnt smell coming from [src]!")) set_smoke_state(worst_cooked_food_state) update_appearance() + use_power(active_power_usage) /obj/machinery/oven/attackby(obj/item/I, mob/user, params) diff --git a/code/modules/food_and_drinks/kitchen_machinery/processor.dm b/code/modules/food_and_drinks/kitchen_machinery/processor.dm index 65d4c8ea427..9155ef1a3fb 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/processor.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/processor.dm @@ -7,9 +7,6 @@ icon_state = "processor1" layer = BELOW_OBJ_LAYER density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 50 circuit = /obj/item/circuitboard/machine/processor var/broken = FALSE var/processing = FALSE @@ -42,6 +39,7 @@ LAZYADD(processor_inputs[machine_type], typecache) /obj/machinery/processor/RefreshParts() + . = ..() for(var/obj/item/stock_parts/matter_bin/B in component_parts) rating_amount = B.rating for(var/obj/item/stock_parts/manipulator/M in component_parts) @@ -138,7 +136,7 @@ span_notice("You turn on [src]."), \ span_hear("You hear a food processor.")) playsound(src.loc, 'sound/machines/blender.ogg', 50, TRUE) - use_power(500) + use_power(active_power_usage) var/total_time = 0 for(var/atom/movable/movable_input as anything in processor_contents) var/datum/food_processor_process/recipe = PROCESSOR_SELECT_RECIPE(movable_input) diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 8ecf86d9684..a67c76511d2 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -8,9 +8,6 @@ icon_state = "smartfridge" layer = BELOW_OBJ_LAYER density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 100 circuit = /obj/item/circuitboard/machine/smartfridge /// What path boards used to construct it should build into when dropped. Needed so we don't accidentally have them build variants with items preloaded in them. var/base_build_path = /obj/machinery/smartfridge @@ -36,6 +33,7 @@ load(new typekey(src)) /obj/machinery/smartfridge/RefreshParts() + . = ..() for(var/obj/item/stock_parts/matter_bin/B in component_parts) max_n_of_items = 1500 * B.rating @@ -168,6 +166,7 @@ if(!M.put_in_hands(O)) O.forceMove(drop_location()) adjust_item_drop_location(O) + use_power(active_power_usage) /obj/machinery/smartfridge/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -266,9 +265,6 @@ desc = "A wooden contraption, used to dry plant products, food and hide." icon = 'icons/obj/hydroponics/equipment.dmi' icon_state = "drying_rack" - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 200 visible_contents = FALSE base_build_path = /obj/machinery/smartfridge/drying_rack //should really be seeing this without admin fuckery. var/drying = FALSE @@ -290,7 +286,6 @@ new /obj/item/stack/sheet/mineral/wood(drop_location(), 10) ..() -/obj/machinery/smartfridge/drying_rack/RefreshParts() /obj/machinery/smartfridge/drying_rack/default_deconstruction_screwdriver() /obj/machinery/smartfridge/drying_rack/exchange_parts() /obj/machinery/smartfridge/drying_rack/spawn_frame() @@ -348,6 +343,7 @@ SStgui.update_uis(src) update_appearance() + use_power(active_power_usage) /obj/machinery/smartfridge/drying_rack/accept_check(obj/item/O) if(HAS_TRAIT(O, TRAIT_DRYABLE)) //set on dryable element @@ -457,6 +453,7 @@ organ.organ_flags |= ORGAN_FROZEN /obj/machinery/smartfridge/organ/RefreshParts() + . = ..() for(var/obj/item/stock_parts/matter_bin/B in component_parts) max_n_of_items = 20 * B.rating repair_rate = max(0, STANDARD_ORGAN_HEALING * (B.rating - 1) * 0.5) diff --git a/code/modules/food_and_drinks/restaurant/_venue.dm b/code/modules/food_and_drinks/restaurant/_venue.dm index c3510bd87f5..63c64d6e72a 100644 --- a/code/modules/food_and_drinks/restaurant/_venue.dm +++ b/code/modules/food_and_drinks/restaurant/_venue.dm @@ -108,9 +108,6 @@ icon_state = "portal" anchored = TRUE density = FALSE - use_power = IDLE_POWER_USE - idle_power_usage = 10 - active_power_usage = 100 circuit = /obj/item/circuitboard/machine/restaurant_portal layer = BELOW_OBJ_LAYER resistance_flags = INDESTRUCTIBLE | FIRE_PROOF | UNACIDABLE | ACID_PROOF diff --git a/code/modules/holodeck/computer.dm b/code/modules/holodeck/computer.dm index b559a0db1cb..c1444e90ae6 100644 --- a/code/modules/holodeck/computer.dm +++ b/code/modules/holodeck/computer.dm @@ -33,8 +33,6 @@ GLOBAL_LIST_INIT(typecache_holodeck_linked_floorcheck_ok, typecacheof(list(/turf name = "holodeck control console" desc = "A computer used to control a nearby holodeck." icon_screen = "holocontrol" - idle_power_usage = 10 - active_power_usage = 50 //new vars ///what area type this holodeck loads into. linked turns into the nearest instance of this area @@ -133,6 +131,7 @@ GLOBAL_LIST_INIT(typecache_holodeck_linked_floorcheck_ok, typecacheof(list(/turf LAZYADD(program_cache, list(info_this)) /obj/machinery/computer/holodeck/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "Holodeck", name) @@ -357,7 +356,7 @@ GLOBAL_LIST_INIT(typecache_holodeck_linked_floorcheck_ok, typecacheof(list(/turf derez(item) for(var/obj/effect/holodeck_effect/holo_effect as anything in effects) holo_effect.tick() - update_mode_power_usage(ACTIVE_POWER_USE, 50 + spawned.len * 3 + effects.len * 5) + update_mode_power_usage(ACTIVE_POWER_USE, active_power_usage + spawned.len * 3 + effects.len * 5) /obj/machinery/computer/holodeck/proc/toggle_power(toggleOn = FALSE) if(active == toggleOn) diff --git a/code/modules/holodeck/items.dm b/code/modules/holodeck/items.dm index 46990746310..c5113edac1f 100644 --- a/code/modules/holodeck/items.dm +++ b/code/modules/holodeck/items.dm @@ -118,9 +118,8 @@ var/area/currentarea = null var/eventstarted = FALSE - use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 6 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.02 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.006 power_channel = AREA_USAGE_ENVIRON /obj/machinery/readybutton/attack_ai(mob/user) diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index 76bfb95f0f1..4336d408368 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -4,8 +4,6 @@ icon = 'icons/obj/machines/biogenerator.dmi' icon_state = "biogen-empty" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 40 circuit = /obj/item/circuitboard/machine/biogenerator var/processing = FALSE var/obj/item/reagent_containers/glass/beaker = null @@ -46,6 +44,7 @@ update_appearance() /obj/machinery/biogenerator/RefreshParts() + . = ..() var/E = 0 var/P = 0 var/max_storage = 40 @@ -180,7 +179,7 @@ processing = TRUE update_appearance() playsound(loc, 'sound/machines/blender.ogg', 50, TRUE) - use_power(S * 30) + use_power(S * active_power_usage) sleep(S + 15 / productivity) processing = FALSE update_appearance() diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 91a1eba21fc..bb1c00be1ea 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -8,7 +8,6 @@ pixel_z = 8 obj_flags = CAN_BE_HIT | UNIQUE_RENAME circuit = /obj/item/circuitboard/machine/hydroponics - idle_power_usage = 5000 use_power = NO_POWER_USE ///The amount of water in the tray (max 100) var/waterlevel = 100 @@ -161,6 +160,7 @@ AddComponent(/datum/component/usb_port, list(/obj/item/circuit_component/hydroponics)) /obj/machinery/hydroponics/constructable/RefreshParts() + . = ..() var/tmp_capacity = 0 for (var/obj/item/stock_parts/matter_bin/M in component_parts) tmp_capacity += M.rating @@ -461,7 +461,7 @@ self_sustaining = new_value - update_use_power(self_sustaining ? IDLE_POWER_USE : NO_POWER_USE) + update_use_power(self_sustaining ? ACTIVE_POWER_USE : NO_POWER_USE) update_appearance() SEND_SIGNAL(src, COMSIG_HYDROTRAY_SET_SELFSUSTAINING, new_value) diff --git a/code/modules/hydroponics/seed_extractor.dm b/code/modules/hydroponics/seed_extractor.dm index 4d37dd64273..2a1f2e966a1 100644 --- a/code/modules/hydroponics/seed_extractor.dm +++ b/code/modules/hydroponics/seed_extractor.dm @@ -89,6 +89,7 @@ return NONE /obj/machinery/seed_extractor/RefreshParts() + . = ..() for(var/obj/item/stock_parts/matter_bin/B in component_parts) max_seeds = initial(max_seeds) * B.rating for(var/obj/item/stock_parts/manipulator/M in component_parts) diff --git a/code/modules/library/lib_machines.dm b/code/modules/library/lib_machines.dm index 7e2053a2c26..9f941f04307 100644 --- a/code/modules/library/lib_machines.dm +++ b/code/modules/library/lib_machines.dm @@ -50,6 +50,8 @@ var/sending_request = FALSE ///Prevents spamming requests, acts as a second layer of protection against spam COOLDOWN_DECLARE(db_request_cooldown) + ///Interface name for the ui_interact call for different subtypes. + var/interface_type = "LibraryVisitor" /obj/machinery/computer/libraryconsole/Initialize(mapload) . = ..() @@ -57,9 +59,10 @@ INVOKE_ASYNC(src, .proc/update_db_info) /obj/machinery/computer/libraryconsole/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, "LibraryVisitor") + ui = new(user, src, interface_type) ui.open() /obj/machinery/computer/libraryconsole/ui_data(mob/user) @@ -273,6 +276,7 @@ icon_screen = "library" icon_keyboard = null circuit = /obj/item/circuitboard/computer/libraryconsole + interface_type = "LibraryConsole" ///Can spawn secret lore item var/can_spawn_lore = TRUE ///The screen we're currently on, sent to the ui @@ -307,12 +311,6 @@ if(mapload) dynamic_inv_load = TRUE //Only load in stuff if we were placed during mapload -/obj/machinery/computer/libraryconsole/bookmanagement/ui_interact(mob/user, datum/tgui/ui) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) - ui = new(user, src, "LibraryConsole") - ui.open() - /obj/machinery/computer/libraryconsole/bookmanagement/ui_data(mob/user) var/list/data = list() data["can_db_request"] = can_db_request() diff --git a/code/modules/mapfluff/ruins/spaceruin_code/TheDerelict.dm b/code/modules/mapfluff/ruins/spaceruin_code/TheDerelict.dm index 76d6e79ae4a..332fb3bacb3 100644 --- a/code/modules/mapfluff/ruins/spaceruin_code/TheDerelict.dm +++ b/code/modules/mapfluff/ruins/spaceruin_code/TheDerelict.dm @@ -115,6 +115,7 @@ lock_vault() /obj/machinery/computer/vaultcontroller/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "VaultController", name) diff --git a/code/modules/mapfluff/ruins/spaceruin_code/oldstation.dm b/code/modules/mapfluff/ruins/spaceruin_code/oldstation.dm index c704b60ff15..4edfbffae17 100644 --- a/code/modules/mapfluff/ruins/spaceruin_code/oldstation.dm +++ b/code/modules/mapfluff/ruins/spaceruin_code/oldstation.dm @@ -82,8 +82,8 @@ anchored = TRUE density = TRUE obj_flags = NO_BUILD // Becomes undense when the door is open - idle_power_usage = 50 - active_power_usage = 300 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.5 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.3 var/busy = FALSE var/busy_icon_state diff --git a/code/modules/mining/aux_base.dm b/code/modules/mining/aux_base.dm index 53f37e45f13..1d19fd1f534 100644 --- a/code/modules/mining/aux_base.dm +++ b/code/modules/mining/aux_base.dm @@ -45,6 +45,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/auxiliary_base, 32) return ..() /obj/machinery/computer/auxiliary_base/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "AuxBaseConsole", name) diff --git a/code/modules/modular_computers/computers/machinery/modular_computer.dm b/code/modules/modular_computers/computers/machinery/modular_computer.dm index 82e5bc8c390..e48f6f9fe17 100644 --- a/code/modules/modular_computers/computers/machinery/modular_computer.dm +++ b/code/modules/modular_computers/computers/machinery/modular_computer.dm @@ -10,8 +10,7 @@ icon = null icon_state = null - use_power = IDLE_POWER_USE - idle_power_usage = 5 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.05 ///A flag that describes this device type var/hardware_flag = 0 ///Power usage during last tick diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm index 94996795a20..6b286b9faaf 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -21,9 +21,6 @@ icon = 'icons/obj/library.dmi' icon_state = "photocopier" density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 30 - active_power_usage = 200 power_channel = AREA_USAGE_EQUIP max_integrity = 300 integrity_failure = 0.33 @@ -218,6 +215,7 @@ */ /obj/machinery/photocopier/proc/do_copy_loop(datum/callback/copy_cb, mob/user) busy = TRUE + update_use_power(ACTIVE_POWER_USE) var/i for(i in 1 to num_copies) if(attempt_charge(src, user) & COMPONENT_OBJ_CANCEL_CHARGE) @@ -229,6 +227,7 @@ * Sets busy to `FALSE`. Created as a proc so it can be used in callbacks. */ /obj/machinery/photocopier/proc/reset_busy() + update_use_power(IDLE_POWER_USE) busy = FALSE /** diff --git a/code/modules/plumbing/ducts.dm b/code/modules/plumbing/ducts.dm index dfb9885c400..295cc7b790d 100644 --- a/code/modules/plumbing/ducts.dm +++ b/code/modules/plumbing/ducts.dm @@ -8,6 +8,8 @@ All the important duct code: icon = 'icons/obj/plumbing/fluid_ducts.dmi' icon_state = "nduct" + use_power = NO_POWER_USE + ///bitfield with the directions we're connected in var/connects ///set to TRUE to disable smart duct behaviour diff --git a/code/modules/plumbing/plumbers/_plumb_machinery.dm b/code/modules/plumbing/plumbers/_plumb_machinery.dm index 014a3240d9a..4adb0f008b4 100644 --- a/code/modules/plumbing/plumbers/_plumb_machinery.dm +++ b/code/modules/plumbing/plumbers/_plumb_machinery.dm @@ -8,8 +8,7 @@ icon = 'icons/obj/plumbing/plumbers.dmi' icon_state = "pump" density = TRUE - active_power_usage = 30 - use_power = ACTIVE_POWER_USE + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 7.5 resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF ///Plumbing machinery is always gonna need reagents, so we might aswell put it here var/buffer = 50 diff --git a/code/modules/plumbing/plumbers/acclimator.dm b/code/modules/plumbing/plumbers/acclimator.dm index 7707bce23f1..7cc83ca4f48 100644 --- a/code/modules/plumbing/plumbers/acclimator.dm +++ b/code/modules/plumbing/plumbers/acclimator.dm @@ -11,6 +11,7 @@ icon_state = "acclimator" base_icon_state = "acclimator" buffer = 200 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 ///towards wich temperature do we build? var/target_temperature = 300 @@ -55,6 +56,7 @@ if(!emptying) //suspend heating/cooling during emptying phase reagents.adjust_thermal_energy((target_temperature - reagents.chem_temp) * heater_coefficient * delta_time * SPECIFIC_HEAT_DEFAULT * reagents.total_volume) //keep constant with chem heater reagents.handle_reactions() + use_power(active_power_usage * delta_time) else if(acclimate_state != NEUTRAL) acclimate_state = NEUTRAL update_appearance() diff --git a/code/modules/plumbing/plumbers/bottler.dm b/code/modules/plumbing/plumbers/bottler.dm index fadbcbd9a4b..7aa6466990c 100644 --- a/code/modules/plumbing/plumbers/bottler.dm +++ b/code/modules/plumbing/plumbers/bottler.dm @@ -7,7 +7,7 @@ reagent_flags = TRANSPARENT | DRAINABLE buffer = 100 - + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 ///how much do we fill var/wanted_amount = 10 ///where things are sent @@ -68,7 +68,7 @@ wanted_amount = new_amount to_chat(user, span_notice(" The [src] will now fill for [wanted_amount]u.")) -/obj/machinery/plumbing/bottler/process() +/obj/machinery/plumbing/bottler/process(delta_time) if(machine_stat & NOPOWER) return // Sanity check the result locations and stop processing if they don't exist @@ -78,6 +78,7 @@ ///see if machine has enough to fill, is anchored down and has any inputspot objects to pick from if(reagents.total_volume >= wanted_amount && anchored && length(inputspot.contents)) + use_power(active_power_usage * delta_time) var/obj/AM = pick(inputspot.contents)///pick a reagent_container that could be used if((istype(AM, /obj/item/reagent_containers) && !istype(AM, /obj/item/reagent_containers/hypospray/medipen)) || istype(AM, /obj/item/ammo_casing/shotgun/dart)) var/obj/item/reagent_containers/B = AM diff --git a/code/modules/plumbing/plumbers/destroyer.dm b/code/modules/plumbing/plumbers/destroyer.dm index cce5d122f71..e6aecd95bca 100644 --- a/code/modules/plumbing/plumbers/destroyer.dm +++ b/code/modules/plumbing/plumbers/destroyer.dm @@ -3,6 +3,7 @@ desc = "Breaks down chemicals and annihilates them." icon_state = "disposal" pass_flags_self = PASSMACHINE | LETPASSTHROW // Small + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 ///we remove 5 reagents per second var/disposal_rate = 5 @@ -17,6 +18,7 @@ if(icon_state != initial(icon_state) + "_working") //threw it here instead of update icon since it only has two states icon_state = initial(icon_state) + "_working" reagents.remove_any(disposal_rate * delta_time) + use_power(active_power_usage * delta_time) else if(icon_state != initial(icon_state)) icon_state = initial(icon_state) diff --git a/code/modules/plumbing/plumbers/fermenter.dm b/code/modules/plumbing/plumbers/fermenter.dm index 73f2d330495..dd8b32e02b5 100644 --- a/code/modules/plumbing/plumbers/fermenter.dm +++ b/code/modules/plumbing/plumbers/fermenter.dm @@ -7,7 +7,7 @@ reagent_flags = TRANSPARENT | DRAINABLE buffer = 400 - + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 ///input dir var/eat_dir = SOUTH @@ -47,4 +47,5 @@ if(G.distill_reagent) var/amount = G.seed.potency * 0.25 reagents.add_reagent(G.distill_reagent, amount) + use_power(active_power_usage * amount) qdel(G) diff --git a/code/modules/plumbing/plumbers/grinder_chemical.dm b/code/modules/plumbing/plumbers/grinder_chemical.dm index b8a2f6d0676..eb7e7f53c3c 100644 --- a/code/modules/plumbing/plumbers/grinder_chemical.dm +++ b/code/modules/plumbing/plumbers/grinder_chemical.dm @@ -7,7 +7,7 @@ reagent_flags = TRANSPARENT | DRAINABLE buffer = 400 - + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 var/eat_dir = SOUTH /obj/machinery/plumbing/grinder_chemical/Initialize(mapload, bolt, layer) @@ -42,6 +42,7 @@ return var/obj/item/I = AM if(I.juice_results || I.grind_results) + use_power(active_power_usage) if(I.juice_results) I.on_juice() reagents.add_reagent_list(I.juice_results) diff --git a/code/modules/plumbing/plumbers/pill_press.dm b/code/modules/plumbing/plumbers/pill_press.dm index 04ffa775373..7c843bc1773 100644 --- a/code/modules/plumbing/plumbers/pill_press.dm +++ b/code/modules/plumbing/plumbers/pill_press.dm @@ -3,7 +3,7 @@ name = "chemical press" desc = "A press that makes pills, patches and bottles." icon_state = "pill_press" - + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 ///maximum size of a pill var/max_pill_volume = 50 ///maximum size of a patch @@ -59,7 +59,7 @@ patch_style["class_name"] = patches_assets.icon_class_name(raw_patch_style) patch_styles += list(patch_style) -/obj/machinery/plumbing/pill_press/process() +/obj/machinery/plumbing/pill_press/process(delta_time) if(machine_stat & NOPOWER) return if(reagents.total_volume >= current_volume) @@ -98,6 +98,7 @@ stored_products -= AM AM.forceMove(drop_location()) + use_power(active_power_usage * delta_time) /obj/machinery/plumbing/pill_press/ui_assets(mob/user) return list( diff --git a/code/modules/plumbing/plumbers/pumps.dm b/code/modules/plumbing/plumbers/pumps.dm index f69fd835c9a..c10cacbc7ec 100644 --- a/code/modules/plumbing/plumbers/pumps.dm +++ b/code/modules/plumbing/plumbers/pumps.dm @@ -7,8 +7,7 @@ base_icon_state = "pump" anchored = FALSE density = TRUE - idle_power_usage = 10 - active_power_usage = 1000 + use_power = NO_POWER_USE ///units we pump per second var/pump_power = 1 diff --git a/code/modules/plumbing/plumbers/reaction_chamber.dm b/code/modules/plumbing/plumbers/reaction_chamber.dm index 3268a6561cb..eddf6bd3e3c 100644 --- a/code/modules/plumbing/plumbers/reaction_chamber.dm +++ b/code/modules/plumbing/plumbers/reaction_chamber.dm @@ -5,7 +5,7 @@ icon_state = "reaction_chamber" buffer = 200 reagent_flags = TRANSPARENT | NO_REACT - + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 /** * list of set reagents that the reaction_chamber allows in, and must all be present before mixing is enabled. * example: list(/datum/reagent/water = 20, /datum/reagent/fuel/oil = 50) @@ -73,6 +73,8 @@ reagents.adjust_thermal_energy((target_temperature - reagents.chem_temp) * heater_coefficient * delta_time * SPECIFIC_HEAT_DEFAULT * reagents.total_volume) //keep constant with chem heater reagents.handle_reactions() + use_power(active_power_usage * delta_time) + /obj/machinery/plumbing/reaction_chamber/power_change() . = ..() if(use_power != NO_POWER_USE) diff --git a/code/modules/plumbing/plumbers/splitters.dm b/code/modules/plumbing/plumbers/splitters.dm index ceedf7d955b..e18a3a49b05 100644 --- a/code/modules/plumbing/plumbers/splitters.dm +++ b/code/modules/plumbing/plumbers/splitters.dm @@ -3,7 +3,7 @@ name = "Chemical Splitter" desc = "A chemical splitter for smart chemical factorization. Waits till a set of conditions is met and then stops all input and splits the buffer evenly or other in two ducts." icon_state = "splitter" - + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 buffer = 100 density = FALSE diff --git a/code/modules/plumbing/plumbers/synthesizer.dm b/code/modules/plumbing/plumbers/synthesizer.dm index 6f49377a0e0..7e2728f3f64 100644 --- a/code/modules/plumbing/plumbers/synthesizer.dm +++ b/code/modules/plumbing/plumbers/synthesizer.dm @@ -5,7 +5,7 @@ icon_state = "synthesizer" icon = 'icons/obj/plumbing/plumbers.dmi' - + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 2 ///Amount we produce for every process. Ideally keep under 5 since thats currently the standard duct capacity var/amount = 1 ///I track them here because I have no idea how I'd make tgui loop like that @@ -51,6 +51,7 @@ if(reagents.total_volume >= amount*delta_time*0.5) //otherwise we get leftovers, and we need this to be precise return reagents.add_reagent(reagent_id, amount*delta_time*0.5) + use_power(active_power_usage * amount * delta_time * 0.5) /obj/machinery/plumbing/synthesizer/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/plumbing/plumbers/teleporter.dm b/code/modules/plumbing/plumbers/teleporter.dm index 0228640fb6a..5956bf95436 100644 --- a/code/modules/plumbing/plumbers/teleporter.dm +++ b/code/modules/plumbing/plumbers/teleporter.dm @@ -77,7 +77,7 @@ to_chat(user, span_notice("You store linkage information in [I]'s buffer.")) return TRUE -/obj/machinery/plumbing/receiver/process() +/obj/machinery/plumbing/receiver/process(delta_time) if(machine_stat & NOPOWER || panel_open) return @@ -96,6 +96,8 @@ next_index++ + use_power(active_power_usage * delta_time) + ///Notify all senders to forget us /obj/machinery/plumbing/receiver/proc/lose_senders() for(var/A in senders) diff --git a/code/modules/power/floodlight.dm b/code/modules/power/floodlight.dm index 3819cee732a..2aea8f5309f 100644 --- a/code/modules/power/floodlight.dm +++ b/code/modules/power/floodlight.dm @@ -61,8 +61,8 @@ density = TRUE max_integrity = 100 integrity_failure = 0.8 - idle_power_usage = 100 - active_power_usage = 1000 + idle_power_usage = 0 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION anchored = FALSE light_power = 1.75 var/list/light_setting_list = list(0, 5, 10, 15) diff --git a/code/modules/power/gravitygenerator.dm b/code/modules/power/gravitygenerator.dm index 7691585b39e..e0867ff2685 100644 --- a/code/modules/power/gravitygenerator.dm +++ b/code/modules/power/gravitygenerator.dm @@ -133,7 +133,7 @@ GLOBAL_LIST_EMPTY(gravity_generators) // We will keep track of this by adding ne /obj/machinery/gravity_generator/main icon_state = "on_8" idle_power_usage = 0 - active_power_usage = 3000 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 3 power_channel = AREA_USAGE_ENVIRON sprite_number = 8 use_power = IDLE_POWER_USE diff --git a/code/modules/power/lighting/light.dm b/code/modules/power/lighting/light.dm index 4f347151b76..86f6709067b 100644 --- a/code/modules/power/lighting/light.dm +++ b/code/modules/power/lighting/light.dm @@ -8,8 +8,8 @@ plane = GAME_PLANE_UPPER max_integrity = 100 use_power = ACTIVE_POWER_USE - idle_power_usage = 2 - active_power_usage = 20 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.02 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 0.02 power_channel = AREA_USAGE_LIGHT //Lights are calc'd via area so they dont need to be in the machine list ///What overlay the light should use var/overlay_icon = 'icons/obj/lighting_overlay.dmi' @@ -180,7 +180,6 @@ set_light(l_range = 0) update_appearance() - active_power_usage = (brightness * 10) if(on != on_gs) on_gs = on if(on) diff --git a/code/modules/power/monitor.dm b/code/modules/power/monitor.dm index 5802c49a167..091151fe479 100644 --- a/code/modules/power/monitor.dm +++ b/code/modules/power/monitor.dm @@ -7,8 +7,6 @@ icon_keyboard = "power_key" light_color = LIGHT_COLOR_YELLOW use_power = ACTIVE_POWER_USE - idle_power_usage = 20 - active_power_usage = 100 circuit = /obj/item/circuitboard/computer/powermonitor tgui_id = "PowerMonitor" @@ -83,6 +81,7 @@ demand.Cut(1, 2) /obj/machinery/computer/monitor/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "PowerMonitor", name) diff --git a/code/modules/power/port_gen.dm b/code/modules/power/port_gen.dm index 112d7922956..2f0315e679d 100644 --- a/code/modules/power/port_gen.dm +++ b/code/modules/power/port_gen.dm @@ -102,6 +102,7 @@ return ..() /obj/machinery/power/port_gen/pacman/RefreshParts() + . = ..() var/temp_rating = 0 var/consumption_coeff = 0 for(var/obj/item/stock_parts/SP in component_parts) diff --git a/code/modules/power/rtg.dm b/code/modules/power/rtg.dm index 179b02968d4..f2772304f23 100644 --- a/code/modules/power/rtg.dm +++ b/code/modules/power/rtg.dm @@ -26,6 +26,7 @@ add_avail(power_gen) /obj/machinery/power/rtg/RefreshParts() + . = ..() var/part_level = 0 for(var/obj/item/stock_parts/SP in component_parts) part_level += SP.rating @@ -103,4 +104,55 @@ circuit = null /obj/machinery/power/rtg/debug/RefreshParts() + SHOULD_CALL_PARENT(FALSE) return + +/obj/machinery/power/rtg/lavaland + name = "Lava powered RTG" + desc = "This device only works when exposed to the toxic fumes of Lavaland" + circuit = null + power_gen = 1500 + anchored = TRUE + resistance_flags = LAVA_PROOF + +/obj/machinery/power/rtg/lavaland/Initialize(mapload) + . = ..() + var/turf/our_turf = get_turf(src) + if(!islava(our_turf)) + power_gen = 0 + if(!is_mining_level(z)) + power_gen = 0 + +/obj/machinery/power/rtg/lavaland/Moved(atom/OldLoc, Dir) + . = ..() + var/turf/our_turf = get_turf(src) + if(!islava(our_turf)) + power_gen = 0 + return + if(!is_mining_level(z)) + power_gen = 0 + return + power_gen = initial(power_gen) + +/obj/machinery/power/rtg/old_station + name = "Old RTG" + desc = "A very old RTG, it seems on the verge of being destroyed" + circuit = null + power_gen = 750 + anchored = TRUE + +/obj/machinery/power/rtg/old_station/attackby(obj/item/I, mob/user, params) + if(default_deconstruction_screwdriver(user, "[initial(icon_state)]-open", initial(icon_state), I)) + to_chat(user,span_warning("You feel it crumbling under your hands!")) + return + else if(default_deconstruction_crowbar(I, user = user)) + return + return ..() + +/obj/machinery/power/rtg/old_station/default_deconstruction_crowbar(obj/item/crowbar, ignore_panel, custom_deconstruct, mob/user) + to_chat(user,span_warning("It's starting to fall off!")) + if(!do_after(user, 3 SECONDS, src)) + return TRUE + to_chat(user,span_notice("You feel like you made a mistake")) + new /obj/effect/decal/cleanable/ash/large(loc) + qdel(src) diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 87c5fce29be..c5661177bb7 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -11,8 +11,6 @@ circuit = /obj/item/circuitboard/machine/emitter use_power = NO_POWER_USE - idle_power_usage = 10 - active_power_usage = 300 /// The icon state used by the emitter when it's on. var/icon_state_on = "emitter_+a" @@ -84,6 +82,7 @@ welded = FALSE /obj/machinery/power/emitter/RefreshParts() + . = ..() var/max_fire_delay = 12 SECONDS var/fire_shoot_delay = 12 SECONDS var/min_fire_delay = 2.4 SECONDS diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index a34e3e73fd8..dffba8c22a6 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -61,6 +61,7 @@ update_appearance() /obj/machinery/power/smes/RefreshParts() + SHOULD_CALL_PARENT(FALSE) var/IO = 0 var/MC = 0 var/C @@ -407,7 +408,8 @@ log_smes() /obj/machinery/power/smes/engineering - charge = 1.5e6 // Engineering starts with some charge for singulo + charge = 2e6 // Engineering starts with some charge for singulo //sorry little one, singulo as engine is gone + output_level = 90000 /obj/machinery/power/smes/magical name = "magical power storage unit" diff --git a/code/modules/power/solar.dm b/code/modules/power/solar.dm index dc8c6821aea..22f7a352163 100644 --- a/code/modules/power/solar.dm +++ b/code/modules/power/solar.dm @@ -355,7 +355,7 @@ icon_state = "computer" density = TRUE use_power = IDLE_POWER_USE - idle_power_usage = 250 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION max_integrity = 200 integrity_failure = 0.5 var/icon_screen = "solar" diff --git a/code/modules/power/tesla/coil.dm b/code/modules/power/tesla/coil.dm index 781f10d10a4..62d4efac206 100644 --- a/code/modules/power/tesla/coil.dm +++ b/code/modules/power/tesla/coil.dm @@ -39,6 +39,7 @@ wires = new /datum/wires/tesla_coil(src) /obj/machinery/power/energy_accumulator/tesla_coil/RefreshParts() + . = ..() var/power_multiplier = 0 zap_cooldown = 100 for(var/obj/item/stock_parts/capacitor/C in component_parts) diff --git a/code/modules/power/turbine/turbine_computer.dm b/code/modules/power/turbine/turbine_computer.dm index 9c5ba267667..15a76d3f051 100644 --- a/code/modules/power/turbine/turbine_computer.dm +++ b/code/modules/power/turbine/turbine_computer.dm @@ -44,6 +44,7 @@ turbine_core = WEAKREF(machine) /obj/machinery/computer/turbine_computer/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "TurbineComputer", name) diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 0f2a0f2372c..7cda834cba8 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -18,8 +18,6 @@ icon = 'icons/obj/chemical.dmi' icon_state = "dispenser" base_icon_state = "dispenser" - use_power = IDLE_POWER_USE - idle_power_usage = 40 interaction_flags_machine = INTERACT_MACHINE_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OFFLINE resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_dispenser @@ -125,7 +123,7 @@ if (recharge_counter >= 8) var/usedpower = cell.give(recharge_amount) if(usedpower) - use_power(250*recharge_amount) + use_power(active_power_usage + recharge_amount) recharge_counter = 0 return recharge_counter += delta_time @@ -404,17 +402,22 @@ visible_message(span_danger("[src] malfunctions, spraying chemicals everywhere!")) /obj/machinery/chem_dispenser/RefreshParts() + . = ..() recharge_amount = initial(recharge_amount) var/newpowereff = 0.0666666 + var/parts_rating = 0 for(var/obj/item/stock_parts/cell/P in component_parts) cell = P for(var/obj/item/stock_parts/matter_bin/M in component_parts) newpowereff += 0.0166666666*M.rating + parts_rating += M.rating for(var/obj/item/stock_parts/capacitor/C in component_parts) recharge_amount *= C.rating + parts_rating += C.rating for(var/obj/item/stock_parts/manipulator/M in component_parts) if (M.rating > 3) dispensable_reagents |= upgrade_reagents + parts_rating += M.rating powerefficiency = round(newpowereff, 0.01) /obj/machinery/chem_dispenser/proc/replace_beaker(mob/living/user, obj/item/reagent_containers/new_beaker) @@ -640,6 +643,7 @@ circuit = /obj/item/circuitboard/machine/chem_dispenser/abductor working_state = null nopower_state = null + use_power = NO_POWER_USE dispensable_reagents = list( /datum/reagent/aluminium, /datum/reagent/bromine, diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index 78be5eab528..556cf9e55c1 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -15,8 +15,7 @@ icon = 'icons/obj/chemical.dmi' icon_state = "mixer0b" base_icon_state = "mixer" - use_power = IDLE_POWER_USE - idle_power_usage = 40 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.4 resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_heater @@ -90,6 +89,7 @@ return TRUE /obj/machinery/chem_heater/RefreshParts() + . = ..() heater_coefficient = 0.1 for(var/obj/item/stock_parts/micro_laser/M in component_parts) heater_coefficient *= M.rating @@ -154,6 +154,8 @@ beaker.reagents.adjust_thermal_energy((target_temperature - beaker.reagents.chem_temp) * heater_coefficient * delta_time * SPECIFIC_HEAT_DEFAULT * beaker.reagents.total_volume) beaker.reagents.handle_reactions() + use_power(active_power_usage * delta_time) + /obj/machinery/chem_heater/attackby(obj/item/I, mob/user, params) if(default_deconstruction_screwdriver(user, "mixer0b", "mixer0b", I)) return diff --git a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm index 9596262dc3f..a30a5610408 100644 --- a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm +++ b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm @@ -13,8 +13,7 @@ This will not clean any inverted reagents. Inverted reagents will still be corre icon = 'icons/obj/chemical.dmi' icon_state = "HPLC" base_icon_state = "HPLC" - use_power = IDLE_POWER_USE - idle_power_usage = 20 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.2 resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_mass_spec ///If we're processing reagents or not @@ -48,6 +47,7 @@ This will not clean any inverted reagents. Inverted reagents will still be corre return ..() /obj/machinery/chem_mass_spec/RefreshParts() + . = ..() cms_coefficient = 1 for(var/obj/item/stock_parts/micro_laser/laser in component_parts) cms_coefficient /= laser.rating @@ -306,6 +306,7 @@ This will not clean any inverted reagents. Inverted reagents will still be corre return FALSE if(!processing_reagents) return TRUE + use_power(active_power_usage) if(progress_time >= delay_time) processing_reagents = FALSE progress_time = 0 diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index 223a11fd4fe..d3656723c75 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -12,8 +12,7 @@ icon = 'icons/obj/chemical.dmi' icon_state = "mixer0" base_icon_state = "mixer" - use_power = IDLE_POWER_USE - idle_power_usage = 20 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.2 resistance_flags = FIRE_PROOF | ACID_PROOF circuit = /obj/item/circuitboard/machine/chem_master @@ -73,6 +72,7 @@ return ..() /obj/machinery/chem_master/RefreshParts() + . = ..() reagents.maximum_volume = 0 for(var/obj/item/reagent_containers/glass/beaker/B in component_parts) reagents.maximum_volume += B.reagents.maximum_volume @@ -283,6 +283,7 @@ name, "")) if (amount == null || amount <= 0) return FALSE + use_power(active_power_usage) if (to_container == "beaker" && !mode) reagents.remove_reagent(reagent, amount) return TRUE @@ -333,7 +334,7 @@ var/vol_each_text = params["volume"] var/vol_each_max = reagents.total_volume / amount var/list/style - + use_power(active_power_usage) if (item_type == "pill") vol_each_max = min(50, vol_each_max) else if (item_type == "patch") diff --git a/code/modules/reagents/chemistry/machinery/chem_recipe_debug.dm b/code/modules/reagents/chemistry/machinery/chem_recipe_debug.dm index 476cf054ffc..76e4b0ce7d5 100644 --- a/code/modules/reagents/chemistry/machinery/chem_recipe_debug.dm +++ b/code/modules/reagents/chemistry/machinery/chem_recipe_debug.dm @@ -7,8 +7,7 @@ density = TRUE icon = 'icons/obj/chemical.dmi' icon_state = "HPLC_debug" - use_power = IDLE_POWER_USE - idle_power_usage = 40 + idle_power_usage = BASE_MACHINE_IDLE_CONSUMPTION * 0.4 resistance_flags = FIRE_PROOF | ACID_PROOF | INDESTRUCTIBLE ///List of every reaction in the game kept locally for easy access var/list/cached_reactions = list() diff --git a/code/modules/reagents/chemistry/machinery/pandemic.dm b/code/modules/reagents/chemistry/machinery/pandemic.dm index 618c671f24b..c04b7907b64 100644 --- a/code/modules/reagents/chemistry/machinery/pandemic.dm +++ b/code/modules/reagents/chemistry/machinery/pandemic.dm @@ -9,8 +9,6 @@ icon_state = "pandemic0" icon_keyboard = null base_icon_state = "pandemic" - use_power = IDLE_POWER_USE - idle_power_usage = 20 resistance_flags = ACID_PROOF circuit = /obj/item/circuitboard/computer/pandemic @@ -154,6 +152,7 @@ update_appearance() /obj/machinery/computer/pandemic/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "Pandemic", name) @@ -220,6 +219,7 @@ if(!istype(A) || !A.mutable) to_chat(usr, span_warning("ERROR: Cannot replicate virus strain.")) return + use_power(active_power_usage) A = A.Copy() var/list/data = list("viruses" = list(A)) var/obj/item/reagent_containers/glass/bottle/B = new(drop_location()) @@ -235,6 +235,7 @@ if("create_vaccine_bottle") if (wait) return + use_power(active_power_usage) var/id = params["index"] var/datum/disease/D = SSdisease.archive_diseases[id] var/obj/item/reagent_containers/glass/bottle/B = new(drop_location()) diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index 4c3734f624c..b26b8ab5280 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -7,9 +7,6 @@ icon_state = "juicer1" base_icon_state = "juicer" layer = BELOW_OBJ_LAYER - use_power = IDLE_POWER_USE - idle_power_usage = 5 - active_power_usage = 100 circuit = /obj/item/circuitboard/machine/reagentgrinder pass_flags = PASSTABLE resistance_flags = ACID_PROOF @@ -68,6 +65,7 @@ SSexplosions.low_mov_atom += beaker /obj/machinery/reagentgrinder/RefreshParts() + . = ..() speed = 1 for(var/obj/item/stock_parts/manipulator/M in component_parts) speed = M.rating @@ -276,6 +274,7 @@ playsound(src, 'sound/machines/blender.ogg', 50, TRUE) else playsound(src, 'sound/machines/juicer.ogg', 20, TRUE) + use_power(active_power_usage * time) addtimer(CALLBACK(src, .proc/stop_operating), time / speed) /obj/machinery/reagentgrinder/proc/stop_operating() diff --git a/code/modules/reagents/chemistry/machinery/smoke_machine.dm b/code/modules/reagents/chemistry/machinery/smoke_machine.dm index 9b97dd74d58..e7a62c7c2df 100644 --- a/code/modules/reagents/chemistry/machinery/smoke_machine.dm +++ b/code/modules/reagents/chemistry/machinery/smoke_machine.dm @@ -49,6 +49,7 @@ return ..() /obj/machinery/smoke_machine/RefreshParts() + . = ..() var/new_volume = REAGENTS_BASE_VOLUME for(var/obj/item/stock_parts/matter_bin/B in component_parts) new_volume += REAGENTS_BASE_VOLUME * B.rating @@ -66,7 +67,6 @@ max_range += M.rating max_range = max(3, max_range) - /obj/machinery/smoke_machine/on_set_is_operational(old_value) if(old_value) //Turned off end_processing() @@ -87,6 +87,7 @@ var/datum/effect_system/smoke_spread/chem/smoke_machine/smoke = new() smoke.set_up(reagents, setting*3, efficiency, T) smoke.start() + use_power(active_power_usage) /obj/machinery/smoke_machine/wrench_act(mob/living/user, obj/item/tool) . = ..() diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index 85dfd040bc4..bcf5db46132 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -424,13 +424,13 @@ if(machine_stat & NOPOWER) // won't charge if no power return - use_power(100) // base power usage + use_power(idle_power_usage) // base power usage if(!pressure_charging) // if off or ready, no need to charge return // otherwise charge - use_power(500) // charging power usage + use_power(idle_power_usage) // charging power usage var/atom/L = loc //recharging from loc turf diff --git a/code/modules/research/bepis.dm b/code/modules/research/bepis.dm index edc0c48e624..f42895ecf60 100644 --- a/code/modules/research/bepis.dm +++ b/code/modules/research/bepis.dm @@ -18,8 +18,6 @@ density = TRUE layer = ABOVE_MOB_LAYER plane = GAME_PLANE_UPPER - use_power = IDLE_POWER_USE - active_power_usage = 1500 circuit = /obj/item/circuitboard/machine/bepis ///How much cash the UI and machine are depositing at a time. @@ -85,6 +83,7 @@ return default_deconstruction_screwdriver(user, "chamber_open", "chamber", tool) /obj/machinery/rnd/bepis/RefreshParts() + . = ..() var/C = 0 var/M = 0 var/L = 0 diff --git a/code/modules/research/destructive_analyzer.dm b/code/modules/research/destructive_analyzer.dm index 47d5ada291e..6966a79ff14 100644 --- a/code/modules/research/destructive_analyzer.dm +++ b/code/modules/research/destructive_analyzer.dm @@ -14,12 +14,12 @@ Note: Must be placed within 3 tiles of the R&D Console var/decon_mod = 0 /obj/machinery/rnd/destructive_analyzer/RefreshParts() + . = ..() var/T = 0 for(var/obj/item/stock_parts/S in component_parts) T += S.rating decon_mod = T - /obj/machinery/rnd/destructive_analyzer/proc/ConvertReqString2List(list/source_list) var/list/temp_list = params2list(source_list) for(var/O in temp_list) diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 1927c918c64..629333422dc 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -88,6 +88,7 @@ /obj/item/transfer_valve)) /obj/machinery/rnd/experimentor/RefreshParts() + . = ..() for(var/obj/item/stock_parts/manipulator/M in component_parts) if(resetTime > 0 && (resetTime - M.rating) >= 1) resetTime -= M.rating diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index 64399375d98..0300c1448f1 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -45,6 +45,7 @@ cached_designs |= d /obj/machinery/rnd/production/RefreshParts() + . = ..() calculate_efficiency() /obj/machinery/rnd/production/ui_interact(mob/user) @@ -152,11 +153,11 @@ if(materials.on_hold()) say("Mineral access is on hold, please contact the quartermaster.") return FALSE - var/power = 1000 + var/power = active_power_usage amount = clamp(amount, 1, 50) for(var/M in D.materials) power += round(D.materials[M] * amount / 35) - power = min(3000, power) + power = min(active_power_usage, power) use_power(power) var/coeff = efficient_with(D.build_path) ? efficiency_coeff : 1 var/list/efficient_mats = list() diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index 7ef84c60a6f..1c6d97db5ab 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -137,6 +137,7 @@ Nothing else in the console has ID requirements. return ..() /obj/machinery/computer/rdconsole/ui_interact(mob/user, datum/tgui/ui = null) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if (!ui) ui = new(user, src, "Techweb", name) diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index 88c3b7ed77b..7e535f10261 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -119,6 +119,6 @@ else var/obj/item/stack/S = item_inserted stack_name = S.name - use_power(min(1000, (amount_inserted / 100))) + use_power(min(active_power_usage, (amount_inserted / 100))) add_overlay("protolathe_[stack_name]") addtimer(CALLBACK(src, /atom/proc/cut_overlay, "protolathe_[stack_name]"), 10) diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index 78904de857c..28bf1bf3cb1 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -40,6 +40,7 @@ return ..() /obj/machinery/rnd/server/RefreshParts() + . = ..() var/tot_rating = 0 for(var/obj/item/stock_parts/SP in src) tot_rating += SP.rating @@ -60,8 +61,10 @@ /obj/machinery/rnd/server/proc/refresh_working() if(machine_stat & EMPED || research_disabled || machine_stat & NOPOWER) working = FALSE + update_use_power(NO_POWER_USE) else working = TRUE + update_use_power(ACTIVE_POWER_USE) update_appearance() /obj/machinery/rnd/server/emp_act() diff --git a/code/modules/research/stock_parts.dm b/code/modules/research/stock_parts.dm index 76c678b61c2..7b1eea4851d 100644 --- a/code/modules/research/stock_parts.dm +++ b/code/modules/research/stock_parts.dm @@ -222,6 +222,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good var/rating = 1 ///Used when a base part has a different name to higher tiers of part. For example, machine frames want any manipulator and not just a micro-manipulator. var/base_name + var/energy_rating = 1 /obj/item/stock_parts/Initialize(mapload) . = ..() @@ -271,6 +272,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "An advanced capacitor used in the construction of a variety of devices." icon_state = "adv_capacitor" rating = 2 + energy_rating = 3 custom_materials = list(/datum/material/iron=50, /datum/material/glass=50) /obj/item/stock_parts/scanning_module/adv @@ -278,6 +280,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A compact, high resolution scanning module used in the construction of certain devices." icon_state = "adv_scan_module" rating = 2 + energy_rating = 3 custom_materials = list(/datum/material/iron=50, /datum/material/glass=20) /obj/item/stock_parts/manipulator/nano @@ -285,6 +288,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A tiny little manipulator used in the construction of certain devices." icon_state = "nano_mani" rating = 2 + energy_rating = 3 custom_materials = list(/datum/material/iron=30) /obj/item/stock_parts/micro_laser/high @@ -292,6 +296,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A tiny laser used in certain devices." icon_state = "high_micro_laser" rating = 2 + energy_rating = 3 custom_materials = list(/datum/material/iron=10, /datum/material/glass=20) /obj/item/stock_parts/matter_bin/adv @@ -299,6 +304,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A container designed to hold compressed matter awaiting reconstruction." icon_state = "advanced_matter_bin" rating = 2 + energy_rating = 3 custom_materials = list(/datum/material/iron=80) //Rating 3 @@ -308,6 +314,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A super-high capacity capacitor used in the construction of a variety of devices." icon_state = "super_capacitor" rating = 3 + energy_rating = 5 custom_materials = list(/datum/material/iron=50, /datum/material/glass=50) /obj/item/stock_parts/scanning_module/phasic @@ -315,6 +322,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A compact, high resolution phasic scanning module used in the construction of certain devices." icon_state = "super_scan_module" rating = 3 + energy_rating = 5 custom_materials = list(/datum/material/iron=50, /datum/material/glass=20) /obj/item/stock_parts/manipulator/pico @@ -322,6 +330,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A tiny little manipulator used in the construction of certain devices." icon_state = "pico_mani" rating = 3 + energy_rating = 5 custom_materials = list(/datum/material/iron=30) /obj/item/stock_parts/micro_laser/ultra @@ -329,6 +338,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good icon_state = "ultra_high_micro_laser" desc = "A tiny laser used in certain devices." rating = 3 + energy_rating = 5 custom_materials = list(/datum/material/iron=10, /datum/material/glass=20) /obj/item/stock_parts/matter_bin/super @@ -336,6 +346,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A container designed to hold compressed matter awaiting reconstruction." icon_state = "super_matter_bin" rating = 3 + energy_rating = 5 custom_materials = list(/datum/material/iron=80) //Rating 4 @@ -345,6 +356,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A capacity capacitor used in the construction of a variety of devices." icon_state = "quadratic_capacitor" rating = 4 + energy_rating = 10 custom_materials = list(/datum/material/iron=50, /datum/material/glass=50) /obj/item/stock_parts/scanning_module/triphasic @@ -352,6 +364,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A compact, ultra resolution triphasic scanning module used in the construction of certain devices." icon_state = "triphasic_scan_module" rating = 4 + energy_rating = 10 custom_materials = list(/datum/material/iron=50, /datum/material/glass=20) /obj/item/stock_parts/manipulator/femto @@ -359,6 +372,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A tiny little manipulator used in the construction of certain devices." icon_state = "femto_mani" rating = 4 + energy_rating = 10 custom_materials = list(/datum/material/iron=30) /obj/item/stock_parts/micro_laser/quadultra @@ -366,6 +380,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good icon_state = "quadultra_micro_laser" desc = "A tiny laser used in certain devices." rating = 4 + energy_rating = 10 custom_materials = list(/datum/material/iron=10, /datum/material/glass=20) /obj/item/stock_parts/matter_bin/bluespace @@ -373,6 +388,7 @@ If you create T5+ please take a pass at mech_fabricator.dm. The parts being good desc = "A container designed to hold compressed matter awaiting reconstruction." icon_state = "bluespace_matter_bin" rating = 4 + energy_rating = 10 custom_materials = list(/datum/material/iron=80) // Subspace stock parts diff --git a/code/modules/security_levels/keycard_authentication.dm b/code/modules/security_levels/keycard_authentication.dm index b1faed4eaea..5be9ab1a82a 100644 --- a/code/modules/security_levels/keycard_authentication.dm +++ b/code/modules/security_levels/keycard_authentication.dm @@ -9,9 +9,6 @@ GLOBAL_DATUM_INIT(keycard_events, /datum/events, new) desc = "This device is used to trigger station functions, which require more than one ID card to authenticate." icon = 'icons/obj/monitors.dmi' icon_state = "auth_off" - use_power = IDLE_POWER_USE - idle_power_usage = 2 - active_power_usage = 6 power_channel = AREA_USAGE_ENVIRON req_access = list(ACCESS_KEYCARD_AUTH) resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF diff --git a/code/modules/shuttle/computer.dm b/code/modules/shuttle/computer.dm index c26523f3853..cffe675b72a 100644 --- a/code/modules/shuttle/computer.dm +++ b/code/modules/shuttle/computer.dm @@ -26,6 +26,7 @@ connect_to_shuttle(SSshuttle.get_containing_shuttle(src)) /obj/machinery/computer/shuttle/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "ShuttleConsole", name) diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index 380df875ee9..bb4969d7871 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -47,6 +47,7 @@ return GLOB.human_adjacent_state /obj/machinery/computer/emergency_shuttle/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "EmergencyShuttleConsole", name) diff --git a/code/modules/shuttle/spaceship_navigation_beacon.dm b/code/modules/shuttle/spaceship_navigation_beacon.dm index 7f7174f278c..f1a1dd575cc 100644 --- a/code/modules/shuttle/spaceship_navigation_beacon.dm +++ b/code/modules/shuttle/spaceship_navigation_beacon.dm @@ -10,8 +10,6 @@ icon = 'icons/obj/abductor.dmi' icon_state = "core" base_icon_state = "core" - use_power = IDLE_POWER_USE - idle_power_usage = 0 density = TRUE circuit = /obj/item/circuitboard/machine/spaceship_navigation_beacon diff --git a/code/modules/station_goals/bsa.dm b/code/modules/station_goals/bsa.dm index d7bff35b965..af2324a2608 100644 --- a/code/modules/station_goals/bsa.dm +++ b/code/modules/station_goals/bsa.dm @@ -258,6 +258,7 @@ GLOBAL_VAR_INIT(bsa_unlock, FALSE) return GLOB.physical_state /obj/machinery/computer/bsa_control/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "BluespaceArtillery", name) diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm index 61619531c3a..8ca219027f7 100644 --- a/code/modules/station_goals/dna_vault.dm +++ b/code/modules/station_goals/dna_vault.dm @@ -66,7 +66,7 @@ icon_state = "vault" density = TRUE anchored = TRUE - idle_power_usage = 5000 + active_power_usage = BASE_MACHINE_ACTIVE_CONSUMPTION * 5 pixel_x = -32 pixel_y = -64 light_range = 3 @@ -220,3 +220,4 @@ to_chat(H, span_notice("Your arms move as fast as lightning.")) H.next_move_modifier = 0.5 power_lottery[H] = list() + use_power(active_power_usage) diff --git a/code/modules/station_goals/shield.dm b/code/modules/station_goals/shield.dm index 8e12556225a..6ce8ed814d9 100644 --- a/code/modules/station_goals/shield.dm +++ b/code/modules/station_goals/shield.dm @@ -43,6 +43,7 @@ var/notice /obj/machinery/computer/sat_control/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "SatelliteControl", name) diff --git a/code/modules/vehicles/mecha/mech_bay.dm b/code/modules/vehicles/mecha/mech_bay.dm index 2ee53176128..fe735d9510f 100644 --- a/code/modules/vehicles/mecha/mech_bay.dm +++ b/code/modules/vehicles/mecha/mech_bay.dm @@ -41,6 +41,7 @@ recharging_turf = get_step(loc, dir) /obj/machinery/mech_bay_recharge_port/RefreshParts() + . = ..() var/total_rating = 0 for(var/obj/item/stock_parts/capacitor/cap in component_parts) total_rating += cap.rating @@ -65,7 +66,7 @@ if(recharging_mech.cell.charge < recharging_mech.cell.maxcharge) var/delta = min(recharge_power * delta_time, recharging_mech.cell.maxcharge - recharging_mech.cell.charge) recharging_mech.give_power(delta) - use_power(delta*150) + use_power(delta + active_power_usage) else recharge_console.update_appearance() if(recharging_mech.loc != recharging_turf) @@ -105,6 +106,7 @@ return ..() /obj/machinery/computer/mech_bay_power_console/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "MechBayPowerConsole", name) diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index 976d0e02a4d..865e9363266 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -4,9 +4,6 @@ name = "exosuit fabricator" desc = "Nothing is being built." density = TRUE - use_power = IDLE_POWER_USE - idle_power_usage = 20 - active_power_usage = 5000 req_access = list(ACCESS_ROBOTICS) circuit = /obj/item/circuitboard/machine/mechfab processing_flags = START_PROCESSING_MANUALLY @@ -79,6 +76,7 @@ return ..() /obj/machinery/mecha_part_fabricator/RefreshParts() + . = ..() var/T = 0 //maximum stocking amount (default 300000, 600000 at T4) diff --git a/code/modules/vehicles/mecha/mecha_control_console.dm b/code/modules/vehicles/mecha/mecha_control_console.dm index b52cd69a879..eef2a1de549 100644 --- a/code/modules/vehicles/mecha/mecha_control_console.dm +++ b/code/modules/vehicles/mecha/mecha_control_console.dm @@ -7,6 +7,7 @@ circuit = /obj/item/circuitboard/computer/mecha_control /obj/machinery/computer/mecha/ui_interact(mob/user, datum/tgui/ui) + . = ..() ui = SStgui.try_update_ui(user, src, ui) if(!ui) ui = new(user, src, "ExosuitControlConsole", name) diff --git a/code/modules/vending/_vending.dm b/code/modules/vending/_vending.dm index b0fefa0da41..96232b96fcd 100644 --- a/code/modules/vending/_vending.dm +++ b/code/modules/vending/_vending.dm @@ -226,6 +226,7 @@ return !shut_up /obj/machinery/vending/RefreshParts() //Better would be to make constructable child + SHOULD_CALL_PARENT(FALSE) if(!component_parts) return @@ -970,7 +971,7 @@ GLOBAL_LIST_EMPTY(vending_products) purchase_message_cooldown = world.time + 5 SECONDS //This is not the best practice, but it's safe enough here since the chances of two people using a machine with the same ref in 5 seconds is fuck low last_shopper = REF(usr) - use_power(5) + use_power(active_power_usage) if(icon_vend) //Show the vending animation if needed flick(icon_vend,src) playsound(src, 'sound/machines/machine_vend.ogg', 50, TRUE, extrarange = -3) @@ -1282,7 +1283,7 @@ GLOBAL_LIST_EMPTY(vending_products) last_shopper = REF(usr) /// Remove the item loaded_items-- - use_power(5) + use_power(active_power_usage) vending_machine_input[choice] = max(vending_machine_input[choice] - 1, 0) if(user.CanReach(src) && user.put_in_hands(dispensed_item)) to_chat(user, span_notice("You take [dispensed_item.name] out of the slot.")) diff --git a/code/modules/wiremod/shell/brain_computer_interface.dm b/code/modules/wiremod/shell/brain_computer_interface.dm index 2990ebe568e..1310708108d 100644 --- a/code/modules/wiremod/shell/brain_computer_interface.dm +++ b/code/modules/wiremod/shell/brain_computer_interface.dm @@ -273,12 +273,9 @@ icon_state = "bci_implanter" base_icon_state = "bci_implanter" layer = ABOVE_WINDOW_LAYER - use_power = IDLE_POWER_USE anchored = TRUE density = TRUE obj_flags = NO_BUILD // Becomes undense when the door is open - idle_power_usage = 50 - active_power_usage = 300 var/busy = FALSE var/busy_icon_state @@ -407,6 +404,8 @@ if (!occupant || busy) return + update_use_power(ACTIVE_POWER_USE) + var/locked_state = locked locked = TRUE @@ -416,6 +415,7 @@ addtimer(CALLBACK(src, .proc/complete_process, locked_state), 3 SECONDS) /obj/machinery/bci_implanter/proc/complete_process(locked_state) + update_use_power(IDLE_POWER_USE) locked = locked_state set_busy(FALSE)