Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Standardizes formatting in vv_do_topic() #880

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/datums/outfit.dm
Original file line number Diff line number Diff line change
Expand Up @@ -532,5 +532,11 @@

/datum/outfit/vv_do_topic(list/href_list)
. = ..()

if(!.)
return

if(href_list[VV_HK_TO_OUTFIT_EDITOR])
if(!check_rights(NONE))
return
usr.client.open_outfit_editor(src)
4 changes: 4 additions & 0 deletions code/datums/weakrefs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@

/datum/weakref/vv_do_topic(list/href_list)
. = ..()

if(!.)
return

if(href_list[VV_HK_WEAKREF_RESOLVE])
if(!check_rights(NONE))
return
Expand Down
59 changes: 41 additions & 18 deletions code/game/atom/atom_vv.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,17 @@

/atom/vv_do_topic(list/href_list)
. = ..()
if(href_list[VV_HK_ADD_REAGENT] && check_rights(R_VAREDIT))

if(!.)
return

if(href_list[VV_HK_ADD_REAGENT])
if(!check_rights(R_VAREDIT))
return
if(!reagents)
var/amount = input(usr, "Specify the reagent size of [src]", "Set Reagent Size", 50) as num|null
if(amount)
create_reagents(amount)

if(reagents)
var/chosen_id
switch(tgui_alert(usr, "Choose a method.", "Add Reagents", list("Search", "Choose from a list", "I'm feeling lucky")))
Expand Down Expand Up @@ -61,27 +66,32 @@
log_admin("[key_name(usr)] has added [amount] units of [chosen_id] to [src]")
message_admins(span_notice("[key_name(usr)] has added [amount] units of [chosen_id] to [src]"))

if(href_list[VV_HK_TRIGGER_EXPLOSION] && check_rights(R_FUN))
if(href_list[VV_HK_TRIGGER_EXPLOSION])
if(!check_rights(R_FUN))
return
usr.client.cmd_admin_explosion(src)

if(href_list[VV_HK_TRIGGER_EMP] && check_rights(R_FUN))
if(href_list[VV_HK_TRIGGER_EMP])
if(!check_rights(R_FUN))
return
usr.client.cmd_admin_emp(src)

if(href_list[VV_HK_SHOW_HIDDENPRINTS] && check_rights(R_ADMIN))
if(href_list[VV_HK_SHOW_HIDDENPRINTS])
if(!check_rights(R_ADMIN))
return
usr.client.cmd_show_hiddenprints(src)

if(href_list[VV_HK_ARMOR_MOD])
if(!check_rights(NONE))
return
var/list/pickerlist = list()
var/list/armorlist = get_armor().get_rating_list()

for (var/i in armorlist)
pickerlist += list(list("value" = armorlist[i], "name" = i))

var/list/result = presentpicker(usr, "Modify armor", "Modify armor: [src]", Button1="Save", Button2 = "Cancel", Timeout=FALSE, inputtype = "text", values = pickerlist)
var/list/armor_all = ARMOR_LIST_ALL()

if (islist(result))
if (result["button"] != 2) // If the user pressed the cancel button
if(islist(result))
if(result["button"] != 2) // If the user pressed the cancel button
// text2num conveniently returns a null on invalid values
var/list/converted = list()
for(var/armor_key in armor_all)
Expand All @@ -102,7 +112,9 @@
return
ai_controller = new result(src)

if(href_list[VV_HK_MODIFY_TRANSFORM] && check_rights(R_VAREDIT))
if(href_list[VV_HK_MODIFY_TRANSFORM])
if(!check_rights(R_VAREDIT))
return
var/result = input(usr, "Choose the transformation to apply","Transform Mod") as null|anything in list("Scale","Translate","Rotate","Shear")
var/matrix/M = transform
if(!result)
Expand Down Expand Up @@ -131,10 +143,11 @@
if(isnull(angle))
return
transform = M.Turn(angle)

SEND_SIGNAL(src, COMSIG_ATOM_VV_MODIFY_TRANSFORM)

if(href_list[VV_HK_SPIN_ANIMATION] && check_rights(R_VAREDIT))
if(href_list[VV_HK_SPIN_ANIMATION])
if(!check_rights(R_VAREDIT))
return
var/num_spins = input(usr, "Do you want infinite spins?", "Spin Animation") in list("Yes", "No")
if(num_spins == "No")
num_spins = input(usr, "How many spins?", "Spin Animation") as null|num
Expand All @@ -155,25 +168,35 @@
return
SpinAnimation(spin_speed, num_spins, direction)

if(href_list[VV_HK_STOP_ALL_ANIMATIONS] && check_rights(R_VAREDIT))
if(href_list[VV_HK_STOP_ALL_ANIMATIONS])
if(!check_rights(R_VAREDIT))
return
var/result = input(usr, "Are you sure?", "Stop Animating") in list("Yes", "No")
if(result == "Yes")
animate(src, transform = null, flags = ANIMATION_END_NOW) // Literally just fucking stop animating entirely because admin said so
return

if(href_list[VV_HK_AUTO_RENAME] && check_rights(R_VAREDIT))
if(href_list[VV_HK_AUTO_RENAME])
if(!check_rights(R_VAREDIT))
return
var/newname = input(usr, "What do you want to rename this to?", "Automatic Rename") as null|text
// Check the new name against the chat filter. If it triggers the IC chat filter, give an option to confirm.
if(newname && !(is_ic_filtered(newname) || is_soft_ic_filtered(newname) && tgui_alert(usr, "Your selected name contains words restricted by IC chat filters. Confirm this new name?", "IC Chat Filter Conflict", list("Confirm", "Cancel")) != "Confirm"))
vv_auto_rename(newname)

if(href_list[VV_HK_EDIT_FILTERS] && check_rights(R_VAREDIT))
if(href_list[VV_HK_EDIT_FILTERS])
if(!check_rights(R_VAREDIT))
return
usr.client?.open_filter_editor(src)

if(href_list[VV_HK_EDIT_COLOR_MATRIX] && check_rights(R_VAREDIT))
if(href_list[VV_HK_EDIT_COLOR_MATRIX])
if(!check_rights(R_VAREDIT))
return
usr.client?.open_color_matrix_editor(src)

if(href_list[VV_HK_TEST_MATRIXES] && check_rights(R_VAREDIT))
if(href_list[VV_HK_TEST_MATRIXES])
if(!check_rights(R_VAREDIT))
return
usr.client?.open_matrix_tester(src)

/atom/vv_get_header()
Expand Down
4 changes: 0 additions & 4 deletions code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,6 @@
if(href_list[VV_HK_GET_MOVABLE])
if(!check_rights(R_ADMIN))
return

if(QDELETED(src))
return
forceMove(get_turf(usr))
Expand All @@ -1657,16 +1656,13 @@
if(href_list[VV_HK_DEADCHAT_PLAYS] && check_rights(R_FUN))
if(tgui_alert(usr, "Allow deadchat to control [src] via chat commands?", "Deadchat Plays [src]", list("Allow", "Cancel")) != "Allow")
return

// Alert is async, so quick sanity check to make sure we should still be doing this.
if(QDELETED(src))
return

// This should never happen, but if it does it should not be silent.
if(deadchat_plays() == COMPONENT_INCOMPATIBLE)
to_chat(usr, span_warning("Deadchat control not compatible with [src]."))
CRASH("deadchat_control component incompatible with object of type: [type]")

to_chat(usr, span_notice("Deadchat now control [src]."))
log_admin("[key_name(usr)] has added deadchat control to [src]")
message_admins(span_notice("[key_name(usr)] has added deadchat control to [src]"))
Expand Down
9 changes: 3 additions & 6 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,9 @@
if(!.)
return

if(href_list[VV_HK_ADD_FANTASY_AFFIX] && check_rights(R_FUN))

if(href_list[VV_HK_ADD_FANTASY_AFFIX])
if(!check_rights(R_FUN))
return
//gathering all affixes that make sense for this item
var/list/prefixes = list()
var/list/suffixes = list()
Expand All @@ -507,13 +508,11 @@
prefixes[affix_choice.name] = affix_choice
else
suffixes[affix_choice.name] = affix_choice

//making it more presentable here
var/list/affixes = list("---PREFIXES---")
affixes.Add(prefixes)
affixes.Add("---SUFFIXES---")
affixes.Add(suffixes)

//admin picks, cleanup the ones we didn't do and handle chosen
var/picked_affix_name = tgui_input_list(usr, "Affix to add to [src]", "Enchant [src]", affixes)
if(isnull(picked_affix_name))
Expand All @@ -527,7 +526,6 @@
fantasy_quality++
else
fantasy_quality--

//name gets changed by the component so i want to store it for feedback later
var/before_name = name
//naming these vars that i'm putting into the fantasy component to make it more readable
Expand All @@ -537,7 +535,6 @@
if(AddComponent(/datum/component/fantasy, fantasy_quality, list(affix), canFail, announce) == COMPONENT_INCOMPATIBLE)
to_chat(usr, span_warning("Fantasy component not compatible with [src]."))
CRASH("fantasy component incompatible with object of type: [type]")

to_chat(usr, span_notice("[before_name] now has [picked_affix_name]!"))
log_admin("[key_name(usr)] has added [picked_affix_name] fantasy affix to [before_name]")
message_admins(span_notice("[key_name(usr)] has added [picked_affix_name] fantasy affix to [before_name]"))
Expand Down
82 changes: 42 additions & 40 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -227,50 +227,52 @@ GLOBAL_LIST_EMPTY(objects_by_id_tag)
VV_DROPDOWN_OPTION(VV_HK_OSAY, "Object Say")

/obj/vv_do_topic(list/href_list)
if(!(. = ..()))
. = ..()

if(!.)
return

if(href_list[VV_HK_OSAY])
if(check_rights(R_FUN, FALSE))
usr.client.object_say(src)
if(!check_rights(R_FUN, FALSE))
return
usr.client.object_say(src)

if(href_list[VV_HK_MASS_DEL_TYPE])
if(check_rights(R_DEBUG|R_SERVER))
var/action_type = tgui_alert(usr, "Strict type ([type]) or type and all subtypes?",,list("Strict type","Type and subtypes","Cancel"))
if(action_type == "Cancel" || !action_type)
return

if(tgui_alert(usr, "Are you really sure you want to delete all objects of type [type]?",,list("Yes","No")) != "Yes")
return

if(tgui_alert(usr, "Second confirmation required. Delete?",,list("Yes","No")) != "Yes")
return

var/O_type = type
switch(action_type)
if("Strict type")
var/i = 0
for(var/obj/Obj in world)
if(Obj.type == O_type)
i++
qdel(Obj)
CHECK_TICK
if(!i)
to_chat(usr, "No objects of this type exist")
return
log_admin("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ")
message_admins(span_notice("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) "))
if("Type and subtypes")
var/i = 0
for(var/obj/Obj in world)
if(istype(Obj,O_type))
i++
qdel(Obj)
CHECK_TICK
if(!i)
to_chat(usr, "No objects of this type exist")
return
log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ")
message_admins(span_notice("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) "))
if(!check_rights(R_DEBUG|R_SERVER))
return
var/action_type = tgui_alert(usr, "Strict type ([type]) or type and all subtypes?",,list("Strict type","Type and subtypes","Cancel"))
if(action_type == "Cancel" || !action_type)
return
if(tgui_alert(usr, "Are you really sure you want to delete all objects of type [type]?",,list("Yes","No")) != "Yes")
return
if(tgui_alert(usr, "Second confirmation required. Delete?",,list("Yes","No")) != "Yes")
return
var/O_type = type
switch(action_type)
if("Strict type")
var/i = 0
for(var/obj/Obj in world)
if(Obj.type == O_type)
i++
qdel(Obj)
CHECK_TICK
if(!i)
to_chat(usr, "No objects of this type exist")
return
log_admin("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ")
message_admins(span_notice("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) "))
if("Type and subtypes")
var/i = 0
for(var/obj/Obj in world)
if(istype(Obj,O_type))
i++
qdel(Obj)
CHECK_TICK
if(!i)
to_chat(usr, "No objects of this type exist")
return
log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ")
message_admins(span_notice("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) "))

/obj/examine(mob/user)
. = ..()
Expand Down
6 changes: 6 additions & 0 deletions code/modules/events/space_vines/vine_controller.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ GLOBAL_LIST_INIT(vine_mutations_list, init_vine_mutation_list())

/datum/spacevine_controller/vv_do_topic(href_list)
. = ..()

if(!.)
return

if(href_list[VV_HK_SPACEVINE_PURGE])
if(!check_rights(NONE))
return
if(tgui_alert(usr, "Are you sure you want to delete this spacevine cluster?", "Delete Vines", list("Yes", "No")) == "Yes")
DeleteVines()

Expand Down
8 changes: 7 additions & 1 deletion code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,10 @@

/mob/living/carbon/vv_do_topic(list/href_list)
. = ..()

if(!.)
return

if(href_list[VV_HK_MODIFY_BODYPART])
if(!check_rights(R_SPAWN))
return
Expand Down Expand Up @@ -1112,7 +1116,6 @@
if("replace")
var/limb2add = input(usr, "Select a bodypart type to add", "Add/Replace Bodypart") as null|anything in sort_list(limbtypes)
var/obj/item/bodypart/new_bp = new limb2add()

if(new_bp.replace_limb(src, special = TRUE))
admin_ticket_log("key_name_admin(usr)] has replaced [src]'s [BP.type] with [new_bp.type]")
qdel(BP)
Expand All @@ -1124,6 +1127,7 @@
if(!check_rights(NONE))
return
usr.client.manipulate_organs(src)

if(href_list[VV_HK_MARTIAL_ART])
if(!check_rights(NONE))
return
Expand All @@ -1144,6 +1148,7 @@
MA.teach(src)
log_admin("[key_name(usr)] has taught [MA] to [key_name(src)].")
message_admins(span_notice("[key_name_admin(usr)] has taught [MA] to [key_name_admin(src)]."))

if(href_list[VV_HK_GIVE_TRAUMA])
if(!check_rights(NONE))
return
Expand All @@ -1160,6 +1165,7 @@
if(BT)
log_admin("[key_name(usr)] has traumatized [key_name(src)] with [BT.name]")
message_admins(span_notice("[key_name_admin(usr)] has traumatized [key_name_admin(src)] with [BT.name]."))

if(href_list[VV_HK_CURE_TRAUMA])
if(!check_rights(NONE))
return
Expand Down
Loading
Loading