Skip to content

Rewrites and Modpacks NPC Merchants - #5505

Open
Neerti wants to merge 4 commits into
NebulaSS13:devfrom
Neerti:nebula_merchant_refactor
Open

Neerti wants to merge 4 commits into
NebulaSS13:devfrom
Neerti:nebula_merchant_refactor

Conversation

@Neerti

@Neerti Neerti commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

After 15 months in development, hopefully it will have been worth the wait.

This project rewrites merchants more or less from scratch, with the aim of being highly configurable and modular. I rewrote the merchant system due to running into a lot of limitations while trying to make a downsteam fork that relied heavily on merchants as a replacement for things like cargo supply packs. The highly modular nature of this rewrite was done so that I can have a good foundation to place my changes on top of, without unnecessarily impacting other people who might have different ideas.

The code for the new merchants are now inside two modpacks. The first modpack, titled Merchants, holds all of the systems for the merchants features, such as base types for merchants, trade hubs, the in-game merchant computer program, the trade subsystem, etc. The second modpack, titled Standard Merchants, hold the content such as individual merchant definitions. These are separated out in order to allow for downsteam servers to use the merchant system by itself and not include merchant types they might not want to use.

Any map that wants to have a trade pad mapped in will require a dependency on at least Merchants. Tradeship has a dependency on both Merchants and Standard Merchants. The Liberia map, for playable merchants, has a dependency on Merchants.

There is a readme at the base of the Merchants modpack which gives some more information on how the systems connect together, as well as instructions on how to make new content using the system.

Description of changes

Here is a list of new functionality added by the rewrite:

  • The merchants themselves:
    • Supply and demand can be reused across different merchants.
    • Merchant buying and selling prices now utilize a list of modifiers that determine things like the base markup, disposition discounts, or relative skill level scaling. Not including one of those modifiers makes that merchant not use it.
    • Merchants can use a different currency instead of the default currency set by the map.
    • Things merchants might want to buy can be required to conform to specific requirements, besides just a type check. Some examples include being made out of a specific material, a mob being dead, a reagent container being empty, or a gas container having a specific ratio of gases and being at a specific temperature.
    • Merchants can demand reagents, gas mixtures, or material stacks. These demands can ask for a specific quantity, such as a certain number of units or moles.
    • Merchants can have limited amounts of cash on hand.
    • Merchants can be set to only buy or sell a limited number of things. For example, a merchant might only have 4 clams available to buy, or they might only want 30 sheets of steel.
    • Merchants have different disposition values for different characters, so one person who insults the merchant can't lock out everyone else.
    • Merchants can start off with a different default disposition value for different characters. For example, the Smuggler merchant in Standard Merchants might like people who are similarly shady right off the bat.
    • Merchants can refuse to interact with people who lack an ID, or otherwise would show up as "Unknown".
    • Merchants can be haggled with, for buying or selling. Players input a number as an offer, and the merchant can accept or refuse the offer, causing a loss of some disposition. Really dumb offers might make the merchant refuse to talk to that player.
    • Merchants have their own skill levels, which is compared with players' Finance skills to determine who has an advantage.
    • Merchants can be set to use different in-game languages. If a player doesn't speak at least one of them, interacting with the merchant will be a lot more difficult, due to the text of things like item names and dialogue becoming scrambled. Certain interactions will also become impossible, such as asking questions.
    • Merchants can be asked how much they would pay for everything currently on the merchant pad.
    • Merchants can be asked how long they will stick around for.
    • Merchants can be gifted items.
    • Merchant dialogue has been decl-ized, and can be reused between different merchants
  • Trade Hubs:
    • Trade hubs can be configured extensively, allowing functionality such as having specific merchants always show up, or only allowing a narrow range of merchant types to potentially show up.
    • Overmap trade hubs can be scanned to show what merchants are present there.
  • Merchant Program:
    • The merchant program can hold different kinds of currency at the same time.
    • If the software is running (open or in the background), and a merchant arrives at, or departs from, a trade hub within range, a message is displayed for anyone near the console, along with an audio cue.
  • New Merchants (inside Standard Merchants modpack):
    • Smuggler merchants, who require a bribe to be interactable. They come in three variants; the Gunrunner, who buys weapons, the Hacker, who buys scary law boards, and Malpractice, who buys drugs. They will quickly leave after the first transaction occurs, so they can make a clean getaway. Characters with a shady background have a chance to have the bribe requirement be waived.
    • Damaged Ship merchant, who buys stuff that is useful after having an incident, such as construction supplies or medication.
    • Fishmonger merchant, who buys dead fish (sea or spaceborne), and sells fishing gear and some aquatic goodies such as clams. Requires the Fishing modpack to be enabled.
  • Existing Merchants (inside Standard Merchants modpack):
    • Xeno shop merchants only accept living specimens.
    • Pizzaria can sell soda as well as pizza.
    • Mining merchant can demand ores correctly.
    • Medical merchant can demand alcoholic reagents.
    • The 'severance' merchant can demand specific species to eat.
    • Some existing merchants were tweaked slightly to improve their characterization. For example, most of the "retail" themed merchants no longer consider players' skill levels or disposition for pricing, and will refuse to haggle. Another example are AI-themed merchants who have infinite patience and don't mind if the silly organics try to haggle with them down to the last credit.
    • General quality pass for each of the merchants.
      • Merchants should no longer offer to sell things like quantum mechanic clothing pieces.

Why and what will this PR improve

This will continue Neb's goal of modpacking features and becoming more modular, and the rewritten system is intended to be highly customizable. It also removes some really awful code (/datum/trader/proc/get_possible_item() comes to mind).

Authorship

Neerti

Changelog

🆑
refactor: Merchant system has been completely rewritten.
add: Merchants can be haggled with. Bad offers might offend the merchants, so beware.
add: Merchants can be asked more questions, such as how long they will stay for, or how much they would buy things for.
add: Merchant program can alert people near the console that a merchant has arrived at, or left from, a trade hub that it has access to.
add: New Smuggler merchant, who generally requires a bribe to be interactable. They seek to buy illicit goods.
add: New Damaged Ship merchant, who wants to buy construction supplies and medication, to recover from an incident.
add: New Fishmonger merchant, who buys dead fish, and sells fishing gear and some aquatic goods.
/:cl:

@Neerti
Neerti marked this pull request as draft September 17, 2026 05:24
@Neerti
Neerti force-pushed the nebula_merchant_refactor branch 5 times, most recently from 0c3c171 to 41b3a68 Compare September 17, 2026 11:09
@Neerti
Neerti marked this pull request as ready for review September 17, 2026 11:16
@MistakeNot4892 MistakeNot4892 added the ready for review This PR is ready for review and merge. label Sep 19, 2026
Comment thread mods/content/standard_merchants/merchants/dogan.dm Outdated
Comment thread mods/content/standard_merchants/merchants/transient/rare/rock.dm
@Neerti
Neerti force-pushed the nebula_merchant_refactor branch from 44d4f91 to f5bfc5d Compare September 21, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review This PR is ready for review and merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants