Ship Vendor Fix
By Vollmetal Verified
Community Rating
Simple edit to the ShipVendorScript script used by all vendors so they properly take care of ships that are removed whenever their inventories reset.
This will prevent any pointer handle leaks related to ship vendor inventory resets and probably several other bugs related to old supposedly cleaned up ships randomly reappearing on landing pads. The fix is experimental and I've done the most testing make sure it's doing things properly but testing for specific ref handle leaks is a really long and laborious process to do so your mileage may vary.
What Normally Happens With Ship Vendors:
- When you sell a ship, that ship is simply placed back into the vendor's "inventory" array to be displayed in the buy/sell screen.
- Every 7 days (week) the vendor runs the Delete() command on all ships in it's inventory then clears it's inventory array.
- New ships are spawned on the landing pad disabled and linked to the landing pad.
- Repeat
The Problem:
- When ships are supposed to be cleared, the link to the local landing pad/docking port isn't cleared, potentially keeping the ship loaded at all times or at minimum preventing it from being cleaned by the game's garbage collector.
- When ships are supposed to be cleared they are not sent anywhere. There is no holding cell they're placed in. This means that so long as the cell, usually a persistent or city cell, is loaded or not reset garbage collection either can't or rarely will clear out the disabled ships.
- Delete() is called instead of using DisableNoWait() and clearing all references and links. Delete() does nothing to ship references as they're a complex group of multiple references layered on top of each other. Instead you need to disable the ship or kill it and leave it in an unloaded cell until the game's garbage collector comes through and cleans it up, which the engine does properly so long as the ship isn't spawned in as a persistent ship.
The Solution:
This mod does a couple small things:
- It creates an empty "trash" cell to place ships to be killed or cleaned up. That way no scripts, quests, etc can scan them and the engine doesn't try to load them. The player cannot get to this cell.
- When ship vendors go through their list for cleaning it places the ship in the trash cell.
- The ship is then disabled.
- Finally to make absolutely sure the engine knows to clean it up, the ship is killed.
- After all that's done to every ship in the array, the array is forcibly cleared as it is in vanilla.
Release notes
Xbox
-
1.01== Describe this release ==
- Removed NPC edits for compatibility -
1.00== Describe this release ==
Playstation
-
1.01== Describe this release ==
- Removed NPC edits for compatibility -
1.00== Describe this release ==
PC
-
1.01== Describe this release ==
- Removed NPC edits for compatibility -
1.00== Describe this release ==
Starfield News - Are Paid Mods Worth It? Plus 6 More Stories
#Starfield Creation Kit Tutorial 11 - Create a Mod with Vendors that Sell your Custom Built Ships
Explore more Starfield creations for Ships. Browse all Ships mods →
Craftable Weightless Containers
Adds new craftable containers, that have no weight limit.
Constellation Action Figures Set
Brought to you by Chunks and Constellation! The all-new [Constellation Action Figures Set] is ready to decorate your outposts and starships!
Sensible Starting Ship
Want a better starting ship? This mod puts the ship in the bag, bruh.
DarkStar Integration - Watchtower: Orbital.Strike\\Fleet.Command
Fully integrates DarkStar and Watchtower