Fixes all bugs; exports now work

This commit is contained in:
Jack Edge
2016-06-26 20:08:50 +01:00
parent ba673a04d1
commit 1dc2950eb9
3 changed files with 26 additions and 27 deletions
+9 -14
View File
@@ -25,18 +25,13 @@
else if(!istype(cargo_console))
user << "<span class='warning'>You must link [src] to a cargo console first!</span>"
else
var/obj/docking_port/mobile/supply/supply = SSshuttle.supply
if(!supply)
user << "<span class='warning'>Falied to connect to exports database!</span>"
return
// Before you fix it:
// yes, checking manifests is a part of intended functionality.
var/price = export_item_and_contents(O, cargo_console.contraband, cargo_console.emagged, dry_run=TRUE)
user << "<span class='notice'>Scanned [O].</span>"
// Before you fix it: yes, checking manifests is a part of intended functionality.
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>"
if(price)
user << "<span class='notice'>Scanned [O], value: <b>[price]</b> \
credits[O.contents.len ? " (contents included)" : ""].</span>"
else
user << "<span class='warning'>Scanned [O], no export value. \
</span>"
+7 -4
View File
@@ -26,7 +26,10 @@ 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)
/proc/export_item_and_contents(atom/movable/AM, contraband, emagged, dry_run=FALSE)
if(!exports_list.len)
setupExports()
var/sold_str = ""
var/cost = 0
@@ -34,8 +37,8 @@ Credit dupes that require a lot of manual work shouldn't be removed, unless they
// 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)
var/atom/movable/thing = i
for(var/datum/export/E in exports_list)
if(!E)
continue
if(E.applies_to(thing, contraband, emagged))
@@ -135,4 +138,4 @@ var/list/exports_list = list()
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
exports_list += E