mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
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
This commit is contained in:
@@ -27,10 +27,10 @@
|
||||
return
|
||||
|
||||
//create the crate
|
||||
var/obj/structure/closet/crate/crate = new object.containertype(_loc)
|
||||
crate.name = "[object.containername] [comment ? "([comment])":"" ]"
|
||||
if(object.access)
|
||||
crate.req_access = list(text2num(object.access))
|
||||
var/obj/structure/closet/crate/crate = object.create_package(_loc)
|
||||
|
||||
if(comment)
|
||||
crate.name = "[crate.name] ([comment])"
|
||||
|
||||
//create the manifest slip
|
||||
var/obj/item/paper/manifest/slip = new
|
||||
@@ -52,24 +52,8 @@
|
||||
slip.info += "[packagesAmt] PACKAGES IN THIS SHIPMENT<br>"
|
||||
slip.info += "CONTENTS:<br><ul>"
|
||||
|
||||
//we now create the actual contents
|
||||
var/list/contains = list()
|
||||
if(istype(object, /datum/supply_packs/misc/randomised))
|
||||
var/datum/supply_packs/misc/randomised/SO = object
|
||||
contains = list()
|
||||
if(length(object.contains))
|
||||
for(var/j in 1 to SO.num_contained)
|
||||
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)
|
||||
for(var/atom/A in crate.contents)
|
||||
slip.info += "<li>[A.name]</li>"
|
||||
|
||||
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
|
||||
|
||||
@@ -32,3 +32,30 @@
|
||||
//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)
|
||||
|
||||
Reference in New Issue
Block a user