mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-22 12:29:46 +01:00
Bugfixes: Fax machines, CentCom turrets, Robo-limb emag. New feature for monkey cubes (#1116)
Fixes #1059, #131 Resolves #1020 Fixes #1100 Resolves #663
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
var/list/obj/machinery/photocopier/faxmachine/allfaxes = list()
|
||||
var/list/admin_departments = list("Central Command", "Sol Government")
|
||||
var/list/alldepartments = list()
|
||||
|
||||
var/list/arrived_faxes = list() //cache for faxes that have been sent to the admins
|
||||
var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
var/list/alldepartments = list()
|
||||
|
||||
/obj/machinery/photocopier/faxmachine
|
||||
name = "fax machine"
|
||||
@@ -16,9 +14,17 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
idle_power_usage = 30
|
||||
active_power_usage = 200
|
||||
|
||||
var/static/const/adminfax_cooldown = 1800 // in 1/10 seconds
|
||||
var/static/const/normalfax_cooldown = 300
|
||||
var/static/const/broadcastfax_cooldown = 3000
|
||||
|
||||
var/static/const/broadcast_departments = "Stationwide broadcast (WARNING)"
|
||||
var/static/list/admin_departments = list("Central Command", "Sol Government")
|
||||
|
||||
var/obj/item/weapon/card/id/scan = null // identification
|
||||
var/authenticated = 0
|
||||
var/sendcooldown = 0 // to avoid spamming fax messages
|
||||
var/sendtime = 0 // Time when fax was sent
|
||||
var/sendcooldown = 0 // Delay, before another fax can be sent (in 1/10 second). Used by set_cooldown() and get_remaining_cooldown()
|
||||
|
||||
var/department = "Unknown" // our department
|
||||
|
||||
@@ -60,7 +66,7 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
dat += "<a href='byond://?src=\ref[src];remove=1'>Remove Item</a><br><br>"
|
||||
|
||||
if(sendcooldown)
|
||||
dat += "<b>Transmitter arrays realigning. Please stand by.</b><br>"
|
||||
dat += "<b>Transmitter arrays realigning. Please stand by. [round(get_remaining_cooldown() / 10)] seconds remaining.</b><br>"
|
||||
|
||||
else
|
||||
|
||||
@@ -71,7 +77,7 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
else
|
||||
if(sendcooldown)
|
||||
dat += "Please insert paper to send via secure connection.<br><br>"
|
||||
dat += "<b>Transmitter arrays realigning. Please stand by.</b><br>"
|
||||
dat += "<b>Transmitter arrays realigning. Please stand by. [round(get_remaining_cooldown() / 10)] seconds remaining.</b><br>"
|
||||
else
|
||||
dat += "Please insert paper to send via secure connection.<br><br>"
|
||||
|
||||
@@ -91,19 +97,30 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
|
||||
user << browse(dat, "window=copier")
|
||||
onclose(user, "copier")
|
||||
|
||||
if (sendcooldown != 0)
|
||||
spawn(50)
|
||||
// Auto-refresh every 5 seconds, if cooldown is active
|
||||
updateUsrDialog()
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/Topic(href, href_list)
|
||||
if(href_list["send"])
|
||||
if (sendcooldown > 0)
|
||||
// Rate-limit sending faxes
|
||||
usr << "<span class='warning'>The fax machine isn't ready, yet!</span>"
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
if(copyitem)
|
||||
if (destination in admin_departments)
|
||||
send_admin_fax(usr, destination)
|
||||
else if (destination == broadcast_departments)
|
||||
send_broadcast_fax()
|
||||
else
|
||||
sendfax(destination)
|
||||
|
||||
if (sendcooldown)
|
||||
spawn(sendcooldown) // cooldown time
|
||||
sendcooldown = 0
|
||||
updateUsrDialog()
|
||||
|
||||
else if(href_list["remove"])
|
||||
if(copyitem)
|
||||
@@ -136,7 +153,7 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
|
||||
if(href_list["dept"])
|
||||
var/lastdestination = destination
|
||||
destination = input(usr, "Which department?", "Choose a department", "") as null|anything in (alldepartments + admin_departments)
|
||||
destination = input(usr, "Which department?", "Choose a department", "") as null|anything in (alldepartments + admin_departments + broadcast_departments)
|
||||
if(!destination) destination = lastdestination
|
||||
|
||||
if(href_list["auth"])
|
||||
@@ -169,9 +186,44 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
|
||||
updateUsrDialog()
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/sendfax(var/destination)
|
||||
/obj/machinery/photocopier/faxmachine/process()
|
||||
.=..()
|
||||
/var/static/ui_update_delay = 0
|
||||
|
||||
var/current_time = world.time
|
||||
if (current_time > sendtime + sendcooldown)
|
||||
sendcooldown = 0
|
||||
|
||||
/*
|
||||
* Set the send cooldown
|
||||
* cooldown: duration in ~1/10s
|
||||
*/
|
||||
/obj/machinery/photocopier/faxmachine/proc/set_cooldown(var/cooldown)
|
||||
// Reset send time
|
||||
sendtime = world.time
|
||||
|
||||
// Set cooldown length
|
||||
sendcooldown = cooldown
|
||||
|
||||
/*
|
||||
* Get remaining cooldown duration in ~1/10s
|
||||
*/
|
||||
/obj/machinery/photocopier/faxmachine/proc/get_remaining_cooldown()
|
||||
var/remaining_time = (sendtime + sendcooldown) - world.time
|
||||
if ((remaining_time < 0) || (sendcooldown == 0))
|
||||
// Time is up, but Process() hasn't caught up, yet
|
||||
// or no cooldown has been set
|
||||
remaining_time = 0
|
||||
return remaining_time
|
||||
|
||||
/*
|
||||
* Send normal fax message to on-station fax machine
|
||||
* destination: (string) from /allfaxes
|
||||
* display_message: (bool) 1=display info text, 0="silent mode"
|
||||
*/
|
||||
/obj/machinery/photocopier/faxmachine/proc/sendfax(var/destination, var/display_message = 1)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
return 0
|
||||
|
||||
use_power(200)
|
||||
|
||||
@@ -180,11 +232,14 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
if( F.department == destination )
|
||||
success = F.recievefax(copyitem)
|
||||
|
||||
if (success)
|
||||
visible_message("[src] beeps, \"Message transmitted successfully.\"")
|
||||
//sendcooldown = 600
|
||||
else
|
||||
visible_message("[src] beeps, \"Error transmitting message.\"")
|
||||
if (display_message)
|
||||
// Normal fax
|
||||
if (success)
|
||||
visible_message("[src] beeps, \"Message transmitted successfully.\"")
|
||||
sendcooldown = normalfax_cooldown
|
||||
else
|
||||
visible_message("[src] beeps, \"Error transmitting message.\"")
|
||||
return success
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/recievefax(var/obj/item/incoming)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
@@ -212,6 +267,22 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
|
||||
return 1
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/send_broadcast_fax()
|
||||
var success = 1
|
||||
for (var/dest in (alldepartments - department))
|
||||
// Send to everyone except this department
|
||||
delay(1)
|
||||
success &= sendfax(dest, 0) // 0: don't display success/error messages
|
||||
|
||||
if(!success)// Stop on first error
|
||||
break
|
||||
if (success)
|
||||
visible_message("[src] beeps, \"Messages transmitted successfully.\"")
|
||||
set_cooldown(broadcastfax_cooldown)
|
||||
else
|
||||
visible_message("[src] beeps, \"Error transmitting messages.\"")
|
||||
set_cooldown(normalfax_cooldown)
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/send_admin_fax(var/mob/sender, var/destination)
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
@@ -240,9 +311,9 @@ var/list/sent_faxes = list() //cache for faxes that have been sent by the admins
|
||||
message_admins(sender, "SOL GOVERNMENT FAX", rcvdcopy, "CentcommFaxReply", "#1F66A0")
|
||||
//message_admins(sender, "SOL GOVERNMENT FAX", rcvdcopy, "SolGovFaxReply", "#1F66A0")
|
||||
|
||||
sendcooldown = 1800
|
||||
sleep(50)
|
||||
visible_message("[src] beeps, \"Message transmitted successfully.\"")
|
||||
set_cooldown(adminfax_cooldown)
|
||||
spawn(50)
|
||||
visible_message("[src] beeps, \"Message transmitted successfully.\"")
|
||||
|
||||
|
||||
/obj/machinery/photocopier/faxmachine/proc/message_admins(var/mob/sender, var/faxname, var/obj/item/sent, var/reply_type, font_colour="#006100")
|
||||
|
||||
Reference in New Issue
Block a user