POLARIS: Communicator small refactor

This commit is contained in:
Arokha Sieyes
2018-03-15 23:47:00 -04:00
committed by Leshana
parent c492d1a21b
commit cad8df658e
4 changed files with 9 additions and 13 deletions

View File

@@ -134,11 +134,7 @@
if(href_list["rename"]) if(href_list["rename"])
var/new_name = sanitizeSafe(input(usr,"Please enter your name.","Communicator",usr.name) ) var/new_name = sanitizeSafe(input(usr,"Please enter your name.","Communicator",usr.name) )
if(new_name) if(new_name)
owner = new_name register_device(new_name)
name = "[owner]'s [initial(name)]"
if(camera)
camera.name = name
camera.c_tag = name
if(href_list["toggle_visibility"]) if(href_list["toggle_visibility"])
switch(network_visibility) switch(network_visibility)

View File

@@ -75,12 +75,12 @@ var/global/list/obj/item/device/communicator/all_communicators = list()
//This is a pretty terrible way of doing this. //This is a pretty terrible way of doing this.
spawn(5 SECONDS) //Wait for our mob to finish spawning. spawn(5 SECONDS) //Wait for our mob to finish spawning.
if(ismob(loc)) if(ismob(loc))
register_device(loc) register_device(loc.name)
initialize_exonet(loc) initialize_exonet(loc)
else if(istype(loc, /obj/item/weapon/storage)) else if(istype(loc, /obj/item/weapon/storage))
var/obj/item/weapon/storage/S = loc var/obj/item/weapon/storage/S = loc
if(ismob(S.loc)) if(ismob(S.loc))
register_device(S.loc) register_device(S.loc.name)
initialize_exonet(S.loc) initialize_exonet(S.loc)
// Proc: examine() // Proc: examine()
@@ -268,12 +268,12 @@ var/global/list/obj/item/device/communicator/all_communicators = list()
// Proc: register_device() // Proc: register_device()
// Parameters: 1 (user - the person to use their name for) // Parameters: 1 (user - the person to use their name for)
// Description: Updates the owner's name and the device's name. // Description: Updates the owner's name and the device's name.
/obj/item/device/communicator/proc/register_device(mob/user) /obj/item/device/communicator/proc/register_device(new_name)
if(!user) if(!new_name)
return return
owner = user.name owner = new_name
name = "[owner]'s [initial(name)]" name = "[new_name]'s [initial(name)]"
if(camera) if(camera)
camera.name = name camera.name = name
camera.c_tag = name camera.c_tag = name

View File

@@ -258,7 +258,7 @@ var/list/ai_verbs_default = list(
aiPDA.name = pickedName + " (" + aiPDA.ownjob + ")" aiPDA.name = pickedName + " (" + aiPDA.ownjob + ")"
if(aiCommunicator) if(aiCommunicator)
aiCommunicator.register_device(src) aiCommunicator.register_device(src.name)
/* /*
The AI Power supply is a dummy object used for powering the AI since only machinery should be using power. The AI Power supply is a dummy object used for powering the AI since only machinery should be using power.

View File

@@ -210,7 +210,7 @@
/mob/living/silicon/robot/proc/setup_communicator() /mob/living/silicon/robot/proc/setup_communicator()
if (!communicator) if (!communicator)
communicator = new/obj/item/device/communicator/integrated(src) communicator = new/obj/item/device/communicator/integrated(src)
communicator.register_device(src, "[modtype] [braintype]") communicator.register_device(src.name, "[modtype] [braintype]")
//If there's an MMI in the robot, have it ejected when the mob goes away. --NEO //If there's an MMI in the robot, have it ejected when the mob goes away. --NEO
//Improved /N //Improved /N