// READ: Don't use the apostrophe in name or desc. Causes script errors. //Ling power's evolution menu entry datum should be contained alongside the mob proc for the actual power, in their own file. var/list/powers = subtypesof(/datum/power/changeling) //needed for the badmin verb for now var/list/datum/power/changeling/powerinstances = list() /datum/power //Could be used by other antags too var/name = "Power" var/desc = "Placeholder" var/helptext = "" var/enhancedtext = "" var/isVerb = 1 // Is it an active power, or passive? var/verbpath // Path to a verb that contains the effects. var/make_hud_button = 1 // Is this ability significant enough to dedicate screen space for a HUD button? var/ability_icon_state = null // icon_state for icons for the ability HUD. Must be in screen_spells.dmi. /datum/power/changeling var/allowduringlesserform = 0 var/genomecost = 500000 // Cost for the changling to evolve this power. // Modularchangling, totally stolen from the new player panel. YAYY /datum/changeling/proc/EvolutionMenu()//The new one set name = "-Evolution Menu-" set category = "Changeling" set desc = "Adapt yourself carefully." if(!usr || !usr.mind || !usr.mind.changeling) return src = usr.mind.changeling if(!powerinstances.len) for(var/P in powers) powerinstances += new P() var/dat = "Changling Evolution Menu" //javascript, the part that does most of the work~ dat += {" "} //body tag start + onload and onkeypress (onkeyup) javascript event calls dat += "" //title + search bar dat += {"
Changling Evolution Menu
Hover over a power to see more information
Current evolution points left to evolve with: [geneticpoints]
Absorb other changelings to acquire more evolution points

Search:
"} //player table header dat += {" "} var/i = 1 for(var/datum/power/changeling/P in powerinstances) var/ownsthis = 0 if(P in purchased_powers) ownsthis = 1 var/color = "#e6e6e6" if(i%2 == 0) color = "#f2f2f2" dat += {" "} i++ //player table ending dat += {"
Evolve [P] - Cost: [ownsthis ? "Purchased" : P.genomecost]
"} usr << browse(dat, "window=powers;size=900x480") /datum/changeling/Topic(href, href_list) ..() if(!ismob(usr)) return if(href_list["P"]) var/datum/mind/M = usr.mind if(!istype(M)) return purchasePower(M, href_list["P"]) call(/datum/changeling/proc/EvolutionMenu)() /datum/changeling/proc/purchasePower(var/datum/mind/M, var/Pname, var/remake_verbs = 1) if(!M || !M.changeling) return var/datum/power/changeling/Thepower = Pname for (var/datum/power/changeling/P in powerinstances) //to_world("[P] - [Pname] = [P.name == Pname ? "True" : "False"]") if(P.name == Pname) Thepower = P break if(Thepower == null) to_chat(M.current, "This is awkward. Changeling power purchase failed, please report this bug to a coder!") return if(Thepower in purchased_powers) to_chat(M.current, "We have already evolved this ability!") return if(geneticpoints < Thepower.genomecost) to_chat(M.current, "We cannot evolve this... yet. We must acquire more DNA.") return geneticpoints -= Thepower.genomecost purchased_powers += Thepower if(Thepower.genomecost > 0) purchased_powers_history.Add("[Pname] ([Thepower.genomecost] points)") if(Thepower.make_hud_button && Thepower.isVerb) if(!M.current.ability_master) M.current.ability_master = new /obj/screen/movable/ability_master(M.current) M.current.ability_master.add_ling_ability( object_given = M.current, verb_given = Thepower.verbpath, name_given = Thepower.name, ability_icon_given = Thepower.ability_icon_state, arguments = list() ) if(!Thepower.isVerb && Thepower.verbpath) call(M.current, Thepower.verbpath)() else if(remake_verbs) M.current.make_changeling()