[batt_percent]%
[shot_cost_percent]%
"
+ return
+ if(batt_percent <= 25)
+ hud.maptext = "[batt_percent]%
[shot_cost_percent]%
"
+ return
+ hud.maptext = "[batt_percent]%
[shot_cost_percent]%
"
+
+ else if(istype(parent, /obj/item/weldingtool))
+ var/obj/item/weldingtool/welder = parent
+ hud.maptext = null
+ var/backing_color = COLOR_TAN_ORANGE
+ hud.icon_state = "backing"
+
+ if(welder.get_fuel() < 1)
+ hud.set_hud(backing_color, "oe", "te", "he", "empty_flash")
+ return
+
+ var/indicator
+ var/fuel = num2text(welder.get_fuel())
+ var/oth_o
+ var/oth_t
+ var/oth_h
+
+ if(welder.welding)
+ indicator = "flame_on"
+ else
+ indicator = "flame_off"
+
+ fuel = num2text(welder.get_fuel())
+
+ switch(length(fuel))
+ if(1)
+ oth_o = "o[fuel[1]]"
+ if(2)
+ oth_o = "o[fuel[2]]"
+ oth_t = "t[fuel[1]]"
+ if(3)
+ oth_o = "o[fuel[3]]"
+ oth_t = "t[fuel[2]]"
+ oth_h = "h[fuel[1]]"
+ else
+ oth_o = "o9"
+ oth_t = "t9"
+ oth_h = "h9"
+ hud.set_hud(backing_color, oth_o, oth_t, oth_h, indicator)
+
+/obj/item/gun/ballistic/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/ammo_hud)
+
+/obj/item/gun/energy/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/ammo_hud)
+
+/obj/item/weldingtool/ComponentInitialize()
+ . = ..()
+ AddComponent(/datum/component/ammo_hud)
diff --git a/modular_skyrat/modules/gunhud/code/hud/gun_hud.dm b/modular_skyrat/modules/gunhud/code/hud/gun_hud.dm
new file mode 100644
index 00000000000..a282af67369
--- /dev/null
+++ b/modular_skyrat/modules/gunhud/code/hud/gun_hud.dm
@@ -0,0 +1,86 @@
+/////////////////////////
+//Customizable ammo hud//
+/////////////////////////
+
+/*
+This hud is controlled namely by the ammo_hud component. Generally speaking this is inactive much like all other hud components until it's needed.
+It does not do any calculations of it's own, you must do this externally.
+If you wish to use this hud, use the ammo_hud component or create another one which interacts with it via the below procs.
+proc/turn_off
+proc/turn_on
+proc/set_hud
+Check the gun_hud.dmi for all available icons you can use.
+*/
+
+/atom/movable/screen/ammo_counter
+ name = "ammo counter"
+ icon = 'modular_skyrat/modules/gunhud/icons/hud/gun_hud.dmi'
+ icon_state = "backing"
+ screen_loc = ui_ammocounter
+ invisibility = INVISIBILITY_ABSTRACT
+
+ ///This is the color assigned to the OTH backing, numbers and indicator.
+ var/backing_color = COLOR_RED
+ ///This is the "backlight" of the numbers, and only the numbers. Generally you should leave this alone if you aren't making some mutant project.
+ var/oth_backing = "oth_light"
+
+ //Below are the OTH numbers, these are assigned by oX, tX and hX, x being the number you wish to display(0-9)
+ ///OTH position X00
+ var/oth_o
+ ///OTH position 0X0
+ var/oth_t
+ ///OTH position 00X
+ var/oth_h
+ ///This is the custom indicator sprite that will appear in the box at the bottom of the ammo hud, use this for something like semi/auto toggle on a gun.
+ var/indicator
+
+///This proc simply resets the hud to standard and removes it from the players visible hud.
+/atom/movable/screen/ammo_counter/proc/turn_off()
+ invisibility = INVISIBILITY_ABSTRACT
+ maptext = null
+ backing_color = COLOR_RED
+ oth_backing = ""
+ oth_o = ""
+ oth_t = ""
+ oth_h = ""
+ indicator = ""
+ update_appearance()
+
+///This proc turns the hud on, but does not set it to anything other than the currently set values
+/atom/movable/screen/ammo_counter/proc/turn_on()
+ invisibility = 0
+
+///This is the main proc for altering the hud's appeareance, it controls the setting of the overlays. Use the OTH and below variables to set it accordingly.
+/atom/movable/screen/ammo_counter/proc/set_hud(_backing_color, _oth_o, _oth_t, _oth_h, _indicator, _oth_backing = "oth_light")
+ backing_color = _backing_color
+ oth_backing = _oth_backing
+ oth_o = _oth_o
+ oth_t = _oth_t
+ oth_h = _oth_h
+ indicator = _indicator
+
+ update_appearance()
+
+/atom/movable/screen/ammo_counter/update_overlays()
+ . = ..()
+ if(oth_backing)
+ var/mutable_appearance/oth_backing_overlay = mutable_appearance(icon, oth_backing)
+ oth_backing_overlay.color = backing_color
+ . += oth_backing_overlay
+ if(oth_o)
+ var/mutable_appearance/o_overlay = mutable_appearance(icon, oth_o)
+ o_overlay.color = backing_color
+ . += o_overlay
+ if(oth_t)
+ var/mutable_appearance/t_overlay = mutable_appearance(icon, oth_t)
+ t_overlay.color = backing_color
+ . += t_overlay
+ if(oth_h)
+ var/mutable_appearance/h_overlay = mutable_appearance(icon, oth_h)
+ h_overlay.color = backing_color
+ . += h_overlay
+ if(indicator)
+ var/mutable_appearance/indicator_overlay = mutable_appearance(icon, indicator)
+ indicator_overlay.color = backing_color
+ . += indicator_overlay
+
diff --git a/modular_skyrat/modules/gunhud/icons/hud/gun_hud.dmi b/modular_skyrat/modules/gunhud/icons/hud/gun_hud.dmi
new file mode 100644
index 00000000000..c412d504196
Binary files /dev/null and b/modular_skyrat/modules/gunhud/icons/hud/gun_hud.dmi differ
diff --git a/modular_skyrat/modules/gunhud/readme.md b/modular_skyrat/modules/gunhud/readme.md
new file mode 100644
index 00000000000..e580d96643a
--- /dev/null
+++ b/modular_skyrat/modules/gunhud/readme.md
@@ -0,0 +1,26 @@
+## Title: Gunpoint
+
+MODULE ID: GUNHUD
+
+### Description:
+
+Adds a dynamic hud system for energy and some ballistics guns.
+
+### TG Proc Changes:
+- N/A
+### Defines:
+
+.code\__DEFINES\atom_hud.dm > #define AMMO_HUD "25"
+
+.code\modules\projectiles\guns\ballistic.dm > /obj/item/gun/ballistic/examine(mob/user)
+
+### Master file additions
+
+- Hud directory > _defines.dm, human.dm, hud.dm
+
+### Included files that are not contained in this module:
+
+- N/A
+
+### Credits:
+Gandalf2k15 - OG creation.
diff --git a/modular_skyrat/modules/gunsgalore/code/guns/master.dm b/modular_skyrat/modules/gunsgalore/code/guns/master.dm
index d08239e5389..da0910adf0b 100644
--- a/modular_skyrat/modules/gunsgalore/code/guns/master.dm
+++ b/modular_skyrat/modules/gunsgalore/code/guns/master.dm
@@ -81,6 +81,7 @@
jammed = TRUE
playsound(src, 'sound/effects/stall.ogg', 60, TRUE)
to_chat(user, "