Progress Commit 2 - Energy Gun HUD works, starting Projectiles

Saving progress to resume later.
This commit is contained in:
Rykka
2022-04-03 21:51:07 -06:00
parent 3b5c753b7b
commit 85e69ffba4
8 changed files with 104 additions and 8 deletions

View File

@@ -38,13 +38,17 @@
var/warned = FALSE
var/static/list/ammo_screen_loc_list = list(ui_ammo_hud1, ui_ammo_hud2, ui_ammo_hud3 ,ui_ammo_hud4)
/obj/screen/ammo/proc/add_hud(var/mob/living/user)
/obj/screen/ammo/proc/add_hud(var/mob/living/user, var/obj/item/weapon/gun/G)
if(!user?.client)
return
// var/obj/item/weapon/gun/G = user.get_active_hand()
if(!G)
CRASH("/obj/screen/ammo/proc/add_hud() has been called from [src] without the required param of G")
var/obj/item/weapon/gun/G = user.get_active_hand()
if(!G || !G.has_ammo_counter() || !G.hud_enabled)
if(!G.has_ammo_counter())
return
user.client.screen += src
@@ -52,13 +56,13 @@
/obj/screen/ammo/proc/remove_hud(var/mob/living/user)
user?.client?.screen -= src
/obj/screen/ammo/proc/update_hud(var/mob/living/user)
/obj/screen/ammo/proc/update_hud(var/mob/living/user, var/obj/item/weapon/gun/G)
if(!user?.client?.screen.Find(src))
return
var/obj/item/weapon/gun/G = user.get_active_hand()
// var/obj/item/weapon/gun/G = user.get_active_hand()
if(!G || !istype(G) || !G.has_ammo_counter() || !G.hud_enabled || !G.get_ammo_type() || isnull(G.get_ammo_count()))
if(!G || !istype(G) || !G.has_ammo_counter() || !G.get_ammo_type() || isnull(G.get_ammo_count()))
remove_hud()
return