diff --git a/code/_onclick/hud/_defines.dm b/code/_onclick/hud/_defines.dm index 98f46e173dd..20c18fe507b 100644 --- a/code/_onclick/hud/_defines.dm +++ b/code/_onclick/hud/_defines.dm @@ -25,6 +25,17 @@ #define ui_action_slot9 "9:22,16:26" #define ui_action_slot10 "10:24,16:26" +#define ui_power_slot1 "1:6,15:24" +#define ui_power_slot2 "2:8,15:24" +#define ui_power_slot3 "3:10,15:24" +#define ui_power_slot4 "4:12,15:24" +#define ui_power_slot5 "5:14,15:24" +#define ui_power_slot6 "6:16,15:24" +#define ui_power_slot7 "7:18,15:24" +#define ui_power_slot8 "8:20,15:24" +#define ui_power_slot9 "9:22,15:24" +#define ui_power_slot10 "10:24,15:24" + //Middle left indicators #define ui_alienplasmadisplay "1,6:15" diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 687f3b6cac2..6a81365a794 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -108,7 +108,7 @@ var/datum/global_hud/global_hud = new() var/list/obj/screen/hotkeybuttons var/list/obj/screen/item_action/item_action_list = list() //Used for the item action ui buttons. - + var/list/obj/screen/item_action/power_action_list = list() //Used for the power action ui buttons. datum/hud/New(mob/owner) mymob = owner diff --git a/code/_onclick/hud/human.dm b/code/_onclick/hud/human.dm index 39e0aca6370..f7441c928f0 100644 --- a/code/_onclick/hud/human.dm +++ b/code/_onclick/hud/human.dm @@ -552,4 +552,55 @@ A.screen_loc = ui_action_slot10 break //5 slots available, so no more can be added. num++ - src.client.screen += src.hud_used.item_action_list \ No newline at end of file + src.client.screen += src.hud_used.item_action_list + + +/mob/living/carbon/human/update_power_buttons() + var/num = 1 + if(!hud_used) return + if(!client) return + + if(!hud_used.hud_shown) //Hud toggled to minimal + return + + client.screen -= hud_used.power_action_list + + hud_used.power_action_list = list() + for(var/obj/effect/proc_holder/spell/S in spell_list) + if(S.icon_power_button) + var/obj/screen/power_action/P = new(hud_used) + P.icon = 'icons/mob/screen1_action.dmi' + P.icon_state = S.icon_power_button + + if(S.power_button_name) + P.name = S.power_button_name + else + P.name = "Use [S.name]" + P.owner = S + + hud_used.power_action_list += P + + switch(num) + if(1) + P.screen_loc = ui_power_slot1 + if(2) + P.screen_loc = ui_power_slot2 + if(3) + P.screen_loc = ui_power_slot3 + if(4) + P.screen_loc = ui_power_slot4 + if(5) + P.screen_loc = ui_power_slot5 + if(6) + P.screen_loc = ui_power_slot6 + if(7) + P.screen_loc = ui_power_slot7 + if(8) + P.screen_loc = ui_power_slot8 + if(9) + P.screen_loc = ui_power_slot9 + if(10) + P.screen_loc = ui_power_slot10 + break //5 slots available, so no more can be added. + num++ + src.client.screen += src.hud_used.power_action_list \ No newline at end of file diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 41d8a7819d0..6ecd8ec509e 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -41,6 +41,11 @@ S.close(usr) return 1 +/obj/screen/power_action + var/obj/effect/proc_holder/spell/owner + +/obj/screen/power_action/Click() + /obj/screen/item_action var/obj/item/owner @@ -67,6 +72,9 @@ /mob/proc/update_action_buttons() return +/mob/proc/update_power_buttons() + return + /obj/screen/grab name = "grab" diff --git a/code/datums/spell.dm b/code/datums/spell.dm index f82f654a2d4..9b4349a04eb 100644 --- a/code/datums/spell.dm +++ b/code/datums/spell.dm @@ -45,6 +45,9 @@ var/list/spells = typesof(/obj/effect/proc_holder/spell) //needed for the badmin var/critfailchance = 0 var/centcom_cancast = 1 //Whether or not the spell should be allowed on z2 + var/icon_power_button + var/power_button_name + /obj/effect/proc_holder/spell/proc/cast_check(skipcharge = 0,mob/user = usr) //checks if the spell can be cast based on its settings; skipcharge is used when an additional cast_check is called inside the spell if(!(src in user.spell_list)) diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index ed9de1280b4..98648bbc188 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1411,6 +1411,7 @@ var/global/list/brutefireloss_overlays = list("1" = image("icon" = 'icons/mob/sc client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask/*, global_hud.nvg*/) update_action_buttons() + update_power_buttons() if(damageoverlay.overlays) damageoverlay.overlays = list()