var/list/sting_paths // totally stolen from the new player panel. YAYY /obj/effect/proc_holder/changeling/evolution_menu name = "-Evolution Menu-" //Dashes are so it's listed before all the other abilities. desc = "Choose our method of subjugation." dna_cost = 0 /obj/effect/proc_holder/changeling/evolution_menu/Click() if(!usr || !usr.mind || !usr.mind.changeling) return var/datum/changeling/changeling = usr.mind.changeling if(!sting_paths) sting_paths = init_paths(/obj/effect/proc_holder/changeling) var/dat = create_menu(changeling) usr << browse(dat, "window=powers;size=600x700")//900x480 /obj/effect/proc_holder/changeling/evolution_menu/proc/create_menu(datum/changeling/changeling) var/dat 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 += {"
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:
"} //player table header dat += {" "} var/i = 1 for(var/path in sting_paths) var/obj/effect/proc_holder/changeling/P = new path() if(P.dna_cost <= 0) //Let's skip the crap we start with. Keeps the evolution menu uncluttered. continue var/ownsthis = changeling.has_sting(P) var/color if(ownsthis) if(i%2 == 0) color = "#d8ebd8" else color = "#c3dec3" else if(i%2 == 0) color = "#f2f2f2" else color = "#e6e6e6" dat += {" "} i++ //player table ending dat += {"
Evolve [P][ownsthis ? " - Purchased" : (P.req_dna>changeling.absorbedcount ? " - Requires [P.req_dna] absorptions" : " - Cost: [P.dna_cost]")]
"} return dat /obj/effect/proc_holder/changeling/evolution_menu/Topic(href, href_list) ..() if(!(iscarbon(usr) && usr.mind && usr.mind.changeling)) return if(href_list["P"]) usr.mind.changeling.purchasePower(usr, href_list["P"]) else if(href_list["readapt"]) usr.mind.changeling.lingRespec(usr) var/dat = create_menu(usr.mind.changeling) usr << browse(dat, "window=powers;size=600x700") ///// /datum/changeling/proc/purchasePower(mob/living/carbon/user, sting_name) var/obj/effect/proc_holder/changeling/thepower = null if(!sting_paths) sting_paths = init_paths(/obj/effect/proc_holder/changeling) for(var/path in sting_paths) var/obj/effect/proc_holder/changeling/S = new path() if(S.name == sting_name) thepower = S if(thepower == null) user << "This is awkward. Changeling power purchase failed, please report this bug to a coder!" return if(absorbedcount < thepower.req_dna) user << "We lack the energy to evolve this ability!" return if(has_sting(thepower)) user << "We have already evolved this ability!" return if(thepower.dna_cost < 0) user << "We cannot evolve this ability." return if(geneticpoints < thepower.dna_cost) user << "We have reached our capacity for abilities." return if(user.status_flags & FAKEDEATH)//To avoid potential exploits by buying new powers while in stasis, which clears your verblist. user << "We lack the energy to evolve new abilities right now." return geneticpoints -= thepower.dna_cost purchasedpowers += thepower thepower.on_purchase(user) //Reselect powers /datum/changeling/proc/lingRespec(mob/user) if(!ishuman(user)) user << "We can't remove our evolutions in this form!" return if(canrespec) user << "We have removed our evolutions from this form, and are now ready to readapt." user.remove_changeling_powers(1) canrespec = 0 user.make_changeling() return 1 else user << "You lack the power to readapt your evolutions!" return 0 /mob/proc/make_changeling() if(!mind) return if(!ishuman(src) && !ismonkey(src)) return if(!mind.changeling) mind.changeling = new /datum/changeling(gender) if(!sting_paths) sting_paths = init_paths(/obj/effect/proc_holder/changeling) if(mind.changeling.purchasedpowers) remove_changeling_powers(1) // purchase free powers. for(var/path in sting_paths) var/obj/effect/proc_holder/changeling/S = new path() if(!S.dna_cost) if(!mind.changeling.has_sting(S)) mind.changeling.purchasedpowers+=S S.on_purchase(src) var/mob/living/carbon/C = src //only carbons have dna now, so we have to typecaste if(ishuman(C)) var/datum/changelingprofile/prof = mind.changeling.add_new_profile(C, src) mind.changeling.first_prof = prof return 1 /datum/changeling/proc/reset() chosen_sting = null geneticpoints = initial(geneticpoints) sting_range = initial(sting_range) chem_storage = initial(chem_storage) chem_recharge_rate = initial(chem_recharge_rate) chem_charges = min(chem_charges, chem_storage) chem_recharge_slowdown = initial(chem_recharge_slowdown) mimicing = "" /mob/proc/remove_changeling_powers(keep_free_powers=0) if(ishuman(src) || ismonkey(src)) if(mind && mind.changeling) mind.changeling.changeling_speak = 0 mind.changeling.reset() for(var/obj/effect/proc_holder/changeling/p in mind.changeling.purchasedpowers) if(p.dna_cost == 0 && keep_free_powers) continue mind.changeling.purchasedpowers -= p p.on_refund(src) if(hud_used) hud_used.lingstingdisplay.icon_state = null hud_used.lingstingdisplay.invisibility = 101 /datum/changeling/proc/has_sting(obj/effect/proc_holder/changeling/power) for(var/obj/effect/proc_holder/changeling/P in purchasedpowers) if(power.name == P.name) return 1 return 0