//Mailsystem disposal chute /obj/machinery/disposal/mail name = "mail chute" icon_state = "mailchute" desc = "A pneumatic mail-delivery chute." icon_style = "mail" var/mail_tag = null var/destination_tag = null var/list/destinations = list() var/frequency = 1475 var/datum/radio_frequency/radio_connection var/last_inquire = 0 //No signal spamming etc var/autoname = 0 var/message = null var/mailgroup = null var/mailgroup2 = null var/net_id = null var/pdafrequency = 1149 var/datum/radio_frequency/pda_connection New() ..() if (src.autoname == 1 && !isnull(src.mail_tag)) src.name = "mail chute ([src.mail_tag])" spawn(100) if (src) if (radio_controller) radio_connection = radio_controller.add_object(src, "[frequency]") pda_connection = radio_controller.add_object(src, "[pdafrequency]") src.post_radio_status() if (!src.net_id) src.net_id = generate_net_id(src) return // user interaction interact(mob/user, var/ai=0) src.add_fingerprint(user) if(stat & BROKEN) user.machine = null return var/dat = "Mail Transport UnitMail Transport Unit: [src.mail_tag ? (capitalize(src.mail_tag)) : "GENERIC"]
" if(flush) dat += "Shipping handle: Disengage Engaged" else dat += "Shipping handle: Disengaged Engage" dat += "

Eject contents
" dat += "
Destination: [src.destination_tag ? src.destination_tag : "NONE"]" dat += "
Rescan
" if(mode == 0) dat += "Pump: Off On
" else if(mode == 1) dat += "Pump: Off On (pressurizing)
" else dat += "Pump: Off On (idle)
" var/per = 100* air_contents.return_pressure() / (2*ONE_ATMOSPHERE) dat += "Pressure: [round(per, 1)]%
" user.machine = src user << browse(dat, "window=mailchute;size=360x270") onclose(user, "mailchute") Topic(href, href_list) ..() src.add_fingerprint(usr) if(stat & BROKEN) return if(usr.stat || usr.restrained() || src.flushing) return if (in_range(src, usr) && istype(src.loc, /turf)) usr.machine = src if(href_list["close"]) usr.machine = null usr << browse(null, "window=mailchute") return if(href_list["pump"]) if(text2num(href_list["pump"])) mode = 1 else mode = 0 update() if(href_list["set_dest"]) if(destinations) var/dest = input("Select Parcel Destination", "Delivery Target Selection", src.destination_tag) as null|anything in destinations if(dest && in_range(src, usr)) src.destination_tag = dest update() if(href_list["rescan"]) if(last_inquire && world.time < (last_inquire + 10)) return destinations = null var/datum/signal/signal = get_free_signal() signal.source = src signal.transmission_method = TRANSMISSION_RADIO signal.data["command"] = "mail_inquire" spawn(4) if (radio_connection) radio_connection.post_signal(src, signal) if(href_list["handle"]) flush = text2num(href_list["handle"]) update() if(href_list["eject"]) eject() else usr << browse(null, "window=mailchute") usr.machine = null return return proc/post_radio_status() var/datum/signal/signal = get_free_signal() signal.source = src signal.transmission_method = TRANSMISSION_RADIO signal.data["command"] = "mail_reply" signal.data["data"] = src.mail_tag radio_connection.post_signal(src, signal) return receive_signal(datum/signal/signal) if (signal.data["command"] == "mail_reply") if (!src.destinations) src.destinations = new() var/destination = signal.data["data"] if (!destination) return if (!(destination in src.destinations)) src.destinations += destination src.destinations = sortList(src.destinations) else if (signal.data["command"] == "mail_inquire") spawn (4) if (src) src.post_radio_status() return return flush() if(!src.destination_tag) return flushing = 1 if (istype(src, /obj/machinery/disposal/mail)) flick("mailchute-flush", src) else flick("disposal-flush", src) var/obj/disposalholder/H = new() // virtual holder object which actually // travels through the pipes. H.init(src) // copy the contents of disposer to holder H.mail_tag = src.destination_tag air_contents.zero() // new empty gas resv. sleep(10) playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0) sleep(5) // wait for animation to finish H.start(src) // start the holder processing movement flushing = 0 // now reset disposal state flush = 0 if(mode == 2) // if was ready, mode = 1 // switch to charging update() return expel() if (message) var/myarea = get_area(src) message = "Mail delivery alert in [myarea]." if (message && mailgroup && pda_connection) var/datum/signal/newsignal = get_free_signal() newsignal.source = src newsignal.transmission_method = TRANSMISSION_RADIO newsignal.data["command"] = "text_message" newsignal.data["sender_name"] = "CHUTE-MAILBOT" newsignal.data["message"] = "[message]" newsignal.data["address_1"] = "00000000" newsignal.data["group"] = mailgroup newsignal.data["sender"] = src.net_id pda_connection.post_signal(src, newsignal) if (message && mailgroup2 && pda_connection) var/datum/signal/newsignal = get_free_signal() newsignal.source = src newsignal.transmission_method = TRANSMISSION_RADIO newsignal.data["command"] = "text_message" newsignal.data["sender_name"] = "CHUTE-MAILBOT" newsignal.data["message"] = "[message]" newsignal.data["address_1"] = "00000000" newsignal.data["group"] = mailgroup2 newsignal.data["sender"] = src.net_id pda_connection.post_signal(src, newsignal) ..() return colosseum flush() flushing = 1 if (istype(src, /obj/machinery/disposal/mail)) flick("mailchute-flush", src) else flick("disposal-flush", src) var/obj/disposalholder/H = new() // virtual holder object which actually // travels through the pipes. H.init(src) // copy the contents of disposer to holder sleep(10) playsound(src, 'sound/machines/disposalflush.ogg', 50, 0, 0) sleep(5) // wait for animation to finish H.start(src) // start the holder processing movement flushing = 0 // now reset disposal state flush = 0 if(mode == 2) // if was ready, mode = 1 // switch to charging update() return ex_act(severity) return /obj/machinery/disposal/mail/autoname autoname = 1 // Please keep the destinations identical to /obj/machinery/disposal/mail/small/autoname. janitor name = "Janitor" mail_tag = "janitor" mailgroup = "janitor" message = 1 kitchen name = "Kitchen" mail_tag = "kitchen" mailgroup = "kitchen" message = 1 hydroponics name = "Hydroponics" mail_tag = "hydroponics" mailgroup = "botany" message = 1 security name = "Security" mail_tag = "security" mailgroup = "security" message = 1 brig name = "Brig" mail_tag = "brig" detective name = "Detective" mail_tag = "detective" bridge name = "Bridge" mail_tag = "bridge" mailgroup = "command" message = 1 chapel name = "Chapel" mail_tag = "chapel" mailgroup = "chaplain" message = 1 engineering name = "Engineering" mail_tag = "engineering" mailgroup = "engineer" message = 1 mechanics name = "Mechanics" mail_tag = "mechanics" mailgroup = "mechanic" message = 1 mining name = "Mining" mail_tag = "mining" mailgroup = "mining" message = 1 qm name = "QM" mail_tag = "QM" mailgroup = "cargo" message = 1 refinery name = "Refinery" mail_tag = "refinery" research name = "Research" mail_tag = "research" mailgroup = "science" message = 1 telescience name = "Telescience" mail_tag = "telescience" chemistry name = "Chemistry" mail_tag = "chemistry" testchamber name = "Test Chamber" mail_tag = "testchamber" medbay name = "Medbay" mail_tag = "medbay" mailgroup = "medbay" mailgroup2 = "medresearch" message = 1 robotics name = "Robotics" mail_tag = "robotics" mailgroup = "medresearch" mailgroup2 = null genetics name = "Genetics" mail_tag = "genetics" mailgroup = "medresearch" mailgroup2 = null pathology name = "Pathology" mail_tag = "pathology" morgue name = "Morgue" mail_tag = "morgue" booth name = "Medical Booth" mail_tag = "medical booth" checkpoint name = "Don't spawn me" mailgroup = "security" mailgroup2 = "command" message = 1 arrivals name = "Arrivals Checkpoint" mail_tag = "arrivals checkpoint" escape name = "Escape Hallway Checkpoint" mail_tag = "escape checkpoint" customs name = "Customs Checkpoint" mail_tag = "customs checkpoint" sec_foyer name = "Security Foyer Checkpoint" mail_tag = "sec foyer checkpoint" podbay name = "Pod Bay Checkpoint" mail_tag = "podbay checkpoint" chapel name = "Chapel Checkpoint" mail_tag = "chapel checkpoint" cargo name = "Cargo Checkpoint" mail_tag = "cargo checkpoint" port name = "Port Hallway Checkpoint" mail_tag = "port hallway checkpoint" starboard name = "Starboard Hallway Checkpoint" mail_tag = "starboard hallway checkpoint" public name = "Don't spawn me" crew name = "Crew Quarters" mail_tag = "crew" crewA name = "Crew A" mail_tag = "crewA" crewB name = "Crew B" mail_tag = "crewB" arcade name = "Arcade" mail_tag = "arcade" market name = "Market" mail_tag = "market" cafeteria name = "Cafeteria" mail_tag = "cafeteria" arrivals name = "Arrivals" mail_tag = "arrivals hallway" escape name = "Escape" mail_tag = "escape hallway" medbay_lobby name = "Medbay Lobby" mail_tag = "medbay lobby" podbay name = "Pod Bay" mail_tag = "podbay" /obj/machinery/disposal/mail/small icon = 'icons/obj/disposal_small.dmi' handle_state = "dispover-handle" density = 0 /obj/machinery/disposal/mail/small/autoname autoname = 1 /* New() // Would be more elegant, but I want them to be aligned properly in the map editor. ..() if (src.dir == NORTH) src.pixel_y = 32 return */ // Please keep the destinations identical to /obj/machinery/disposal/mail/autoname. janitor name = "Janitor" mail_tag = "janitor" mailgroup = "janitor" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST kitchen name = "Kitchen" mail_tag = "kitchen" mailgroup = "kitchen" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST hydroponics name = "Hydroponics" mail_tag = "hydroponics" mailgroup = "botany" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST security name = "Security" mail_tag = "security" mailgroup = "security" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST brig name = "Brig" mail_tag = "brig" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST detective name = "Detective" mail_tag = "detective" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST bridge name = "Bridge" mail_tag = "bridge" mailgroup = "command" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST chapel name = "Chapel" mail_tag = "chapel" mailgroup = "chaplain" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST engineering name = "Engineering" mail_tag = "engineering" mailgroup = "engineer" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST mechanics name = "Mechanics" mail_tag = "mechanics" mailgroup = "mechanic" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST mining name = "Mining" mail_tag = "mining" mailgroup = "mining" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST qm name = "QM" mail_tag = "QM" mailgroup = "cargo" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST refinery name = "Refinery" mail_tag = "refinery" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST research name = "Research" mail_tag = "research" mailgroup = "science" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST telescience name = "Telescience" mail_tag = "telescience" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST chemistry name = "Chemistry" mail_tag = "chemistry" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST testchamber name = "Test Chamber" mail_tag = "testchamber" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST medbay name = "Medbay" mail_tag = "medbay" mailgroup = "medbay" mailgroup2 = "medresearch" message = 1 north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST robotics name = "Robotics" mail_tag = "robotics" mailgroup = "medresearch" mailgroup2 = null north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST genetics name = "Genetics" mail_tag = "genetics" mailgroup = "medresearch" mailgroup2 = null north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST pathology name = "Pathology" mail_tag = "pathology" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST morgue name = "Morgue" mail_tag = "morgue" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST booth name = "Medical Booth" mail_tag = "medical booth" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST checkpoint name = "Don't spawn me" mailgroup = "security" mailgroup2 = "command" message = 1 arrivals name = "Arrivals Checkpoint" mail_tag = "arrivals checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST escape name = "Escape Hallway Checkpoint" mail_tag = "escape checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST customs name = "Customs Checkpoint" mail_tag = "customs checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST sec_foyer name = "Security Foyer Checkpoint" mail_tag = "sec foyer checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST podbay name = "Pod Bay Checkpoint" mail_tag = "podbay checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST chapel name = "Chapel Checkpoint" mail_tag = "chapel checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST cargo name = "Cargo Checkpoint" mail_tag = "cargo checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST port name = "Port Hallway Checkpoint" mail_tag = "port hallway checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST starboard name = "Starboard Hallway Checkpoint" mail_tag = "starboard hallway checkpoint" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST public name = "Don't spawn me" crew name = "Crew Quarters" mail_tag = "crew" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST crewA name = "Crew A" mail_tag = "crewA" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST crewB name = "Crew B" mail_tag = "crewB" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST arcade name = "Arcade" mail_tag = "arcade" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST market name = "Market" mail_tag = "market" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST cafeteria name = "Cafeteria" mail_tag = "cafeteria" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST arrivals name = "Arrivals" mail_tag = "arrivals hallway" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST escape name = "Escape" mail_tag = "escape hallway" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST medbay_lobby name = "Medbay Lobby" mail_tag = "medbay lobby" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST podbay name = "Pod Bay" mail_tag = "podbay" north dir = NORTH pixel_y = 32 east dir = EAST south dir = SOUTH west dir = WEST