diff --git a/code/modules/cciaa/cciaa.dm b/code/modules/cciaa/cciaa.dm index 732b2d69131..a0db01f4afd 100644 --- a/code/modules/cciaa/cciaa.dm +++ b/code/modules/cciaa/cciaa.dm @@ -154,9 +154,8 @@ M.implant_loyalty(M, 1) - var/obj/item/weapon/card/id/W = new(M) + var/obj/item/weapon/card/id/centcom/W = new(M) W.name = "[M.real_name]'s ID Card" - W.icon_state = "centcom" W.item_state = "id_inv" W.access = get_all_accesses() + get_centcom_access("CCIA Agent") W.assignment = "Central Command Internal Affairs Agent" diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 02b2b70bc14..4b3f4e840c2 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -224,7 +224,7 @@ emp_act if(istype(I,/obj/item/weapon/card/emag)) if(!(affecting.status & ORGAN_ROBOT)) user << "\red That limb isn't robotic." - return + return 0 if(affecting.sabotaged) user << "\red [src]'s [affecting.name] is already sabotaged!" else @@ -232,7 +232,7 @@ emp_act var/obj/item/weapon/card/emag/emag = I emag.uses-- affecting.sabotaged = 1 - return 1 + return 0 if(I.attack_verb.len) visible_message("\red [src] has been [pick(I.attack_verb)] in the [hit_area] with [I.name] by [user]!") diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm index 75f7dcf85fd..80c86329c33 100644 --- a/code/modules/paperwork/faxmachine.dm +++ b/code/modules/paperwork/faxmachine.dm @@ -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 += "Remove Item

" if(sendcooldown) - dat += "Transmitter arrays realigning. Please stand by.
" + dat += "Transmitter arrays realigning. Please stand by. [round(get_remaining_cooldown() / 10)] seconds remaining.
" 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.

" - dat += "Transmitter arrays realigning. Please stand by.
" + dat += "Transmitter arrays realigning. Please stand by. [round(get_remaining_cooldown() / 10)] seconds remaining.
" else dat += "Please insert paper to send via secure connection.

" @@ -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 << "The fax machine isn't ready, yet!" + 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") diff --git a/code/modules/reagents/reagent_containers/food/snacks.dm b/code/modules/reagents/reagent_containers/food/snacks.dm index 1b64a6c79e7..0cb69d3faf6 100644 --- a/code/modules/reagents/reagent_containers/food/snacks.dm +++ b/code/modules/reagents/reagent_containers/food/snacks.dm @@ -1596,7 +1596,7 @@ afterattack(obj/O as obj, var/mob/living/carbon/human/user as mob, proximity) if(!proximity) return - if(istype(O,/obj/structure/sink) && !wrapped) + if(( istype(O, /obj/structure/reagent_dispensers/watertank) || istype(O,/obj/structure/sink) ) && !wrapped) user << "You place \the [name] under a stream of water..." if(istype(user)) user.unEquip(src) diff --git a/html/changelogs/inselc-PR-1116.yml b/html/changelogs/inselc-PR-1116.yml new file mode 100644 index 00000000000..478105bc984 --- /dev/null +++ b/html/changelogs/inselc-PR-1116.yml @@ -0,0 +1,10 @@ +author: inselc + +delete-after: True + +changes: + - bugfix: "Removed animation on emagging robotic limbs." + - bugfix: "Fixed CCIAA turret whitelist." + - bugfix: "Fixed fax machine cooldown." + - rscadd: "Added ability to expand monkey cubes at water tanks." + - rscadd: "Added stationwide fax broadcast."