Removes requirements for exports to be contained

🆑 coiax
rscadd: All items in the supply shuttle are processed for export,
irregardless of whether they are in a container or not.
/🆑
This commit is contained in:
Jack Edge
2016-06-26 12:40:13 +01:00
parent 7df85cfb34
commit ba673a04d1
5 changed files with 63 additions and 74 deletions
+7 -12
View File
@@ -33,15 +33,10 @@
user << "<span class='notice'>Scanned [O].</span>"
// Before you fix it: yes, checking manifests is a part of intended functionality.
var/exported = FALSE
for(var/a in supply.exports)
var/datum/export/E = a
if(E.applies_to(O, cargo_console.contraband, cargo_console.emagged))
var/cost = E.get_cost(O, cargo_console.contraband, cargo_console.emagged)
user << "<span class='notice'>Export cost: [cost] credits.</span>"
if(is_type_in_list(O, supply.storage_objects) && O.contents.len)
user << "<span class='notice'>(contents not included)</span>"
exported = TRUE
break
if(!exported)
user << "<span class='notice'>The object is unexportable.</span>"
var/price = export_item_and_contents(O, supply.exports, cargo_console.contraband, cargo_console.emagged, dry_run=TRUE)
if(price)
user << "<span class='notice'>Export value: [price] \
credits.</span>"
if(O.contents.len)
user << "<span class='notice'>(contents included)</span>"
+33 -1
View File
@@ -26,7 +26,32 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
then the player gets the profit from selling his own wasted time.
*/
/proc/export_item_and_contents(atom/movable/AM, exports, contraband, emagged, dry_run=FALSE)
var/sold_str = ""
var/cost = 0
var/list/contents = AM.GetAllContents()
// We go backwards, so it'll be innermost objects sold first
for(var/i in reverseRange(contents))
var/atom/movable/thing
for(var/datum/export/E in exports)
if(!E)
continue
if(E.applies_to(thing, contraband, emagged))
if(dry_run)
cost += E.get_cost(thing, contraband, emagged)
else
E.sell_object(thing, contraband, emagged)
sold_str += " [thing.name]"
break
if(!dry_run)
qdel(thing)
if(dry_run)
return cost
else
return sold_str
/datum/export
var/unit_name = "" // Unit name. Only used in "Received [total_amount] [name]s [message]." message
@@ -37,7 +62,6 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
var/list/export_types = list() // Type of the exported object. If none, the export datum is considered base type.
var/include_subtypes = TRUE // Set to FALSE to make the datum apply only to a strict type.
var/list/exclude_types = list() // Types excluded from export
var/shuttle_floor = FALSE // TRUE if the item can be sold on the floor, not only in crates.
// Used by print-out
var/total_cost = 0
@@ -104,3 +128,11 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
/datum/export/proc/export_end()
total_cost = 0
total_amount = 0
var/list/exports_list = list()
/proc/setupExports()
for(var/subtype in subtypesof(/datum/export))
var/datum/export/E = new subtype
if(E.export_types && E.export_types.len) // Exports without a type are invalid/base types
exports += E
+1 -5
View File
@@ -1,9 +1,5 @@
// Large objects that don't fit in crates, but must be sellable anyway.
/datum/export/large
shuttle_floor = TRUE
// Crates, boxes, lockers.
/datum/export/large/crate
cost = 500
@@ -111,4 +107,4 @@
/datum/export/large/barrier
cost = 325
unit_name = "security barrier"
export_types = list(/obj/item/weapon/grenade/barrier, /obj/structure/barricade/security)
export_types = list(/obj/item/weapon/grenade/barrier, /obj/structure/barricade/security)