Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CR] Free Merchants shop inventory revamp #55488

Merged
merged 2 commits into from
Mar 16, 2022
Merged

[CR] Free Merchants shop inventory revamp #55488

merged 2 commits into from
Mar 16, 2022

Conversation

Ilysen
Copy link
Contributor

@Ilysen Ilysen commented Feb 19, 2022

Summary

Content "Reworked the goods that Smokes in the refugee center will buy and sell."

Purpose of change

#52374 took the first step of revamping the refugee center NPCs by replacing the shopkeeper with a unique character named Smokes. The PR focused almost entirely on dialogue, with things like quests and the actual shop being unchanged. This PR aims to lay further groundwork to continue what that PR started, as those other parts of the faction remain very old.

This draws from the design steps set out in #51320, but it doesn't close the issue outright, since this is just one NPC in a larger faction.

Describe the solution

I performed a full revamp of the stuff that Smokes offers, with the goal of keeping it consistent with what he tells the player and is laid out in existing issues. The shop now contains:

  • A large amount of loose Merch is guaranteed, as well as 2-3 bundles with a hundred notes each.
  • A small amount of welding gear is guaranteed, using the SUS_welding_gear item group.
  • Many spare parts, including but not limited to: solder, thread, nails, adhesives, raw materials (like wood, planks, and clay), rags, cloth sheets, tailoring fasters, and welding rods. Some of these are distributed randomly, while others are guaranteed to spawn in some quantity.
  • A modest amount of common ammo.
  • Possibly civilian-grade guns, but with a low chance, and always in very low quantities.
  • A small amount of low-grade melee weapons.
  • A unisex clothing selection.
  • Many common tools and a smaller amount of construction materials.
  • The shop does not sell food or medical supplies at all, at least right now.

The goal here is to establish the Free Merchants as a supplier for common crafting materials, since they're a hub for scavengers and trade for the materials those scavengers gather, in addition to having a surplus when they came into the center. It also gives players a genuine reason to want to visit the refugee center, as large quantities of things like welding rods can be very desirable. It also incentivizes the economy that the Free Merchants themselves are trying to cultivate: selling them food in order to get a lot of cheap goods in bulk.

I'd like to get some feedback on the inventory selection in particular, since DDA is a complicated game and it's very possible I've missed something that these guys might have (or, for that matter, things they actually shouldn't have that are currently included in the PR.)

Finally, I've created a file called FREE_MERCHANTS_INFO.md where I've written down info about their economy and things they want and don't want, to help with future work on them. I'm fine removing this, though - it stemmed from a document I made internally to track my thoughts, but I ended up making it into a file since I thought it might be helpful, too.

On the C++ side of things, I have made several changes:

  • NPC classes have a new field, sells_belongings, defaulting to true. If a class's JSON entry has this set to false, the NPC will not be willing to sell items they're wearing or wielding, meaning they won't sell their outfits. Items inside of their bags are still fair game.
  • Shopkeeper item groups can now be classed as rigid. Normally, shopkeeper groups will be processed endlessly until the NPC's inventory is full or a target value has been reached, dependent on their faction. Rigid groups will be handled much more like mapgen item placement - they'll be fully processed a single time per restock, then not run again. This allows a much finer degree of control over what items an NPC should stock in their inventory (although this is already possible by doing things like placing the stock in nearby containers via chat events instead of using the built-in restocking system.)

Describe alternatives you've considered

  • Keeping medical supplies in some form. I didn't deliberately exclude them; it just didn't occur to me. Things like antiparasitic drugs were part of the previous shopkeeper's inventory, and removing them from Smokes presents a significant dichotomy change, since players can no longer buy the drug from the Free Merchants directly.
  • Altering the stock of some of these items. This PR does offer a potent and viable alternative to scavenging or crafting desirable stuff, especially tools, and that might dramatically affect balance if rushing the refugee center is a strategy we want to specifically avoid. They stock a lot of things in abundance right now, and some values might be overtuned or undertuned.
  • Currently, any stock that Gavin can't fit into his inventory will be dropped onto the floor under him. This is also the case with the current shopkeeper. I'd like to change this by having the stock spawn in nearby containers like it does for Rubik, but I discovered that the room he's in is actually split across two overmap tiles, making nested mapgen more difficult.
  • I'd like to make it so that any food that Gavin is carrying won't be buyable or even disappears entirely, so that any food you sell him is properly assumed to be given to the shelter. I decided that this would be out-of-scope for this PR and my coding chops aren't up to snuff for it, but I'd still like to do it in a future thingy.
  • A lot of stuff that Smokes (and other NPCs, for that matter) offers hasn't been properly given a proper price, meaning it has the potential to significantly break the economy. I'm not sure of the best scope to handle this.
  • My C++ is rusty at best, and I'm no professional by any means. I'm absolutely open to handling the code changes in any other way as long as the functionality is kept.

Testing

Throughout the course of making this, I created worlds, jumped to the refugee center, and spoke to Smokes to get a sense of his inventory generation. I also tested to make sure that normal item groups spawned correctly by talking to the starting NPC, Rubik, and the intercom at Hub 01, which they seem to.

Additional context

Here's a sample inventory from Smokes, with some caveats:

  1. Some stuff naturally generates in the furniture around him, which is automatically offered in the shop inventory. It isn't part of his normal generation.
  2. The third page is just a single wheat seed, so it's not included as a screenshot.

image
cataclysm-tiles_VlHPHDdpuF

@Ilysen Ilysen requested a review from I-am-Erk as a code owner February 19, 2022 00:14
@Ilysen Ilysen marked this pull request as draft February 19, 2022 00:14
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Feb 19, 2022
@github-actions github-actions bot added the astyled astyled PR, label is assigned by github actions label Feb 19, 2022
@Maleclypse Maleclypse added the NPC / Factions NPCs, AI, Speech, Factions, Ownership label Feb 19, 2022
@bombasticSlacks
Copy link
Contributor

NPC classes have a new field, sells_belongings, defaulting to true. If a class's JSON entry has this set to false, the NPC will not be willing to sell items they're wearing or wielding, meaning they won't sell their outfits. Items inside of their bags are still fair game.

Great change

@PatrikLundell
Copy link
Contributor

I think it makes more sense to set selling of equipped items to false as the default. I believe one abuse in games is to buy the weapon and armor an NPC is wearing, and then kill them when unprotected and unarmed. Thus, the selling of these things ought to be enabled explicitly when desired.

@Ilysen
Copy link
Contributor Author

Ilysen commented Feb 19, 2022

I'm ok with that! I like to keep PRs super atomized, though, so I'd probably want to do it in a different PR if this one gets merged, just so that it can have discussion and such independently.

@Ilysen Ilysen marked this pull request as ready for review March 9, 2022 15:44
@Ilysen
Copy link
Contributor Author

Ilysen commented Mar 9, 2022

I'm not sure if I'm doing this quiiite right, but the code in here should be final. I'd still like to get input on what they're stocking in terms of sold goods, though.

Copy link
Member

@Maleclypse Maleclypse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The json looks great on this. I am not comfortable reviewing c++ so this isn't saying there's something wrong with that part.

doc/NPCs.md Outdated Show resolved Hide resolved
Co-authored-by: Anton Burmistrov <[email protected]>
@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON BasicBuildPassed This PR builds correctly, label assigned by github actions labels Mar 13, 2022
@Maleclypse
Copy link
Member

I feel like this is a pretty solid item list for the merchants to sell. It gives you the option to get some weapons especially if you need a weapon to go back into back bay but won't let you go after a bandit safehouse.

@kevingranade kevingranade merged commit e43fa47 into CleverRaven:master Mar 16, 2022
@Ilysen Ilysen deleted the smokes-inventory branch March 16, 2022 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants