---
# System prepended metadata

title: cargo/economy/suffering

---

# cargo/economy/suffering

basically;
- economy is too uninteractive on rp
- economy is interactive on main but abstractly barred from usage because muh BALANCE (see: good reasons like the RD getting 400k out of literally nowhere)
- cargo is a joke on rp
- cargo is not a joke on main but could be improved
- we don't want to write the same code twice how about we MODULARIZE (oh no)

things im willing to code right now while busy if needed
- most of the economy system - believe it or not this is infinitely less obnoxious to do than cargo

things to note
- most of these can be modular enough to not require everything be written at once, e.g. cargo small orders would work fine with points until economy is overhauled
- economy: optimally we will have a CONFIG_GET() for ticked pay vs static pay per round because rp will probably lose their ship over ticked pay, i'm willing to take the fall and make this a thing
- economy: config entries for account uplink and payroll uplink incase we need to quick-disable for balancing on a temporary basis.

## Supply

- consider these things separate subsystems

### cargo system

#### computers
- supply ordering computer
- supply request computer
- contains ui sections for
    - supply packs
    - small items
    - **per faction**

#### supply packs
- categories (just like now)
- crates per category (just like now)
- per faction
- supply packs come in some sort of container each

#### small items
- categories
- items per category
- all of this per faction
- grouped into cheap cardboard boxes or something that decons to paper
- locked to the person who bought it, **or** a specific access (by default, most are cargo, stuff like guns would be armory)
    - stuff like weapons would be overridden to always be locked to said access so you can't order unlocked weapons as an assistant

#### /datum/supply_system
- this reprensets **how** the system works
- abstracts the transport of supplies 
    - /datum/supply_system/shuttle - use cargo shuttle, bidirectional
    - /datum/supply_system/pod - use pod, obviously one way, sends are instant
    - /datum/supply_system/telepad - use pad, bidirectional, send/receive are instant but take power, link to special machine, etc
- order information etc is stored on this
    - if we make supplypods a thing, the consoles for those would use that system, etc
- can incur multipliers on buy/sell prices
    - e.g. pods taking 10x money always but sending 10 copies at a time like how it does on main
- contains the procs needed to scan for items to sell/spawn items to buy

#### /datum/supply_faction
- represents a faction selling in the area of space
- used so we can have themed imports/exports 
    - hephaestus specializing in weapons, nt specializing in prototypes, veymed selling medical gear, etc

#### /datum/supply_pack
- self explanatory

#### /datum/supply_item
- small items

### black market
- literally just an item
- same as trading system but operates off universal list
- **steal this from main**
- this is just a small fluff gimmick for buying contraband/small items
- we can skip this and do trading only if we want for rp, but, this is honestly fun.

### trading

- **nebula has this, don't code from scratch, take it**

#### /obj/machinery/trade_telepad
- combined telepad/control machine
- connects to /datum/trade_hub
    - available ones are controlled by proc
    - overmap trade hubs in the future?
- allows buying and selling of things on pad
- does not link to account, directly operates in money
- cargo starts with one
- faction id - for initial implementaiton, just null

#### /datum/trade_hub
- name
- desc
- stores happiness/relations
- **Literally steal this from Nebula, they have this, just needs to be refactored a bit**
- lists of things it sells
    - based generally around trade value, with some randomization for some that are more or less expensive
- lists of things it buys
    - ditto

### exports
- main has this but needs to be slightly rewritten, likely!
- /datum/export
    - /datum/export/universal
        - expensive, can work on all items
    - /datum/export/specific
        - uses typecache/optimizations to determine what to scan
    - heavily log all uses of this for debugging
- universal /atom worth scan system used both by trading and cargo system
    - e.g. /datum/export/universal/raw_materials - describes value of raw materials
    - e.g. /datum/export/universal/reagent_contents - describe value of reagents in atoms
    - e.g. /datum/export/item/narcotics - describe value of narcotics sold, something like a pirate trader/faction would use this
- /get_worth() or this may need to be optimized the shit out of for this to work
    - all export datums run on, worst case, every item
        - LISTMANIA

### stock market
- yeah let's not now that i think about it.
- if you really feel this is a good idea main still has archived code.
- god help you

## Economy

### Datastructure/Refactor
- /datum/bank_account or /datum/money_account or What Ever
    - unique key by id
    - human readable metadata of: owner name, owner job, creation date and location (fluff i'm sure hrp people understand ahah)
    - transaction list of ordered /datum/transactions
    - and obviously, MONEY IN ACCOUNT stored in here
    - id of economic faction - more on that later
    - **always reference by id** - subsystem 
- /datum/transaction
    - logs all transactions
    - **IC FLUFF** - not used for ooc purposes. log_economy will handle admin logging
    - data: type, reason, amount, target (if applicable)
    - viewable on atm
- /datum/economic_faction
    - has a master account mostly for fluff each that admins can access
    - represents one payroll system e.g. the station has one that the hop has control over
    - only accounts under a specific faction can be managed by consoles with access to that faction
        - allow traders to have their own faction + accounts
- /datum/payroll_system
    - allow nesting for department systems
    - consoles can access one, heads can control their department's, hop/captain can control station's
    - root gets x money per payroll tick (likely 5-15 minutes)
    - payment distributed to any payroll systems and bank accounts on the list, whether by percentage, or static amount
    - has an account to back up so overpaying for a few ticks will work until it runs out of money

### payroll system
- see /datum/payroll_system
- station gets x money per tick for free
    - based on crew count, map, admin Fuckery(tm), etc
- **everything is a config value for balancing**

### department account
- every department has an account
- links to their payroll system!!
- cargo's is what supply would run off!!
- station has a master one too backing its master payroll system

### ***atom worth***
- root /atom/proc/get_worth()
- returns a list
    - economical categories, e.g. weapon, drugs, etc
    - nominal trade value, assumed to be galactic average
    - raw materials value
    - etc
- parsed by anything that needs it to determine something's sell value
- cargo + traders get scanners to *approximate* this on the fly.

### machinery
- bank card component 
    - so basically id card but ECS/DCS 
- holochips as well as physical thaler cash
    - i'm cancer and can simulate this easily
    - holochips can be removed from bank card ocmponents that allow this
- coin
    - coins are frankly broken in economy but we might as well let it count as a prank
- universal /proc/check_payment(obj/item/I, amount, allowed_types), /proc/attempt_payment(same), /proc/get_money(same)
    - supports all of above
- vendors
    - use this system duh
    - we'll have GAGS vendors soon so good time to overhaul anyways :|
- atms
    - duh
    - can be used to relink bank cards
- EFTPOS
    - duh
- account uplink/management terminal
    - linked to a specific economic faction, allows manipulation including forced transfers, pin changes, bank card relinks, etc, within that economic faction
- payroll management terminal
    - ditto for linking - allows infinite manipulation of payroll within that by reassigning payroll auto-distribution amounts
- REMOVE THESE:
    - cash registers
    - retail scanners
    - if anyone complains THEY can try to code these without shitcode because as it stands these are dumpster fires and we already are stretched more than thin, dev wise

### admin interface
- we frankly don't need to but if someone really wants to:
    - interface for managing accounts by id - sort of like the hop's terminal but universal and omniscient
    - interface for managing payroll systems/payroll roots

