Traits framework (#12548)

This commit is contained in:
Fox McCloud
2019-10-15 20:12:46 -04:00
committed by variableundefined
parent c2a963d7a8
commit d6a6debf94
47 changed files with 557 additions and 86 deletions
+44
View File
@@ -1111,3 +1111,47 @@ Traitors and the like can also be revived with the previous role mostly intact.
dat += "[S.name] - <a href='?src=[S.UID()];announce=1'>Announce</a> | <a href='?src=[S.UID()];remove=1'>Remove</a><br>"
dat += "<br><a href='?src=[UID()];add_station_goal=1'>Add New Goal</a>"
usr << browse(dat, "window=goals;size=400x400")
/// Allow admin to add or remove traits of datum
/datum/admins/proc/modify_traits(datum/D)
if(!D)
return
var/add_or_remove = input("Remove/Add?", "Trait Remove/Add") as null|anything in list("Add","Remove")
if(!add_or_remove)
return
var/list/availible_traits = list()
switch(add_or_remove)
if("Add")
for(var/key in GLOB.traits_by_type)
if(istype(D,key))
availible_traits += GLOB.traits_by_type[key]
if("Remove")
if(!GLOB.trait_name_map)
GLOB.trait_name_map = generate_trait_name_map()
for(var/trait in D.status_traits)
var/name = GLOB.trait_name_map[trait] || trait
availible_traits[name] = trait
var/chosen_trait = input("Select trait to modify", "Trait") as null|anything in availible_traits
if(!chosen_trait)
return
chosen_trait = availible_traits[chosen_trait]
var/source = "adminabuse"
switch(add_or_remove)
if("Add") //Not doing source choosing here intentionally to make this bit faster to use, you can always vv it.
ADD_TRAIT(D, chosen_trait, source)
if("Remove")
var/specific = input("All or specific source ?", "Trait Remove/Add") as null|anything in list("All","Specific")
if(!specific)
return
switch(specific)
if("All")
source = null
if("Specific")
source = input("Source to be removed","Trait Remove/Add") as null|anything in D.status_traits[chosen_trait]
if(!source)
return
REMOVE_TRAIT(D, chosen_trait, source)