Static communicators (#9032)

* commstatic

* further work
This commit is contained in:
Greenjoe12345
2023-03-13 23:49:06 -08:00
committed by GitHub
parent 01d7833f13
commit fa3434f7cf
7 changed files with 146 additions and 23 deletions
@@ -150,9 +150,12 @@
if(..())
return 1
if(href_list["rename"])
var/new_name = sanitizeSafe(input(usr,"Please enter your name.","Communicator",usr.name) )
if(new_name)
register_device(new_name)
if(!can_rename)
to_chat(usr, "Renaming forbidden on this device.")
else
var/new_name = sanitizeSafe(input(usr,"Please enter your name.","Communicator",usr.name) )
if(new_name)
register_device(new_name)
if(href_list["toggle_visibility"])
switch(network_visibility)
@@ -73,6 +73,8 @@ var/global/list/obj/item/communicator/all_communicators = list()
var/list/communicating = list()
var/update_ticks = 0
var/newsfeed_channel = 0
var/static_name = null
var/can_rename = 1
// Proc: New()
// Parameters: None
@@ -95,6 +97,9 @@ var/global/list/obj/item/communicator/all_communicators = list()
// Parameters: None
// Description: Tries to register ourselves to the mob that we've presumably spawned in. Not the most amazing way of doing this.
/obj/item/communicator/proc/register_to_holder()
if(static_name)
register_device(static_name)
initialize_exonet(loc)
if(ismob(loc))
register_device(loc.name)
initialize_exonet(loc)
@@ -279,7 +284,10 @@ var/global/list/obj/item/communicator/all_communicators = list()
return
owner = new_name
name = "[new_name]'s [initial(name)]"
if(static_name)
name = "[new_name]"
else
name = "[new_name]'s [initial(name)]"
if(camera)
camera.name = name
camera.c_tag = name
@@ -0,0 +1,27 @@
/obj/item/communicator/desktop
name = "desktop communicator"
desc = "A static communicator unit, seen in homes, offices and the receptions of businesses across the galaxy."
icon_state = "commstatic"
anchored = 1
static_name = "fixed communicator"
can_rename = 0
/obj/item/communicator/desktop/attack_hand(mob/user)
return attack_self(user)
/obj/item/communicator/desktop/initialize_exonet(mob/user)
if(!static_name)
return
if(!exonet)
exonet = new(src)
if(!exonet.address)
exonet.make_address("communicator-[static_name]")
if(!node)
node = get_exonet_node()
populate_known_devices()
/obj/item/communicator/desktop/register_to_holder()
if(!static_name)
return ..()
register_device(static_name)
initialize_exonet()