mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-06 23:51:43 +00:00
Re-implement NanoUI cargo console
This commit is contained in:
@@ -212,125 +212,3 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
S.dwidth = M.dwidth
|
||||
S.dheight = M.dheight
|
||||
moveShuttle(M.id, "[M.roundstart_move]", 0)
|
||||
|
||||
/datum/supply_order
|
||||
var/ordernum
|
||||
var/datum/supply_packs/object = null
|
||||
var/orderedby = null
|
||||
var/orderedbyRank
|
||||
var/comment = null
|
||||
|
||||
/datum/supply_order/proc/generateRequisition(atom/_loc)
|
||||
if(!object)
|
||||
return
|
||||
|
||||
var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(_loc)
|
||||
reqform.name = "requisition form - [object.name]"
|
||||
reqform.info += "<h3>[station_name] Supply Requisition Form</h3><hr>"
|
||||
reqform.info += "INDEX: #[ordernum]<br>"
|
||||
reqform.info += "REQUESTED BY: [orderedby]<br>"
|
||||
reqform.info += "RANK: [orderedbyRank]<br>"
|
||||
reqform.info += "REASON: [comment]<br>"
|
||||
reqform.info += "SUPPLY CRATE TYPE: [object.name]<br>"
|
||||
reqform.info += "ACCESS RESTRICTION: [get_access_desc(object.access)]<br>"
|
||||
reqform.info += "CONTENTS:<br>"
|
||||
reqform.info += object.manifest
|
||||
reqform.info += "<hr>"
|
||||
reqform.info += "STAMP BELOW TO APPROVE THIS REQUISITION:<br>"
|
||||
|
||||
reqform.update_icon() //Fix for appearing blank when printed.
|
||||
|
||||
return reqform
|
||||
|
||||
/datum/supply_order/proc/createObject(atom/_loc, errors=0)
|
||||
if(!object)
|
||||
return
|
||||
|
||||
//create the crate
|
||||
var/atom/Crate = new object.containertype(_loc)
|
||||
Crate.name = "[object.containername] [comment ? "([comment])":"" ]"
|
||||
if(object.access)
|
||||
Crate:req_access = list(text2num(object.access))
|
||||
|
||||
//create the manifest slip
|
||||
var/obj/item/weapon/paper/manifest/slip = new /obj/item/weapon/paper/manifest()
|
||||
slip.erroneous = errors
|
||||
slip.points = object.cost
|
||||
slip.ordernumber = ordernum
|
||||
|
||||
var/stationName = (errors & MANIFEST_ERROR_NAME) ? new_station_name() : station_name()
|
||||
var/packagesAmt = shuttle_master.shoppinglist.len + ((errors & MANIFEST_ERROR_COUNT) ? rand(1,2) : 0)
|
||||
|
||||
slip.info = "<h3>[command_name()] Shipping Manifest</h3><hr><br>"
|
||||
slip.info +="Order #[ordernum]<br>"
|
||||
slip.info +="Destination: [stationName]<br>"
|
||||
slip.info +="[packagesAmt] PACKAGES IN THIS SHIPMENT<br>"
|
||||
slip.info +="CONTENTS:<br><ul>"
|
||||
|
||||
//we now create the actual contents
|
||||
var/list/contains
|
||||
if(istype(object, /datum/supply_packs/misc/randomised))
|
||||
var/datum/supply_packs/misc/randomised/SO = object
|
||||
contains = list()
|
||||
if(object.contains.len)
|
||||
for(var/j=1, j<=SO.num_contained, j++)
|
||||
contains += pick(object.contains)
|
||||
else
|
||||
contains = object.contains
|
||||
|
||||
for(var/typepath in contains)
|
||||
if(!typepath) continue
|
||||
var/atom/A = new typepath(Crate)
|
||||
if(object.amount && A.vars.Find("amount") && A:amount)
|
||||
A:amount = object.amount
|
||||
slip.info += "<li>[A.name]</li>" //add the item to the manifest (even if it was misplaced)
|
||||
|
||||
if(istype(Crate, /obj/structure/closet/critter)) // critter crates do not actually spawn mobs yet and have no contains var, but the manifest still needs to list them
|
||||
var/obj/structure/closet/critter/CritCrate = Crate
|
||||
if(CritCrate.content_mob)
|
||||
var/mob/crittername = CritCrate.content_mob
|
||||
slip.info += "<li>[initial(crittername.name)]</li>"
|
||||
|
||||
if((errors & MANIFEST_ERROR_ITEM))
|
||||
//secure and large crates cannot lose items
|
||||
if(findtext("[object.containertype]", "/secure/") || findtext("[object.containertype]","/largecrate/"))
|
||||
errors &= ~MANIFEST_ERROR_ITEM
|
||||
else
|
||||
var/lostAmt = max(round(Crate.contents.len/10), 1)
|
||||
//lose some of the items
|
||||
while(--lostAmt >= 0)
|
||||
qdel(pick(Crate.contents))
|
||||
|
||||
//manifest finalisation
|
||||
slip.info += "</ul><br>"
|
||||
slip.info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS<hr>" // And now this is actually meaningful.
|
||||
slip.loc = Crate
|
||||
if(istype(Crate, /obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/CR = Crate
|
||||
CR.manifest = slip
|
||||
CR.update_icon()
|
||||
if(istype(Crate, /obj/structure/largecrate))
|
||||
var/obj/structure/largecrate/LC = Crate
|
||||
LC.manifest = slip
|
||||
LC.update_icon()
|
||||
|
||||
return Crate
|
||||
|
||||
/datum/controller/process/shuttle/proc/generateSupplyOrder(packId, _orderedby, _orderedbyRank, _comment)
|
||||
if(!packId)
|
||||
return
|
||||
var/datum/supply_packs/P = supply_packs["[packId]"]
|
||||
if(!P)
|
||||
return
|
||||
|
||||
var/datum/supply_order/O = new()
|
||||
O.ordernum = ordernum++
|
||||
O.object = P
|
||||
O.orderedby = _orderedby
|
||||
O.orderedbyRank = _orderedbyRank
|
||||
O.comment = _comment
|
||||
|
||||
requestlist += O
|
||||
|
||||
return O
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
#define ORDER_SCREEN_WIDTH 625 //width of order computer interaction window
|
||||
#define ORDER_SCREEN_HEIGHT 580 //height of order computer interaction window
|
||||
#define SUPPLY_SCREEN_WIDTH 625 //width of supply computer interaction window
|
||||
#define SUPPLY_SCREEN_HEIGHT 620 //height of supply computer interaction window
|
||||
|
||||
/obj/item/weapon/paper/manifest
|
||||
name = "supply manifest"
|
||||
var/erroneous = 0
|
||||
@@ -16,9 +21,6 @@
|
||||
height = 7
|
||||
roundstart_move = "supply_away"
|
||||
|
||||
/obj/docking_port/mobile/supply/New()
|
||||
..()
|
||||
|
||||
/obj/docking_port/mobile/supply/register()
|
||||
if(!..())
|
||||
return 0
|
||||
@@ -90,7 +92,6 @@
|
||||
|
||||
shuttle_master.shoppinglist.Cut()
|
||||
|
||||
|
||||
/obj/docking_port/mobile/supply/proc/sell()
|
||||
if(z != ZLEVEL_CENTCOMM) //we only sell when we are -at- centcomm
|
||||
return 1
|
||||
@@ -129,31 +130,31 @@
|
||||
if(slip.erroneous && denied) // Caught a mistake by Centcom (IDEA: maybe Centcom rarely gets offended by this)
|
||||
pointsEarned = slip.points - shuttle_master.points_per_crate
|
||||
shuttle_master.points += pointsEarned // For now, give a full refund for paying attention (minus the crate cost)
|
||||
msg += "<font color=green>+[pointsEarned]</font>: Station correctly denied package [slip.ordernumber]: "
|
||||
msg += "<span class='good'>+[pointsEarned]</span>: Station correctly denied package [slip.ordernumber]: "
|
||||
if(slip.erroneous & MANIFEST_ERROR_NAME)
|
||||
msg += "Destination station incorrect. "
|
||||
else if(slip.erroneous & MANIFEST_ERROR_COUNT)
|
||||
msg += "Packages incorrectly counted. "
|
||||
else if(slip.erroneous & MANIFEST_ERROR_ITEM)
|
||||
msg += "Package incomplete. "
|
||||
msg += "Points refunded.<BR>"
|
||||
msg += "Points refunded.<br>"
|
||||
else if(!slip.erroneous && !denied) // Approving a proper order awards the relatively tiny points_per_slip
|
||||
shuttle_master.points += shuttle_master.points_per_slip
|
||||
msg += "<font color=green>+[shuttle_master.points_per_slip]</font>: Package [slip.ordernumber] accorded.<BR>"
|
||||
msg += "<span class='good'>+[shuttle_master.points_per_slip]</span>: Package [slip.ordernumber] accorded.<br>"
|
||||
else // You done goofed.
|
||||
if(slip.erroneous)
|
||||
msg += "<font color=red>+0</font>: Station approved package [slip.ordernumber] despite error: "
|
||||
msg += "<span class='good'>+0</span>: Station approved package [slip.ordernumber] despite error: "
|
||||
if(slip.erroneous & MANIFEST_ERROR_NAME)
|
||||
msg += "Destination station incorrect."
|
||||
else if(slip.erroneous & MANIFEST_ERROR_COUNT)
|
||||
msg += "Packages incorrectly counted."
|
||||
else if(slip.erroneous & MANIFEST_ERROR_ITEM)
|
||||
msg += "We found unshipped items on our dock."
|
||||
msg += " Be more vigilant.<BR>"
|
||||
msg += " Be more vigilant.<br>"
|
||||
else
|
||||
pointsEarned = round(shuttle_master.points_per_crate - slip.points)
|
||||
shuttle_master.points += pointsEarned
|
||||
msg += "<font color=red>[pointsEarned]</font>: Station denied package [slip.ordernumber]. Our records show no fault on our part.<BR>"
|
||||
msg += "<span class='nad'>[pointsEarned]</span>: Station denied package [slip.ordernumber]. Our records show no fault on our part.<br>"
|
||||
find_slip = 0
|
||||
continue
|
||||
|
||||
@@ -176,7 +177,7 @@
|
||||
if(cost)
|
||||
shuttle_master.techLevels[tech.id] = tech.level
|
||||
shuttle_master.points += cost
|
||||
msg += "<font color=green>+[cost]</font>: [tech.name] - new data.<BR>"
|
||||
msg += "<span class='good'>+[cost]</span>: [tech.name] - new data.<br>"
|
||||
|
||||
// Sell max reliablity designs
|
||||
if(istype(thing, /obj/item/weapon/disk/design_disk))
|
||||
@@ -189,46 +190,45 @@
|
||||
// Maxed out reliability designs only.
|
||||
shuttle_master.points += shuttle_master.points_per_design
|
||||
shuttle_master.researchDesigns += design.id
|
||||
msg += "<font color=green>+[shuttle_master.points_per_design]</font>: Reliable [design.name] design.<BR>"
|
||||
msg += "<span class='good'>+[shuttle_master.points_per_design]</span>: Reliable [design.name] design.<br>"
|
||||
|
||||
// Sell exotic plants
|
||||
if(istype(thing, /obj/item/seeds))
|
||||
var/obj/item/seeds/S = thing
|
||||
if(S.seed.get_trait(TRAIT_RARITY) == 0) // Mundane species
|
||||
msg += "<font color=red>+0</font>: We don't need samples of mundane species \"[capitalize(S.seed.seed_name)]\".<BR>"
|
||||
msg += "<span class='bad'>+0</span>: We don't need samples of mundane species \"[capitalize(S.seed.seed_name)]\".<br>"
|
||||
else if(shuttle_master.discoveredPlants[S.type]) // This species has already been sent to CentComm
|
||||
var/potDiff = S.seed.get_trait(TRAIT_POTENCY) - shuttle_master.discoveredPlants[S.type] // Compare it to the previous best
|
||||
if(potDiff > 0) // This sample is better
|
||||
shuttle_master.discoveredPlants[S.type] = S.seed.get_trait(TRAIT_POTENCY)
|
||||
msg += "<font color=green>+[potDiff]</font>: New sample of \"[capitalize(S.seed.seed_name)]\" is superior. Good work.<BR>"
|
||||
msg += "<span class='good'>+[potDiff]</span>: New sample of \"[capitalize(S.seed.seed_name)]\" is superior. Good work.<br>"
|
||||
shuttle_master.points += potDiff
|
||||
else // This sample is worthless
|
||||
msg += "<font color=red>+0</font>: New sample of \"[capitalize(S.seed.seed_name)]\" is not more potent than existing sample ([shuttle_master.discoveredPlants[S.type]] potency).<BR>"
|
||||
msg += "<span class='bad'>+0</span>: New sample of \"[capitalize(S.seed.seed_name)]\" is not more potent than existing sample ([shuttle_master.discoveredPlants[S.type]] potency).<br>"
|
||||
else // This is a new discovery!
|
||||
shuttle_master.discoveredPlants[S.type] = S.seed.get_trait(TRAIT_POTENCY)
|
||||
msg += "<font color=green>+[S.seed.get_trait(TRAIT_RARITY)]</font>: New species discovered: \"[capitalize(S.seed.seed_name)]\". Excellent work.<BR>"
|
||||
msg += "<span class='good'>+[S.seed.get_trait(TRAIT_RARITY)]</span>: New species discovered: \"[capitalize(S.seed.seed_name)]\". Excellent work.<br>"
|
||||
shuttle_master.points += S.seed.get_trait(TRAIT_RARITY) // That's right, no bonus for potency. Send a crappy sample first to "show improvement" later
|
||||
qdel(MA)
|
||||
shuttle_master.sold_atoms += "."
|
||||
|
||||
if(plasma_count > 0)
|
||||
pointsEarned = round(plasma_count * shuttle_master.points_per_plasma)
|
||||
msg += "<font color=green>+[pointsEarned]</font>: Received [plasma_count] unit(s) of exotic material.<BR>"
|
||||
msg += "<span class='good'>+[pointsEarned]</span>: Received [plasma_count] unit(s) of exotic material.<br>"
|
||||
shuttle_master.points += pointsEarned
|
||||
|
||||
if(intel_count > 0)
|
||||
pointsEarned = round(intel_count * shuttle_master.points_per_intel)
|
||||
msg += "<font color=green>+[pointsEarned]</font>: Received [intel_count] article(s) of enemy intelligence.<BR>"
|
||||
msg += "<span class='good'>+[pointsEarned]</span>: Received [intel_count] article(s) of enemy intelligence.<br>"
|
||||
shuttle_master.points += pointsEarned
|
||||
|
||||
if(crate_count > 0)
|
||||
pointsEarned = round(crate_count * shuttle_master.points_per_crate)
|
||||
msg += "<font color=green>+[pointsEarned]</font>: Received [crate_count] crate(s).<BR>"
|
||||
msg += "<span class='good'>+[pointsEarned]</span>: Received [crate_count] crate(s).<br>"
|
||||
shuttle_master.points += pointsEarned
|
||||
|
||||
shuttle_master.centcom_message = msg
|
||||
|
||||
|
||||
/proc/forbidden_atoms_check(atom/A)
|
||||
var/list/blacklist = list(
|
||||
/mob/living,
|
||||
@@ -252,74 +252,256 @@
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
/obj/machinery/computer/ordercomp/attack_hand(mob/user)
|
||||
if(..())
|
||||
|
||||
/********************
|
||||
SUPPLY ORDER
|
||||
********************/
|
||||
/datum/supply_order
|
||||
var/ordernum
|
||||
var/datum/supply_packs/object = null
|
||||
var/orderedby = null
|
||||
var/orderedbyRank
|
||||
var/comment = null
|
||||
var/crates
|
||||
|
||||
/datum/controller/process/shuttle/proc/generateSupplyOrder(packId, _orderedby, _orderedbyRank, _comment, _crates)
|
||||
if(!packId)
|
||||
return
|
||||
user.set_machine(src)
|
||||
var/dat
|
||||
if(temp)
|
||||
dat = temp
|
||||
var/datum/supply_packs/P = supply_packs["[packId]"]
|
||||
if(!P)
|
||||
return
|
||||
|
||||
var/datum/supply_order/O = new()
|
||||
O.ordernum = ordernum++
|
||||
O.object = P
|
||||
O.orderedby = _orderedby
|
||||
O.orderedbyRank = _orderedbyRank
|
||||
O.comment = _comment
|
||||
O.crates = _crates
|
||||
|
||||
requestlist += O
|
||||
|
||||
return O
|
||||
|
||||
/datum/supply_order/proc/generateRequisition(atom/_loc)
|
||||
if(!object)
|
||||
return
|
||||
|
||||
var/obj/item/weapon/paper/reqform = new /obj/item/weapon/paper(_loc)
|
||||
reqform.name = "Requisition Form - [crates] '[object.name]' for [orderedby]"
|
||||
reqform.info += "<h3>[station_name] Supply Requisition Form</h3><hr>"
|
||||
reqform.info += "INDEX: #[shuttle_master.ordernum]<br>"
|
||||
reqform.info += "REQUESTED BY: [orderedby]<br>"
|
||||
reqform.info += "RANK: [orderedbyRank]<br>"
|
||||
reqform.info += "REASON: [comment]<br>"
|
||||
reqform.info += "SUPPLY CRATE TYPE: [object.name]<br>"
|
||||
reqform.info += "NUMBER OF CRATES: [crates]<br>"
|
||||
reqform.info += "ACCESS RESTRICTION: [object.access ? get_access_desc(object.access) : "None"]<br>"
|
||||
reqform.info += "CONTENTS:<br>"
|
||||
reqform.info += object.manifest
|
||||
reqform.info += "<hr>"
|
||||
reqform.info += "STAMP BELOW TO APPROVE THIS REQUISITION:<br>"
|
||||
|
||||
reqform.update_icon() //Fix for appearing blank when printed.
|
||||
|
||||
return reqform
|
||||
|
||||
/datum/supply_order/proc/createObject(atom/_loc, errors=0)
|
||||
if(!object)
|
||||
return
|
||||
|
||||
//create the crate
|
||||
var/atom/Crate = new object.containertype(_loc)
|
||||
Crate.name = "[object.containername] [comment ? "([comment])":"" ]"
|
||||
if(object.access)
|
||||
Crate:req_access = list(text2num(object.access))
|
||||
|
||||
//create the manifest slip
|
||||
var/obj/item/weapon/paper/manifest/slip = new /obj/item/weapon/paper/manifest()
|
||||
slip.erroneous = errors
|
||||
slip.points = object.cost
|
||||
slip.ordernumber = ordernum
|
||||
|
||||
var/stationName = (errors & MANIFEST_ERROR_NAME) ? new_station_name() : station_name()
|
||||
var/packagesAmt = shuttle_master.shoppinglist.len + ((errors & MANIFEST_ERROR_COUNT) ? rand(1,2) : 0)
|
||||
|
||||
slip.name = "Shipping Manifest - '[object.name]' for [orderedby]"
|
||||
slip.info = "<h3>[command_name()] Shipping Manifest</h3><hr><br>"
|
||||
slip.info +="Order: #[ordernum]<br>"
|
||||
slip.info +="Destination: [stationName]<br>"
|
||||
slip.info +="Requested By: [orderedby]<br>"
|
||||
slip.info +="Rank: [orderedbyRank]<br>"
|
||||
slip.info +="Reason: [comment]<br>"
|
||||
slip.info +="Supply Crate Type: [object.name]<br>"
|
||||
slip.info +="Access Restriction: [object.access ? get_access_desc(object.access) : "None"]<br>"
|
||||
slip.info +="[packagesAmt] PACKAGES IN THIS SHIPMENT<br>"
|
||||
slip.info +="CONTENTS:<br><ul>"
|
||||
|
||||
//we now create the actual contents
|
||||
var/list/contains
|
||||
if(istype(object, /datum/supply_packs/misc/randomised))
|
||||
var/datum/supply_packs/misc/randomised/SO = object
|
||||
contains = list()
|
||||
if(object.contains.len)
|
||||
for(var/j=1, j<=SO.num_contained, j++)
|
||||
contains += pick(object.contains)
|
||||
else
|
||||
dat += {"<div class='statusDisplay'>Shuttle Location: [shuttle_master.supply.name]<BR>
|
||||
<HR>Supply Points: [shuttle_master.points]<BR></div>
|
||||
contains = object.contains
|
||||
|
||||
<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>"}
|
||||
for(var/typepath in contains)
|
||||
if(!typepath) continue
|
||||
var/atom/A = new typepath(Crate)
|
||||
if(object.amount && A.vars.Find("amount") && A:amount)
|
||||
A:amount = object.amount
|
||||
slip.info += "<li>[A.name]</li>" //add the item to the manifest (even if it was misplaced)
|
||||
|
||||
// Removing the old window method but leaving it here for reference
|
||||
//user << browse(dat, "window=computer;size=575x450")
|
||||
//onclose(user, "computer")
|
||||
if(istype(Crate, /obj/structure/closet/critter)) // critter crates do not actually spawn mobs yet and have no contains var, but the manifest still needs to list them
|
||||
var/obj/structure/closet/critter/CritCrate = Crate
|
||||
if(CritCrate.content_mob)
|
||||
var/mob/crittername = CritCrate.content_mob
|
||||
slip.info += "<li>[initial(crittername.name)]</li>"
|
||||
|
||||
// Added the new browser window method
|
||||
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
|
||||
if((errors & MANIFEST_ERROR_ITEM))
|
||||
//secure and large crates cannot lose items
|
||||
if(findtext("[object.containertype]", "/secure/") || findtext("[object.containertype]","/largecrate/"))
|
||||
errors &= ~MANIFEST_ERROR_ITEM
|
||||
else
|
||||
var/lostAmt = max(round(Crate.contents.len/10), 1)
|
||||
//lose some of the items
|
||||
while(--lostAmt >= 0)
|
||||
qdel(pick(Crate.contents))
|
||||
|
||||
//manifest finalisation
|
||||
slip.info += "</ul><br>"
|
||||
slip.info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS<hr>" // And now this is actually meaningful.
|
||||
slip.loc = Crate
|
||||
if(istype(Crate, /obj/structure/closet/crate))
|
||||
var/obj/structure/closet/crate/CR = Crate
|
||||
CR.manifest = slip
|
||||
CR.update_icon()
|
||||
if(istype(Crate, /obj/structure/largecrate))
|
||||
var/obj/structure/largecrate/LC = Crate
|
||||
LC.manifest = slip
|
||||
LC.update_icon()
|
||||
|
||||
return Crate
|
||||
|
||||
/***************************
|
||||
ORDER/REQUESTS CONSOLE
|
||||
**************************/
|
||||
/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
|
||||
var/temp = null
|
||||
var/reqtime = 0
|
||||
var/hacked = 0
|
||||
var/can_order_contraband = 0
|
||||
var/last_viewed_group = "categories"
|
||||
var/datum/supply_packs/content_pack
|
||||
|
||||
/obj/machinery/computer/ordercomp
|
||||
name = "Supply Ordering Console"
|
||||
desc = "Used to order supplies from cargo staff."
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_screen = "request"
|
||||
circuit = /obj/item/weapon/circuitboard/ordercomp
|
||||
var/reqtime = 0
|
||||
var/last_viewed_group = "categories"
|
||||
var/datum/supply_packs/content_pack
|
||||
|
||||
/obj/machinery/computer/ordercomp/attack_ai(var/mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/ordercomp/attack_hand(var/mob/user as mob)
|
||||
ui_interact(user)
|
||||
|
||||
/obj/machinery/computer/ordercomp/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
var/data[0]
|
||||
data["last_viewed_group"] = last_viewed_group
|
||||
|
||||
var/category_list[0]
|
||||
for(var/category in all_supply_groups)
|
||||
category_list.Add(list(list("name" = get_supply_group_name(category), "category" = category)))
|
||||
data["categories"] = category_list
|
||||
|
||||
var/cat = text2num(last_viewed_group)
|
||||
var/packs_list[0]
|
||||
for(var/set_name in shuttle_master.supply_packs)
|
||||
var/datum/supply_packs/pack = shuttle_master.supply_packs[set_name]
|
||||
if(!pack.contraband && !pack.hidden && pack.group == cat)
|
||||
// 0/1 after the pack name (set_name) is a boolean for ordering multiple crates
|
||||
packs_list.Add(list(list("name" = pack.name, "amount" = pack.amount, "cost" = pack.cost, "command1" = list("doorder" = "[set_name]0"), "command2" = list("doorder" = "[set_name]1"), "command3" = list("contents" = set_name))))
|
||||
|
||||
data["supply_packs"] = packs_list
|
||||
if(content_pack)
|
||||
var/pack_name = sanitize(content_pack.name)
|
||||
data["contents_name"] = pack_name
|
||||
data["contents"] = content_pack.manifest
|
||||
data["contents_access"] = content_pack.access ? get_access_desc(content_pack.access) : "None"
|
||||
|
||||
var/requests_list[0]
|
||||
for(var/set_name in shuttle_master.requestlist)
|
||||
var/datum/supply_order/SO = set_name
|
||||
if(SO)
|
||||
// Check if the usr owns the request, so they can cancel requests
|
||||
var/obj/item/weapon/card/id/I = usr.get_id_card()
|
||||
var/owned = 0
|
||||
if(I && SO.orderedby == I.registered_name)
|
||||
owned = 1
|
||||
requests_list.Add(list(list("ordernum" = SO.ordernum, "supply_type" = SO.object.name, "orderedby" = SO.orderedby, "owned" = owned, "command1" = list("rreq" = SO.ordernum))))
|
||||
data["requests"] = requests_list
|
||||
|
||||
var/orders_list[0]
|
||||
for(var/set_name in shuttle_master.shoppinglist)
|
||||
var/datum/supply_order/SO = set_name
|
||||
if(SO)
|
||||
orders_list.Add(list(list("ordernum" = SO.ordernum, "supply_type" = SO.object.name, "orderedby" = SO.orderedby)))
|
||||
data["orders"] = orders_list
|
||||
|
||||
data["points"] = round(shuttle_master.points)
|
||||
data["send"] = list("send" = 1)
|
||||
|
||||
data["moving"] = shuttle_master.supply.mode != SHUTTLE_IDLE
|
||||
data["at_station"] = shuttle_master.supply.getDockedId() == "supply_home"
|
||||
data["timeleft"] = shuttle_master.supply.timeLeft(600)
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "order_console.tmpl", name, ORDER_SCREEN_WIDTH, ORDER_SCREEN_HEIGHT)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/ordercomp/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
return 1
|
||||
|
||||
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: [shuttle_master.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: [shuttle_master.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 shuttle_master.supply_packs )
|
||||
var/datum/supply_packs/N = shuttle_master.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 (href_list["doorder"])
|
||||
if(world.time < reqtime)
|
||||
visible_message("\The [src] flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"")
|
||||
return
|
||||
visible_message("<b>[src]</b>'s monitor flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"")
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
|
||||
//Find the correct supply_pack datum
|
||||
if(!shuttle_master.supply_packs["[href_list["doorder"]]"]) return
|
||||
var/index = copytext(href_list["doorder"], 1, lentext(href_list["doorder"])) //text2num(copytext(href_list["doorder"], 1))
|
||||
var/multi = text2num(copytext(href_list["doorder"], -1))
|
||||
if(!isnum(multi))
|
||||
return 1
|
||||
var/datum/supply_packs/P = shuttle_master.supply_packs[index]
|
||||
if(!istype(P))
|
||||
return 1
|
||||
var/crates = 1
|
||||
if(multi)
|
||||
var/num_input = input(usr, "Amount:", "How many crates?", "") as num
|
||||
crates = Clamp(round(text2num(num_input)), 1, 20)
|
||||
if(..())
|
||||
return 1
|
||||
|
||||
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/reason = sanitize(copytext(input(usr,"Reason:","Why do you require this item?","") as null|text, 1, MAX_MESSAGE_LEN))
|
||||
if(world.time > timeout || !reason || ..())
|
||||
return 1
|
||||
|
||||
var/idname = "*None Provided*"
|
||||
var/idrank = "*None Provided*"
|
||||
@@ -329,139 +511,173 @@
|
||||
idrank = H.get_assignment()
|
||||
else if(issilicon(usr))
|
||||
idname = usr.real_name
|
||||
|
||||
var/datum/supply_order/O = shuttle_master.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>"
|
||||
//make our supply_order datums
|
||||
for(var/i = 1; i <= crates; i++)
|
||||
var/datum/supply_order/O = shuttle_master.generateSupplyOrder(index, idname, idrank, reason, crates)
|
||||
if(!O) return
|
||||
if(i == 1)
|
||||
O.generateRequisition(loc)
|
||||
|
||||
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 shuttle_master.shoppinglist)
|
||||
temp += "[SO.object.name] approved by [SO.orderedby] [SO.comment ? "([SO.comment])":""]<BR>"
|
||||
else if (href_list["rreq"])
|
||||
var/ordernum = text2num(href_list["rreq"])
|
||||
var/obj/item/weapon/card/id/I = usr.get_id_card()
|
||||
for(var/i=1, i<=shuttle_master.requestlist.len, i++)
|
||||
var/datum/supply_order/SO = shuttle_master.requestlist[i]
|
||||
if(SO.ordernum == ordernum && (I && SO.orderedby == I.registered_name))
|
||||
shuttle_master.requestlist.Cut(i,i+1)
|
||||
break
|
||||
|
||||
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 shuttle_master.requestlist)
|
||||
temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby]<BR>"
|
||||
else if (href_list["last_viewed_group"])
|
||||
content_pack = null
|
||||
last_viewed_group = text2num(href_list["last_viewed_group"])
|
||||
|
||||
else if (href_list["mainmenu"])
|
||||
temp = null
|
||||
else if (href_list["contents"])
|
||||
var/topic = href_list["contents"]
|
||||
if(topic == 1)
|
||||
content_pack = null
|
||||
else
|
||||
var/datum/supply_packs/P = shuttle_master.supply_packs[topic]
|
||||
content_pack = P
|
||||
|
||||
add_fingerprint(usr)
|
||||
updateUsrDialog()
|
||||
return
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
|
||||
/obj/machinery/computer/supplycomp/attack_hand(mob/user)
|
||||
if(!allowed(user))
|
||||
user << "<span class='warning'>Access Denied.</span>"
|
||||
return
|
||||
/obj/machinery/computer/supplycomp/attack_ai(var/mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/supplycomp/attack_hand(var/mob/user as mob)
|
||||
if(!allowed(user) && !isobserver(user))
|
||||
user << "<span class='warning'>Access denied.</span>"
|
||||
return 1
|
||||
|
||||
if(..())
|
||||
return
|
||||
user.set_machine(src)
|
||||
post_signal("supply")
|
||||
var/dat
|
||||
if (temp)
|
||||
dat = temp
|
||||
else
|
||||
var/atDepot = (shuttle_master.supply.getDockedId() == "supply_away")
|
||||
var/inTransit = (shuttle_master.supply.mode != SHUTTLE_IDLE)
|
||||
var/canOrder = atDepot && !inTransit
|
||||
|
||||
dat += {"<div class='statusDisplay'><B>Supply shuttle</B><HR>
|
||||
Location: [shuttle_master.supply.getStatusText()]<BR>
|
||||
<HR>\nSupply Points: [shuttle_master.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>"]
|
||||
\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> [shuttle_master.centcom_message ? shuttle_master.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()
|
||||
ui_interact(user)
|
||||
return
|
||||
|
||||
/obj/machinery/computer/supplycomp/emag_act(mob/user)
|
||||
/obj/machinery/computer/supplycomp/emag_act(user as mob)
|
||||
if(!hacked)
|
||||
user << "<span class='notice'>Special supplies unlocked.</span>"
|
||||
hacked = 1
|
||||
return
|
||||
|
||||
/obj/machinery/computer/supplycomp/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
|
||||
// data to send to ui
|
||||
var/data[0]
|
||||
data["last_viewed_group"] = last_viewed_group
|
||||
|
||||
var/category_list[0]
|
||||
for(var/category in all_supply_groups)
|
||||
category_list.Add(list(list("name" = get_supply_group_name(category), "category" = category)))
|
||||
data["categories"] = category_list
|
||||
|
||||
var/cat = text2num(last_viewed_group)
|
||||
var/packs_list[0]
|
||||
for(var/set_name in shuttle_master.supply_packs)
|
||||
var/datum/supply_packs/pack = shuttle_master.supply_packs[set_name]
|
||||
if((pack.hidden && src.hacked) || (pack.contraband && src.can_order_contraband) || (!pack.contraband && !pack.hidden))
|
||||
if(pack.group == cat)
|
||||
// 0/1 after the pack name (set_name) is a boolean for ordering multiple crates
|
||||
packs_list.Add(list(list("name" = pack.name, "amount" = pack.amount, "cost" = pack.cost, "command1" = list("doorder" = "[set_name]0"), "command2" = list("doorder" = "[set_name]1"), "command3" = list("contents" = set_name))))
|
||||
|
||||
data["supply_packs"] = packs_list
|
||||
if(content_pack)
|
||||
var/pack_name = sanitize(content_pack.name)
|
||||
data["contents_name"] = pack_name
|
||||
data["contents"] = content_pack.manifest
|
||||
data["contents_access"] = content_pack.access ? get_access_desc(content_pack.access) : "None"
|
||||
|
||||
var/requests_list[0]
|
||||
for(var/set_name in shuttle_master.requestlist)
|
||||
var/datum/supply_order/SO = set_name
|
||||
if(SO)
|
||||
if(!SO.comment)
|
||||
SO.comment = "No comment."
|
||||
requests_list.Add(list(list("ordernum" = SO.ordernum, "supply_type" = SO.object.name, "orderedby" = SO.orderedby, "comment" = SO.comment, "command1" = list("confirmorder" = SO.ordernum), "command2" = list("rreq" = SO.ordernum))))
|
||||
data["requests"] = requests_list
|
||||
|
||||
var/orders_list[0]
|
||||
for(var/set_name in shuttle_master.shoppinglist)
|
||||
var/datum/supply_order/SO = set_name
|
||||
if(SO)
|
||||
orders_list.Add(list(list("ordernum" = SO.ordernum, "supply_type" = SO.object.name, "orderedby" = SO.orderedby, "comment" = SO.comment)))
|
||||
data["orders"] = orders_list
|
||||
|
||||
data["points"] = round(shuttle_master.points)
|
||||
data["send"] = list("send" = 1)
|
||||
data["message"] = shuttle_master.centcom_message ? shuttle_master.centcom_message : "Remember to stamp and send back the supply manifests."
|
||||
|
||||
data["moving"] = shuttle_master.supply.mode != SHUTTLE_IDLE
|
||||
data["at_station"] = shuttle_master.supply.getDockedId() == "supply_home"
|
||||
data["timeleft"] = shuttle_master.supply.timeLeft(600)
|
||||
data["can_launch"] = !shuttle_master.supply.canMove()
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "supply_console.tmpl", name, SUPPLY_SCREEN_WIDTH, SUPPLY_SCREEN_HEIGHT)
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/supplycomp/proc/is_authorized(user)
|
||||
if(allowed(user))
|
||||
return 1
|
||||
|
||||
if(isobserver(user) && check_rights(R_ADMIN, 0))
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
/obj/machinery/computer/supplycomp/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
return 1
|
||||
|
||||
if(isturf(loc) && ( in_range(src, usr) || istype(usr, /mob/living/silicon) ) )
|
||||
usr.set_machine(src)
|
||||
if(!is_authorized(usr))
|
||||
return 1
|
||||
|
||||
if(!shuttle_master)
|
||||
log_to_dd("## ERROR: The shuttle_master controller datum is missing somehow.")
|
||||
return 1
|
||||
|
||||
//Calling the shuttle
|
||||
if(href_list["send"])
|
||||
if(shuttle_master.supply.canMove())
|
||||
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>"
|
||||
|
||||
usr << "<span class='warning'>For safety reasons the automated supply shuttle cannot transport live organisms, classified nuclear weaponry or homing beacons.</span>"
|
||||
else if(shuttle_master.supply.getDockedId() == "supply_home")
|
||||
temp = "The supply shuttle has departed.<BR><BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
shuttle_master.toggleShuttle("supply", "supply_home", "supply_away", 1)
|
||||
investigate_log("[usr.key] has sent the supply shuttle away. Remaining points: [shuttle_master.points]. Shuttle contents:[shuttle_master.sold_atoms]", "cargo")
|
||||
else
|
||||
if(!shuttle_master.supply.request(shuttle_master.getDock("supply_home")))
|
||||
temp = "The supply shuttle has been called and will arrive in [shuttle_master.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(shuttle_master.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: [shuttle_master.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: [shuttle_master.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 shuttle_master.supply_packs )
|
||||
var/datum/supply_packs/N = shuttle_master.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>"*/
|
||||
investigate_log("[key_name(usr)] has sent the supply shuttle away. Remaining points: [shuttle_master.points]. Shuttle contents: [shuttle_master.sold_atoms]", "cargo")
|
||||
else if(!shuttle_master.supply.request(shuttle_master.getDock("supply_home")))
|
||||
post_signal("supply")
|
||||
|
||||
else if (href_list["doorder"])
|
||||
if(world.time < reqtime)
|
||||
visible_message("\The [src] flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"")
|
||||
return
|
||||
visible_message("<b>[src]</b>'s monitor flashes, \"[world.time - reqtime] seconds remaining until another requisition form may be printed.\"")
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
|
||||
//Find the correct supply_pack datum
|
||||
if(!shuttle_master.supply_packs[href_list["doorder"]])
|
||||
return
|
||||
var/index = copytext(href_list["doorder"], 1, lentext(href_list["doorder"])) //text2num(copytext(href_list["doorder"], 1))
|
||||
var/multi = text2num(copytext(href_list["doorder"], -1))
|
||||
if(!isnum(multi))
|
||||
return 1
|
||||
var/datum/supply_packs/P = shuttle_master.supply_packs[index]
|
||||
if(!istype(P))
|
||||
return 1
|
||||
var/crates = 1
|
||||
if(multi)
|
||||
var/num_input = input(usr, "Amount:", "How many crates?", "") as num
|
||||
crates = Clamp(round(text2num(num_input)), 1, 20)
|
||||
if(!is_authorized(usr) || ..())
|
||||
return 1
|
||||
|
||||
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/reason = sanitize(copytext(input(usr,"Reason:","Why do you require this item?","") as null|text,1,MAX_MESSAGE_LEN))
|
||||
if(world.time > timeout || !reason || !is_authorized(usr) || ..())
|
||||
return 1
|
||||
|
||||
var/idname = "*None Provided*"
|
||||
var/idrank = "*None Provided*"
|
||||
|
||||
if(ishuman(usr))
|
||||
var/mob/living/carbon/human/H = usr
|
||||
idname = H.get_authentification_name()
|
||||
@@ -469,86 +685,57 @@
|
||||
else if(issilicon(usr))
|
||||
idname = usr.real_name
|
||||
|
||||
var/datum/supply_order/O = shuttle_master.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>"
|
||||
//make our supply_order datums
|
||||
for(var/i = 1; i <= crates; i++)
|
||||
var/datum/supply_order/O = shuttle_master.generateSupplyOrder(index, idname, idrank, reason, crates)
|
||||
if(!O) return 1
|
||||
if(i == 1)
|
||||
O.generateRequisition(loc)
|
||||
|
||||
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<=shuttle_master.requestlist.len, i++)
|
||||
var/datum/supply_order/SO = shuttle_master.requestlist[i]
|
||||
if(SO && SO.ordernum == ordernum)
|
||||
if(SO.ordernum == ordernum)
|
||||
O = SO
|
||||
P = O.object
|
||||
if(shuttle_master.points >= P.cost)
|
||||
shuttle_master.requestlist.Cut(i,i+1)
|
||||
shuttle_master.points -= P.cost
|
||||
shuttle_master.shoppinglist += O
|
||||
temp = "Thanks for your order."
|
||||
investigate_log("[usr.key] has authorized an order for [P.name]. Remaining points: [shuttle_master.points].", "cargo")
|
||||
investigate_log("[key_name(usr)] has authorized an order for [P.name]. Remaining points: [shuttle_master.points].", "cargo")
|
||||
else
|
||||
temp = "Not enough supply points."
|
||||
usr << "<span class='warning'>There are insufficient supply points for this request.</span>"
|
||||
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 shuttle_master.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 shuttle_master.requestlist)
|
||||
temp += "#[SO.ordernum] - [SO.object.name] requested by [SO.orderedby] [shuttle_master.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<=shuttle_master.requestlist.len, i++)
|
||||
var/datum/supply_order/SO = shuttle_master.requestlist[i]
|
||||
if(SO && SO.ordernum == ordernum)
|
||||
if(SO.ordernum == ordernum)
|
||||
shuttle_master.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"])
|
||||
shuttle_master.requestlist.Cut()
|
||||
temp = "List cleared.<BR>"
|
||||
temp += "<BR><A href='?src=\ref[src];mainmenu=1'>Main Menu</A>"
|
||||
else if (href_list["last_viewed_group"])
|
||||
content_pack = null
|
||||
last_viewed_group = text2num(href_list["last_viewed_group"])
|
||||
|
||||
else if (href_list["mainmenu"])
|
||||
temp = null
|
||||
else if (href_list["contents"])
|
||||
var/topic = href_list["contents"]
|
||||
if(topic == 1)
|
||||
content_pack = null
|
||||
else
|
||||
var/datum/supply_packs/P = shuttle_master.supply_packs[topic]
|
||||
content_pack = P
|
||||
|
||||
add_fingerprint(usr)
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/computer/supplycomp/proc/post_signal(command)
|
||||
nanomanager.update_uis(src)
|
||||
return 1
|
||||
|
||||
/obj/machinery/computer/supplycomp/proc/post_signal(var/command)
|
||||
var/datum/radio_frequency/frequency = radio_controller.return_frequency(1435)
|
||||
|
||||
if(!frequency) return
|
||||
@@ -560,12 +747,9 @@
|
||||
|
||||
frequency.post_signal(src, status_signal)
|
||||
|
||||
|
||||
/**********
|
||||
MISC
|
||||
**********/
|
||||
|
||||
|
||||
/area/supply/station
|
||||
name = "Supply Shuttle"
|
||||
icon_state = "shuttle3"
|
||||
@@ -576,12 +760,10 @@
|
||||
icon_state = "shuttle3"
|
||||
requires_power = 0
|
||||
|
||||
//SUPPLY PACKS MOVED TO /code/defines/obj/supplypacks.dm
|
||||
|
||||
/obj/structure/plasticflaps //HOW DO YOU CALL THOSE THINGS ANYWAY
|
||||
/obj/structure/plasticflaps
|
||||
name = "\improper plastic flaps"
|
||||
desc = "Completely impassable - or are they?"
|
||||
icon = 'icons/obj/stationobjs.dmi' //Change this.
|
||||
icon = 'icons/obj/stationobjs.dmi'
|
||||
icon_state = "plasticflaps"
|
||||
density = 0
|
||||
anchored = 1
|
||||
@@ -633,13 +815,18 @@
|
||||
name = "\improper Airtight plastic flaps"
|
||||
desc = "Heavy duty, airtight, plastic flaps."
|
||||
|
||||
New()
|
||||
air_update_turf(1)
|
||||
..()
|
||||
/obj/structure/plasticflaps/mining/New()
|
||||
air_update_turf(1)
|
||||
..()
|
||||
|
||||
Destroy()
|
||||
air_update_turf(1)
|
||||
return ..()
|
||||
/obj/structure/plasticflaps/mining/Destroy()
|
||||
air_update_turf(1)
|
||||
return ..()
|
||||
|
||||
CanAtmosPass(turf/T)
|
||||
return 0
|
||||
/obj/structure/plasticflaps/mining/CanAtmosPass(turf/T)
|
||||
return 0
|
||||
|
||||
#undef ORDER_SCREEN_WIDTH
|
||||
#undef ORDER_SCREEN_HEIGHT
|
||||
#undef SUPPLY_SCREEN_WIDTH
|
||||
#undef SUPPLY_SCREEN_HEIGHT
|
||||
Reference in New Issue
Block a user