From 3af4e6ae79a987903dee333488b80033baffc901 Mon Sep 17 00:00:00 2001 From: Nick <42454181+Momo8289@users.noreply.github.com> Date: Wed, 31 Jul 2024 11:08:07 -0400 Subject: [PATCH] Power cell overlay now updates when exiting an object's contents (#85079) ## About The Pull Request The charge indicator overlay on power cells is now properly updated when the cell is charged/discharged. Before, you could use a power cell until it's empty and the overlay wouldn't change at all. ## Why It's Good For The Game The overlay is there to indicate the charge of the cell. It should work. ## Changelog :cl: fix: The charge indicators on power cells now work properly. code: Removed some now redundant power cell appearance updates /:cl: --------- Co-authored-by: jimmyl <70376633+mc-oofert@ users.noreply.github.com> --- code/game/objects/items/defib.dm | 1 - code/game/objects/items/melee/baton.dm | 1 - code/modules/mob/living/basic/bots/_bots.dm | 1 - code/modules/mob/living/silicon/robot/robot_defense.dm | 1 - code/modules/mob/living/simple_animal/bot/bot.dm | 1 - code/modules/mob/living/simple_animal/bot/mulebot.dm | 1 - code/modules/mod/mod_core.dm | 1 - code/modules/power/apc/apc_main.dm | 1 - code/modules/power/apc/apc_tool_act.dm | 1 - code/modules/power/lighting/light_construct.dm | 1 - code/modules/power/power_store.dm | 7 +++++++ code/modules/reagents/reagent_containers/misc.dm | 1 - code/modules/vehicles/motorized_wheelchair.dm | 1 - 13 files changed, 7 insertions(+), 12 deletions(-) diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 0abf30a6f24..b34540e441c 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -147,7 +147,6 @@ if(!cell || !cell_removable) return FALSE - cell.update_appearance() cell.forceMove(get_turf(src)) balloon_alert(user, "removed [cell]") cell = null diff --git a/code/game/objects/items/melee/baton.dm b/code/game/objects/items/melee/baton.dm index 27909b5317e..7992aa95a7f 100644 --- a/code/game/objects/items/melee/baton.dm +++ b/code/game/objects/items/melee/baton.dm @@ -504,7 +504,6 @@ /obj/item/melee/baton/security/Exited(atom/movable/mov_content) . = ..() if(mov_content == cell) - cell.update_appearance() cell = null active = FALSE update_appearance() diff --git a/code/modules/mob/living/basic/bots/_bots.dm b/code/modules/mob/living/basic/bots/_bots.dm index 9f2b915944b..04b3a7864d2 100644 --- a/code/modules/mob/living/basic/bots/_bots.dm +++ b/code/modules/mob/living/basic/bots/_bots.dm @@ -517,7 +517,6 @@ GLOBAL_LIST_INIT(command_strings, list( if(istype(item_to_drop, /obj/item/stock_parts/power_store/cell)) var/obj/item/stock_parts/power_store/cell/dropped_cell = item_to_drop dropped_cell.charge = 0 - dropped_cell.update_appearance() return if(istype(item_to_drop, /obj/item/storage)) diff --git a/code/modules/mob/living/silicon/robot/robot_defense.dm b/code/modules/mob/living/silicon/robot/robot_defense.dm index 0e4e79f84ce..549762fd7a9 100644 --- a/code/modules/mob/living/silicon/robot/robot_defense.dm +++ b/code/modules/mob/living/silicon/robot/robot_defense.dm @@ -214,7 +214,6 @@ GLOBAL_LIST_INIT(blacklisted_borg_hats, typecacheof(list( //Hats that don't real if(!wiresexposed && !issilicon(user)) if(!cell) return - cell.update_appearance() cell.add_fingerprint(user) to_chat(user, span_notice("You remove \the [cell].")) user.put_in_active_hand(cell) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index c483d371e1a..e2bb112e156 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -556,7 +556,6 @@ if(istype(item_to_drop, /obj/item/stock_parts/power_store/cell)) var/obj/item/stock_parts/power_store/cell/dropped_cell = item_to_drop dropped_cell.charge = 0 - dropped_cell.update_appearance() else if(istype(item_to_drop, /obj/item/storage)) var/obj/item/storage/storage_to_drop = item_to_drop diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index 6b9b4aa77fa..f3194e88b18 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -754,7 +754,6 @@ new /obj/item/stack/cable_coil/cut(Tsec) if(cell) cell.forceMove(Tsec) - cell.update_appearance() cell = null new /obj/effect/decal/cleanable/oil(loc) diff --git a/code/modules/mod/mod_core.dm b/code/modules/mod/mod_core.dm index 0c13efa1b95..5f93427f532 100644 --- a/code/modules/mod/mod_core.dm +++ b/code/modules/mod/mod_core.dm @@ -173,7 +173,6 @@ /obj/item/mod/core/standard/proc/uninstall_cell() if(!cell) return - cell.update_appearance() cell = null mod.update_charge_alert() diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index 871906fe4b8..7a487a009b2 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -308,7 +308,6 @@ /obj/machinery/power/apc/Exited(atom/movable/gone, direction) . = ..() if(gone == cell) - cell.update_appearance() cell = null charging = APC_NOT_CHARGING update_appearance() diff --git a/code/modules/power/apc/apc_tool_act.dm b/code/modules/power/apc/apc_tool_act.dm index 2072ab14561..8e4d51a703d 100644 --- a/code/modules/power/apc/apc_tool_act.dm +++ b/code/modules/power/apc/apc_tool_act.dm @@ -320,7 +320,6 @@ balloon_alert(user, "cell removed") var/turf/user_turf = get_turf(user) cell.forceMove(user_turf) - cell.update_appearance() cell = null charging = APC_NOT_CHARGING update_appearance() diff --git a/code/modules/power/lighting/light_construct.dm b/code/modules/power/lighting/light_construct.dm index ec09fdc2692..902ca9fb0eb 100644 --- a/code/modules/power/lighting/light_construct.dm +++ b/code/modules/power/lighting/light_construct.dm @@ -63,7 +63,6 @@ return user.visible_message(span_notice("[user] removes [cell] from [src]!"), span_notice("You remove [cell].")) user.put_in_hands(cell) - cell.update_appearance() cell = null add_fingerprint(user) diff --git a/code/modules/power/power_store.dm b/code/modules/power/power_store.dm index 03e75d052ad..d1118b929ed 100644 --- a/code/modules/power/power_store.dm +++ b/code/modules/power/power_store.dm @@ -57,6 +57,13 @@ ) AddElement(/datum/element/connect_loc, loc_connections) + +/obj/item/stock_parts/power_store/Moved(atom/old_loc, movement_dir, forced, list/old_locs, momentum_change = TRUE) + . = ..() + if(!isturf(old_loc)) + update_appearance() + + /** * Signal proc for [COMSIG_ITEM_MAGICALLY_CHARGED] * diff --git a/code/modules/reagents/reagent_containers/misc.dm b/code/modules/reagents/reagent_containers/misc.dm index d2dc2adfb5f..8b13ab4a54b 100644 --- a/code/modules/reagents/reagent_containers/misc.dm +++ b/code/modules/reagents/reagent_containers/misc.dm @@ -91,7 +91,6 @@ /obj/item/reagent_containers/cup/maunamug/attack_hand(mob/living/user, list/modifiers) if(cell && open) - cell.update_appearance() user.put_in_hands(cell) cell = null to_chat(user, span_notice("You remove the power cell from [src].")) diff --git a/code/modules/vehicles/motorized_wheelchair.dm b/code/modules/vehicles/motorized_wheelchair.dm index cecf6b815e2..6a38f65e3bf 100644 --- a/code/modules/vehicles/motorized_wheelchair.dm +++ b/code/modules/vehicles/motorized_wheelchair.dm @@ -100,7 +100,6 @@ /obj/vehicle/ridden/wheelchair/motorized/attack_hand(mob/living/user, list/modifiers) if(!power_cell || !panel_open) return ..() - power_cell.update_appearance() to_chat(user, span_notice("You remove [power_cell] from [src].")) user.put_in_hands(power_cell) power_cell = null