diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index 134e1b60aaf..cf44b2ff2e2 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -547,6 +547,20 @@ max_w_class = WEIGHT_CLASS_NORMAL max_storage_space = 100 +/obj/item/storage/part_replacer/full + starts_with = list( + /obj/item/stock_parts/capacitor/adv = 5, + /obj/item/stock_parts/capacitor/super = 5, + /obj/item/stock_parts/manipulator/nano = 5, + /obj/item/stock_parts/manipulator/pico = 5, + /obj/item/stock_parts/scanning_module/adv = 5, + /obj/item/stock_parts/scanning_module/phasic = 5, + /obj/item/stock_parts/matter_bin/adv = 5, + /obj/item/stock_parts/matter_bin/super = 5, + /obj/item/stock_parts/micro_laser/high = 5, + /obj/item/stock_parts/micro_laser/ultra = 5, + ) + /obj/item/ectoplasm name = "ectoplasm" desc = "spooky" diff --git a/code/game/objects/structures/machinery/mech_recharger.dm b/code/game/objects/structures/machinery/mech_recharger.dm index 75387841344..c84dc689839 100644 --- a/code/game/objects/structures/machinery/mech_recharger.dm +++ b/code/game/objects/structures/machinery/mech_recharger.dm @@ -12,9 +12,14 @@ var/mob/living/heavy_vehicle/charging var/base_charge_rate = 90 KILO WATTS var/repair_power_usage = 15 KILO WATTS // Per 1 HP of health. - var/repair = 0 + var/repair var/charge + var/charge_per_capacitor_rating = 0.5 + var/charge_per_scanner_rating = 0.25 + var/repair_per_scanner_rating = 0.25 + var/repair_per_manipulator_rating = 0.5 + component_types = list( /obj/item/circuitboard/mech_recharger, /obj/item/stock_parts/capacitor = 2, @@ -26,7 +31,11 @@ . += ..() . += "Upgraded capacitors will increase charging rate." . += "Upgraded scanning modules will increase both charging rate and repair speed." + . += SPAN_NOTICE(" - The current charge speed is [active_power_usage / 1000] kW") . += "Upgraded manipulators will increase repair speed." + if(repair > 0) + . += SPAN_NOTICE(" - The current repair speed is [repair] HP per second") + . += SPAN_NOTICE(" - The current repair power usage is [(repair_power_usage * repair) / 1000] kW") /obj/structure/machinery/mech_recharger/Initialize(mapload) . = ..() @@ -50,19 +59,30 @@ if(gone == charging) stop_charging() +/obj/structure/machinery/mech_recharger/attackby(obj/item/attacking_item, mob/user) + if(default_part_replacement(user, attacking_item)) + return TRUE + else if(default_deconstruction_screwdriver(user, attacking_item)) + return TRUE + else if(default_deconstruction_crowbar(user, attacking_item)) + return TRUE + return ..() + /obj/structure/machinery/mech_recharger/RefreshParts() ..() - charge = 0 - repair = -5 + charge = -0.25 + repair = -1.75 - for(var/obj/item/stock_parts/P in component_parts) + for(var/obj/item/stock_parts/P in component_parts) //Charges at 315 kW and repairs at 2 HP/s fully upgraded. if(iscapacitor(P)) - charge += P.rating * 20 + charge += P.rating * charge_per_capacitor_rating else if(isscanner(P)) - charge += P.rating * 5 - repair += P.rating + charge += P.rating * charge_per_scanner_rating + repair += P.rating * repair_per_scanner_rating else if(ismanipulator(P)) - repair += P.rating * 2 + repair += P.rating * repair_per_manipulator_rating + + change_power_consumption(initial(base_charge_rate) * charge, POWER_USE_ACTIVE) /obj/structure/machinery/mech_recharger/process() if(!charging) @@ -81,9 +101,9 @@ stop_charging() return - var/remaining_energy = active_power_usage + var/remaining_energy = active_power_usage * charge - if(repair && !fully_repaired()) + if(repair > 0 && !fully_repaired()) for(var/obj/item/mech_component/MC in charging) if(MC) MC.repair_brute_damage(repair) diff --git a/html/changelogs/Fenodyree-MechChargerFix.yml b/html/changelogs/Fenodyree-MechChargerFix.yml new file mode 100644 index 00000000000..ec62acf3a29 --- /dev/null +++ b/html/changelogs/Fenodyree-MechChargerFix.yml @@ -0,0 +1,60 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: Fenodyree + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixes mech rechargers being impossible to deconstruct or upgrade." + - bugfix: "Fixes mech rechargers upgrades not applying." + - rscadd: "Adds a pre-filled part changer for testing purposes, or maybe loot in away missions."