Merge pull request #14853 from SabreML/Cult-Radial-Menus

Adds radial menus to cult structures and constructs
This commit is contained in:
AffectedArc07
2020-11-15 09:31:19 +00:00
committed by GitHub
3 changed files with 37 additions and 29 deletions
+8 -5
View File
@@ -80,12 +80,15 @@
if(cooldowntime > world.time)
to_chat(user, "<span class='cultitalic'>The magic in [src] is weak, it will be ready to use again in [get_ETA()].</span>")
return
var/choice = input(user, selection_prompt, selection_title) as null|anything in choosable_items
var/pickedtype = choosable_items[choice]
if(pickedtype && Adjacent(user) && src && !QDELETED(src) && !user.incapacitated() && cooldowntime <= world.time)
var/choice = show_radial_menu(user, src, choosable_items, require_near = TRUE)
var/picked_type = choosable_items[choice]
if(!QDELETED(src) && picked_type && Adjacent(user) && !user.incapacitated() && cooldowntime <= world.time)
cooldowntime = world.time + creation_delay
var/obj/item/N = new pickedtype(get_turf(src))
to_chat(user, replacetext("[creation_message]", "%ITEM%", "[N.name]"))
var/obj/O = new picked_type
if(istype(O, /obj/structure) || !user.put_in_hands(O))
O.forceMove(get_turf(src))
to_chat(user, replacetext("[creation_message]", "%ITEM%", "[O.name]"))
/**
* Returns the cooldown time in minutes and seconds
+23 -20
View File
@@ -306,29 +306,32 @@
if("CONSTRUCT")
var/obj/structure/constructshell/shell = target
var/mob/living/simple_animal/shade/shade = locate() in src
var/list/construct_types = list("Juggernaut" = /mob/living/simple_animal/hostile/construct/armoured,
"Wraith" = /mob/living/simple_animal/hostile/construct/wraith,
"Artificer" = /mob/living/simple_animal/hostile/construct/builder)
/// Custom construct icons for different cults
var/list/construct_icons = list("Juggernaut" = image(icon = 'icons/mob/mob.dmi', icon_state = SSticker.cultdat.get_icon("juggernaut")),
"Wraith" = image(icon = 'icons/mob/mob.dmi', icon_state = SSticker.cultdat.get_icon("wraith")),
"Artificer" = image(icon = 'icons/mob/mob.dmi', icon_state = SSticker.cultdat.get_icon("builder")))
if(shade)
var/construct_class = alert(user, "Please choose which type of construct you wish to create.", null, "Juggernaut", "Wraith", "Artificer")
if(shell.active)
return // Don't want two people doing it at once
shell.active = TRUE
switch(construct_class)
if("Juggernaut")
var/mob/living/simple_animal/hostile/construct/armoured/C = new(shell.loc)
C.init_construct(shade, src, shell)
to_chat(C, "<B>You are a Juggernaut. Though slow, your shell can withstand extreme punishment, create shield walls and even deflect energy weapons, and rip apart enemies and walls alike.</B>")
if("Wraith")
var/mob/living/simple_animal/hostile/construct/wraith/C = new(shell.loc)
C.init_construct(shade, src, shell)
to_chat(C, "<B>You are a Wraith. Though relatively fragile, you are fast, deadly, and even able to phase through walls.</B>")
if("Artificer")
var/mob/living/simple_animal/hostile/construct/builder/C = new(shell.loc)
C.init_construct(shade, src, shell)
to_chat(C, "<B>You are an Artificer. You are incredibly weak and fragile, but you are able to construct fortifications, use magic missile, repair allied constructs (by clicking on them), </B><I>and most important of all create new constructs</I><B> (Use your Artificer spell to summon a new construct shell and Summon Soulstone to create a new soulstone).</B>")
var/construct_choice = show_radial_menu(user, shell, construct_icons, custom_check = CALLBACK(src, .proc/radial_check, user), require_near = TRUE)
var/picked_class = construct_types[construct_choice]
if((picked_class && !QDELETED(shell) && !QDELETED(src)) && user.Adjacent(shell) && !user.incapacitated() && radial_check(user))
var/mob/living/simple_animal/hostile/construct/C = new picked_class(shell.loc)
C.init_construct(shade, src, shell)
to_chat(C, C.playstyle_string)
else
to_chat(user, "<span class='danger'>Creation failed!</span>: The soul stone is empty! Go kill someone!")
return
/obj/item/soulstone/proc/radial_check(mob/user)
if(!ishuman(user)) // Should never happen, but just in case
return FALSE
var/mob/living/carbon/human/H = user
if(!H.is_in_hands(src)) // Not holding the soulstone
return FALSE
return TRUE
/mob/living/simple_animal/hostile/construct/proc/init_construct(mob/living/simple_animal/shade/shade, obj/item/soulstone/SS, obj/structure/constructshell/shell)
if(shade.mind)