mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 19:44:58 +01:00
tgui cargo console
rewrite awful shuttle/cargo code a lot as well
This commit is contained in:
@@ -0,0 +1,182 @@
|
||||
/obj/machinery/computer/cargo
|
||||
name = "supply console"
|
||||
desc = "Used to order supplies, approve requests, and control the shuttle."
|
||||
icon_screen = "supply"
|
||||
circuit = /obj/item/weapon/circuitboard/cargo
|
||||
var/requestonly = FALSE
|
||||
var/contraband = FALSE
|
||||
|
||||
/obj/machinery/computer/cargo/request
|
||||
name = "supply request console"
|
||||
desc = "Used to request supplies from cargo."
|
||||
icon_screen = "request"
|
||||
circuit = /obj/item/weapon/circuitboard/cargo/request
|
||||
requestonly = TRUE
|
||||
|
||||
/obj/machinery/computer/cargo/New()
|
||||
..()
|
||||
var/obj/item/weapon/circuitboard/cargo/board = circuit
|
||||
contraband = board.contraband
|
||||
|
||||
/obj/machinery/computer/cargo/emag_act(mob/user)
|
||||
if(!emagged)
|
||||
user << "<span class='notice'>Special supplies unlocked.</span>"
|
||||
emagged = TRUE
|
||||
|
||||
/obj/machinery/computer/cargo/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "cargo", name, 1000, 800, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/cargo/get_ui_data()
|
||||
var/list/data = list()
|
||||
data["requestonly"] = requestonly
|
||||
data["location"] = SSshuttle.supply.getStatusText()
|
||||
data["points"] = SSshuttle.points
|
||||
data["away"] = SSshuttle.supply.getDockedId() == "supply_away"
|
||||
data["docked"] = SSshuttle.supply.mode == SHUTTLE_IDLE
|
||||
data["loan"] = SSshuttle.shuttle_loan ? TRUE : FALSE
|
||||
data["loan_dispatched"] = SSshuttle.shuttle_loan && SSshuttle.shuttle_loan.dispatched
|
||||
data["message"] = SSshuttle.centcom_message || "Remember to stamp and send back the supply manifests."
|
||||
|
||||
var/list/supplies = list()
|
||||
supplies.len = all_supply_groups.len
|
||||
for(var/group in all_supply_groups)
|
||||
supplies[group] = list(
|
||||
"name" = get_supply_group_name(group),
|
||||
"packs" = list()
|
||||
)
|
||||
for(var/pack in SSshuttle.supply_packs)
|
||||
var/datum/supply_packs/P = SSshuttle.supply_packs[pack]
|
||||
if((P.hidden && !emagged) || (P.contraband && !contraband))
|
||||
continue
|
||||
supplies[P.group]["packs"] += list(list(
|
||||
"name" = P.name,
|
||||
"cost" = P.cost,
|
||||
"id" = pack
|
||||
))
|
||||
data["supplies"] = supplies
|
||||
|
||||
data["cart"] = list()
|
||||
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
|
||||
data["cart"] += list(list(
|
||||
"object" = SO.object.name,
|
||||
"cost" = SO.object.cost,
|
||||
"id" = SO.ordernum
|
||||
))
|
||||
|
||||
data["requests"] = list()
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
data["requests"] += list(list(
|
||||
"object" = SO.object.name,
|
||||
"cost" = SO.object.cost,
|
||||
"orderedby" = SO.orderedby,
|
||||
"comment" = SO.comment,
|
||||
"id" = SO.ordernum
|
||||
))
|
||||
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/cargo/ui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
if(action != "add" && requestonly)
|
||||
return
|
||||
switch(action)
|
||||
if("send")
|
||||
if(SSshuttle.supply.canMove())
|
||||
say("For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons.")
|
||||
return
|
||||
if(SSshuttle.supply.getDockedId() == "supply_home")
|
||||
SSshuttle.moveShuttle("supply", "supply_away", TRUE)
|
||||
say("The supply shuttle has departed.")
|
||||
investigate_log("[key_name(usr)] has sent the supply shuttle away. Points: [SSshuttle.points]. Contents: [SSshuttle.sold_atoms].", "cargo")
|
||||
else
|
||||
investigate_log("[key_name(usr)] has called the supply shuttle. Points: [SSshuttle.points].", "cargo") // TODO: more robust logging here
|
||||
say("The supply shuttle has been called and will arrive in [SSshuttle.supply.timeLeft(600)] minutes.")
|
||||
SSshuttle.moveShuttle("supply", "supply_home", TRUE)
|
||||
. = TRUE
|
||||
if("loan")
|
||||
if(!SSshuttle.shuttle_loan)
|
||||
return
|
||||
else if(SSshuttle.supply.mode == SHUTTLE_IDLE)
|
||||
SSshuttle.shuttle_loan.loan_shuttle()
|
||||
say("The supply shuttle has been loaned to Centcom.")
|
||||
. = TRUE
|
||||
if("add")
|
||||
var/id = params["id"]
|
||||
if(!SSshuttle.supply_packs[id])
|
||||
return
|
||||
|
||||
var/name = "*None Provided*"
|
||||
var/rank = "*None Provided*"
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
name = H.get_authentification_name()
|
||||
rank = H.get_assignment()
|
||||
else if(issilicon(usr))
|
||||
name = usr.real_name
|
||||
rank = "Silicon"
|
||||
|
||||
var/reason = ""
|
||||
if(requestonly)
|
||||
reason = input("Reason:", name, "") as text|null
|
||||
if(isnull(reason) || ..())
|
||||
return
|
||||
|
||||
var/turf/T = get_turf(src)
|
||||
var/datum/supply_order/SO = SSshuttle.generateSupplyOrder(id, name, rank, reason)
|
||||
SO.generateRequisition(T)
|
||||
if(requestonly)
|
||||
SSshuttle.requestlist += SO
|
||||
else
|
||||
SSshuttle.shoppinglist += SO
|
||||
. = TRUE
|
||||
if("remove")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
|
||||
if(SO.ordernum == id)
|
||||
SSshuttle.shoppinglist -= SO
|
||||
. = TRUE
|
||||
break
|
||||
if("clear")
|
||||
SSshuttle.shoppinglist.Cut()
|
||||
. = TRUE
|
||||
if("approve")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
if(SO.ordernum == id)
|
||||
SSshuttle.requestlist -= SO
|
||||
SSshuttle.shoppinglist += SO
|
||||
. = TRUE
|
||||
break
|
||||
if("deny")
|
||||
var/id = text2num(params["id"])
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
if(SO.ordernum == id)
|
||||
SSshuttle.requestlist -= SO
|
||||
. = TRUE
|
||||
break
|
||||
if("denyall")
|
||||
SSshuttle.requestlist.Cut()
|
||||
. = TRUE
|
||||
if(.)
|
||||
post_signal("supply")
|
||||
|
||||
/obj/machinery/computer/cargo/proc/post_signal(command)
|
||||
|
||||
var/datum/radio_frequency/frequency = SSradio.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)
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
/obj/machinery/computer/supplycomp
|
||||
name = "supply shuttle console"
|
||||
desc = "Used to order supplies."
|
||||
icon_screen = "supply"
|
||||
req_access = list(access_cargo)
|
||||
circuit = /obj/item/weapon/circuitboard/supplycomp
|
||||
verb_say = "flashes"
|
||||
verb_ask = "flashes"
|
||||
verb_exclaim = "flashes"
|
||||
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/supplycomp/New()
|
||||
..()
|
||||
|
||||
var/obj/item/weapon/circuitboard/supplycomp/board = circuit
|
||||
can_order_contraband = board.contraband_enabled
|
||||
|
||||
/obj/machinery/computer/supplycomp/attack_hand(mob/user)
|
||||
if(!allowed(user))
|
||||
user << "<span class='warning'>Access Denied.</span>"
|
||||
return
|
||||
|
||||
if(..())
|
||||
return
|
||||
user.set_machine(src)
|
||||
post_signal("supply")
|
||||
var/dat
|
||||
if (temp)
|
||||
dat = temp
|
||||
else
|
||||
var/atDepot = (SSshuttle.supply.getDockedId() == "supply_away")
|
||||
var/inTransit = (SSshuttle.supply.mode != SHUTTLE_IDLE)
|
||||
var/canOrder = atDepot && !inTransit
|
||||
|
||||
dat += {"<div class='statusDisplay'><B>Supply shuttle</B><HR>
|
||||
Location: [SSshuttle.supply.getStatusText()]<BR>
|
||||
<HR>\nSupply Points: [SSshuttle.points]<BR>\n</div><BR>
|
||||
[canOrder ? "\n<A href='?src=\ref[src];order=categories'>Order items</A><BR>\n<BR>" : "\n*Must be away to order items*<BR>\n<BR>"]
|
||||
[inTransit ? "\n*Shuttle already called*<BR>\n<BR>": atDepot ? "\n<A href='?src=\ref[src];send=1'>Send to station</A><BR>\n<BR>":"\n<A href='?src=\ref[src];send=1'>Send to centcom</A><BR>\n<BR>"]
|
||||
[SSshuttle.shuttle_loan ? (SSshuttle.shuttle_loan.dispatched ? "\n*Shuttle loaned to Centcom*<BR>\n<BR>" : "\n<A href='?src=\ref[src];send=1;loan=1'>Loan shuttle to Centcom (5 mins duration)</A><BR>\n<BR>") : "\n*No pending external shuttle requests*<BR>\n<BR>"]
|
||||
\n<A href='?src=\ref[src];viewrequests=1'>View requests</A><BR>\n<BR>
|
||||
\n<A href='?src=\ref[src];vieworders=1'>View orders</A><BR>\n<BR>
|
||||
\n<A href='?src=\ref[user];mach_close=computer'>Close</A><BR>
|
||||
<HR>\n<B>Central Command messages:</B><BR> [SSshuttle.centcom_message ? SSshuttle.centcom_message : "Remember to stamp and send back the supply manifests."]"}
|
||||
|
||||
var/datum/browser/popup = new(user, "computer", "Supply Shuttle Console", 700, 455)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
return
|
||||
|
||||
/obj/machinery/computer/supplycomp/emag_act(mob/user)
|
||||
if(!hacked)
|
||||
user << "<span class='notice'>Special supplies unlocked.</span>"
|
||||
hacked = 1
|
||||
|
||||
/obj/machinery/computer/supplycomp/Topic(href, href_list)
|
||||
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(SSshuttle.supply.canMove())
|
||||
if(SSshuttle.shuttle_loan)
|
||||
temp = "The supply shuttle must be docked to send new commands.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
else
|
||||
temp = "For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
|
||||
else if(SSshuttle.supply.getDockedId() == "supply_home")
|
||||
if(href_list["loan"] && SSshuttle.shuttle_loan)
|
||||
if(!SSshuttle.shuttle_loan.dispatched)
|
||||
SSshuttle.shuttle_loan.loan_shuttle()
|
||||
temp = "The supply shuttle has been loaned to Centcom.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
post_signal("supply")
|
||||
else
|
||||
temp = "You can not loan the supply shuttle at this time.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
else
|
||||
temp = "The supply shuttle has departed.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
SSshuttle.toggleShuttle("supply", "supply_home", "supply_away", 1)
|
||||
investigate_log("[usr.key] has sent the supply shuttle away. Remaining points: [SSshuttle.points]. Shuttle contents:[SSshuttle.sold_atoms]", "cargo")
|
||||
else
|
||||
if(href_list["loan"] && SSshuttle.shuttle_loan)
|
||||
if(!SSshuttle.shuttle_loan.dispatched && SSshuttle.supply.mode == SHUTTLE_IDLE) // Must either be at centcom, or at the station. No redirecting off course!
|
||||
SSshuttle.shuttle_loan.loan_shuttle()
|
||||
temp = "The supply shuttle has been loaned to Centcom.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
post_signal("supply")
|
||||
else
|
||||
temp = "You can not loan the supply shuttle at this time.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
else
|
||||
if(!SSshuttle.supply.request(SSshuttle.getDock("supply_home")))
|
||||
temp = "The supply shuttle has been called and will arrive in [SSshuttle.supply.timeLeft(600)] minutes.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
post_signal("supply")
|
||||
|
||||
else if (href_list["order"])
|
||||
if(SSshuttle.supply.mode != SHUTTLE_IDLE)
|
||||
return
|
||||
if(href_list["order"] == "categories")
|
||||
//all_supply_groups
|
||||
//Request what?
|
||||
last_viewed_group = "categories"
|
||||
temp = "<div class='statusDisplay'><b>Supply points: [SSshuttle.points]</b><BR>"
|
||||
temp += "<A href='?src=\ref[src];mainmenu=1'>Main Menu</A><BR></div><BR>"
|
||||
temp += "<b>Select a category</b><BR><BR>"
|
||||
for(var/cat in all_supply_groups )
|
||||
temp += "<A href='?src=\ref[src];order=[cat]'>[get_supply_group_name(cat)]</A><BR>"
|
||||
else
|
||||
last_viewed_group = href_list["order"]
|
||||
var/cat = text2num(last_viewed_group)
|
||||
temp = "<div class='statusDisplay'><b>Supply points: [SSshuttle.points]</b><BR>"
|
||||
temp += "<A href='?src=\ref[src];order=categories'>Back to all categories</A><BR></div><BR>"
|
||||
temp += "<b>Request from: [get_supply_group_name(cat)]</b><BR><BR>"
|
||||
for(var/supply_type in SSshuttle.supply_packs )
|
||||
var/datum/supply_packs/N = SSshuttle.supply_packs[supply_type]
|
||||
if((N.hidden && !hacked) || (N.contraband && !can_order_contraband) || N.group != cat)
|
||||
continue //Have to send the type instead of a reference to
|
||||
temp += "<A href='?src=\ref[src];doorder=[supply_type]'>[N.name]</A> Cost: [N.cost]<BR>" //the obj because it would get caught by the garbage
|
||||
|
||||
/*temp = "Supply points: [supply_shuttle.points]<BR><HR><BR>Request what?<BR><BR>"
|
||||
|
||||
for(var/supply_name in supply_shuttle.supply_packs )
|
||||
var/datum/supply_packs/N = supply_shuttle.supply_packs[supply_name]
|
||||
if(N.hidden && !hacked) continue
|
||||
if(N.contraband && !can_order_contraband) continue
|
||||
temp += "<A href='?src=\ref[src];doorder=[supply_name]'>[supply_name]</A> Cost: [N.cost]<BR>" //the obj because it would get caught by the garbage
|
||||
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"*/
|
||||
|
||||
else if (href_list["doorder"])
|
||||
if(world.time < reqtime)
|
||||
say("[world.time - reqtime] seconds remaining until another requisition form may be printed.")
|
||||
return
|
||||
|
||||
//Find the correct supply_pack datum
|
||||
if(!SSshuttle.supply_packs[href_list["doorder"]])
|
||||
return
|
||||
|
||||
var/timeout = world.time + 600
|
||||
var/reason = stripped_input(usr,"Reason:","Why do you require this item?","")
|
||||
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
|
||||
|
||||
var/datum/supply_order/O = SSshuttle.generateSupplyOrder(href_list["doorder"], idname, idrank, reason)
|
||||
if(!O)
|
||||
return
|
||||
O.generateRequisition(loc)
|
||||
|
||||
reqtime = (world.time + 5) % 1e5
|
||||
|
||||
temp = "Order request placed.<BR>"
|
||||
temp += "<BR><A href='?src=\ref[src];order=[last_viewed_group]'>Back</A> | <A href='?src=\ref[src];mainmenu=1'>Main Menu</A> | <A href='?src=\ref[src];confirmorder=[O.ordernum]'>Authorize Order</A>"
|
||||
|
||||
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<=SSshuttle.requestlist.len, i++)
|
||||
var/datum/supply_order/SO = SSshuttle.requestlist[i]
|
||||
if(SO && SO.ordernum == ordernum)
|
||||
O = SO
|
||||
P = O.object
|
||||
if(SSshuttle.points >= P.cost)
|
||||
SSshuttle.requestlist.Cut(i,i+1)
|
||||
SSshuttle.points -= P.cost
|
||||
SSshuttle.shoppinglist += O
|
||||
temp = "Thanks for your order."
|
||||
investigate_log("[usr.key] has authorized an order for [P.name]. Remaining points: [SSshuttle.points].", "cargo")
|
||||
else
|
||||
temp = "Not enough supply points."
|
||||
break
|
||||
temp += "<BR><BR><A href='?src=\ref[src];viewrequests=1'>Back</A> <A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
|
||||
else if (href_list["vieworders"])
|
||||
temp = "<A href='?src=\ref[src];mainmenu=1'>Main Menu</A><BR><BR>Current approved orders: <BR><BR>"
|
||||
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
|
||||
temp += "#[SO.ordernum] - [SO.object.name] approved by [SO.orderedby][SO.comment ? " ([SO.comment])":""]<BR>"// <A href='?src=\ref[src];cancelorder=[S]'>(Cancel)</A><BR>"
|
||||
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
/*
|
||||
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]<BR><BR><BR>"
|
||||
|
||||
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])":""] <A href='?src=\ref[src];cancelorder=[S]'>(Cancel)</A><BR>"
|
||||
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
*/
|
||||
else if (href_list["viewrequests"])
|
||||
temp = "<A href='?src=\ref[src];mainmenu=1'>Main Menu</A><BR><BR>Current requests: <BR><BR>"
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby] [SSshuttle.supply.getDockedId() == "supply_away" ? "<A href='?src=\ref[src];confirmorder=[SO.ordernum]'>Approve</A> <A href='?src=\ref[src];rreq=[SO.ordernum]'>Remove</A>" : ""]<BR>"
|
||||
|
||||
temp += "<BR><A href='?src=\ref[src];clearreq=1'>Clear list</A>"
|
||||
|
||||
else if (href_list["rreq"])
|
||||
var/ordernum = text2num(href_list["rreq"])
|
||||
temp = "Invalid Request.<BR>"
|
||||
for(var/i=1, i<=SSshuttle.requestlist.len, i++)
|
||||
var/datum/supply_order/SO = SSshuttle.requestlist[i]
|
||||
if(SO && SO.ordernum == ordernum)
|
||||
SSshuttle.requestlist.Cut(i,i+1)
|
||||
temp = "Request removed.<BR>"
|
||||
break
|
||||
temp += "<BR><A href='?src=\ref[src];viewrequests=1'>Back</A> <A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
|
||||
else if (href_list["clearreq"])
|
||||
SSshuttle.requestlist.Cut()
|
||||
temp = "List cleared.<BR>"
|
||||
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
|
||||
else if (href_list["mainmenu"])
|
||||
temp = null
|
||||
|
||||
add_fingerprint(usr)
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/computer/supplycomp/proc/post_signal(command)
|
||||
|
||||
var/datum/radio_frequency/frequency = SSradio.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)
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
/obj/machinery/computer/ordercomp
|
||||
name = "supply ordering console"
|
||||
desc = "Used to order supplies from cargo staff."
|
||||
icon_screen = "request"
|
||||
circuit = /obj/item/weapon/circuitboard/ordercomp
|
||||
verb_say = "flashes"
|
||||
verb_ask = "flashes"
|
||||
verb_exclaim = "flashes"
|
||||
var/temp = null
|
||||
var/reqtime = 0 //Cooldown for requisitions - Quarxink
|
||||
var/last_viewed_group = "categories"
|
||||
|
||||
/obj/machinery/computer/ordercomp/attack_hand(mob/user)
|
||||
if(..())
|
||||
return
|
||||
user.set_machine(src)
|
||||
var/dat
|
||||
if(temp)
|
||||
dat = temp
|
||||
else
|
||||
dat += {"<div class='statusDisplay'>Shuttle Location: [SSshuttle.supply.name]<BR>
|
||||
<HR>Supply Points: [SSshuttle.points]<BR></div>
|
||||
|
||||
<BR>\n<A href='?src=\ref[src];order=categories'>Request items</A><BR><BR>
|
||||
<A href='?src=\ref[src];vieworders=1'>View approved orders</A><BR><BR>
|
||||
<A href='?src=\ref[src];viewrequests=1'>View requests</A><BR><BR>
|
||||
<A href='?src=\ref[user];mach_close=computer'>Close</A>"}
|
||||
|
||||
var/datum/browser/popup = new(user, "computer", "Supply Ordering Console", 575, 450)
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
|
||||
popup.open()
|
||||
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 = "<div class='statusDisplay'><b>Supply points: [SSshuttle.points]</b><BR>"
|
||||
temp += "<A href='?src=\ref[src];mainmenu=1'>Main Menu</A><BR></div><BR>"
|
||||
temp += "<b>Select a category</b><BR><BR>"
|
||||
for(var/cat in all_supply_groups )
|
||||
temp += "<A href='?src=\ref[src];order=[cat]'>[get_supply_group_name(cat)]</A><BR>"
|
||||
else
|
||||
last_viewed_group = href_list["order"]
|
||||
var/cat = text2num(last_viewed_group)
|
||||
temp = "<div class='statusDisplay'><b>Supply points: [SSshuttle.points]</b><BR>"
|
||||
temp += "<A href='?src=\ref[src];order=categories'>Back to all categories</A><BR></div><BR>"
|
||||
temp += "<b>Request from: [get_supply_group_name(cat)]</b><BR><BR>"
|
||||
for(var/supply_type in SSshuttle.supply_packs )
|
||||
var/datum/supply_packs/N = SSshuttle.supply_packs[supply_type]
|
||||
if(N.hidden || N.contraband || N.group != cat)
|
||||
continue //Have to send the type instead of a reference to
|
||||
temp += "<A href='?src=\ref[src];doorder=[supply_type]'>[N.name]</A> Cost: [N.cost]<BR>" //the obj because it would get caught by the garbage
|
||||
else if (href_list["doorder"])
|
||||
if(world.time < reqtime)
|
||||
say("[world.time - reqtime] seconds remaining until another requisition form may be printed.")
|
||||
return
|
||||
|
||||
//Find the correct supply_pack datum
|
||||
if(!SSshuttle.supply_packs["[href_list["doorder"]]"])
|
||||
return
|
||||
|
||||
var/timeout = world.time + 600
|
||||
var/reason = stripped_input(usr,"Reason:","Why do you require this item?","")
|
||||
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
|
||||
|
||||
var/datum/supply_order/O = SSshuttle.generateSupplyOrder(href_list["doorder"], idname, idrank, reason)
|
||||
if(!O)
|
||||
return
|
||||
O.generateRequisition(loc)
|
||||
|
||||
reqtime = (world.time + 5) % 1e5
|
||||
|
||||
temp = "Thanks for your request. The cargo team will process it as soon as possible.<BR>"
|
||||
temp += "<BR><A href='?src=\ref[src];order=[last_viewed_group]'>Back</A> <A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
|
||||
else if (href_list["vieworders"])
|
||||
temp = "<A href='?src=\ref[src];mainmenu=1'>Main Menu</A><BR><BR>Current approved orders: <BR><BR>"
|
||||
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
|
||||
temp += "[SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]<BR>"
|
||||
|
||||
else if (href_list["viewrequests"])
|
||||
temp = "<A href='?src=\ref[src];mainmenu=1'>Main Menu</A><BR><BR>Current requests: <BR><BR>"
|
||||
for(var/datum/supply_order/SO in SSshuttle.requestlist)
|
||||
temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby]<BR>"
|
||||
|
||||
else if (href_list["mainmenu"])
|
||||
temp = null
|
||||
|
||||
add_fingerprint(usr)
|
||||
updateUsrDialog()
|
||||
return
|
||||
@@ -241,24 +241,24 @@
|
||||
build_path = /obj/item/weapon/circuitboard/rdconsole
|
||||
category = list("Computer Boards")
|
||||
|
||||
/datum/design/ordercomp
|
||||
name = "Computer Design (Supply ordering console)"
|
||||
desc = "Allows for the construction of circuit boards used to build a Supply ordering console."
|
||||
id = "ordercomp"
|
||||
req_tech = list("programming" = 2)
|
||||
build_type = IMPRINTER
|
||||
materials = list(MAT_GLASS = 1000, "sacid" = 20)
|
||||
build_path = /obj/item/weapon/circuitboard/ordercomp
|
||||
category = list("Computer Boards")
|
||||
|
||||
/datum/design/supplycomp
|
||||
name = "Computer Design (Supply shuttle console)"
|
||||
desc = "Allows for the construction of circuit boards used to build a Supply shuttle console."
|
||||
id = "supplycomp"
|
||||
/datum/design/cargo
|
||||
name = "Computer Design (Supply Console)"
|
||||
desc = "Allows for the construction of circuit boards used to build a Supply Console."
|
||||
id = "cargo"
|
||||
req_tech = list("programming" = 3)
|
||||
build_type = IMPRINTER
|
||||
materials = list(MAT_GLASS = 1000, "sacid" = 20)
|
||||
build_path = /obj/item/weapon/circuitboard/supplycomp
|
||||
build_path = /obj/item/weapon/circuitboard/cargo
|
||||
category = list("Computer Boards")
|
||||
|
||||
/datum/design/cargorequest
|
||||
name = "Computer Design (Supply Request Console)"
|
||||
desc = "Allows for the construction of circuit boards used to build a Supply Request Console."
|
||||
id = "cargorequest"
|
||||
req_tech = list("programming" = 2)
|
||||
build_type = IMPRINTER
|
||||
materials = list(MAT_GLASS = 1000, "sacid" = 20)
|
||||
build_path = /obj/item/weapon/circuitboard/cargo/request
|
||||
category = list("Computer Boards")
|
||||
|
||||
/datum/design/mining
|
||||
|
||||
@@ -529,7 +529,7 @@
|
||||
dst = previous
|
||||
else
|
||||
dst = destination
|
||||
. += " towards [dst ? dst.name : "unknown location"] ([timeLeft(600)]mins)"
|
||||
. += " towards [dst ? dst.name : "unknown location"] ([timeLeft(600)] minutes)"
|
||||
#undef DOCKING_PORT_HIGHLIGHT
|
||||
|
||||
|
||||
|
||||
@@ -60,6 +60,13 @@
|
||||
/datum/proc/ui_host()
|
||||
return src // Default src.
|
||||
|
||||
/**
|
||||
* global
|
||||
*
|
||||
* Used to track the current screen.
|
||||
**/
|
||||
/datum/var/ui_screen = "home"
|
||||
|
||||
/**
|
||||
* global
|
||||
*
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
"can_close" = TRUE,
|
||||
"auto_format" = FALSE
|
||||
)
|
||||
var/screen = "home" // The screen this UI is currently viewing (defaults to home).
|
||||
var/style = "nanotrasen" // The style to be used for this UI.
|
||||
var/interface // The interface (template) to be used for this UI.
|
||||
var/autoupdate = TRUE // Update the UI every MC tick.
|
||||
@@ -142,16 +141,6 @@
|
||||
/datum/tgui/proc/set_window_options(list/window_options)
|
||||
src.window_options = window_options
|
||||
|
||||
/**
|
||||
* public
|
||||
*
|
||||
* Set the screen (page) for this UI.
|
||||
*
|
||||
* required screen string The screen to change to.
|
||||
**/
|
||||
/datum/tgui/proc/set_screen(screen)
|
||||
src.screen = lowertext(screen)
|
||||
|
||||
/**
|
||||
* public
|
||||
*
|
||||
@@ -224,7 +213,7 @@
|
||||
var/list/config_data = list(
|
||||
"title" = title,
|
||||
"status" = status,
|
||||
"screen" = screen,
|
||||
"screen" = src_object.ui_screen,
|
||||
"style" = style,
|
||||
"interface" = interface,
|
||||
"fancy" = user.client.prefs.tgui_fancy,
|
||||
@@ -260,8 +249,8 @@
|
||||
// Generate the JSON.
|
||||
var/json = json_encode(json_data)
|
||||
// Strip #255/improper.
|
||||
json = replacetext(json, "\improper", "")
|
||||
json = replacetext(json, "\proper", "")
|
||||
json = replacetext(json, "\improper", "")
|
||||
return json
|
||||
|
||||
/**
|
||||
@@ -284,7 +273,7 @@
|
||||
initialized = TRUE
|
||||
if("tgui:view")
|
||||
if(params["screen"])
|
||||
screen = params["screen"]
|
||||
src_object.ui_screen = params["screen"]
|
||||
SStgui.update_uis(src_object)
|
||||
if("tgui:link")
|
||||
user << link(params["url"])
|
||||
|
||||
Reference in New Issue
Block a user