From 04f90b749f6a72dfdfa097b41aa8c53c3032e975 Mon Sep 17 00:00:00 2001 From: qweq12yt <45515587+qweq12yt@users.noreply.github.com> Date: Tue, 30 Mar 2021 12:33:23 -0300 Subject: [PATCH 1/5] fixes material crates not shipping --- .../closets/secure/secure_closets.dm | 47 +++++++++++++++++++ code/modules/cargo/packs.dm | 5 +- code/modules/cargo/packs/materials.dm | 16 +++---- code/modules/cargo/packs/misc.dm | 2 +- code/modules/shuttle/supply.dm | 1 - 5 files changed, 60 insertions(+), 11 deletions(-) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm index 0c314d988c..5b78ca323c 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm @@ -19,3 +19,50 @@ desc = "A sturdier card-locked storage unit used for bulky shipments." max_integrity = 500 // Same as crates. melee_min_damage = 25 // Idem. + +/obj/structure/closet/secure_closet/goodies/owned + name = "private locker" + desc = "A locker designed to only open for who purchased its contents." + ///Account of the person buying the crate if private purchasing. + var/datum/bank_account/buyer_account + ///Department of the person buying the crate if buying via the NIRN app. + var/datum/bank_account/department/department_account + ///Is the secure crate opened or closed? + var/privacy_lock = TRUE + ///Is the crate being bought by a person, or a budget card? + var/department_purchase = FALSE + +/obj/structure/closet/secure_closet/goodies/owned/examine(mob/user) + . = ..() + . += "It's locked with a privacy lock, and can only be unlocked by the buyer's ID." + +/obj/structure/closet/secure_closet/goodies/owned/Initialize(mapload, datum/bank_account/_buyer_account) + . = ..() + buyer_account = _buyer_account + if(istype(buyer_account, /datum/bank_account/department)) + department_purchase = TRUE + department_account = buyer_account + +/obj/structure/closet/secure_closet/goodies/owned/togglelock(mob/living/user, silent) + if(privacy_lock) + if(!broken) + var/obj/item/card/id/id_card = user.get_idcard(TRUE) + if(id_card) + if(id_card.registered_account) + if(id_card.registered_account == buyer_account || (department_purchase && (id_card.registered_account?.account_job?.paycheck_department) == (department_account.department_id))) + if(iscarbon(user)) + add_fingerprint(user) + locked = !locked + user.visible_message("[user] unlocks [src]'s privacy lock.", + "You unlock [src]'s privacy lock.") + privacy_lock = FALSE + update_icon() + else if(!silent) + to_chat(user, "Bank account does not match with buyer!") + else if(!silent) + to_chat(user, "No linked bank account detected!") + else if(!silent) + to_chat(user, "No ID detected!") + else if(!silent) + to_chat(user, "[src] is broken!") + else ..() diff --git a/code/modules/cargo/packs.dm b/code/modules/cargo/packs.dm index 7ec3a775a5..db722436ca 100644 --- a/code/modules/cargo/packs.dm +++ b/code/modules/cargo/packs.dm @@ -21,7 +21,10 @@ /datum/supply_pack/proc/generate(atom/A, datum/bank_account/paying_account) var/obj/structure/closet/crate/C if(paying_account) - C = new /obj/structure/closet/crate/secure/owned(A, paying_account) + if(ispath(crate_type, /obj/structure/closet/secure_closet/goodies)) + C = new /obj/structure/closet/secure_closet/goodies/owned(A, paying_account) + else + C = new /obj/structure/closet/crate/secure/owned(A, paying_account) C.name = "[crate_name] - Purchased by [paying_account.account_holder]" else C = new crate_type(A) diff --git a/code/modules/cargo/packs/materials.dm b/code/modules/cargo/packs/materials.dm index 86c6b114f0..8b063c1a30 100644 --- a/code/modules/cargo/packs/materials.dm +++ b/code/modules/cargo/packs/materials.dm @@ -14,56 +14,56 @@ ////////////////////////////////////////////////////////////////////////////// /datum/supply_pack/materials/cardboard50 - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "50 Cardboard Sheets" desc = "Create a bunch of boxes." cost = 300 //thrice their export value contains = list(/obj/item/stack/sheet/cardboard/fifty) /datum/supply_pack/materials/glass50 - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "50 Glass Sheets" desc = "Let some nice light in with fifty glass sheets!" cost = 300 //double their export value contains = list(/obj/item/stack/sheet/glass/fifty) /datum/supply_pack/materials/metal50 - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "50 Metal Sheets" desc = "Any construction project begins with a good stack of fifty metal sheets!" cost = 300 //double their export value contains = list(/obj/item/stack/sheet/metal/fifty) /datum/supply_pack/materials/plasteel20 - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "20 Plasteel Sheets" desc = "Reinforce the station's integrity with twenty plasteel sheets!" cost = 4000 contains = list(/obj/item/stack/sheet/plasteel/twenty) /datum/supply_pack/materials/plastic50 - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "50 Plastic Sheets" desc = "Build a limitless amount of toys with fifty plastic sheets!" cost = 200 // double their export contains = list(/obj/item/stack/sheet/plastic/twenty) /datum/supply_pack/materials/sandstone30 - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "30 Sandstone Blocks" desc = "Neither sandy nor stoney, these thirty blocks will still get the job done." cost = 150 // five times their export contains = list(/obj/item/stack/sheet/mineral/sandstone/thirty) /datum/supply_pack/materials/wood50 - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "50 Wood Planks" desc = "Turn cargo's boring metal groundwork into beautiful panelled flooring and much more with fifty wooden planks!" cost = 400 // 6-7 planks shy from having equal import/export prices contains = list(/obj/item/stack/sheet/mineral/wood/twenty) /datum/supply_pack/materials/rcdammo - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "Large RCD ammo Single-Pack" desc = "A single large compressed RCD matter pack, to help with any holes or projects people might be working on." cost = 600 diff --git a/code/modules/cargo/packs/misc.dm b/code/modules/cargo/packs/misc.dm index 985c827e65..d72ee231a8 100644 --- a/code/modules/cargo/packs/misc.dm +++ b/code/modules/cargo/packs/misc.dm @@ -370,7 +370,7 @@ ////////////////////////////////////////////////////////////////////////////// /datum/supply_pack/misc/carpet - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "Classic Carpet Single-Pack" desc = "Plasteel floor tiles getting on your nerves? This 50 units stack of extra soft carpet will tie any room together." cost = 200 diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm index 899e2b2f6f..60dfdd53c5 100644 --- a/code/modules/shuttle/supply.dm +++ b/code/modules/shuttle/supply.dm @@ -128,7 +128,6 @@ GLOBAL_LIST_INIT(cargo_shuttle_leave_behind_typecache, typecacheof(list( var/value = 0 var/purchases = 0 var/list/goodies_by_buyer = list() // if someone orders more than GOODY_FREE_SHIPPING_MAX goodies, we upcharge to a normal crate so they can't carry around 20 combat shotties - for(var/datum/supply_order/SO in SSshuttle.shoppinglist) if(!empty_turfs.len) break From 2775543c9734078422075b5d2d6e6183c2a7999b Mon Sep 17 00:00:00 2001 From: qweq12yt <45515587+qweq12yt@users.noreply.github.com> Date: Wed, 31 Mar 2021 00:46:07 -0300 Subject: [PATCH 2/5] additional comments --- code/modules/cargo/packs.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/cargo/packs.dm b/code/modules/cargo/packs.dm index db722436ca..f35e2d91ea 100644 --- a/code/modules/cargo/packs.dm +++ b/code/modules/cargo/packs.dm @@ -21,8 +21,8 @@ /datum/supply_pack/proc/generate(atom/A, datum/bank_account/paying_account) var/obj/structure/closet/crate/C if(paying_account) - if(ispath(crate_type, /obj/structure/closet/secure_closet/goodies)) - C = new /obj/structure/closet/secure_closet/goodies/owned(A, paying_account) + if(ispath(crate_type, /obj/structure/closet/secure_closet/goodies)) // lets ensure private orders don't come in crates when the original one comes in lockers + C = new /obj/structure/closet/secure_closet/goodies/owned(A, paying_account) // that would lead to infinite money exploits else C = new /obj/structure/closet/crate/secure/owned(A, paying_account) C.name = "[crate_name] - Purchased by [paying_account.account_holder]" From b97a38f125d1dc22f2b5bd69827bd0da443cb0e5 Mon Sep 17 00:00:00 2001 From: qweq12yt <45515587+qweq12yt@users.noreply.github.com> Date: Wed, 31 Mar 2021 00:55:14 -0300 Subject: [PATCH 3/5] todo comment hopefully i will be able to do it in the future, or someone else will implement it --- code/modules/shuttle/supply.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/shuttle/supply.dm b/code/modules/shuttle/supply.dm index 60dfdd53c5..74ac0fc166 100644 --- a/code/modules/shuttle/supply.dm +++ b/code/modules/shuttle/supply.dm @@ -128,6 +128,7 @@ GLOBAL_LIST_INIT(cargo_shuttle_leave_behind_typecache, typecacheof(list( var/value = 0 var/purchases = 0 var/list/goodies_by_buyer = list() // if someone orders more than GOODY_FREE_SHIPPING_MAX goodies, we upcharge to a normal crate so they can't carry around 20 combat shotties + // var/list/lockers_by_buyer = list() // TODO, combine orders that come in lockers into a single locker to not crowd the shuttle for(var/datum/supply_order/SO in SSshuttle.shoppinglist) if(!empty_turfs.len) break From 37be0768b3f666aa7aedd718a9bf572f2a0af697 Mon Sep 17 00:00:00 2001 From: qweq12yt <45515587+qweq12yt@users.noreply.github.com> Date: Wed, 31 Mar 2021 01:08:01 -0300 Subject: [PATCH 4/5] goodbye define - more comments --- code/__DEFINES/cargo.dm | 5 ++--- code/modules/cargo/packs.dm | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/__DEFINES/cargo.dm b/code/__DEFINES/cargo.dm index 40a50fe1e6..85e5e9d2ac 100644 --- a/code/__DEFINES/cargo.dm +++ b/code/__DEFINES/cargo.dm @@ -60,6 +60,5 @@ GLOBAL_LIST_INIT(podstyles, list(\ )) //cit -#define PACK_GOODY_NONE 0 -#define PACK_GOODY_PUBLIC 1 //can be bought by both privates and cargo -#define PACK_GOODY_PRIVATE 2 //can be bought only by privates +#define PACK_GOODY_NONE 0 // can be bought by cargo and privates +#define PACK_GOODY_PRIVATE 1 // can be bought only by privates diff --git a/code/modules/cargo/packs.dm b/code/modules/cargo/packs.dm index f35e2d91ea..3e3aeff592 100644 --- a/code/modules/cargo/packs.dm +++ b/code/modules/cargo/packs.dm @@ -15,6 +15,7 @@ var/special_enabled = FALSE var/DropPodOnly = FALSE //only usable by the Bluespace Drop Pod via the express cargo console var/admin_spawned = FALSE //Can only an admin spawn this crate? + // this might be all in all unnecessary with current code if some changes are made var/goody = PACK_GOODY_NONE //Small items can be grouped into a single crate.They also come in a closet/lockbox instead of a full crate, so the 700 min doesn't apply var/can_private_buy = TRUE //Can it be purchased privately by each crewmember? From c392d6e8882b7e62034a050659d16c060ddecd9c Mon Sep 17 00:00:00 2001 From: qweq12yt <45515587+qweq12yt@users.noreply.github.com> Date: Thu, 8 Apr 2021 21:40:51 -0300 Subject: [PATCH 5/5] fix issue --- code/modules/cargo/packs/materials.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/cargo/packs/materials.dm b/code/modules/cargo/packs/materials.dm index d9de94a15b..94f14fb503 100644 --- a/code/modules/cargo/packs/materials.dm +++ b/code/modules/cargo/packs/materials.dm @@ -56,7 +56,7 @@ contains = list(/obj/item/stack/sheet/mineral/sandstone/thirty) /datum/supply_pack/materials/wood20 - goody = PACK_GOODY_PUBLIC + crate_type = /obj/structure/closet/secure_closet/goodies name = "20 Wood Planks" desc = "Turn cargo's boring metal groundwork into beautiful panelled flooring and much more with twenty wooden planks!" cost = 400 // 6-7 planks shy from having equal import/export prices