From 6c50583b34891cc4ac84fa719771eaff01aa4fdb Mon Sep 17 00:00:00 2001
From: kevinz000 <2003111+kevinz000@users.noreply.github.com>
Date: Tue, 10 Sep 2019 11:13:09 -0700
Subject: [PATCH] Fixes VV renaming (#46410)
* vv fix
* forgot the define
---
code/__DEFINES/vv.dm | 1 +
code/game/atoms.dm | 9 ++++++++-
code/modules/mob/mob.dm | 26 +++++++++++++++-----------
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm
index 9948f5cc927..aec3dbccc69 100644
--- a/code/__DEFINES/vv.dm
+++ b/code/__DEFINES/vv.dm
@@ -81,6 +81,7 @@
#define VV_HK_ADD_REAGENT "addreagent"
#define VV_HK_TRIGGER_EMP "empulse"
#define VV_HK_TRIGGER_EXPLOSION "explode"
+#define VV_HK_AUTO_RENAME "auto_rename"
// /obj
#define VV_HK_OSAY "osay"
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 1876d27a76b..33fd61adfcc 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -925,11 +925,15 @@
var/angle = input(usr, "Choose angle to rotate","Transform Mod") as null|num
if(!isnull(angle))
transform = M.Turn(angle)
+ if(href_list[VV_HK_AUTO_RENAME] && check_rights(R_VAREDIT))
+ var/newname = input(usr, "What do you want to rename this to?", "Automatic Rename") as null|text
+ if(newname)
+ vv_auto_rename(newname)
/atom/vv_get_header()
. = ..()
var/refid = REF(src)
- . += "[VV_HREF_TARGETREF_1V(refid, VV_HK_BASIC_EDIT, "[src]", NAMEOF(src, name))]"
+ . += "[VV_HREF_TARGETREF(refid, VV_HK_AUTO_RENAME, "[src]")]"
. += "
<< [dir2text(dir) || dir] >>"
///Where atoms should drop if taken from this atom
@@ -939,6 +943,9 @@
return null
return L.AllowDrop() ? L : L.drop_location()
+/atom/proc/vv_auto_rename(newname)
+ name = newname
+
/**
* An atom has entered this atom's contents
*
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 071c0fbdf38..1892754d0a4 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -11,11 +11,11 @@
* Unsets the focus var
*
* Clears alerts for this mob
- *
+ *
* Resets all the observers perspectives to the tile this mob is on
- *
+ *
* qdels any client colours in place on this mob
- *
+ *
* Ghostizes the client attached to this mob
*
* Parent call
@@ -48,7 +48,7 @@
*
* Sends global signal COMSIG_GLOB_MOB_CREATED
*
- * Adds to global lists
+ * Adds to global lists
* * GLOB.mob_list
* * GLOB.mob_directory (by tag)
* * GLOB.dead_mob_list - if mob is dead
@@ -134,7 +134,7 @@
/mob/proc/get_photo_description(obj/item/camera/camera)
return "a ... thing?"
-/**
+/**
* Show a message to this mob (visual)
*/
/mob/proc/show_message(msg, type, alt_msg, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
@@ -169,7 +169,7 @@
/**
* Generate a visible message from this atom
- *
+ *
* Show a message to all player mobs who sees this atom
*
* Show a message to the src mob (if the src is a mob)
@@ -325,7 +325,7 @@
return
/**
- * Equip an item to the slot or delete
+ * Equip an item to the slot or delete
*
* This is just a commonly used configuration for the equip_to_slot_if_possible() proc, used to
* equip people when the round starts and when events happen and such.
@@ -542,7 +542,7 @@
memory_throttle_time = world.time + 5 SECONDS
msg = copytext(msg, 1, MAX_MESSAGE_LEN)
msg = sanitize(msg)
-
+
mind.store_memory(msg)
else
to_chat(src, "You don't have a mind datum for some reason, so you can't add a note to it.")
@@ -671,7 +671,7 @@
return
if(isAI(M))
return
-/**
+/**
* Handle the result of a click drag onto this mob
*
* For mobs this just shows the inventory
@@ -688,7 +688,7 @@
/**
* Output an update to the stat panel for the client
- *
+ *
* calculates client ping, round id, server time, time dilation and other data about the round
* and puts it in the mob status panel on a regular loop
*/
@@ -1006,7 +1006,7 @@
* Fully update the name of a mob
*
* This will update a mob's name, real_name, mind.name, GLOB.data_core records, pda, id and traitor text
- *
+ *
* Calling this proc without an oldname will only update the mob and skip updating the pda, id and records ~Carn
*/
/mob/proc/fully_replace_character_name(oldname,newname)
@@ -1197,6 +1197,10 @@
return debug_variable(var_name, logging, 0, src, FALSE)
. = ..()
+/mob/vv_auto_rename(new_name)
+ //Do not do parent's actions, as we *usually* do this differently.
+ fully_replace_character_name(real_name, new_name)
+
///Show the language menu for this mob
/mob/verb/open_language_menu()
set name = "Open Language Menu"