From 0d767094c4c7611c1a474a492f115d7ac98b0c8a Mon Sep 17 00:00:00 2001
From: Gristlebee <56049844+Gristlebee@users.noreply.github.com>
Date: Tue, 18 Jun 2024 19:11:22 -0700
Subject: [PATCH] Energy/Laser guns display their charge and how many shots
they have left on examine (#3100)
## About The Pull Request
Energy weapons now show on examine how much charge they have, or if they
have a cell installed or not. They also show how many shots they have
left on the current fire mode.
Also changes all the span classes to marcos
## Why It's Good For The Game
QOL change, while it is true you have the charge indicator on the
sprite, it's not the most reliable or accurate. This makes it a lot
easier to keep track of how many shots you have left.
I also often see people try to charge guns with no cells and wonder why
it doesnt work, so some extra textual indication couldnt hurt.
## Changelog
:cl:
add: Energy guns show how much charge and shots they have remaining, or
if it doesnt have a cell installed on examine.
code: span classes to span macros for energy.dm
/:cl:
---
code/modules/projectiles/guns/energy.dm | 30 +++++++++++++++----------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm
index dffa9a7fe7b11..fb0970321308d 100644
--- a/code/modules/projectiles/guns/energy.dm
+++ b/code/modules/projectiles/guns/energy.dm
@@ -134,19 +134,19 @@
/obj/item/gun/energy/proc/insert_cell(mob/user, obj/item/stock_parts/cell/gun/C)
if(small_gun && !istype(C, /obj/item/stock_parts/cell/gun/mini))
- to_chat(user, "\The [C] doesn't seem to fit into \the [src]...")
+ to_chat(user, span_warning("\The [C] doesn't seem to fit into \the [src]..."))
return FALSE
if(!big_gun && istype(C, /obj/item/stock_parts/cell/gun/large))
- to_chat(user, "\The [C] doesn't seem to fit into \the [src]...")
+ to_chat(user, span_warning("\The [C] doesn't seem to fit into \the [src]..."))
return FALSE
if(user.transferItemToLoc(C, src))
cell = C
- to_chat(user, "You load the [C] into \the [src].")
+ to_chat(user, span_notice("You load the [C] into \the [src]."))
playsound(src, load_sound, sound_volume, load_sound_vary)
update_appearance()
return TRUE
else
- to_chat(user, "You cannot seem to get \the [src] out of your hands!")
+ to_chat(user, span_warning("You cannot seem to get \the [src] out of your hands!"))
return FALSE
/obj/item/gun/energy/proc/eject_cell(mob/user, obj/item/stock_parts/cell/gun/tac_load = null)
@@ -155,16 +155,16 @@
var/obj/item/stock_parts/cell/gun/old_cell = cell
old_cell.update_appearance()
cell = null
- to_chat(user, "You pull the cell out of \the [src].")
+ to_chat(user, span_notice("You pull the cell out of \the [src]."))
update_appearance()
if(tac_load && tac_reloads)
if(do_after(user, tactical_reload_delay, src, hidden = TRUE))
if(insert_cell(user, tac_load))
- to_chat(user, "You perform a tactical reload on \the [src].")
+ to_chat(user, span_notice("You perform a tactical reload on \the [src]."))
else
- to_chat(user, "You dropped the old cell, but the new one doesn't fit. How embarassing.")
+ to_chat(user, span_warning("You dropped the old cell, but the new one doesn't fit. How embarassing."))
else
- to_chat(user, "Your reload was interupted!")
+ to_chat(user, span_warning("Your reload was interupted!"))
return
user.put_in_hands(old_cell)
@@ -230,7 +230,7 @@
fire_sound = shot.fire_sound
fire_delay = shot.delay
if (shot.select_name)
- to_chat(user, "[src] is now set to [shot.select_name].")
+ to_chat(user, span_notice("[src] is now set to [shot.select_name]."))
chambered = null
playsound(user, 'sound/weapons/gun/general/selector.ogg', 100, TRUE)
recharge_newshot(TRUE)
@@ -308,13 +308,13 @@
if(!BB)
. = ""
else if(BB.nodamage || !BB.damage || BB.damage_type == STAMINA)
- user.visible_message("[user] tries to light [user.p_their()] [A.name] with [src], but it doesn't do anything. Dumbass.")
+ user.visible_message(span_danger("[user] tries to light [user.p_their()] [A.name] with [src], but it doesn't do anything. Dumbass."))
playsound(user, E.fire_sound, 50, TRUE)
playsound(user, BB.hitsound_non_living, 50, TRUE)
cell.use(E.e_cost)
. = ""
else if(BB.damage_type != BURN)
- user.visible_message("[user] tries to light [user.p_their()] [A.name] with [src], but only succeeds in utterly destroying it. Dumbass.")
+ user.visible_message(span_danger("[user] tries to light [user.p_their()] [A.name] with [src], but only succeeds in utterly destroying it. Dumbass."))
playsound(user, E.fire_sound, 50, TRUE)
playsound(user, BB.hitsound_non_living, 50, TRUE)
cell.use(E.e_cost)
@@ -324,10 +324,16 @@
playsound(user, E.fire_sound, 50, TRUE)
playsound(user, BB.hitsound_non_living, 50, TRUE)
cell.use(E.e_cost)
- . = "[user] casually lights their [A.name] with [src]. Damn."
+ . = span_danger("[user] casually lights their [A.name] with [src]. Damn.")
/obj/item/gun/energy/examine(mob/user)
. = ..()
+ var/obj/item/ammo_casing/energy/shot = ammo_type[select]
if(ammo_type.len > 1)
. += "You can switch firemodes by pressing the unqiue action key. By default, this is space"
+ if(cell)
+ . += "\The [name]'s cell has [cell.percent()]% charge remaining."
+ . += "\The [name] has [round(cell.charge/shot.e_cost)] shots remaining on [shot.select_name] mode."
+ else
+ . += span_notice("\The [name] doesn't seem to have a cell!")