diff --git a/code/game/gamemodes/changeling/evolution_menu.dm b/code/game/gamemodes/changeling/evolution_menu.dm index b3b4000bbf1..3f935a4c163 100644 --- a/code/game/gamemodes/changeling/evolution_menu.dm +++ b/code/game/gamemodes/changeling/evolution_menu.dm @@ -1,300 +1,88 @@ -GLOBAL_LIST_EMPTY(sting_paths) -// totally stolen from the new player panel. YAYY +/// The evolution menu will be shown in the compact mode, with only powers and costs being displayed. +#define COMPACT_MODE 0 +/// The evolution menu will be shown in the expanded mode, with powers, costs, and ability descriptions being displayed. +#define EXPANDED_MODE 1 /datum/action/changeling/evolution_menu name = "-Evolution Menu-" //Dashes are so it's listed before all the other abilities. desc = "Choose our method of subjugation." button_icon_state = "changelingsting" dna_cost = 0 + /// Which UI view will be displayed. Compact mode will show only ability names, and will leave out their descriptions and helptext. + var/view_mode = EXPANDED_MODE + /// A list containing the names of bought changeling abilities. For use with the UI. + var/list/purchased_abilities = list() + /// A list containing every purchasable changeling ability. Includes its name, description, helptext and cost. + var/static/list/ability_list = list() + +/datum/action/changeling/evolution_menu/Grant(mob/M) + . = ..() + if(length(ability_list)) + return // List is already populated. + + for(var/action in subtypesof(/datum/action/changeling)) + var/datum/action/changeling/C = action + if(initial(C.dna_cost) <= 0) // Filter out innate abilities like DNA sting, Evolution menu, etc. + continue + ability_list += list(list( + "name" = initial(C.name), + "description" = initial(C.desc), + "helptext" = initial(C.helptext), + "cost" = initial(C.dna_cost) + )) /datum/action/changeling/evolution_menu/Trigger() - if(!usr || !usr.mind || !usr.mind.changeling) - return - var/datum/changeling/changeling = usr.mind.changeling + tgui_interact(owner) - if(!GLOB.sting_paths || !GLOB.sting_paths.len) - GLOB.sting_paths = init_subtypes(/datum/action/changeling) +/datum/action/changeling/evolution_menu/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_always_state) + ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) + if(!ui) + ui = new(user, src, ui_key, "EvolutionMenu", "Evolution Menu", 480, 574, master_ui, state) + ui.set_autoupdate(FALSE) + ui.open() - var/dat = create_menu(changeling) - usr << browse(dat, "window=powers;size=600x700")//900x480 +/datum/action/changeling/evolution_menu/tgui_data(mob/user) + var/datum/changeling/cling = owner.mind.changeling + var/list/data = list( + "can_respec" = cling.canrespec, + "evo_points" = cling.geneticpoints, + "purchsed_abilities" = purchased_abilities, + "view_mode" = view_mode + ) + return data -/datum/action/changeling/evolution_menu/proc/create_menu(var/datum/changeling/changeling) - var/dat - dat +="
|
- Changeling Evolution Menu - Hover over a power to see more information - Current ability choices remaining: [changeling.geneticpoints] - By rendering a lifeform to a husk, we gain enough power to alter and adapt our evolutions. - (Readapt) - - |
-
| - Search: - | -
|
-
-
- Evolve [cling_power][ownsthis ? " - Purchased" : (cling_power.req_dna>changeling.absorbedcount ? " - Requires [cling_power.req_dna] absorptions" : " - Cost: [cling_power.dna_cost]")]
-
- - |
-