Now uses a proc that generates messages on target console

Basically gutted topic code.
This commit is contained in:
scoopscoop
2014-08-07 18:38:09 +03:00
parent 98739e8510
commit 9d47d2c98e
2 changed files with 61 additions and 15 deletions
+58 -4
View File
@@ -8,14 +8,14 @@ var/list/obj/machinery/requests_console/allConsoles = list()
/obj/machinery/requests_console
name = "requests console"
desc = "A console intended to send requests to diferent departments on the station."
desc = "A console intended to send requests to different departments on the station."
anchored = 1
icon = 'icons/obj/terminals.dmi'
icon_state = "req_comp0"
var/department = "Unknown" //The list of all departments on the station (Determined from this variable on each unit) Set this to the same thing if you want several consoles in one department
var/list/messages = list() //List of all messages
var/departmentType = 0
// 0 = none (not listed, can only repeplied to)
// 0 = none (not listed, can only replied to)
// 1 = assistance
// 2 = supplies
// 3 = info
@@ -46,10 +46,10 @@ var/list/obj/machinery/requests_console/allConsoles = list()
// 1 = hacked
var/announcementConsole = 0
// 0 = This console cannot be used to send department announcements
// 1 = This console can send department announcementsf
// 1 = This console can send department announcements
var/open = 0 // 1 if open
var/announceAuth = 0 //Will be set to 1 when you authenticate yourself for announcements
var/msgVerified = "" //Will contain the name of the person who varified it
var/msgVerified = "" //Will contain the name of the person who verified it
var/msgStamped = "" //If a message is stamped, this will contain the stamp name
var/message = "";
var/dpt = ""; //the department which will be receiving the message
@@ -409,6 +409,60 @@ var/list/obj/machinery/requests_console/allConsoles = list()
updateUsrDialog()
return
/obj/machinery/requests_console/proc/createmessage(source, title, message, priority, paper) //generate one-way message, from 'source'
var/obj/machinery/requests_console/Console = src
var/sending = message
capitalize(source)
capitalize(title)
sending += "<BR>"
switch(priority)
if(2) //High priority
if(Console.newmessagepriority < 2)
Console.newmessagepriority = 2
Console.update_icon()
if(!Console.silent)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
for (var/mob/O in hearers(5, Console.loc))
O.show_message("\icon[Console] *The Requests Console beeps: '[title]'")
Console.messages += "<span class='bad'>High Priority</span><BR><b>From:</b> [source]><BR>[sending]"
if(paper)
var/obj/item/weapon/paper/slip = new /obj/item/weapon/paper(Console.loc)
slip.info = "<span class='bad'>High Priority</span><BR><b>From:</b> [source]<BR>[sending]"
slip.name = "Important Message - [source]"
if(3) // Extreme Priority
if(Console.newmessagepriority < 3)
Console.newmessagepriority = 3
Console.update_icon()
if(1)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
for (var/mob/O in hearers(7, Console.loc))
O.show_message("\icon[Console] *The Requests Console yells: '[title]'")
Console.messages += "<span class='bad'>!!!Extreme Priority!!!</span><BR><b>From:</b> [source]<BR>[sending]"
var/obj/item/weapon/paper/slip = new /obj/item/weapon/paper(Console.loc)
if(paper)
slip.info = "<span class='bad'>!!!Extreme Priority!!!</span><BR><b>From:</b> [source]<BR>[sending]"
slip.name = "URGENT message - [source]"
var/mob/living/target = locate() in view(7,Console)
if(target)
Console.visible_message("<span class='danger'>[Console] launches [slip] at [target]!</span>")
slip.throw_at(target, 16, 3)
else // Normal priority
if(Console.newmessagepriority < 1)
Console.newmessagepriority = 1
Console.update_icon()
if(!Console.silent)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
for (var/mob/O in hearers(4, Console.loc))
O.show_message("\icon[Console] *The Requests Console beeps: '[title]'")
Console.messages += "<b>From:</b> [source]<BR>[sending]"
if(paper)
var/obj/item/weapon/paper/slip = new /obj/item/weapon/paper(Console.loc)
slip.info = "<b>From:</b> [source]<BR>[sending]"
slip.name = "Message - [source]"
Console.luminosity = 2
/obj/machinery/requests_console/attackby(var/obj/item/weapon/O as obj, var/mob/user as mob)
if (istype(O, /obj/item/weapon/crowbar))
+3 -11
View File
@@ -35,21 +35,13 @@
s.amount = 0
stack_list[processed_sheet] = s
if(s.name != "glass" && s.name != "metal") //we can get these from cargo anyway
var/msg = "[capitalize(s.name)] sheets are now available in the Cargo Bay."
for(var/obj/machinery/requests_console/D in world) //this will only happen a few times per round
if(D.department == "Science" || D.department == "Robotics")
announce_mats(D, s.name)
if(D.department == "Science" || D.department == "Robotics" || D.department == "Research Director's Desk")
D.createmessage("Ore Redemption Machine", "New minerals available!", msg, 1, 0)
var/obj/item/stack/sheet/storage = stack_list[processed_sheet]
storage.amount += 1 //Stack the sheets
O.loc = null //Let the old sheet garbage collect
/obj/machinery/mineral/ore_redemption/proc/announce_mats(obj/machinery/requests_console/T, N) //announce the availability of string N to request console T
T.newmessagepriority = 1
T.update_icon()
// if(!T.silent)
// playsound(T.loc, 'sound/machines/twobeep.ogg', 50, 1)
for (var/mob/O in hearers(4, T.loc))
O.show_message("\icon[T] *The Requests Console flashes: 'New minerals available!'")
T.messages += "<b>From:</b> Ore Redemption Machine<BR>[capitalize(N)] sheets are now available in the Cargo Bay."
/obj/machinery/mineral/ore_redemption/process()
if(!panel_open) //If the machine is partially dissassembled, it should not process minerals