Files
Paradise/code/modules/supply/supply_pack.dm
T
Luc 2ee1b06936 Purchasable Emergency Shuttles (Ready for review) (#23701)
* basic framework

* Moves shuttle loading out to subsystem

* work out most of the ordering logic

* better whitelisting

* shuttle speed factor is a thing now

* Better speed factor, renaming

* try to fix some typing issues

* Apply suggestions from code review

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Fixes some issues with multiple shuttle orders

* add some basic prices

* more minor price adjustments

* Add cmag support

* order of ops

* Update code/controllers/subsystem/SSshuttles.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Make necessary tgui tweaks

* Whitespace suggestions

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Update code/controllers/subsystem/SSshuttles.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* addresses some review concerns

* remove todo

* Apply suggestions from code review

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* Update code/controllers/subsystem/SSshuttles.dm

Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>

* ahh eto

* cleaned up as per discord

---------

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
2024-03-11 17:12:06 +00:00

112 lines
3.5 KiB
Plaintext

/datum/supply_packs
/// The name of this supply pack.
var/name
/// Paths for the items contained in this pack.
var/list/contains = list()
/// The manifest contents for this order.
var/manifest = ""
/// The number of crates that get generated by this pack.
var/amount
/// The cost of this pack.
var/cost
/// Path of the type of order that should be generated from this order
var/datum/supply_order/order_type = /datum/supply_order
/// The type of container that the contents will arrive in.
var/containertype = /obj/structure/closet/crate
/// The name to give the container itself.
var/containername
/// If the container is lockable, the access to require for it.
var/access
/// If TRUE, this pack is only visible on an emagged supply console.
var/hidden = FALSE
/// If TRUE, this pack is only visible on a hacked supply console.
var/contraband = FALSE
/// If TRUE, this pack is only visible on a cmagged supply console.
var/cmag_hidden = FALSE
/// A special pack that should not appear unless certain circumstances are fulfilled (event, station goals, admin packs)
var/special = FALSE
/// If this pack is special, whether it should be visible or not.
var/special_enabled = FALSE
/// If true, this pack can only be ordered in units of 1.
var/singleton = FALSE
/// Identifier indicating the specific "set" of singletons that this belongs to.
/// Only one item in this set can be in the shopping cart at once.
var/singleton_group_id
/// The pack group this should appear in.
var/group = SUPPLY_MISC
///Determines which departments do not need QM approval to order this supply pack
var/list/department_restrictions = list()
/// Particular beacons that we'll notify the relevant department when we reach
var/list/announce_beacons = list()
/// List of names for being done in TGUI
var/list/ui_manifest = list()
/datum/supply_packs/New()
. = ..()
if(contains)
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>"
else
ui_manifest = list(manifest)
/**
* Create a supply order for this pack.
*/
/datum/supply_packs/proc/create_order(orderedby, occupation, comment, order_num)
RETURN_TYPE(/datum/supply_order)
var/datum/supply_order/order = new order_type()
order.ordernum = order_num
order.object = src
order.orderedby = orderedby
order.orderedbyRank = occupation
order.comment = comment
return order
/// Define a special condition as to whether or not this crate can currently be ordered.
/datum/supply_packs/proc/can_order()
return TRUE
/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) && amount)
var/obj/item/stack/mats = A
mats.amount = amount
return crate
/datum/supply_packs/proc/generate_items()
return contains
/// Called right when an order for this pack is confirmed.
/datum/supply_packs/proc/on_order_confirm(datum/supply_order/order)
return
/datum/supply_packs/misc/randomised/generate_items()
. = list()
if(length(contains))
for(var/j in 1 to num_contained)
. += pick(contains)
/datum/supply_packs/proc/get_cost()
return cost * SSeconomy.pack_price_modifier