diff --git a/code/__DEFINES/station.dm b/code/__DEFINES/station.dm index 3cb026e4f76..ddaa82daffc 100644 --- a/code/__DEFINES/station.dm +++ b/code/__DEFINES/station.dm @@ -14,3 +14,6 @@ /// The data file that future station traits forced by an admin are stored in #define FUTURE_STATION_TRAITS_FILE "data/future_station_traits.json" + +/// The amount of time until the station charter can no longer be used to rename the station +#define STATION_RENAME_TIME_LIMIT 5 MINUTES diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index be1376f2966..c9c2c6ea83b 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -717,8 +717,10 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai // cargo traits ///If the item will block the cargo shuttle from flying to centcom #define TRAIT_BANNED_FROM_CARGO_SHUTTLE "banned_from_cargo_shuttle" -///If the item's contents are immune to the missing item manifest error +///If the crate's contents are immune to the missing item manifest error #define TRAIT_NO_MISSING_ITEM_ERROR "no_missing_item_error" +///If the crate is immune to the wrong content in manifest error +#define TRAIT_NO_MANIFEST_CONTENTS_ERROR "no_manifest_contents_error" ///SSeconomy trait, if the market is crashing and people can't withdraw credits from ID cards. #define TRAIT_MARKET_CRASHING "market_crashing" diff --git a/code/game/objects/items/charter.dm b/code/game/objects/items/charter.dm index 55dd8bad996..1d1f8fad7cc 100644 --- a/code/game/objects/items/charter.dm +++ b/code/game/objects/items/charter.dm @@ -1,5 +1,3 @@ -#define STATION_RENAME_TIME_LIMIT 3000 - /obj/item/station_charter name = "station charter" icon = 'icons/obj/scrolls.dmi' @@ -119,5 +117,3 @@ SSblackbox.record_feedback("text", "station_renames", 1, "[station_name()]") if(!unlimited_uses) used = TRUE - -#undef STATION_RENAME_TIME_LIMIT diff --git a/code/game/objects/items/storage/lockbox.dm b/code/game/objects/items/storage/lockbox.dm index b5b38efc698..9154e0ef3ed 100644 --- a/code/game/objects/items/storage/lockbox.dm +++ b/code/game/objects/items/storage/lockbox.dm @@ -251,6 +251,7 @@ . = ..() buyer_account = _buyer_account ADD_TRAIT(src, TRAIT_NO_MISSING_ITEM_ERROR, TRAIT_GENERIC) + ADD_TRAIT(src, TRAIT_NO_MANIFEST_CONTENTS_ERROR, TRAIT_GENERIC) //SKYRAT EDIT START if(istype(buyer_account, /datum/bank_account/department)) diff --git a/code/game/objects/structures/crates_lockers/crates/secure.dm b/code/game/objects/structures/crates_lockers/crates/secure.dm index a550daf05ea..595481b707c 100644 --- a/code/game/objects/structures/crates_lockers/crates/secure.dm +++ b/code/game/objects/structures/crates_lockers/crates/secure.dm @@ -22,6 +22,7 @@ /obj/structure/closet/crate/secure/Initialize(mapload) . = ..() ADD_TRAIT(src, TRAIT_NO_MISSING_ITEM_ERROR, TRAIT_GENERIC) + ADD_TRAIT(src, TRAIT_NO_MANIFEST_CONTENTS_ERROR, TRAIT_GENERIC) /obj/structure/closet/crate/secure/take_damage(damage_amount, damage_type = BRUTE, damage_flag = "", sound_effect = TRUE, attack_dir, armour_penetration = 0) if(prob(tamperproof) && damage_amount >= DAMAGE_PRECISION) diff --git a/code/modules/cargo/department_order.dm b/code/modules/cargo/department_order.dm index 46122fd8741..7622993e901 100644 --- a/code/modules/cargo/department_order.dm +++ b/code/modules/cargo/department_order.dm @@ -169,7 +169,17 @@ GLOBAL_LIST_INIT(department_order_cooldowns, list( say("ERROR: No more then [CARGO_MAX_ORDER] of any pack may be ordered at once") return - department_order = new(pack, name, rank, ckey, "", null, chosen_delivery_area, null) + department_order = new( + pack = pack, + orderer = name, + orderer_rank = rank, + orderer_ckey = ckey, + reason = "", + paying_account = null, + department_destination = chosen_delivery_area, + coupon = null, + manifest_can_fail = FALSE, + ) SSshuttle.shopping_list += department_order if(!already_signalled) RegisterSignal(SSshuttle, COMSIG_SUPPLY_SHUTTLE_BUY, PROC_REF(finalize_department_order)) diff --git a/code/modules/cargo/exports.dm b/code/modules/cargo/exports.dm index 44a628740bd..622ab5ef9b0 100644 --- a/code/modules/cargo/exports.dm +++ b/code/modules/cargo/exports.dm @@ -27,6 +27,8 @@ Then the player gets the profit from selling his own wasted time. var/list/total_amount = list() ///export instance => total value of sold objects var/list/total_value = list() + ///set to false if any objects in a dry run were unscannable + var/all_contents_scannable = TRUE /* * Handles exporting a movable atom and its contents @@ -56,6 +58,10 @@ Then the player gets the profit from selling his own wasted time. if(export.applies_to(thing, apply_elastic)) if(!dry_run && (SEND_SIGNAL(thing, COMSIG_ITEM_PRE_EXPORT) & COMPONENT_STOP_EXPORT)) break + //Don't add value of unscannable items for a dry run report + if(dry_run && !export.scannable) + report.all_contents_scannable = FALSE + break sold = export.sell_object(thing, report, dry_run, apply_elastic) report.exported_atoms += " [thing.name]" break @@ -89,6 +95,8 @@ Then the player gets the profit from selling his own wasted time. var/include_subtypes = TRUE /// Types excluded from export var/list/exclude_types = list() + /// Set to false if the cost shouldn't be determinable by an export scanner + var/scannable = TRUE /// cost includes elasticity, this does not. var/init_cost diff --git a/code/modules/cargo/exports/manifest.dm b/code/modules/cargo/exports/manifest.dm index 1f975ddc439..03fe33467fb 100644 --- a/code/modules/cargo/exports/manifest.dm +++ b/code/modules/cargo/exports/manifest.dm @@ -1,3 +1,5 @@ +#define MAX_MANIFEST_PENALTY CARGO_CRATE_VALUE * 2.5 + // Approved manifest. // +80 credits flat. /datum/export/manifest_correct @@ -5,6 +7,7 @@ k_elasticity = 0 unit_name = "approved manifest" export_types = list(/obj/item/paper/fluff/jobs/cargo/manifest) + scannable = FALSE /datum/export/manifest_correct/applies_to(obj/O) if(!..()) @@ -16,12 +19,13 @@ return FALSE // Correctly denied manifest. -// Refunds the package cost minus the cost of crate. +// Refunds package cost minus the value of the crate. /datum/export/manifest_error_denied cost = -CARGO_CRATE_VALUE k_elasticity = 0 unit_name = "correctly denied manifest" export_types = list(/obj/item/paper/fluff/jobs/cargo/manifest) + scannable = FALSE /datum/export/manifest_error_denied/applies_to(obj/O) if(!..()) @@ -38,12 +42,13 @@ // Erroneously approved manifest. -// Substracts the package cost. +// Subtracts half the package cost. (max -500 credits) /datum/export/manifest_error unit_name = "erroneously approved manifest" k_elasticity = 0 export_types = list(/obj/item/paper/fluff/jobs/cargo/manifest) allow_negative_cost = TRUE + scannable = FALSE /datum/export/manifest_error/applies_to(obj/O) if(!..()) @@ -56,17 +61,17 @@ /datum/export/manifest_error/get_cost(obj/O) var/obj/item/paper/fluff/jobs/cargo/manifest/M = O - return -M.order_cost + return -min(M.order_cost * 0.5, MAX_MANIFEST_PENALTY) // Erroneously denied manifest. -// Substracts the package cost minus the cost of crate. +// Subtracts half the package cost. (max -500 credits) /datum/export/manifest_correct_denied - cost = -CARGO_CRATE_VALUE k_elasticity = 0 unit_name = "erroneously denied manifest" export_types = list(/obj/item/paper/fluff/jobs/cargo/manifest) allow_negative_cost = TRUE + scannable = FALSE /datum/export/manifest_correct_denied/applies_to(obj/O) if(!..()) @@ -79,4 +84,6 @@ /datum/export/manifest_correct_denied/get_cost(obj/O) var/obj/item/paper/fluff/jobs/cargo/manifest/M = O - return ..() - M.order_cost + return -min(M.order_cost * 0.5, MAX_MANIFEST_PENALTY) + +#undef MAX_MANIFEST_PENALTY diff --git a/code/modules/cargo/order.dm b/code/modules/cargo/order.dm index 2707719c170..9217446d9b5 100644 --- a/code/modules/cargo/order.dm +++ b/code/modules/cargo/order.dm @@ -21,13 +21,13 @@ if(!manifest_can_fail) return - if(prob(MANIFEST_ERROR_CHANCE)) + if(prob(MANIFEST_ERROR_CHANCE) && (world.time-SSticker.round_start_time > STATION_RENAME_TIME_LIMIT)) //Too confusing if station name gets changed errors |= MANIFEST_ERROR_NAME investigate_log("Supply order #[order_id] generated a manifest with an incorrect station name.", INVESTIGATE_CARGO) if(prob(MANIFEST_ERROR_CHANCE)) errors |= MANIFEST_ERROR_CONTENTS investigate_log("Supply order #[order_id] generated a manifest missing listed contents.", INVESTIGATE_CARGO) - if(prob(MANIFEST_ERROR_CHANCE)) + else if(prob(MANIFEST_ERROR_CHANCE)) //Content and item errors could remove the same items, so only one at a time errors |= MANIFEST_ERROR_ITEM investigate_log("Supply order #[order_id] generated with incorrect contents shipped.", INVESTIGATE_CARGO) @@ -136,11 +136,15 @@ for(var/atom/movable/AM in container.contents - manifest_paper) container_contents[AM.name]++ if((manifest_paper.errors & MANIFEST_ERROR_CONTENTS) && container_contents) - for(var/i = 1 to rand(1, round(container.contents.len * 0.5))) // Remove anywhere from one to half of the items - var/missing_item = pick(container_contents) - container_contents[missing_item]-- - if(container_contents[missing_item] == 0) // To avoid 0s and negative values on the manifest - container_contents -= missing_item + if(HAS_TRAIT(container, TRAIT_NO_MANIFEST_CONTENTS_ERROR)) + manifest_paper.errors &= ~MANIFEST_ERROR_CONTENTS + else + for(var/iteration in 1 to rand(1, round(container.contents.len * 0.5))) // Remove anywhere from one to half of the items + var/missing_item = pick(container_contents) + container_contents[missing_item]-- + if(container_contents[missing_item] == 0) // To avoid 0s and negative values on the manifest + container_contents -= missing_item + for(var/item in container_contents) manifest_text += "
  • [container_contents[item]] [item][container_contents[item] == 1 ? "" : "s"]
  • " diff --git a/code/modules/cargo/universal_scanner.dm b/code/modules/cargo/universal_scanner.dm index b9a2d01e14e..5895a1fba78 100644 --- a/code/modules/cargo/universal_scanner.dm +++ b/code/modules/cargo/universal_scanner.dm @@ -167,17 +167,39 @@ * Scans an object, target, and provides it's export value based on selling to the cargo shuttle, to mob/user. */ /obj/item/universal_scanner/proc/export_scan(obj/target, mob/user) - // Before you fix it: - // yes, checking manifests is a part of intended functionality. var/datum/export_report/report = export_item_and_contents(target, dry_run = TRUE) var/price = 0 for(var/exported_datum in report.total_amount) price += report.total_value[exported_datum] + + var/message = "Scanned [target]" + var/warning = FALSE + if(length(target.contents)) + message = "Scanned [target] and its contents" + if(price) + message += ", total value: [price] credits" + else + message += ", no export values" + warning = TRUE + if(!report.all_contents_scannable) + message += " (Undeterminable value detected, final value may differ)" + message += "." + else + if(!report.all_contents_scannable) + message += ", unable to determine value." + warning = TRUE + else if(price) + message += ", value: [price] credits." + else + message += ", no export value." + warning = TRUE + if(warning) + to_chat(user, span_warning(message)) + else + to_chat(user, span_notice(message)) + if(price) - to_chat(user, span_notice("Scanned [target], value: [price] credits[target.contents.len ? " (contents included)" : ""].")) playsound(src, 'sound/machines/terminal_select.ogg', 50, vary = TRUE) - else - to_chat(user, span_warning("Scanned [target], no export value.")) if(ishuman(user)) var/mob/living/carbon/human/scan_human = user