fix: shopkeepers properly generate shopkeeper_item_group
if different from carry_override
, generic arsonist NPCs no longer overloaded with loot
#4637
+80
−23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose of change
A while back I noticed that NPC arsonists spawned with an absolute fuckload of stuff, because I'd been adamant about letting the arsonist NPC class be usable by both the unique refugee center shopkeep and random NPCs.
What was going to be a nice simple lil JSON fix turned into a giant pain in the dick as I found I needed to change some codeto actually fix NPC shopkeepers being able to have different itemgroups in
shopkeeper_item_group
andcarry_override
.This should as a side effect fix cases like the chemist NPC where the NPC class has only
shopkeeper_item_group
defined potentially failing to generate starting inventory too.Describe the solution
C++ changes:
npc::load_npc_template
so that any NPC set to count as a shopkeeper checks fort he presence ofshopkeeper_item_group
and, if found, clears out their starting items and properly fills it with the full contents of that group. Currently doesn't respect faction value stuff and other behaviors innpc::shop_restock
but I kinda really would like to fuck with that in a follow up PR and fix any potential jank in it.npc_trading::trade
so thatshop_restock
is only called by NPCs set to count as shopkeepers, preventing any potential case of a non-shopkeeper NPC whose class hasshopkeeper_item_group
defined from magically devouring every item in their inventory and regenerating fresh ones from thin air.JSON changes:
NC_ARSONIST_STOCK
, with most of the stuff broken up into specific distributions to roll for. Less huge stacks of stuff overall but now can be a good source of components to make their explosives, various scrap metals, and a slightly wider range of books. Lot less molotovs and pipe bombs but more of the components to make your own, and more salvage.NC_ARSONIST_carry_misc
. It's basicallyNC_ARSONIST_STOCK
but minus the Merch and with much lower amounts of stuff, since carried by plain NPCs without magical shopkeeper powers.carry_override
, separate fromshopkeeper_item_group
. Idea is that generic arsonists that spawn in the wild will make use of the previously de-facto obsoleteNC_ARSONIST_misc
while Makayla sells more stuff overall.NC_ARSONIST_misc
to have a different range of weights, removed excess clothing and an obsoleted weapon from it, added calls toNC_ARSONIST_STOCK_crafting_supplies
andNC_ARSONIST_STOCK_scrap
.Describe alternatives you've considered
Testing
Generic arsonist:
Refugee center arsonist:
Sometimes she doesn't spawn with their grenades stacked properly and I dunno why the game does that.
Additional context
Checklist