//Config stuff #define SUPPLY_DOCKZ 2 //Z-level of the Dock. #define SUPPLY_STATIONZ 1 //Z-level of the Station. #define SUPPLY_STATION_AREATYPE "/area/supply/station" //Type of the supply shuttle area for station #define SUPPLY_DOCK_AREATYPE "/area/supply/dock" //Type of the supply shuttle area for dock var/datum/controller/supply/supply_controller = new() var/list/mechtoys = list( /obj/item/toy/prize/ripley, /obj/item/toy/prize/fireripley, /obj/item/toy/prize/deathripley, /obj/item/toy/prize/gygax, /obj/item/toy/prize/durand, /obj/item/toy/prize/honk, /obj/item/toy/prize/marauder, /obj/item/toy/prize/seraph, /obj/item/toy/prize/mauler, /obj/item/toy/prize/odysseus, /obj/item/toy/prize/phazon ) /area/supply/station //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS. name = "Supply Shuttle" icon_state = "shuttle3" luminosity = 1 lighting_use_dynamic = 0 requires_power = 0 /area/supply/dock //DO NOT TURN THE lighting_use_dynamic STUFF ON FOR SHUTTLES. IT BREAKS THINGS. name = "Supply Shuttle" icon_state = "shuttle3" luminosity = 1 lighting_use_dynamic = 0 requires_power = 0 //SUPPLY PACKS MOVED TO /code/defines/obj/supplypacks.dm /obj/structure/plasticflaps //HOW DO YOU CALL THOSE THINGS ANYWAY name = "\improper plastic flaps" desc = "Completely impassable - or are they?" icon = 'icons/obj/stationobjs.dmi' //Change this. icon_state = "plasticflaps" density = 0 anchored = 1 layer = 4 explosion_resistance = 5 /obj/structure/plasticflaps/CanPass(atom/A, turf/T) if(istype(A) && A.checkpass(PASSGLASS)) return prob(60) var/obj/structure/stool/bed/B = A if (istype(A, /obj/structure/stool/bed) && B.buckled_mob)//if it's a bed/chair and someone is buckled, it will not pass return 0 if(istype(A, /obj/vehicle)) //no vehicles return 0 if(istype(A, /mob/living)) // You Shall Not Pass! var/mob/living/M = A if(!M.lying && !istype(M, /mob/living/carbon/monkey) && !istype(M, /mob/living/carbon/slime) && !istype(M, /mob/living/simple_animal/mouse) && !istype(M, /mob/living/silicon/robot/drone)) //If your not laying down, or a small creature, no pass. return 0 return ..() /obj/structure/plasticflaps/ex_act(severity) switch(severity) if (1) del(src) if (2) if (prob(50)) del(src) if (3) if (prob(5)) del(src) /obj/structure/plasticflaps/mining //A specific type for mining that doesn't allow airflow because of them damn crates name = "\improper Airtight plastic flaps" desc = "Heavy duty, airtight, plastic flaps." New() //set the turf below the flaps to block air var/turf/T = get_turf(loc) if(T) T.blocks_air = 1 ..() Del() //lazy hack to set the turf to allow air to pass if it's a simulated floor var/turf/T = get_turf(loc) if(T) if(istype(T, /turf/simulated/floor)) T.blocks_air = 0 ..() /obj/machinery/computer/supplycomp name = "Supply shuttle console" icon = 'icons/obj/computer.dmi' icon_state = "supply" req_access = list(access_cargo) circuit = "/obj/item/weapon/circuitboard/supplycomp" var/temp = null var/reqtime = 0 //Cooldown for requisitions - Quarxink var/hacked = 0 var/can_order_contraband = 0 var/last_viewed_group = "categories" /obj/machinery/computer/ordercomp name = "Supply ordering console" icon = 'icons/obj/computer.dmi' icon_state = "request" circuit = "/obj/item/weapon/circuitboard/ordercomp" var/temp = null var/reqtime = 0 //Cooldown for requisitions - Quarxink var/last_viewed_group = "categories" /* /obj/effect/marker/supplymarker icon_state = "X" icon = 'icons/misc/mark.dmi' name = "X" invisibility = 101 anchored = 1 opacity = 0 */ /datum/supply_order var/ordernum var/datum/supply_packs/object = null var/orderedby = null var/comment = null /datum/controller/supply var/processing = 1 var/processing_interval = 300 var/iteration = 0 //supply points var/points = 50 var/points_per_process = 1 var/points_per_slip = 2 var/points_per_crate = 5 var/points_per_platinum = 5 // 5 points per sheet var/points_per_phoron = 5 //control var/ordernum var/list/shoppinglist = list() var/list/requestlist = list() var/list/supply_packs = list() //shuttle movement var/movetime = 1200 var/datum/shuttle/ferry/supply/shuttle New() ordernum = rand(1,9000) //Supply shuttle ticker - handles supply point regenertion and shuttle travelling between centcomm and the station proc/process() for(var/typepath in (typesof(/datum/supply_packs) - /datum/supply_packs)) var/datum/supply_packs/P = new typepath() supply_packs[P.name] = P spawn(0) set background = 1 while(1) if(processing) iteration++ points += points_per_process sleep(processing_interval) //To stop things being sent to centcomm which should not be sent to centcomm. Recursively checks for these types. proc/forbidden_atoms_check(atom/A) if(istype(A,/mob/living)) return 1 if(istype(A,/obj/item/weapon/disk/nuclear)) return 1 if(istype(A,/obj/machinery/nuclearbomb)) return 1 if(istype(A,/obj/item/device/radio/beacon)) return 1 for(var/i=1, i<=A.contents.len, i++) var/atom/B = A.contents[i] if(.(B)) return 1 //Sellin proc/sell() var/area/area_shuttle = shuttle.get_location_area() if(!area_shuttle) return var/phoron_count = 0 var/plat_count = 0 for(var/atom/movable/MA in area_shuttle) if(MA.anchored) continue // Must be in a crate! if(istype(MA,/obj/structure/closet/crate)) callHook("sell_crate", list(MA, area_shuttle)) points += points_per_crate var/find_slip = 1 for(var/atom in MA) // Sell manifests var/atom/A = atom if(find_slip && istype(A,/obj/item/weapon/paper/manifest)) var/obj/item/weapon/paper/slip = A if(slip.stamped && slip.stamped.len) //yes, the clown stamp will work. clown is the highest authority on the station, it makes sense points += points_per_slip find_slip = 0 continue // Sell phoron if(istype(A, /obj/item/stack/sheet/mineral/phoron)) var/obj/item/stack/sheet/mineral/phoron/P = A phoron_count += P.get_amount() // Sell platinum if(istype(A, /obj/item/stack/sheet/mineral/platinum)) var/obj/item/stack/sheet/mineral/platinum/P = A plat_count += P.get_amount() del(MA) if(phoron_count) points += phoron_count * points_per_phoron if(plat_count) points += plat_count * points_per_platinum //Buyin proc/buy() if(!shoppinglist.len) return var/area/area_shuttle = shuttle.get_location_area() if(!area_shuttle) return var/list/clear_turfs = list() for(var/turf/T in area_shuttle) if(T.density || T.contents.len) continue clear_turfs += T for(var/S in shoppinglist) if(!clear_turfs.len) break var/i = rand(1,clear_turfs.len) var/turf/pickedloc = clear_turfs[i] clear_turfs.Cut(i,i+1) var/datum/supply_order/SO = S var/datum/supply_packs/SP = SO.object var/atom/A = new SP.containertype(pickedloc) A.name = "[SP.containername] [SO.comment ? "([SO.comment])":"" ]" //supply manifest generation begin var/obj/item/weapon/paper/manifest/slip = new /obj/item/weapon/paper/manifest(A) slip.info = "

[command_name()] Shipping Manifest



" slip.info +="Order #[SO.ordernum]
" slip.info +="Destination: [station_name]
" slip.info +="[shoppinglist.len] PACKAGES IN THIS SHIPMENT
" slip.info +="CONTENTS:

" slip.info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS
" if (SP.contraband) slip.loc = null //we are out of blanks for Form #44-D Ordering Illicit Drugs. shoppinglist.Cut() return /obj/item/weapon/paper/manifest name = "Supply Manifest" /obj/machinery/computer/ordercomp/attack_ai(var/mob/user as mob) return attack_hand(user) /obj/machinery/computer/supplycomp/attack_ai(var/mob/user as mob) return attack_hand(user) /obj/machinery/computer/ordercomp/attack_hand(var/mob/user as mob) if(..()) return user.set_machine(src) var/dat if(temp) dat = temp else var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (shuttle) dat += {"
Supply shuttle
Location: [shuttle.has_arrive_time() ? "Moving to station ([shuttle.eta_minutes()] Mins.)":shuttle.at_station() ? "Docked":"Away"]

Supply points: [supply_controller.points]

\nRequest items

View approved orders

View requests

Close"} user << browse(dat, "window=computer;size=575x450") onclose(user, "computer") return /obj/machinery/computer/ordercomp/Topic(href, href_list) if(..()) return if( isturf(loc) && (in_range(src, usr) || istype(usr, /mob/living/silicon)) ) usr.set_machine(src) if(href_list["order"]) if(href_list["order"] == "categories") //all_supply_groups //Request what? last_viewed_group = "categories" temp = "Supply points: [supply_controller.points]
" temp += "Main Menu


" temp += "Select a category

" for(var/supply_group_name in all_supply_groups ) temp += "[supply_group_name]
" else last_viewed_group = href_list["order"] temp = "Supply points: [supply_controller.points]
" temp += "Back to all categories


" temp += "Request from: [last_viewed_group]

" for(var/supply_name in supply_controller.supply_packs ) var/datum/supply_packs/N = supply_controller.supply_packs[supply_name] if(N.hidden || N.contraband || N.group != last_viewed_group) continue //Have to send the type instead of a reference to temp += "[supply_name] Cost: [N.cost]
" //the obj because it would get caught by the garbage else if (href_list["doorder"]) if(world.time < reqtime) for(var/mob/V in hearers(src)) V.show_message("[src]'s monitor flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"") return //Find the correct supply_pack datum var/datum/supply_packs/P = supply_controller.supply_packs[href_list["doorder"]] if(!istype(P)) return var/timeout = world.time + 600 var/reason = copytext(sanitize(input(usr,"Reason:","Why do you require this item?","") as null|text),1,MAX_MESSAGE_LEN) if(world.time > timeout) return if(!reason) return var/idname = "*None Provided*" var/idrank = "*None Provided*" if(ishuman(usr)) var/mob/living/carbon/human/H = usr idname = H.get_authentification_name() idrank = H.get_assignment() else if(issilicon(usr)) idname = usr.real_name supply_controller.ordernum++ var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(loc) reqform.name = "Requisition Form - [P.name]" reqform.info += "

[station_name] Supply Requisition Form


" reqform.info += "INDEX: #[supply_controller.ordernum]
" reqform.info += "REQUESTED BY: [idname]
" reqform.info += "RANK: [idrank]
" reqform.info += "REASON: [reason]
" reqform.info += "SUPPLY CRATE TYPE: [P.name]
" reqform.info += "ACCESS RESTRICTION: [replacetext(get_access_desc(P.access))]
" reqform.info += "CONTENTS:
" reqform.info += P.manifest reqform.info += "
" reqform.info += "STAMP BELOW TO APPROVE THIS REQUISITION:
" reqform.update_icon() //Fix for appearing blank when printed. reqtime = (world.time + 5) % 1e5 //make our supply_order datum var/datum/supply_order/O = new /datum/supply_order() O.ordernum = supply_controller.ordernum O.object = P O.orderedby = idname supply_controller.requestlist += O temp = "Thanks for your request. The cargo team will process it as soon as possible.
" temp += "
Back Main Menu" else if (href_list["vieworders"]) temp = "Current approved orders:

" for(var/S in supply_controller.shoppinglist) var/datum/supply_order/SO = S temp += "[SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]
" temp += "
OK" else if (href_list["viewrequests"]) temp = "Current requests:

" for(var/S in supply_controller.requestlist) var/datum/supply_order/SO = S temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby]
" temp += "
OK" else if (href_list["mainmenu"]) temp = null add_fingerprint(usr) updateUsrDialog() return /obj/machinery/computer/supplycomp/attack_hand(var/mob/user as mob) if(!allowed(user)) user << "\red Access Denied." return if(..()) return user.set_machine(src) post_signal("supply") var/dat if (temp) dat = temp else var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (shuttle) dat += "
Supply shuttle
" dat += "\nLocation: " if (shuttle.has_arrive_time()) dat += "In transit ([shuttle.eta_minutes()] Mins.)
" else if (shuttle.at_station()) if (shuttle.docking_controller) switch(shuttle.docking_controller.get_docking_status()) if ("docked") dat += "Docked at station
" if ("undocked") dat += "Undocked from station
" if ("docking") dat += "Docking with station [shuttle.can_force()? "Force Launch" : ""]
" if ("undocking") dat += "Undocking from station [shuttle.can_force()? "Force Launch" : ""]
" else dat += "Station
" if (shuttle.can_launch()) dat += "Send away" else if (shuttle.can_cancel()) dat += "Cancel launch" else dat += "*Shuttle is busy*" dat += "
\n
" else dat += "Away
" if (shuttle.can_launch()) dat += "Request supply shuttle" else if (shuttle.can_cancel()) dat += "Cancel request" else dat += "*Shuttle is busy*" dat += "
\n
" dat += {"
\nSupply points: [supply_controller.points]
\n
\nOrder items
\n
\nView requests
\n
\nView orders
\n
\nClose"} user << browse(dat, "window=computer;size=575x450") onclose(user, "computer") return /obj/machinery/computer/supplycomp/attackby(I as obj, user as mob) if(istype(I,/obj/item/weapon/card/emag) && !hacked) user << "\blue Special supplies unlocked." hacked = 1 return else ..() return /obj/machinery/computer/supplycomp/Topic(href, href_list) if(!supply_controller) world.log << "## ERROR: Eek. The supply_controller controller datum is missing somehow." return var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle if (!shuttle) world.log << "## ERROR: Eek. The supply/shuttle datum is missing somehow." return if(..()) return if(isturf(loc) && ( in_range(src, usr) || istype(usr, /mob/living/silicon) ) ) usr.set_machine(src) //Calling the shuttle if(href_list["send"]) if(shuttle.at_station()) if (shuttle.forbidden_atoms_check()) temp = "For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons.

OK" else shuttle.launch(src) temp = "Initiating launch sequence. \[Force Launch\]

OK" else shuttle.launch(src) temp = "The supply shuttle has been called and will arrive in approximately [round(supply_controller.movetime/600,1)] minutes.

OK" post_signal("supply") if (href_list["force_send"]) shuttle.force_launch(src) if (href_list["cancel_send"]) shuttle.cancel_launch(src) else if (href_list["order"]) //if(!shuttle.idle()) return //this shouldn't be necessary it seems if(href_list["order"] == "categories") //all_supply_groups //Request what? last_viewed_group = "categories" temp = "Supply points: [supply_controller.points]
" temp += "Main Menu


" temp += "Select a category

" for(var/supply_group_name in all_supply_groups ) temp += "[supply_group_name]
" else last_viewed_group = href_list["order"] temp = "Supply points: [supply_controller.points]
" temp += "Back to all categories


" temp += "Request from: [last_viewed_group]

" for(var/supply_name in supply_controller.supply_packs ) var/datum/supply_packs/N = supply_controller.supply_packs[supply_name] if((N.hidden && !hacked) || (N.contraband && !can_order_contraband) || N.group != last_viewed_group) continue //Have to send the type instead of a reference to temp += "[supply_name] Cost: [N.cost]
" //the obj because it would get caught by the garbage /*temp = "Supply points: [supply_controller.points]


Request what?

" for(var/supply_name in supply_controller.supply_packs ) var/datum/supply_packs/N = supply_controller.supply_packs[supply_name] if(N.hidden && !hacked) continue if(N.contraband && !can_order_contraband) continue temp += "[supply_name] Cost: [N.cost]
" //the obj because it would get caught by the garbage temp += "
OK"*/ else if (href_list["doorder"]) if(world.time < reqtime) for(var/mob/V in hearers(src)) V.show_message("[src]'s monitor flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"") return //Find the correct supply_pack datum var/datum/supply_packs/P = supply_controller.supply_packs[href_list["doorder"]] if(!istype(P)) return var/timeout = world.time + 600 var/reason = copytext(sanitize(input(usr,"Reason:","Why do you require this item?","") as null|text),1,MAX_MESSAGE_LEN) if(world.time > timeout) return if(!reason) return var/idname = "*None Provided*" var/idrank = "*None Provided*" if(ishuman(usr)) var/mob/living/carbon/human/H = usr idname = H.get_authentification_name() idrank = H.get_assignment() else if(issilicon(usr)) idname = usr.real_name supply_controller.ordernum++ var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(loc) reqform.name = "Requisition Form - [P.name]" reqform.info += "

[station_name] Supply Requisition Form


" reqform.info += "INDEX: #[supply_controller.ordernum]
" reqform.info += "REQUESTED BY: [idname]
" reqform.info += "RANK: [idrank]
" reqform.info += "REASON: [reason]
" reqform.info += "SUPPLY CRATE TYPE: [P.name]
" reqform.info += "ACCESS RESTRICTION: [replacetext(get_access_desc(P.access))]
" reqform.info += "CONTENTS:
" reqform.info += P.manifest reqform.info += "
" reqform.info += "STAMP BELOW TO APPROVE THIS REQUISITION:
" reqform.update_icon() //Fix for appearing blank when printed. reqtime = (world.time + 5) % 1e5 //make our supply_order datum var/datum/supply_order/O = new /datum/supply_order() O.ordernum = supply_controller.ordernum O.object = P O.orderedby = idname supply_controller.requestlist += O temp = "Order request placed.
" temp += "
Back | Main Menu | Authorize Order" else if(href_list["confirmorder"]) //Find the correct supply_order datum var/ordernum = text2num(href_list["confirmorder"]) var/datum/supply_order/O var/datum/supply_packs/P temp = "Invalid Request" for(var/i=1, i<=supply_controller.requestlist.len, i++) var/datum/supply_order/SO = supply_controller.requestlist[i] if(SO.ordernum == ordernum) O = SO P = O.object if(supply_controller.points >= P.cost) supply_controller.requestlist.Cut(i,i+1) supply_controller.points -= P.cost supply_controller.shoppinglist += O temp = "Thanks for your order.
" temp += "
Back Main Menu" else temp = "Not enough supply points.
" temp += "
Back Main Menu" break else if (href_list["vieworders"]) temp = "Current approved orders:

" for(var/S in supply_controller.shoppinglist) var/datum/supply_order/SO = S temp += "#[SO.ordernum] - [SO.object.name] approved by [SO.orderedby][SO.comment ? " ([SO.comment])":""]
"// (Cancel)
" temp += "
OK" /* else if (href_list["cancelorder"]) var/datum/supply_order/remove_supply = href_list["cancelorder"] supply_shuttle_shoppinglist -= remove_supply supply_shuttle_points += remove_supply.object.cost temp += "Canceled: [remove_supply.object.name]


" for(var/S in supply_shuttle_shoppinglist) var/datum/supply_order/SO = S temp += "[SO.object.name] approved by [SO.orderedby][SO.comment ? " ([SO.comment])":""] (Cancel)
" temp += "
OK" */ else if (href_list["viewrequests"]) temp = "Current requests:

" for(var/S in supply_controller.requestlist) var/datum/supply_order/SO = S temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby] Approve Remove
" temp += "
Clear list" temp += "
OK" else if (href_list["rreq"]) var/ordernum = text2num(href_list["rreq"]) temp = "Invalid Request.
" for(var/i=1, i<=supply_controller.requestlist.len, i++) var/datum/supply_order/SO = supply_controller.requestlist[i] if(SO.ordernum == ordernum) supply_controller.requestlist.Cut(i,i+1) temp = "Request removed.
" break temp += "
Back Main Menu" else if (href_list["clearreq"]) supply_controller.requestlist.Cut() temp = "List cleared.
" temp += "
OK" else if (href_list["mainmenu"]) temp = null add_fingerprint(usr) updateUsrDialog() return /obj/machinery/computer/supplycomp/proc/post_signal(var/command) var/datum/radio_frequency/frequency = radio_controller.return_frequency(1435) if(!frequency) return var/datum/signal/status_signal = new status_signal.source = src status_signal.transmission_method = 1 status_signal.data["command"] = command frequency.post_signal(src, status_signal)