mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2025-12-11 03:10:28 +00:00
small cargo code cleanup (#3941)
* move everything * stuff * done * done * i hate nanoui * that * listmaniia * that * okay that's a higgs bugson moment * oh god git why * a * a * fixes * keyboard moment
This commit is contained in:
@@ -189,72 +189,35 @@ SUBSYSTEM_DEF(supply)
|
||||
|
||||
var/orderedamount = shoppinglist.len
|
||||
var/list/clear_turfs = get_clear_turfs()
|
||||
|
||||
for(var/datum/supply_order/SO in shoppinglist)
|
||||
if(!clear_turfs.len)
|
||||
// if there's no space left don't cram in the rest
|
||||
var/turf/T = pick_n_take(clear_turfs)
|
||||
if(!T)
|
||||
break
|
||||
|
||||
var/i = rand(1,clear_turfs.len)
|
||||
var/turf/pickedloc = clear_turfs[i]
|
||||
clear_turfs.Cut(i,i+1)
|
||||
|
||||
SO.status = SUP_ORDER_SHIPPED
|
||||
var/datum/supply_pack/SP = SO.object
|
||||
|
||||
var/obj/A = new SP.containertype(pickedloc)
|
||||
A.name = "[SP.containername] [SO.comment ? "([SO.comment])":"" ]"
|
||||
var/atom/movable/container = SP.Instantiate(T)
|
||||
if(SO.comment)
|
||||
container.name += " [SO.comment]"
|
||||
|
||||
// Supply manifest generation begin
|
||||
var/obj/item/paper/manifest/slip
|
||||
if(!SP.contraband)
|
||||
slip = new /obj/item/paper/manifest(A)
|
||||
slip = new /obj/item/paper/manifest(container)
|
||||
slip.is_copy = 0
|
||||
slip.info = "<h3>[command_name()] Shipping Manifest</h3><hr><br>"
|
||||
slip.info +="Order #[SO.ordernum]<br>"
|
||||
slip.info +="Destination: [station_name()]<br>"
|
||||
slip.info +="[orderedamount] PACKAGES IN THIS SHIPMENT<br>"
|
||||
slip.info +="CONTENTS:<br><ul>"
|
||||
|
||||
// Spawn the stuff, finish generating the manifest while you're at it
|
||||
if(SP.access)
|
||||
if(isnum(SP.access))
|
||||
A.req_access = list(SP.access)
|
||||
else if(islist(SP.access) && SP.one_access)
|
||||
var/list/L = SP.access // Access var is a plain var, we need a list
|
||||
A.req_one_access = L.Copy()
|
||||
A.req_access = null
|
||||
else if(islist(SP.access) && !SP.one_access)
|
||||
var/list/L = SP.access
|
||||
A.req_access = L.Copy()
|
||||
else
|
||||
log_debug("<span class='danger'>Supply pack with invalid access restriction [SP.access] encountered!</span>")
|
||||
|
||||
var/list/contains
|
||||
if(istype(SP,/datum/supply_pack/randomised))
|
||||
var/datum/supply_pack/randomised/SPR = SP
|
||||
contains = list()
|
||||
if(SPR.contains.len)
|
||||
for(var/j=1,j<=SPR.num_contained,j++)
|
||||
contains += pick(SPR.contains)
|
||||
else
|
||||
contains = SP.contains
|
||||
|
||||
for(var/typepath in contains)
|
||||
if(!typepath)
|
||||
continue
|
||||
|
||||
var/number_of_items = max(1, contains[typepath])
|
||||
for(var/j = 1 to number_of_items)
|
||||
var/atom/B2 = new typepath(A)
|
||||
if(slip)
|
||||
slip.info += "<li>[B2.name]</li>" // Add the item to the manifest
|
||||
|
||||
// Manifest finalisation
|
||||
if(slip)
|
||||
slip.info += "</ul><br>"
|
||||
slip.info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS<hr>"
|
||||
|
||||
return
|
||||
// save the trip to the string tree
|
||||
var/list/info = list()
|
||||
info += "<h3>[command_name()] Shipping Manifest</h3><hr><br>"
|
||||
info +="Order #[SO.ordernum]<br>"
|
||||
info +="Destination: [station_name()]<br>"
|
||||
info +="[orderedamount] PACKAGES IN THIS SHIPMENT<br>"
|
||||
info += "<hr>"
|
||||
info += SP.get_html_manifest(container)
|
||||
info += "<hr>"
|
||||
info += "CHECK CONTENTS AND STAMP BELOW THE LINE TO CONFIRM RECEIPT OF GOODS"
|
||||
info += "<hr>"
|
||||
slip.info += info.Join("")
|
||||
|
||||
// Will attempt to purchase the specified order, returning TRUE on success, FALSE on failure
|
||||
/datum/controller/subsystem/supply/proc/approve_order(var/datum/supply_order/O, var/mob/user)
|
||||
|
||||
Reference in New Issue
Block a user