Skip to content

Fix for missing items & water containers stacking#28

Open
nikkehsolaris wants to merge 3 commits into
AnExiledDev:masterfrom
nikkehsolaris:patch-1
Open

Fix for missing items & water containers stacking#28
nikkehsolaris wants to merge 3 commits into
AnExiledDev:masterfrom
nikkehsolaris:patch-1

Conversation

@nikkehsolaris

Copy link
Copy Markdown

StackSizeController — 4.1.4 patch

Fixes stateful items being made stackable, and items missing from the (stale) repo
vanilla-defaults.json being mis-anchored or crashing commands.

Problems

  1. Liquid containers stack and dupe/lose contents. _ignoreList only protected the
    liquid unit items (water, water.salt), not the containers that hold a variable
    amount of liquid as sub-state. Any global/category multiplier therefore resized
    waterjug, botabag, smallwaterbottle, bucket.water, and the water guns.

  2. New items have no fixed vanilla anchor. DownloadVanillaDefaults() re-downloads the
    repo vanilla-defaults.json and overwrites the local datafile on every load. The
    repo file is stale, so items added by newer Rust updates (e.g. hazmatsuit.pilot) are
    absent. For any missing item, GetVanillaStackSize() falls back to the item's live
    stackable, which on a reload is the already-modified value — so it gets multiplied
    again and compounds, and the inflated value gets persisted into
    IndividualItemStackSize in the config.

  3. Commands crash on unknown items. ItemSearchCommand and ListCategoryItemsCommand
    indexed _vanillaDefaults[shortname] directly, throwing KeyNotFoundException for any
    item not present in the defaults file.

Changes

  • Added waterjug, botabag, smallwaterbottle, bucket.water, gun.water,
    pistol.water to _ignoreList.
  • Added config option UpdateVanillaDefaultsFromRepo (default false). When false, the
    locally-maintained <plugin>_vanilla-defaults datafile is used and never overwritten by
    the repo copy. The repo is still fetched once on first install (no local file) as a
    bootstrap, or always when the option is set to true.
  • Replaced the raw _vanillaDefaults[...] indexer with GetVanillaStackSize() in both
    listing commands so missing items no longer crash them.
  • Folded in PR added null checks to fix item info commands #27 by IsaiahPetrichor: null-guard displayName/displayDescription
    in ItemSearchCommand (null on some item definitions → NullReferenceException), and
    guard the CategoryStackMultipliers lookup with ContainsKey in
    ListCategoryItemsCommand. Same 4.1.4 version bump.
  • Bumped version to 4.1.4 with an explanatory header comment.

Docs

  • Updated README.md to match 4.1.4: new "Protected Items" section; corrected the stale
    "datafiles are no longer used" note (this fork does use the local vanilla-defaults
    datafile, now authoritative); documented UpdateVanillaDefaultsFromRepo in both config
    blocks and the field list; documented the stacksizecontroller.vd command and a
    post-update regeneration workflow; expanded the AllowStackingItemsWithDurability
    guidance; added a changelog. Version bumped to 4/1/4 in the sample configs.

Server-owner steps (not code — recommended alongside this patch)

  1. Set AllowStackingItemsWithDurability to false in the config so armor/weapons/tools
    (anything with durability, i.e. attachment/condition sub-state) revert to vanilla stacks
    and stop duping.
  2. Regenerate a complete defaults file for your server: temporarily set GlobalStackMultiplier
    and every CategoryStackMultipliers entry to 1, reload, run stacksizecontroller.vd,
    then restore your multipliers. With UpdateVanillaDefaultsFromRepo false, that generated
    file is now authoritative and won't be clobbered.
  3. Check IndividualItemStackSize in the config for any newer items already sitting at an
    inflated number (e.g. hazmatsuit.pilot) and correct or delete those entries — Populate
    only adds missing keys, it never re-reads existing ones.
  4. Re-run stacksizecontroller.vd (multipliers at 1) after each wipe/game update to pick up
    newly added items.

Why? This was causing issues on my server & I had time to debug it with Claude.

Adds fixes for water containers stacking & losing water; plus a larger fix for net new items.
added in Isaiah's fix for the 2 commands as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant