Porting some VV updates from tg.

This commit is contained in:
Ghommie
2020-04-25 00:49:51 +02:00
parent debbd3edab
commit e17c51a85d
8 changed files with 255 additions and 43 deletions

View File

@@ -1379,3 +1379,47 @@ GLOBAL_LIST_EMPTY(custom_outfits) //Admin created outfits
else
message_admins("[key_name_admin(usr)] has [newstate ? "activated" : "deactivated"] job exp exempt status on [key_name_admin(C)]")
log_admin("[key_name(usr)] has [newstate ? "activated" : "deactivated"] job exp exempt status on [key_name(C)]")
/// 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 sortList(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 sortList(D.status_traits[chosen_trait])
if(!source)
return
REMOVE_TRAIT(D,chosen_trait,source)

View File

@@ -194,9 +194,10 @@ GLOBAL_PROTECT(VVpixelmovement)
else
variable = L[index]
//EXPERIMENTAL - Keep old associated value while modifying key, if any
var/found = L[variable]
if(!isnull(found))
old_assoc_value = found
if(IS_VALID_ASSOC_KEY(variable))
var/found = L[variable]
if(!isnull(found))
old_assoc_value = found
//
default = vv_get_class(objectvar, variable)

View File

@@ -47,5 +47,33 @@
usr.client.debug_variables(src)
if(href_list[VV_HK_MARK])
usr.client.mark_datum(target)
if(href_list[VV_HK_ADDCOMPONENT])
if(!check_rights(NONE))
return
var/list/names = list()
var/list/componentsubtypes = subtypesof(/datum/component)
names += "---Components---"
names += componentsubtypes
names += "---Elements---"
names += subtypesof(/datum/element)
var/result = input(usr, "Choose a component/element to add","better know what ur fuckin doin pal") as null|anything in names
if(!usr || !result || result == "---Components---" || result == "---Elements---")
return
if(QDELETED(src))
to_chat(usr, "That thing doesn't exist anymore!")
return
var/list/lst = get_callproc_args()
if(!lst)
return
var/datumname = "error"
lst.Insert(1, result)
if(result in componentsubtypes)
datumname = "component"
target._AddComponent(lst)
else
datumname = "element"
target._AddElement(lst)
log_admin("[key_name(usr)] has added [result] [datumname] to [key_name(src)].")
message_admins("<span class='notice'>[key_name_admin(usr)] has added [result] [datumname] to [key_name_admin(src)].</span>")
if(href_list[VV_HK_CALLPROC])
usr.client.callproc_datum(target)