From 4bae4a4eca625039216dd0b77191ed121b16f8db Mon Sep 17 00:00:00 2001
From: Gristlebee <56049844+Gristlebee@users.noreply.github.com>
Date: Tue, 27 Aug 2024 14:36:44 -0700
Subject: [PATCH] Weapon power cells can be charged in weapon rechargers and
fixes e-40 laser charging. (#3309)
## About The Pull Request
You can now directly put a weapons power cell into a weapons recharger
to recharge it.
Also fixes e40s not being able to charge in rechargers. It used the
wrong proc for get_cell.
Changes spans to macros for rechargers.
## Why It's Good For The Game
QOL change, you don't have to go through the repetitive motions of
repeatedly swapping in empty cells into your e-gun in order to charge
them, since you can directly put them in to charge.
It's also intuitive, and I've seen multiple people get confused about
why you cant charge the weapon cell in it while they pointlessly bonk
the cell against it.
Bug fixes are good too.
## Changelog
:cl:
add: Weapon cells can be inserted directly into weapon chargers to
charge them.
fix: e40s not charging in weapons rechargers.
/:cl:
---
code/game/machinery/recharger.dm | 26 +++++++++++--------
.../projectiles/guns/ballistic/assault.dm | 4 +--
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm
index b0e030206a0f0..1e17186238163 100644
--- a/code/game/machinery/recharger.dm
+++ b/code/game/machinery/recharger.dm
@@ -22,6 +22,7 @@
/obj/item/modular_computer,
/obj/item/gun/ballistic/automatic/powered,
/obj/item/gun/ballistic/automatic/assault/e40,
+ /obj/item/stock_parts/cell/gun
))
/obj/machinery/recharger/RefreshParts()
@@ -31,19 +32,22 @@
/obj/machinery/recharger/examine(mob/user)
. = ..()
if(!in_range(user, src) && !issilicon(user) && !isobserver(user))
- . += "You're too far away to examine [src]'s contents and display!"
+ . += span_warning("You're too far away to examine [src]'s contents and display!")
return
if(charging)
- . += {"\The [src] contains:
- - \A [charging]."}
+ . += span_notice("\The [src] contains:")
+ . += span_notice("- \A [charging].")
if(!(machine_stat & (NOPOWER|BROKEN)))
- . += "The status display reads:"
- . += "- Recharging [recharge_coeff*10]% cell charge per cycle."
+ . += span_notice("The status display reads:")
+ . += span_notice("- Recharging [recharge_coeff*10]% cell charge per cycle.")
if(charging)
var/obj/item/stock_parts/cell/C = charging.get_cell()
- . += "- \The [charging]'s cell is at [C.percent()]%."
+ if(istype(charging, /obj/item/stock_parts/cell))
+ . += span_notice("- \The [charging]'s charge is at [C.percent()]%.")
+ else
+ . += span_notice("- \The [charging]'s cell is at [C.percent()]%.")
/obj/machinery/recharger/proc/setCharging(new_charging)
@@ -62,11 +66,11 @@
/obj/machinery/recharger/attackby(obj/item/G, mob/user, params)
if(G.tool_behaviour == TOOL_WRENCH)
if(charging)
- to_chat(user, "Remove the charging item first!")
+ to_chat(user, span_notice("Remove the charging item first!"))
return
set_anchored(!anchored)
power_change()
- to_chat(user, "You [anchored ? "attached" : "detached"] [src].")
+ to_chat(user, span_notice("You [anchored ? "attached" : "detached"] [src]."))
G.play_tool_sound(src)
return
@@ -80,13 +84,13 @@
//Checks to make sure he's not in space doing it, and that the area got proper power.
var/area/a = get_area(src)
if(!isarea(a) || a.power_equip == 0)
- to_chat(user, "[src] blinks red as you try to insert [G].")
+ to_chat(user, span_notice("[src] blinks red as you try to insert [G]."))
return TRUE
if (istype(G, /obj/item/gun/energy))
var/obj/item/gun/energy/E = G
if(!E.can_charge)
- to_chat(user, "Your gun has no external power connector.")
+ to_chat(user, span_notice("Your gun has no external power connector."))
return TRUE
if(!user.transferItemToLoc(G, src))
@@ -94,7 +98,7 @@
setCharging(G)
else
- to_chat(user, "[src] isn't connected to anything!")
+ to_chat(user, span_notice("[src] isn't connected to anything!"))
return TRUE
if(anchored && !charging)
diff --git a/code/modules/projectiles/guns/ballistic/assault.dm b/code/modules/projectiles/guns/ballistic/assault.dm
index d5ed7a8225bf9..bdabf0a5bda9b 100644
--- a/code/modules/projectiles/guns/ballistic/assault.dm
+++ b/code/modules/projectiles/guns/ballistic/assault.dm
@@ -247,8 +247,8 @@
secondary.pre_fire(target, user, message, flag, params, zone_override, bonus_spread)
-/obj/item/gun/ballistic/automatic/powered/get_cell()
- return cell
+/obj/item/gun/ballistic/automatic/assault/e40/get_cell()
+ return secondary.get_cell()
/obj/item/gun/ballistic/automatic/assault/e40/update_overlays()
. = ..()