/// The chance for a manifest or crate to be created with errors #define MANIFEST_ERROR_CHANCE 5 // MANIFEST BITFLAGS /// Determines if the station name will be incorrect on the manifest #define MANIFEST_ERROR_NAME (1 << 0) /// Determines if contents will be deleted from the manifest but still be present in the crate #define MANIFEST_ERROR_CONTENTS (1 << 1) /// Determines if contents will be deleted from the crate but still be present in the manifest #define MANIFEST_ERROR_ITEM (1 << 2) /obj/item/paper/fluff/jobs/cargo/manifest var/order_cost = 0 var/order_id = 0 var/errors = 0 /obj/item/paper/fluff/jobs/cargo/manifest/Initialize(mapload, id, cost, manifest_can_fail = TRUE) . = ..() order_id = id order_cost = cost if(!manifest_can_fail) return if(prob(MANIFEST_ERROR_CHANCE)) 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)) errors |= MANIFEST_ERROR_ITEM investigate_log("Supply order #[order_id] generated with incorrect contents shipped.", INVESTIGATE_CARGO) /obj/item/paper/fluff/jobs/cargo/manifest/proc/is_approved() return LAZYLEN(stamp_cache) && !is_denied() /obj/item/paper/fluff/jobs/cargo/manifest/proc/is_denied() return LAZYLEN(stamp_cache) && ("stamp-deny" in stamp_cache) /datum/supply_order var/id var/cost_type var/orderer var/orderer_rank var/orderer_ckey var/reason var/discounted_pct ///If set to FALSE, we won't charge when the cargo shuttle arrives with this. var/charge_on_purchase = TRUE ///area this order wants to reach, if not null then it will come with the deliver_first component set to this area var/department_destination var/datum/supply_pack/pack var/datum/bank_account/paying_account var/obj/item/coupon/applied_coupon ///Boolean on whether the manifest can fail or not. var/manifest_can_fail = TRUE ///Boolean on whether the manifest can be cancelled through cargo consoles. var/can_be_cancelled = TRUE /datum/supply_order/New( datum/supply_pack/pack, orderer, orderer_rank, orderer_ckey, reason, paying_account, department_destination, coupon, charge_on_purchase = TRUE, manifest_can_fail = TRUE, cost_type = "cr", can_be_cancelled = TRUE, ) id = SSshuttle.order_number++ src.cost_type = cost_type src.pack = pack src.orderer = orderer src.orderer_rank = orderer_rank src.orderer_ckey = orderer_ckey src.reason = reason src.paying_account = paying_account src.department_destination = department_destination src.applied_coupon = coupon src.charge_on_purchase = charge_on_purchase src.manifest_can_fail = manifest_can_fail src.can_be_cancelled = can_be_cancelled //returns the total cost of this order. Its not the total price paid by cargo but the total value of this order /datum/supply_order/proc/get_final_cost() var/cost = pack.get_cost() if(applied_coupon) //apply discount price cost -= (cost * applied_coupon.discount_pct_off) if(!isnull(paying_account)) //privately purchased means 1.1x the cost cost *= 1.1 return cost /datum/supply_order/proc/generateRequisition(turf/T) var/obj/item/paper/requisition_paper = new(T) requisition_paper.name = "requisition form - #[id] ([pack.name])" var/requisition_text = "