Files
Paradise/code/modules/supply/supply_pack.dm
Contrabang 93f26cf5aa Adds a cargo crate spawning tool for admins (#20220)
* Allows admins to create cargo crates

* AA and Miravel review

* remove debug text

* AA review

* Oops

* sirryan review

* sirryan review 2

* atom to turf
2023-02-13 23:21:58 -06:00

62 lines
1.6 KiB
Plaintext

/datum/supply_packs
var/name
var/list/contains = list()
var/manifest = ""
var/amount
var/cost //default amount to cover crate cost?
var/containertype = /obj/structure/closet/crate
var/containername
var/access
var/hidden = FALSE
var/contraband = FALSE
var/group = SUPPLY_MISC
///Determines which departments do not need QM approval to order this supply pack
var/list/department_restrictions = list()
var/list/announce_beacons = list() // Particular beacons that we'll notify the relevant department when we reach
var/special = FALSE //Event/Station Goals/Admin enabled packs
var/special_enabled = FALSE
/// List of names for being done in TGUI
var/list/ui_manifest = list()
/datum/supply_packs/New()
. = ..()
manifest += "<ul>"
for(var/path in contains)
if(!path)
continue
var/atom/movable/AM = path
manifest += "<li>[initial(AM.name)]</li>"
//Add the name to the UI manifest
ui_manifest += "[initial(AM.name)]"
manifest += "</ul>"
/datum/supply_packs/proc/create_package(turf/spawn_location)
var/obj/structure/closet/crate/crate = new containertype(spawn_location)
crate.name = containername
if(access)
crate.req_access = list(text2num(access))
//we now create the actual contents
for(var/typepath in generate_items())
if(!typepath)
continue
var/atom/A = new typepath(crate)
if(isstack(A))
var/obj/item/stack/mats = A
mats.amount = amount
return crate
/datum/supply_packs/proc/generate_items()
return contains
/datum/supply_packs/misc/randomised/generate_items()
. = list()
if(length(contains))
for(var/j in 1 to num_contained)
. += pick(contains)