mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Adds PDA chatroom
This commit is contained in:
@@ -103,17 +103,4 @@
|
||||
if(ai.aiPDA != P && ai.aiPDA != src)
|
||||
ai.show_message("<i>Intercepted message from <b>[sender]</b></i> (Unknown / spam?) <i>to <b>[P:owner]</b>: [message]</i>")
|
||||
|
||||
//Commented out because we don't send messages like this anymore. Instead it will just popup in their chat window.
|
||||
//P.tnote += "<i><b>← From [sender] (Unknown / spam?):</b></i><br>[message]<br>"
|
||||
|
||||
PM.play_ringtone()
|
||||
//Search for holder of the PDA.
|
||||
var/mob/living/L = null
|
||||
if(P.loc && isliving(P.loc))
|
||||
L = P.loc
|
||||
//Maybe they are a pAI!
|
||||
else
|
||||
L = get(P, /mob/living/silicon)
|
||||
|
||||
if(L)
|
||||
L << "\icon[P] <b>Message from [sender] (Unknown / spam?), </b>\"[message]\" (Unable to Reply)"
|
||||
PM.notify("<b>Message from [sender] (Unknown / spam?), </b>\"[message]\" (Unable to Reply)", 0)
|
||||
@@ -149,7 +149,7 @@
|
||||
return
|
||||
|
||||
data["receiver_off"] = M.toff
|
||||
data["ringer_off"] = M.silent
|
||||
data["ringer_off"] = M.notify_silent
|
||||
data["current_ref"] = null
|
||||
data["current_name"] = user.current_pda_messaging
|
||||
|
||||
@@ -205,7 +205,7 @@
|
||||
M.toff = href_list["toggler"] != "1"
|
||||
return 1
|
||||
else if(href_list["ringer"])
|
||||
M.silent = href_list["ringer"] != "1"
|
||||
M.notify_silent = href_list["ringer"] != "1"
|
||||
return 1
|
||||
else if(href_list["select"])
|
||||
var/s = href_list["select"]
|
||||
|
||||
@@ -220,19 +220,9 @@
|
||||
display_to << "<span class='danger'>Error: unable to deliver message.</span>"
|
||||
display_spideros()
|
||||
return
|
||||
//Search for holder of the PDA.
|
||||
var/mob/living/L = null
|
||||
if(P.loc && isliving(P.loc))
|
||||
L = P.loc
|
||||
//Maybe they are a pAI!
|
||||
else
|
||||
L = get(P, /mob/living/silicon)
|
||||
|
||||
if(L)
|
||||
L << "\icon[P] <b>Message from unknown source: </b>\"[t]\" (Unable to Reply)"
|
||||
P.play_ringtone()
|
||||
|
||||
var/datum/data/pda/app/messenger/M = P.find_program(/datum/data/pda/app/messenger)
|
||||
M.set_new(1)
|
||||
M.notify("<b>Message from unknown source: </b>\"[t]\" (Unable to Reply)", 0)
|
||||
|
||||
if("Inject")
|
||||
if( (href_list["tag"]=="radium"? (reagents.get_reagent_amount("radium"))<=(a_boost*a_transfer) : !reagents.get_reagent_amount(href_list["tag"])) )//Special case for radium. If there are only a_boost*a_transfer radium units left.
|
||||
|
||||
+44
-3
@@ -29,19 +29,27 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
var/honkamt = 0 //How many honks left when infected with honk.exe
|
||||
var/mimeamt = 0 //How many silence left when infected with mime.exe
|
||||
var/detonate = 1 // Can the PDA be blown up?
|
||||
var/newmessage = 0 //To remove hackish overlay check
|
||||
var/ttone = "beep" //The ringtone!
|
||||
var/list/ttone_sound = list("beep" = 'sound/machines/twobeep.ogg',
|
||||
"boom" = 'sound/effects/explosionfar.ogg',
|
||||
"slip" = 'sound/misc/slip.ogg',
|
||||
"honk" = 'sound/items/bikehorn.ogg',
|
||||
"SKREE" = 'sound/voice/shriek1.ogg',
|
||||
"holy" = 'sound/items/PDA/ambicha4-short.ogg',
|
||||
"xeno" = 'sound/voice/hiss1.ogg')
|
||||
|
||||
var/list/programs = list(
|
||||
new/datum/data/pda/app/main_menu,
|
||||
new/datum/data/pda/app/notekeeper,
|
||||
new/datum/data/pda/app/messenger,
|
||||
new/datum/data/pda/app/manifest,
|
||||
new/datum/data/pda/app/chatroom,
|
||||
new/datum/data/pda/app/atmos_scanner,
|
||||
new/datum/data/pda/utility/scanmode/notes,
|
||||
new/datum/data/pda/utility/flashlight)
|
||||
var/list/shortcut_cache = list()
|
||||
var/list/shortcut_cat_order = list()
|
||||
var/list/notifying_programs = list()
|
||||
|
||||
var/obj/item/weapon/card/id/id = null //Making it possible to slot an ID card into the PDA so it can function as both.
|
||||
var/ownjob = null //related to above
|
||||
@@ -133,7 +141,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
cat = list()
|
||||
shortcut_cache[P.category] = cat
|
||||
shortcut_cat_order += P.category
|
||||
cat |= list(list(name = P.name, icon = P.icon, ref = "\ref[P]"))
|
||||
cat |= list(list(name = P.name, icon = P.icon, notify_icon = P.notify_icon, ref = "\ref[P]"))
|
||||
|
||||
// force the order of a few core categories
|
||||
shortcut_cat_order = list("General") \
|
||||
@@ -250,12 +258,17 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
start_program(find_program(/datum/data/pda/app/main_menu))
|
||||
if(C.radio)
|
||||
C.radio.hostpda = null
|
||||
for(var/datum/data/pda/P in notifying_programs)
|
||||
if(P in C.programs)
|
||||
P.unnotify()
|
||||
cartridge = null
|
||||
update_shortcuts()
|
||||
if ("Authenticate")//Checks for ID
|
||||
id_check(usr, 1)
|
||||
if("Retro")
|
||||
retro_mode = !retro_mode
|
||||
if("Ringtone")
|
||||
return set_ringtone()
|
||||
else
|
||||
if(current_app)
|
||||
. = current_app.Topic(href, href_list)
|
||||
@@ -281,6 +294,8 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
|
||||
if(can_use(usr))
|
||||
start_program(find_program(/datum/data/pda/app/main_menu))
|
||||
notifying_programs.Cut()
|
||||
overlays.Cut()
|
||||
usr << "<span class='notice'>You press the reset button on \the [src].</span>"
|
||||
else
|
||||
usr << "<span class='notice'>You cannot do this while restrained.</span>"
|
||||
@@ -442,4 +457,30 @@ var/global/list/obj/item/device/pda/PDAs = list()
|
||||
// Pass along the pulse to atoms in contents, largely added so pAIs are vulnerable to EMP
|
||||
/obj/item/device/pda/emp_act(severity)
|
||||
for(var/atom/A in src)
|
||||
A.emp_act(severity)
|
||||
A.emp_act(severity)
|
||||
|
||||
/obj/item/device/pda/proc/play_ringtone()
|
||||
var/S
|
||||
|
||||
if(ttone in ttone_sound)
|
||||
S = ttone_sound[ttone]
|
||||
else
|
||||
S = 'sound/machines/twobeep.ogg'
|
||||
playsound(loc, S, 50, 1)
|
||||
for(var/mob/O in hearers(3, loc))
|
||||
O.show_message(text("\icon[src] *[ttone]*"))
|
||||
|
||||
/obj/item/device/pda/proc/set_ringtone()
|
||||
var/t = input("Please enter new ringtone", name, ttone) as text
|
||||
if (in_range(src, usr) && loc == usr)
|
||||
if (t)
|
||||
if(hidden_uplink && hidden_uplink.check_trigger(usr, lowertext(t), lowertext(lock_code)))
|
||||
usr << "The PDA softly beeps."
|
||||
close(usr)
|
||||
else
|
||||
t = sanitize(copytext(t, 1, 20))
|
||||
ttone = t
|
||||
return 1
|
||||
else
|
||||
close(usr)
|
||||
return 0
|
||||
@@ -17,7 +17,7 @@
|
||||
set category = "AI IM"
|
||||
set name = "Send PDA Message"
|
||||
set src in usr
|
||||
|
||||
|
||||
if(usr.stat == DEAD)
|
||||
usr << "You can't send PDA messages because you are dead!"
|
||||
return
|
||||
@@ -36,7 +36,7 @@
|
||||
set category = "AI IM"
|
||||
set name = "Show Message Log"
|
||||
set src in usr
|
||||
|
||||
|
||||
if(usr.stat == DEAD)
|
||||
usr << "You can't do that because you are dead!"
|
||||
return
|
||||
@@ -56,7 +56,7 @@
|
||||
set category = "AI IM"
|
||||
set name = "Toggle Sender/Receiver"
|
||||
set src in usr
|
||||
|
||||
|
||||
if(usr.stat == DEAD)
|
||||
usr << "You can't do that because you are dead!"
|
||||
return
|
||||
@@ -69,13 +69,13 @@
|
||||
set category = "AI IM"
|
||||
set name = "Toggle Ringer"
|
||||
set src in usr
|
||||
|
||||
|
||||
if(usr.stat == DEAD)
|
||||
usr << "You can't do that because you are dead!"
|
||||
return
|
||||
var/datum/data/pda/app/messenger/M = find_program(/datum/data/pda/app/messenger)
|
||||
M.silent = !M.silent
|
||||
usr << "<span class='notice'>PDA ringer toggled [(M.silent ? "Off" : "On")]!</span>"
|
||||
M.notify_silent = !M.notify_silent
|
||||
usr << "<span class='notice'>PDA ringer toggled [(M.notify_silent ? "Off" : "On")]!</span>"
|
||||
|
||||
/obj/item/device/pda/ai/can_use()
|
||||
return 1
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Base class for anything that can show up on home screen
|
||||
/datum/data/pda
|
||||
var/icon = "tasks"
|
||||
var/notify_icon = "exclamation-circle"
|
||||
var/notify_silent = 0
|
||||
var/hidden = 0 // program not displayed in main menu
|
||||
var/category = "General" // the category to list it in on the main menu
|
||||
var/obj/item/device/pda/pda // if this is null, and the app is running code, something's gone wrong
|
||||
@@ -11,6 +13,35 @@
|
||||
|
||||
/datum/data/pda/proc/start()
|
||||
|
||||
/datum/data/pda/proc/notify(message, blink = 1)
|
||||
if(message)
|
||||
//Search for holder of the PDA.
|
||||
var/mob/living/L = null
|
||||
if(pda.loc && isliving(pda.loc))
|
||||
L = pda.loc
|
||||
//Maybe they are a pAI!
|
||||
else
|
||||
L = get(pda, /mob/living/silicon)
|
||||
|
||||
if(L)
|
||||
L << "\icon[pda] [message]"
|
||||
nanomanager.update_user_uis(L, pda) // Update the receiving user's PDA UI so that they can see the new message
|
||||
|
||||
if(!notify_silent)
|
||||
pda.play_ringtone()
|
||||
|
||||
if(blink && !(src in pda.notifying_programs))
|
||||
pda.overlays.Cut()
|
||||
pda.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||||
pda.notifying_programs |= src
|
||||
|
||||
/datum/data/pda/proc/unnotify()
|
||||
if(src in pda.notifying_programs)
|
||||
pda.notifying_programs -= src
|
||||
if(!pda.notifying_programs.len)
|
||||
pda.overlays.Cut()
|
||||
|
||||
/datum/data/pda/proc/
|
||||
|
||||
// An app has a button on the home screen and its own UI
|
||||
/datum/data/pda/app
|
||||
|
||||
+246
-10
@@ -1,16 +1,252 @@
|
||||
var/list/chatrooms = list()
|
||||
var/list/chatrooms = list(new /datum/chatroom("General Discussion"))
|
||||
|
||||
/datum/chatroom
|
||||
var/name = "Generic Chatroom"
|
||||
var/list/logged_in = list()
|
||||
var/list/users = list()
|
||||
var/list/invites = list()
|
||||
var/list/logs = list() // chat logs
|
||||
var/list/banned = list() // banned users
|
||||
var/list/whitelist = list() // whitelisted users
|
||||
var/list/muted = list()
|
||||
var/topic = "" // topic message for the chatroom
|
||||
var/password = "" // blank for no password.
|
||||
var/operator = "" // name of the operator
|
||||
var/topic = "Discussion" // topic message for the chatroom
|
||||
var/is_public = 1
|
||||
var/announcer = "CyberiadAI"
|
||||
|
||||
/datum/chatroom/proc/attempt_connect(var/obj/item/device/pda/device, var/obj/password)
|
||||
if(!device)
|
||||
/datum/chatroom/New(n)
|
||||
name = n
|
||||
|
||||
/datum/chatroom/proc/post(user, message, username)
|
||||
if(!user || !message)
|
||||
return
|
||||
|
||||
if(!username)
|
||||
if(istype(user, /datum/data/pda/app/chatroom))
|
||||
var/datum/data/pda/app/chatroom/c = user
|
||||
if(!c.pda.owner)
|
||||
return
|
||||
username = c.pda.owner
|
||||
else
|
||||
return
|
||||
|
||||
logs += list(list(username = username, message = message))
|
||||
|
||||
for(var/datum/data/pda/app/chatroom/u in users)
|
||||
if(!u.toff && user != u)
|
||||
u.notify("<b>Post from [username] in #[name], </b>\"[message]\" (<a href='?src=\ref[u];choice=Post;target=\ref[src]'>Post</a>)")
|
||||
|
||||
/datum/chatroom/proc/announce(user, message)
|
||||
post(user, "<span class='average'>[message]</span>", announcer)
|
||||
|
||||
/datum/chatroom/proc/login(datum/data/pda/app/chatroom/user)
|
||||
if(!user || !user.pda.owner)
|
||||
return 0
|
||||
|
||||
if(user in users)
|
||||
return 1
|
||||
|
||||
if(!is_public && !(user in invites))
|
||||
return 0
|
||||
|
||||
users += user
|
||||
announce(user, "[user.pda.owner] has entered #[name].")
|
||||
return 1
|
||||
|
||||
/datum/chatroom/proc/logout(datum/data/pda/app/chatroom/user)
|
||||
if(!user || !user.pda.owner || !(user in users))
|
||||
return
|
||||
|
||||
users -= user
|
||||
invites -= user
|
||||
announce(user, "[user.pda.owner] has left #[name].")
|
||||
|
||||
/datum/data/pda/app/chatroom
|
||||
name = "Chatbuddy"
|
||||
icon = "hashtag"
|
||||
notify_icon = "comments"
|
||||
template = "pda_chatroom"
|
||||
var/toff = 0
|
||||
var/datum/chatroom/current_room = null
|
||||
var/inviting = 0
|
||||
var/channels_created = 0
|
||||
var/max_channels_created = 3
|
||||
var/latest_post = 0
|
||||
var/auto_scroll = 1
|
||||
|
||||
/datum/data/pda/app/chatroom/start()
|
||||
. = ..()
|
||||
unnotify()
|
||||
latest_post = 0
|
||||
|
||||
/datum/data/pda/app/chatroom/update_ui(mob/user as mob, list/data)
|
||||
data["silent"] = notify_silent
|
||||
data["toff"] = toff
|
||||
if(!messaging_available())
|
||||
data["no_server"] = 1
|
||||
has_back = 0
|
||||
else if(current_room)
|
||||
data["room"] = current_room.name
|
||||
data["topic"] = current_room.topic
|
||||
if(inviting)
|
||||
data["inviting"] = 1
|
||||
var/list/pdas = list()
|
||||
for(var/A in PDAs)
|
||||
var/obj/item/device/pda/P = A
|
||||
var/datum/data/pda/app/chatroom/C = P.find_program(/datum/data/pda/app/chatroom)
|
||||
var/datum/data/pda/app/messenger/PM = P.find_program(/datum/data/pda/app/messenger)
|
||||
|
||||
if (!P.owner || P == pda || PM.m_hidden || (C in current_room.invites) || (C in current_room.users))
|
||||
continue
|
||||
pdas += list(list(name = "[P.owner] ([P.ownjob])", ref = "\ref[C]"))
|
||||
data["people"] = pdas
|
||||
else
|
||||
data["history"] = current_room.logs
|
||||
var/list/users[0]
|
||||
for(var/U in current_room.users)
|
||||
var/datum/data/pda/app/chatroom/ch = U
|
||||
users += "<span class='good'>[ch.pda.owner]</span>"
|
||||
for(var/U in (current_room.invites - current_room.users))
|
||||
var/datum/data/pda/app/chatroom/ch = U
|
||||
users += "<span class='average'>[ch.pda.owner]</span>"
|
||||
data["users"] = users
|
||||
data["auto_scroll"] = auto_scroll
|
||||
data["latest_post"] = latest_post
|
||||
latest_post = current_room.logs.len
|
||||
has_back = 1
|
||||
else
|
||||
var/list/rooms[0]
|
||||
for(var/datum/chatroom/c in chatrooms)
|
||||
if((src in c.users) || (src in c.invites) || c.is_public)
|
||||
rooms += list(list(name = "[c]", ref = "\ref[c]"))
|
||||
data["rooms"] = rooms
|
||||
has_back = 0
|
||||
|
||||
/datum/data/pda/app/chatroom/proc/messaging_available()
|
||||
if(message_servers)
|
||||
for(var/A in message_servers)
|
||||
var/obj/machinery/message_server/MS = A
|
||||
if(MS.active)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/datum/data/pda/app/chatroom/proc/check_messaging_available()
|
||||
. = messaging_available()
|
||||
if(!.)
|
||||
usr << "<span class='notice'>ERROR: Messaging server is not responding.</span>"
|
||||
|
||||
/datum/data/pda/app/chatroom/Topic(href, list/href_list)
|
||||
unnotify()
|
||||
|
||||
switch(href_list["choice"])
|
||||
if("Toggle Chatroom")
|
||||
toff = !toff
|
||||
if("Toggle Ringer")
|
||||
notify_silent = !notify_silent
|
||||
if("Back")
|
||||
if(inviting)
|
||||
inviting = 0
|
||||
else
|
||||
current_room = null
|
||||
latest_post = 0
|
||||
if("Join")
|
||||
if(!check_messaging_available())
|
||||
return
|
||||
|
||||
if(href_list["room"])
|
||||
current_room = locate(href_list["room"])
|
||||
if(!(src in current_room.users))
|
||||
if(!current_room.login(src))
|
||||
current_room = null
|
||||
latest_post = 0
|
||||
if("Post")
|
||||
if(!check_messaging_available())
|
||||
return
|
||||
|
||||
var/datum/chatroom/target
|
||||
if(href_list["target"])
|
||||
target = locate(href_list["target"])
|
||||
else
|
||||
target = current_room
|
||||
|
||||
if(!target)
|
||||
return
|
||||
|
||||
var/t = input("Please enter message", target) as text|null
|
||||
if(!t)
|
||||
return
|
||||
t = sanitize(copytext(t, 1, MAX_MESSAGE_LEN))
|
||||
t = readd_quotes(t)
|
||||
if (!t || (!in_range(pda, usr) && pda.loc != usr))
|
||||
return
|
||||
|
||||
target.post(src, t)
|
||||
if("Topic")
|
||||
if(!check_messaging_available() || !current_room)
|
||||
return
|
||||
|
||||
var/t = input("Enter new topic:", current_room, current_room.topic) as text|null
|
||||
if(!t)
|
||||
return
|
||||
t = sanitize(copytext(t, 1, MAX_MESSAGE_LEN))
|
||||
t = readd_quotes(t)
|
||||
if (!t || (!in_range(pda, usr) && pda.loc != usr))
|
||||
return
|
||||
|
||||
current_room.topic = t
|
||||
current_room.announce(src, "Topic has been changed to '[t]' by [pda.owner].")
|
||||
if("Leave")
|
||||
if(!current_room)
|
||||
return
|
||||
|
||||
current_room.logout(src)
|
||||
current_room = null
|
||||
latest_post = 0
|
||||
if("Invite")
|
||||
if(!check_messaging_available() || !current_room)
|
||||
return
|
||||
|
||||
inviting = 1
|
||||
if("Invite PDA")
|
||||
if(!check_messaging_available() || !current_room || !href_list["user"])
|
||||
return
|
||||
|
||||
var/datum/data/pda/app/chatroom/C = locate(href_list["user"])
|
||||
if(C)
|
||||
current_room.invites += C
|
||||
if(!C.toff)
|
||||
C.notify("<b>Invite to #[current_room]</b> (<a href='?src=\ref[C];choice=Join;room=\ref[current_room]'>Join</a>)")
|
||||
if("New Room")
|
||||
if(!check_messaging_available())
|
||||
return
|
||||
|
||||
if(channels_created >= max_channels_created)
|
||||
alert("This PDA has already reached its maximum channels created.", name)
|
||||
return
|
||||
|
||||
var/t = input("Enter room name:", name) as text|null
|
||||
if(!t)
|
||||
return
|
||||
t = sanitize(copytext(t, 1, MAX_NAME_LEN))
|
||||
t = readd_quotes(t)
|
||||
|
||||
var/access = input("Room access?", current_room) as null|anything in list("Public", "Private")
|
||||
if(!access)
|
||||
return
|
||||
|
||||
if (!t || (!in_range(pda, usr) && pda.loc != usr))
|
||||
return
|
||||
|
||||
// check if already taken
|
||||
for(var/datum/chatroom/C in chatrooms)
|
||||
if(C.name == t)
|
||||
alert("Channel with that name already exists.", name)
|
||||
return
|
||||
|
||||
channels_created++
|
||||
current_room = new /datum/chatroom(t)
|
||||
chatrooms += current_room
|
||||
latest_post = 0
|
||||
|
||||
current_room.invites += src
|
||||
current_room.is_public = access == "Public"
|
||||
current_room.login(src)
|
||||
if(!current_room.is_public)
|
||||
current_room.announce(src, "Users must be invited to join this room.")
|
||||
if("Autoscroll")
|
||||
auto_scroll = !auto_scroll
|
||||
@@ -11,6 +11,11 @@
|
||||
data["apps"] = pda.shortcut_cache
|
||||
data["categories"] = pda.shortcut_cat_order
|
||||
data["pai"] = !isnull(pda.pai) // pAI inserted?
|
||||
|
||||
var/list/notifying[0]
|
||||
for(var/P in pda.notifying_programs)
|
||||
notifying["\ref[P]"] = 1
|
||||
data["notifying"] = notifying
|
||||
|
||||
/datum/data/pda/app/main_menu/Topic(href, list/href_list)
|
||||
switch(href_list["choice"])
|
||||
|
||||
+45
-104
@@ -1,82 +1,76 @@
|
||||
/datum/data/pda/app/messenger
|
||||
name = "Messenger"
|
||||
icon = "comments-o"
|
||||
title = "SpaceMessenger V4.0.1"
|
||||
notify_icon = "comments"
|
||||
title = "SpaceMessenger V4.1.0"
|
||||
template = "pda_messenger"
|
||||
|
||||
var/silent = 0 //To beep or not to beep, that is the question
|
||||
var/toff = 0 //If 1, messenger disabled
|
||||
var/list/tnote[0] //Current Texts
|
||||
var/last_text //No text spamming
|
||||
var/list/ttone_sound = list("beep" = 'sound/machines/twobeep.ogg',
|
||||
"boom" = 'sound/effects/explosionfar.ogg',
|
||||
"slip" = 'sound/misc/slip.ogg',
|
||||
"honk" = 'sound/items/bikehorn.ogg',
|
||||
"SKREE" = 'sound/voice/shriek1.ogg',
|
||||
"holy" = 'sound/items/PDA/ambicha4-short.ogg',
|
||||
"xeno" = 'sound/voice/hiss1.ogg')
|
||||
|
||||
var/m_hidden = 0 // Is the PDA hidden from the PDA list?
|
||||
var/active_conversation = null // New variable that allows us to only view a single conversation.
|
||||
var/list/conversations = list() // For keeping up with who we have PDA messsages from.
|
||||
var/latest_post = 0
|
||||
var/auto_scroll = 1
|
||||
|
||||
/datum/data/pda/app/messenger/start()
|
||||
. = ..()
|
||||
set_new(0)
|
||||
unnotify()
|
||||
latest_post = 0
|
||||
|
||||
/datum/data/pda/app/messenger/update_ui(mob/user as mob, list/data)
|
||||
data["silent"] = silent // does the pda make noise when it receives a message?
|
||||
data["silent"] = notify_silent // does the pda make noise when it receives a message?
|
||||
data["toff"] = toff // is the messenger function turned off?
|
||||
data["active_conversation"] = active_conversation // Which conversation are we following right now?
|
||||
|
||||
var/convopdas[0]
|
||||
var/pdas[0]
|
||||
var/count = 0
|
||||
for(var/A in PDAs)
|
||||
var/obj/item/device/pda/P = A
|
||||
var/datum/data/pda/app/messenger/PM = P.find_program(/datum/data/pda/app/messenger)
|
||||
|
||||
if (!P.owner || PM.toff || P == pda || PM.m_hidden)
|
||||
continue
|
||||
if(conversations.Find("\ref[P]"))
|
||||
convopdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "1")))
|
||||
else
|
||||
pdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "0")))
|
||||
count++
|
||||
|
||||
data["convopdas"] = convopdas
|
||||
data["pdas"] = pdas
|
||||
data["pda_count"] = count
|
||||
|
||||
data["messagescount"] = tnote.len
|
||||
data["messages"] = tnote
|
||||
|
||||
has_back = active_conversation
|
||||
if(active_conversation)
|
||||
data["messages"] = tnote
|
||||
for(var/c in tnote)
|
||||
if(c["target"] == active_conversation)
|
||||
data["convo_name"] = sanitize(c["owner"])
|
||||
data["convo_job"] = sanitize(c["job"])
|
||||
break
|
||||
data["auto_scroll"] = auto_scroll
|
||||
data["latest_post"] = latest_post
|
||||
latest_post = tnote.len
|
||||
else
|
||||
var/convopdas[0]
|
||||
var/pdas[0]
|
||||
for(var/A in PDAs)
|
||||
var/obj/item/device/pda/P = A
|
||||
var/datum/data/pda/app/messenger/PM = P.find_program(/datum/data/pda/app/messenger)
|
||||
|
||||
var/list/plugins = list()
|
||||
if(pda.cartridge)
|
||||
for(var/A in pda.cartridge.messenger_plugins)
|
||||
var/datum/data/pda/messenger_plugin/P = A
|
||||
plugins += list(list(name = P.name, icon = P.icon, ref = "\ref[P]"))
|
||||
data["plugins"] = plugins
|
||||
if (!P.owner || PM.toff || P == pda || PM.m_hidden)
|
||||
continue
|
||||
if(conversations.Find("\ref[P]"))
|
||||
convopdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "1")))
|
||||
else
|
||||
pdas.Add(list(list("Name" = "[P]", "Reference" = "\ref[P]", "Detonate" = "[P.detonate]", "inconvo" = "0")))
|
||||
|
||||
if(pda.cartridge)
|
||||
data["charges"] = pda.cartridge.charges ? pda.cartridge.charges : 0
|
||||
data["convopdas"] = convopdas
|
||||
data["pdas"] = pdas
|
||||
|
||||
var/list/plugins = list()
|
||||
if(pda.cartridge)
|
||||
for(var/A in pda.cartridge.messenger_plugins)
|
||||
var/datum/data/pda/messenger_plugin/P = A
|
||||
plugins += list(list(name = P.name, icon = P.icon, ref = "\ref[P]"))
|
||||
data["plugins"] = plugins
|
||||
|
||||
if(pda.cartridge)
|
||||
data["charges"] = pda.cartridge.charges ? pda.cartridge.charges : 0
|
||||
|
||||
/datum/data/pda/app/messenger/Topic(href, list/href_list)
|
||||
set_new(0)
|
||||
unnotify()
|
||||
|
||||
switch(href_list["choice"])
|
||||
if("Toggle Messenger")
|
||||
toff = !toff
|
||||
if("Toggle Ringer")//If viewing texts then erase them, if not then toggle silent status
|
||||
silent = !silent
|
||||
notify_silent = !notify_silent
|
||||
if("Clear")//Clears messages
|
||||
if(href_list["option"] == "All")
|
||||
tnote.Cut()
|
||||
@@ -90,29 +84,19 @@
|
||||
conversations.Remove(active_conversation)
|
||||
|
||||
active_conversation = null
|
||||
if("Ringtone")
|
||||
var/t = input("Please enter new ringtone", name, pda.ttone) as text
|
||||
if (in_range(pda, usr) && pda.loc == usr)
|
||||
if (t)
|
||||
if(pda.hidden_uplink && pda.hidden_uplink.check_trigger(usr, lowertext(t), lowertext(pda.lock_code)))
|
||||
usr << "The PDA softly beeps."
|
||||
pda.close(usr)
|
||||
else
|
||||
t = sanitize(copytext(t, 1, 20))
|
||||
pda.ttone = t
|
||||
else
|
||||
pda.close(usr)
|
||||
return 0
|
||||
latest_post = 0
|
||||
if("Message")
|
||||
var/obj/item/device/pda/P = locate(href_list["target"])
|
||||
create_message(usr, P)
|
||||
if(href_list["target"] in conversations) // Need to make sure the message went through, if not welp.
|
||||
active_conversation = href_list["target"]
|
||||
latest_post = 0
|
||||
if("Select Conversation")
|
||||
var/P = href_list["convo"]
|
||||
for(var/n in conversations)
|
||||
if(P == n)
|
||||
active_conversation = P
|
||||
latest_post = 0
|
||||
if("Messenger Plugin")
|
||||
if(!href_list["target"] || !href_list["plugin"])
|
||||
return
|
||||
@@ -122,30 +106,14 @@
|
||||
usr << "PDA not found."
|
||||
|
||||
var/datum/data/pda/messenger_plugin/plugin = locate(href_list["plugin"])
|
||||
if(plugin && plugin in pda.cartridge.messenger_plugins)
|
||||
if(plugin && (plugin in pda.cartridge.messenger_plugins))
|
||||
plugin.messenger = src
|
||||
plugin.user_act(usr, P)
|
||||
if("Back")
|
||||
active_conversation = null
|
||||
|
||||
/datum/data/pda/app/messenger/proc/set_new(isnew)
|
||||
if(pda.newmessage == isnew)
|
||||
return
|
||||
|
||||
if(pda.newmessage)
|
||||
//To clear message overlays.
|
||||
pda.overlays.Cut()
|
||||
pda.newmessage = 0
|
||||
|
||||
icon = "comments"
|
||||
pda.update_shortcuts()
|
||||
else
|
||||
pda.overlays.Cut()
|
||||
pda.overlays += image('icons/obj/pda.dmi', "pda-r")
|
||||
pda.newmessage = 1
|
||||
|
||||
icon = "comments-o"
|
||||
pda.update_shortcuts()
|
||||
latest_post = 0
|
||||
if("Autoscroll")
|
||||
auto_scroll = !auto_scroll
|
||||
|
||||
/datum/data/pda/app/messenger/proc/create_message(var/mob/living/U, var/obj/item/device/pda/P)
|
||||
var/t = input(U, "Please enter message", name, null) as text|null
|
||||
@@ -207,39 +175,12 @@
|
||||
if(!PM.conversations.Find("\ref[pda]"))
|
||||
PM.conversations.Add("\ref[pda]")
|
||||
|
||||
PM.play_ringtone()
|
||||
//Search for holder of the PDA.
|
||||
var/mob/living/L = null
|
||||
if(P.loc && isliving(P.loc))
|
||||
L = P.loc
|
||||
//Maybe they are a pAI!
|
||||
else
|
||||
L = get(P, /mob/living/silicon)
|
||||
|
||||
|
||||
if(L)
|
||||
L << "\icon[P] <b>Message from [pda.owner] ([pda.ownjob]), </b>\"[t]\" (<a href='byond://?src=\ref[PM];choice=Message;target=\ref[pda]'>Reply</a>)"
|
||||
nanomanager.update_user_uis(L, P) // Update the receiving user's PDA UI so that they can see the new message
|
||||
|
||||
nanomanager.update_user_uis(U, P) // Update the sending user's PDA UI so that they can see the new message
|
||||
set_new(1)
|
||||
PM.notify("<b>Message from [pda.owner] ([pda.ownjob]), </b>\"[t]\" (<a href='?src=\ref[PM];choice=Message;target=\ref[pda]'>Reply</a>)")
|
||||
log_pda("[usr] (PDA: [src.name]) sent \"[t]\" to [P.name]")
|
||||
else
|
||||
U << "<span class='notice'>ERROR: Messaging server is not responding.</span>"
|
||||
|
||||
/datum/data/pda/app/messenger/proc/play_ringtone()
|
||||
if (!silent)
|
||||
var/S
|
||||
|
||||
if(pda.ttone in ttone_sound)
|
||||
S = ttone_sound[pda.ttone]
|
||||
else
|
||||
S = 'sound/machines/twobeep.ogg'
|
||||
playsound(pda.loc, S, 50, 1)
|
||||
for(var/mob/O in hearers(3, pda.loc))
|
||||
if(!silent)
|
||||
O.show_message(text("\icon[pda] *[pda.ttone]*"))
|
||||
|
||||
/datum/data/pda/app/messenger/proc/available_pdas()
|
||||
var/list/names = list()
|
||||
var/list/plist = list()
|
||||
|
||||
@@ -34,10 +34,13 @@
|
||||
. = ..(user, P)
|
||||
if(.)
|
||||
user.show_message("<span class=notice>Virus sent!</span>", 1)
|
||||
var/datum/data/pda/app/messenger/M = P.find_program(/datum/data/pda/app/messenger)
|
||||
var/datum/data/pda/app/M = P.find_program(/datum/data/pda/app/messenger)
|
||||
if(M)
|
||||
M.silent = 1
|
||||
P.ttone = "silence"
|
||||
M.notify_silent = 1
|
||||
M = P.find_program(/datum/data/pda/app/chatroom)
|
||||
if(M)
|
||||
M.notify_silent = 1
|
||||
P.ttone = "silence"
|
||||
|
||||
|
||||
/datum/data/pda/messenger_plugin/virus/detonate
|
||||
|
||||
@@ -50,9 +50,12 @@
|
||||
|
||||
/obj/item/device/pda/mime/New()
|
||||
..()
|
||||
var/datum/data/pda/app/messenger/M = find_program(/datum/data/pda/app/messenger)
|
||||
var/datum/data/pda/app/M = find_program(/datum/data/pda/app/messenger)
|
||||
if(M)
|
||||
M.silent = 1
|
||||
M.notify_silent = 1
|
||||
M = find_program(/datum/data/pda/app/chatroom)
|
||||
if(M)
|
||||
M.notify_silent = 1
|
||||
|
||||
/obj/item/device/pda/heads
|
||||
default_cartridge = /obj/item/weapon/cartridge/head
|
||||
@@ -142,9 +145,12 @@
|
||||
|
||||
/obj/item/device/pda/librarian/New()
|
||||
..()
|
||||
var/datum/data/pda/app/messenger/M = find_program(/datum/data/pda/app/messenger)
|
||||
var/datum/data/pda/app/M = find_program(/datum/data/pda/app/messenger)
|
||||
if(M)
|
||||
M.silent = 1 //Quiet in the library!
|
||||
M.notify_silent = 1 //Quiet in the library!
|
||||
M = find_program(/datum/data/pda/app/chatroom)
|
||||
if(M)
|
||||
M.notify_silent = 1 //Quiet in the library!
|
||||
|
||||
/obj/item/device/pda/clear
|
||||
icon_state = "pda-transp"
|
||||
|
||||
Reference in New Issue
Block a user