mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 01:34:01 +00:00
[MIRROR] Fixing cargo. (#26928)
Fixing cargo. (#82036) ## About The Pull Request I borked carg with my black market refactor, and nobody really noticed because we don't have a unit test to detect the issue. This PR is aimed to fix #81987 and prevent similar accidents in the future. ## Why It's Good For The Game See above. ## Changelog 🆑 fix: FIXED CARGO EXPORTS! /🆑 Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -90,7 +90,7 @@ Then the player gets the profit from selling his own wasted time.
|
||||
if(dry_run && !export.scannable)
|
||||
external_report.all_contents_scannable = FALSE
|
||||
break
|
||||
sold = export.sell_object(exported_atom, exported_atom, dry_run, apply_elastic)
|
||||
sold = export.sell_object(exported_atom, external_report, dry_run, apply_elastic)
|
||||
external_report.exported_atoms += " [exported_atom.name]"
|
||||
break
|
||||
return sold
|
||||
|
||||
@@ -108,6 +108,7 @@
|
||||
#include "cable_powernets.dm"
|
||||
#include "card_mismatch.dm"
|
||||
#include "cardboard_cutouts.dm"
|
||||
#include "cargo_selling.dm"
|
||||
#include "chain_pull_through_space.dm"
|
||||
#include "changeling.dm"
|
||||
#include "chat_filter.dm"
|
||||
|
||||
34
code/modules/unit_tests/cargo_selling.dm
Normal file
34
code/modules/unit_tests/cargo_selling.dm
Normal file
@@ -0,0 +1,34 @@
|
||||
/// Makes sure exports work and things can be sold
|
||||
/datum/unit_test/cargo_selling
|
||||
|
||||
/obj/item/cargo_unit_test_container
|
||||
|
||||
/obj/item/cargo_unit_test_container/Initialize(mapload)
|
||||
. = ..()
|
||||
new /obj/item/cargo_unit_test_content(src)
|
||||
|
||||
/obj/item/cargo_unit_test_content
|
||||
|
||||
/datum/export/cargo_unit_test_container
|
||||
cost = PAYCHECK_LOWER
|
||||
export_types = list(/obj/item/cargo_unit_test_container)
|
||||
|
||||
/datum/export/cargo_unit_test_content
|
||||
cost = PAYCHECK_COMMAND
|
||||
export_types = list(/obj/item/cargo_unit_test_content)
|
||||
|
||||
/datum/unit_test/cargo_selling/Run()
|
||||
var/obj/item/cargo_unit_test_container/box = allocate(/obj/item/cargo_unit_test_container)
|
||||
var/obj/item/cargo_unit_test_container/box_skip_content = allocate(/obj/item/cargo_unit_test_container)
|
||||
|
||||
var/datum/export_report/report_one = export_item_and_contents(box, apply_elastic = FALSE)
|
||||
if(isnull(report_one))
|
||||
TEST_FAIL("called 'export_item_and_contents', but no export report was returned.")
|
||||
var/value = counterlist_sum(report_one.total_value)
|
||||
TEST_ASSERT_EQUAL(value, PAYCHECK_LOWER + PAYCHECK_COMMAND, "'export_item_and_contents' value didn't match expected value")
|
||||
|
||||
var/datum/export_report/report_two = export_single_item(box_skip_content, apply_elastic = FALSE)
|
||||
if(isnull(report_two))
|
||||
TEST_FAIL("called 'export_single_item', but no export report was returned.")
|
||||
value = counterlist_sum(report_two.total_value)
|
||||
TEST_ASSERT_EQUAL(value, PAYCHECK_LOWER, "'export_single_item' value didn't match expected value")
|
||||
Reference in New Issue
Block a user