Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/modules/cargo/exports/large_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/obj/structure/closet/crate/large,
/obj/structure/closet/crate/mail,
/obj/structure/closet/crate/wooden,
/obj/structure/closet/crate/donation, // DOPPLER EDIT ADDITION - Dono crates are in loadout and are craftable... do not want infinite money glitch
)

/datum/export/large/crate/total_printout(datum/export_report/ex, notes = TRUE) // That's why a goddamn metal crate costs that much.
Expand Down
1 change: 1 addition & 0 deletions code/modules/cargo/orderconsole.dm
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
packs += list(list(
"name" = pack.name,
"cost" = pack.get_cost() * get_discount(),
"shortagemult" = pack.get_shortage_price_mult(), // DOPPLER EDIT ADDITION - SUPPLY_SHORTAGE STORY MODULE
"id" = pack_id,
"desc" = pack.desc || pack.name, // If there is a description, use it. Otherwise use the pack's name.
"first_item_icon" = first_item?.icon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,18 @@ GLOBAL_VAR(department_cd_override)
if(!islist(supply_data[pack.group]) || !can_see_pack(pack))
continue

// DOPPLER EDIT ADDITION BEGIN - SUPPLY_SHORTAGE STORY MODULE
var/shortage_text = ""
if (pack.is_unavailable())
shortage_text = " (Shortages: Unavailable!)"
else if (pack.get_shortage_price_mult() != 1)
shortage_text = " (Shortages: [pack.get_shortage_price_mult()]x cooldown)"
// DOPPLER EDIT ADDITION END
UNTYPED_LIST_ADD(supply_data[pack.group], list(
"name" = pack.name,
"cost" = pack.get_cost(),
"unavailable" = pack.is_unavailable(), // DOPPLER EDIT ADDITION - SUPPLY_SHORTAGE STORY MODULE
"shortage_text" = shortage_text, // DOPPLER EDIT ADDITION - SUPPLY_SHORTAGE STORY MODULE
"id" = pack.id,
"desc" = pack.desc || pack.name, // If there is a description, use it. Otherwise use the pack's name.
))
Expand Down
1 change: 1 addition & 0 deletions config/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
$include game_options.txt
$include dbconfig.txt
$include doppler/config_doppler.txt
$include doppler/STORY_SUPPLY_SHORTAGE.txt
$include comms.txt
$include logging.txt
$include resources.txt
Expand Down
10 changes: 10 additions & 0 deletions config/doppler/STORY_SUPPLY_SHORTAGE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Instructions - write SUPPLY_SHORTAGES, followed by this format: SUPPLYPACKTYPEPATH,MULT to change the price of
## a supply pack.
## 1 has no effect.
## -1 will make the item completely unavailable.
## Mults below 1, including 0, are possible, but highly inadvisable.

## Examples:
#SUPPLY_SHORTAGES /datum/supply_pack/goody/laser_single,1.5
#SUPPLY_SHORTAGES /datum/supply_pack/security/armory/laser,-1
#SUPPLY_SHORTAGES /datum/supply_pack/security/stingpack,4
11 changes: 11 additions & 0 deletions modular_doppler/STORY_supply_shortage/config.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/datum/config_entry/keyed_list/supply_shortages
key_mode = KEY_MODE_TYPE
value_mode = VALUE_MODE_NUM
splitter = ","

/datum/config_entry/keyed_list/supply_shortages/validate_config_key(key)
var/type = text2path(key)
if (type in get_usable_supply_packs())
return key
log_config("ERROR: [key] is not a valid supply pack typepath.")
return null
34 changes: 34 additions & 0 deletions modular_doppler/STORY_supply_shortage/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## Title: Supply shortage

MODULE ID: SUPPLY_SHORTAGE

### Description:

TEMPORARY STORY MODULE. WILL BE REVERTED WHEN THE ARC ENDS.

### TG Proc Changes:

code/modules/cargo/orderconsole.dm - L192, added "shortagemult" = pack.get_shortage_price_mult(),
code/modules/modular_computers/file_system/programs/dept_order.dm - L88 - L99

tgui/packages/tgui/interfaces/NtosDeptOrder.tsx - L31-L32, L211-213, L223
tgui/packages/tgui/interfaces/Cargo/CargoCatalog.tsx - L201-L204, L221-L223, L241-L245
tgui/packages/tgui/interfaces/Cargo/types.ts - L42

config/config.txt - L6

### Defines:

N/A

### Master file additions

N/A

### Included files that are not contained in this module:

config/doppler/STORY_SUPPLY_SHORTAGE.txt

### Credits:

Niko
32 changes: 32 additions & 0 deletions modular_doppler/STORY_supply_shortage/supply_pack.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/// Returns a list of non-abstract supply packs.
/proc/get_usable_supply_packs()
RETURN_TYPE(/list)
var/list/packs = list()
for (var/datum/supply_pack/iter_path as anything in subtypesof(/datum/supply_pack))
if (iter_path::abstract_type == iter_path)
continue
packs += iter_path
return packs

/// Returns the assoc list of stringified supply pack typepaths to their price mult.
/proc/get_price_mults()
RETURN_TYPE(/list)
return CONFIG_GET(keyed_list/supply_shortages)

// If this proc returns -1, the item is wholly unavailable.
/// Returns the actual price mult of the supply pack. If -1, the item is completely unavailable. Use get_cost() for actual price calculations.
/datum/supply_pack/proc/get_shortage_price_mult()
var/mult = get_price_mults()["[type]"]
if (isnull(mult))
return 1
return mult

/// Returns TRUE if our shortage price mult is -1.
/datum/supply_pack/proc/is_unavailable()
return get_shortage_price_mult() == -1

/datum/supply_pack/get_cost()
. = ..()

if (!is_unavailable())
. *= get_shortage_price_mult()
59 changes: 59 additions & 0 deletions modular_doppler/donation_box/donation_box.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/obj/structure/closet/crate/donation
name = "donation box"
desc = "A steel crate, modified into a donation box via a small slot on the top. Allows insertion of items without allowing removal."
icon = 'modular_doppler/donation_box/icons/donation_box.dmi'
icon_state = "donation_box"
base_icon_state = "donation_box"

/obj/structure/closet/crate/donation/secure
name = "secure donation box"
desc = "A steel crate, modified into a donation box via a small slot on the top. Allows insertion of items without allowing removal."
icon = 'modular_doppler/donation_box/icons/donation_box.dmi'
icon_state = "securedonation_box"
base_icon_state = "securedonation_box"
secure = TRUE
card_reader_installed = TRUE

/obj/structure/closet/crate/donation/examine(mob/user)
. = ..()

. += span_smallnotice("When closed, you can [EXAMINE_HINT("Right-Click")] with an item to place it in the box, if able.")

/obj/structure/closet/crate/donation/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if (opened)
return NONE
if (user.combat_mode)
return NONE
if (!LAZYACCESS(modifiers, RIGHT_CLICK))
return NONE
if (!insertion_allowed(tool))
balloon_alert(user, "can't fit it in!")
return NONE

user.balloon_alert_to_viewers("inserts [tool]", "inserted [tool]")
user.visible_message(
span_notice("[user] inserts [tool] into the small slot on [src]."),
span_notice("You insert [tool] into the small slot on [src].")
)

if (insert(tool))
return ITEM_INTERACT_SUCCESS
return NONE

/obj/item/donation_box_kit
icon = 'icons/obj/storage/box.dmi'
icon_state = "plasticbox"
name = "donation kit"
desc = "Contains a folded donation box, with an access lock and a few tools inside."

/obj/item/donation_box_kit/attack_self(mob/user, modifiers)
user.balloon_alert_to_viewers("deploying...")
if (!do_after(user, 3 SECONDS, src))
return FALSE
var/obj/structure/closet/crate/donation/secure/box = new /obj/structure/closet/crate/donation/secure(get_turf(user))
new /obj/item/hand_labeler(box)
playsound(src, 'sound/machines/terminal/terminal_eject.ogg', 70, TRUE)
qdel(src)

return TRUE

Binary file not shown.
3 changes: 3 additions & 0 deletions modular_doppler/donation_box/loadout.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/datum/loadout_item/pocket_items/equipment/donation_kit
name = "Donation Kit"
item_path = /obj/item/donation_box_kit
1 change: 1 addition & 0 deletions modular_doppler/modular_crafting/code/sheet_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ GLOBAL_LIST_INIT(doppler_metal_recipes, list(
new/datum/stack_recipe("forge", /obj/structure/reagent_forge, 10, time = 2 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_TOOLS),
new/datum/stack_recipe("throwing wheel", /obj/structure/throwing_wheel, 10, time = 2 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_TOOLS),
new/datum/stack_recipe("metal shelf", /obj/structure/shelf, 1, time = 2 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_STRUCTURE),
new/datum/stack_recipe("donation box", /obj/structure/closet/crate/donation, 10, time = 3 SECONDS, crafting_flags = CRAFT_CHECK_DENSITY | CRAFT_ONE_PER_TURF | CRAFT_ON_SOLID_GROUND, category = CAT_CONTAINERS),
))

GLOBAL_LIST_INIT(doppler_metal_airlock_recipes, list(
Expand Down
4 changes: 4 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6934,6 +6934,8 @@
#include "modular_doppler\deforest_medical_items\code\vulnerable_status_effect.dm"
#include "modular_doppler\deforest_medical_items\code\chemicals\demoneye.dm"
#include "modular_doppler\disable_suicide\config_entries.dm"
#include "modular_doppler\donation_box\donation_box.dm"
#include "modular_doppler\donation_box\loadout.dm"
#include "modular_doppler\doppler_command_uniforms\hop\overrides.dm"
#include "modular_doppler\emotes\code\emotes.dm"
#include "modular_doppler\emotes\code\hologram.dm"
Expand Down Expand Up @@ -7720,6 +7722,8 @@
#include "modular_doppler\starter_resources\ore_vent.dm"
#include "modular_doppler\stone\code\ore_veins.dm"
#include "modular_doppler\stone\code\stone.dm"
#include "modular_doppler\STORY_supply_shortage\config.dm"
#include "modular_doppler\STORY_supply_shortage\supply_pack.dm"
#include "modular_doppler\super_glasses\code\glasses_stats_thief.dm"
#include "modular_doppler\super_glasses\code\techno_visors.dm"
#include "modular_doppler\suuuper_trustworthy_item_orders\code\chem_containers.dm"
Expand Down
13 changes: 12 additions & 1 deletion tgui/packages/tgui/interfaces/Cargo/CargoCatalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ function CatalogList(props: CatalogListProps) {
}

const privateBuy = (self_paid && !pack.goody) || app_cost;
const unavailable = pack.shortagemult === -1;
const shortageString = unavailable
? 'UNAVAILABLE!'
: `${pack.shortagemult}x cost`;
const tooltipIcon = (content: string, icon: string, color: string) => (
<Stack.Item>
<Tooltip content={content}>
Expand All @@ -214,7 +218,9 @@ function CatalogList(props: CatalogListProps) {
dmIconState={pack.first_item_icon_state}
imageSize={32}
color={color}
disabled={(amount_by_name[pack.name] || 0) >= max_order}
disabled={
(amount_by_name[pack.name] || 0) >= max_order || unavailable
}
buttonsAlt={
<Button
color="transparent"
Expand All @@ -232,6 +238,11 @@ function CatalogList(props: CatalogListProps) {
<Stack.Item grow textAlign="left">
{pack.name}
</Stack.Item>
{pack.shortagemult !== 1 && (
<Stack.Item color="red" grow italic bold fontSize={0.7}>
Shortages: {shortageString}
</Stack.Item>
)}
{(!!pack.small_item || !!pack.access || !!pack.contraband) && (
<Stack.Item>
<Stack reverse>
Expand Down
1 change: 1 addition & 0 deletions tgui/packages/tgui/interfaces/Cargo/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type Supply = {
small_item: BooleanLike;
contraband: BooleanLike;
contains: SupplyItem[];
shortagemult: number;
};

type SupplyItem = {
Expand Down
6 changes: 6 additions & 0 deletions tgui/packages/tgui/interfaces/NtosDeptOrder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type typePath = string;
type Pack = {
name: string;
desc: string;
unavailable: BooleanLike;
shortage_text: string;
cost: number;
id: typePath;
};
Expand Down Expand Up @@ -206,6 +208,9 @@ const DepartmentCatalog = () => {
</Box>
</Tooltip>
</Stack.Item>
<Stack.Item color="red" textAlign="center" italic bold>
{pack.shortage_text}
</Stack.Item>
<Stack.Item>
<CooldownEstimate cost={pack.cost} />
&ensp;
Expand All @@ -215,6 +220,7 @@ const DepartmentCatalog = () => {
id: pack.id,
})
}
disabled={pack.unavailable}
>
Order
</Button>
Expand Down
Loading