mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-22 04:24:20 +01:00
@@ -28,7 +28,7 @@
|
||||
|
||||
/obj/machinery/pdapainter/New()
|
||||
..()
|
||||
var/blocked = list(/obj/item/device/pda/ai/pai, /obj/item/device/pda/ai, /obj/item/device/pda/heads,
|
||||
var/blocked = list(/obj/item/device/pda/pai, /obj/item/device/pda/ai, /obj/item/device/pda/heads,
|
||||
/obj/item/device/pda/clear, /obj/item/device/pda/syndicate)
|
||||
|
||||
for(var/P in typesof(/obj/item/device/pda)-blocked)
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
var/screen // Which screen our main window displays
|
||||
var/subscreen // Which specific function of the main screen is being displayed
|
||||
|
||||
var/obj/item/device/pda/ai/pai/pda = null
|
||||
var/obj/item/device/pda/pai/pda = null
|
||||
|
||||
var/secHUD = 0 // Toggles whether the Security HUD is active or not
|
||||
var/medHUD = 0 // Toggles whether the Medical HUD is active or not
|
||||
@@ -110,6 +110,8 @@
|
||||
pda.name = pda.owner + " (" + pda.ownjob + ")"
|
||||
var/datum/data/pda/app/messenger/M = pda.find_program(/datum/data/pda/app/messenger)
|
||||
M.toff = 1
|
||||
var/datum/data/pda/app/chatroom/C = pda.find_program(/datum/data/pda/app/chatroom)
|
||||
C.toff = 1
|
||||
..()
|
||||
|
||||
/mob/living/silicon/pai/Login()
|
||||
|
||||
@@ -222,6 +222,123 @@
|
||||
M.create_message(P, target, 1)
|
||||
return 1
|
||||
|
||||
/datum/pai_software/chatroom
|
||||
name = "Digital Chatroom"
|
||||
ram_cost = 5
|
||||
id = "chatroom"
|
||||
toggle = 0
|
||||
|
||||
on_ui_interact(mob/living/silicon/pai/user, datum/nanoui/ui=null, force_open=1)
|
||||
var/data[0]
|
||||
|
||||
if(!user.pda)
|
||||
return
|
||||
var/datum/data/pda/app/chatroom/M = user.pda.find_program(/datum/data/pda/app/chatroom)
|
||||
if(!M)
|
||||
return
|
||||
|
||||
data["receiver_off"] = M.toff
|
||||
data["ringer_off"] = M.notify_silent
|
||||
|
||||
var/list/rooms[0]
|
||||
for(var/datum/chatroom/c in chatrooms)
|
||||
if((M in c.users) || (M in c.invites) || c.is_public)
|
||||
rooms += list(list(name = "[c]", ref = "\ref[c]"))
|
||||
data["rooms"] = rooms
|
||||
|
||||
if(M.disconnected || !M.messaging_available(1))
|
||||
data["disconnected"] = 1
|
||||
else if(M.current_room)
|
||||
data["current_room"] = "\ref[M.current_room]"
|
||||
data["current_room_name"] = M.current_room.name
|
||||
data["current_room_topic"] = M.current_room.topic
|
||||
data["messages"] = M.current_room.logs
|
||||
var/list/users[0]
|
||||
for(var/U in M.current_room.users)
|
||||
var/datum/data/pda/app/chatroom/ch = U
|
||||
users += "<span class='good'>[ch.pda.owner]</span>"
|
||||
for(var/U in (M.current_room.invites - M.current_room.users))
|
||||
var/datum/data/pda/app/chatroom/ch = U
|
||||
users += "<span class='average'>[ch.pda.owner]</span>"
|
||||
data["users"] = users
|
||||
|
||||
ui = nanomanager.try_update_ui(user, user, id, ui, data, force_open)
|
||||
if(!ui)
|
||||
// Don't copy-paste this unless you're making a pAI software module!
|
||||
ui = new(user, user, id, "pai_chatroom.tmpl", "Digital Chatroom", 450, 600)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
ui.set_auto_update(1)
|
||||
|
||||
Topic(href, href_list)
|
||||
var/mob/living/silicon/pai/P = usr
|
||||
if(!istype(P))
|
||||
return
|
||||
|
||||
if(!isnull(P.pda) && P.pda.can_use())
|
||||
var/datum/data/pda/app/chatroom/M = P.pda.find_program(/datum/data/pda/app/chatroom)
|
||||
if(!M)
|
||||
return
|
||||
|
||||
if(href_list["toggler"])
|
||||
M.toff = href_list["toggler"] != "1"
|
||||
return 1
|
||||
else if(href_list["ringer"])
|
||||
M.notify_silent = href_list["ringer"] != "1"
|
||||
return 1
|
||||
else if(href_list["topic"])
|
||||
if(!M.current_room)
|
||||
return 1
|
||||
|
||||
var/t = input("Enter new topic:", M.current_room, M.current_room.topic) as text|null
|
||||
spawn()
|
||||
if(!t || !M.check_messaging_available() || !P.pda.can_use())
|
||||
return
|
||||
t = sanitize(copytext(t, 1, MAX_MESSAGE_LEN))
|
||||
t = readd_quotes(t)
|
||||
if (!t)
|
||||
return
|
||||
|
||||
M.current_room.topic = t
|
||||
M.current_room.announce(M, "Topic has been changed to '[t]' by [P.pda.owner].")
|
||||
return 1
|
||||
else if(href_list["select"])
|
||||
var/s = href_list["select"]
|
||||
if(s == "*NONE*")
|
||||
M.current_room = null
|
||||
else
|
||||
var/datum/chatroom/CR = locate(s)
|
||||
if(istype(CR))
|
||||
if(!(M in CR.users))
|
||||
if(!CR.login(M))
|
||||
return
|
||||
M.current_room = CR
|
||||
return 1
|
||||
else if(href_list["target"])
|
||||
if(P.silence_time)
|
||||
return alert("Communications circuits remain uninitialized.")
|
||||
|
||||
var/datum/chatroom/target = locate(href_list["target"])
|
||||
if(istype(target))
|
||||
if(!(M in target.users))
|
||||
if(!target.login(M))
|
||||
return
|
||||
var/t = input("Please enter message", target) as text|null
|
||||
spawn()
|
||||
if(!t || !M.check_messaging_available())
|
||||
return
|
||||
t = sanitize(copytext(t, 1, MAX_MESSAGE_LEN))
|
||||
t = readd_quotes(t)
|
||||
if (!t || !P.pda.can_use())
|
||||
return
|
||||
|
||||
target.post(M, t)
|
||||
return 1
|
||||
else if(href_list["reconnect"])
|
||||
spawn()
|
||||
M.messaging_available()
|
||||
return 1
|
||||
|
||||
/datum/pai_software/med_records
|
||||
name = "Medical Records"
|
||||
ram_cost = 15
|
||||
|
||||
+10
-2
@@ -85,5 +85,13 @@
|
||||
playsound(loc, 'sound/items/bikehorn.ogg', 30, 1)
|
||||
return
|
||||
|
||||
/obj/item/device/pda/ai/pai
|
||||
ttone = "assist"
|
||||
/obj/item/device/pda/pai
|
||||
icon_state = "NONE"
|
||||
detonate = 0
|
||||
ttone = "assist"
|
||||
|
||||
/obj/item/device/pda/pai/can_use()
|
||||
var/mob/living/silicon/pai/pAI = usr
|
||||
if(!istype(pAI))
|
||||
return 0
|
||||
return ..() && !pAI.silence_time
|
||||
@@ -0,0 +1,76 @@
|
||||
<!-- pAI chatroom
|
||||
code/modules/mob/living/silicon/pai/software_modules.dm
|
||||
-->
|
||||
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Receiver:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{if data.receiver_off}}
|
||||
{{:helper.link("On", '', {"stopic":"chatroom", "toggler":1})}}
|
||||
{{:helper.link("Off", '', {"stopic":"chatroom", "toggler":2}, 'selected')}}
|
||||
{{else}}
|
||||
{{:helper.link("On", '', {"stopic":"chatroom", "toggler":1}, 'selected')}}
|
||||
{{:helper.link("Off", '', {"stopic":"chatroom", "toggler":2})}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<div class="itemLabel">
|
||||
Ringer:
|
||||
</div>
|
||||
<div class="itemContent">
|
||||
{{if data.ringer_off}}
|
||||
{{:helper.link("On", '', {"stopic":"chatroom", "ringer":1})}}
|
||||
{{:helper.link("Off", '', {"stopic":"chatroom", "ringer":2}, 'selected')}}
|
||||
{{else}}
|
||||
{{:helper.link("On", '', {"stopic":"chatroom", "ringer":1}, 'selected')}}
|
||||
{{:helper.link("Off", '', {"stopic":"chatroom", "ringer":2})}}
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{for data.rooms}}
|
||||
<div class="item">
|
||||
{{:helper.link(value.name, '', {"stopic":"chatroom", "select":value.ref})}}
|
||||
{{:helper.link("Quick Message", '', {"stopic":"chatroom", "target":value.ref})}}
|
||||
</div>
|
||||
{{/for}}
|
||||
<hr>
|
||||
{{if data.disconnected}}
|
||||
<h3>Connection Lost</h3>
|
||||
{{:helper.link("Reconnect", 'refresh', {"stopic":"chatroom", "reconnect":1})}}
|
||||
{{else data.current_room}}
|
||||
<h3>#{{:data.current_room_name}}</h3>
|
||||
<div class="item">
|
||||
<dic class="itemLabel">Topic:</div>
|
||||
<div class="itemContent">{{:helper.link(data.current_room_topic, '', {"stopic":"chatroom", "topic":1})}}</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="itemLabel">Users:</div>
|
||||
<div class="itemContent">
|
||||
{{var firstUser = true;}}
|
||||
{{for data.users}}
|
||||
{{:firstUser ? "" : ", "}}{{:value}}
|
||||
{{firstUser = false;}}
|
||||
{{/for}}
|
||||
</div>
|
||||
</div>
|
||||
{{var prevName = "";}}
|
||||
{{for data.messages}}
|
||||
<div class="item">
|
||||
<div class="itemLabelNarrow">{{:value.username!=prevName ? value.username : " "}}</div>
|
||||
<div class="itemContent">
|
||||
{{:value.message}}
|
||||
</div>
|
||||
</div>
|
||||
{{prevName = value.username;}}
|
||||
{{/for}}
|
||||
{{:helper.link("Send Message", '', {"stopic":"chatroom", "target":data.current_room})}}
|
||||
{{/if}}
|
||||
|
||||
{{if data.current_name}}
|
||||
{{:helper.link("Clear Screen", '', {"stopic":"chatroom", "select":"*NONE*"})}}
|
||||
{{/if}}
|
||||
Reference in New Issue
Block a user