Summary: If you don't check if a blueprint-book record is a preview, then you get the error "BlueprintRecord cannot be read while it is a preview." when attempting to read LuaRecord::contents to get the blueprints inside the book. HOWEVER, the game throws an error when you try to read "is_blueprint_preview" on a LuaRecord of type blueprint-book. My guess is that a simple change is needed to allow checking the preview state of blueprint-book, upgrade-planner, and deconstruction-planner LuaRecords.
What I did:
First Error:
1. Download Cargo Ships version 2.0.21 from the mod portal.
2. Start a server with Cargo Ships enabled.
3. In single player, create a blueprint book with a blueprint inside it. It can be any kind of blueprint. Place the blueprint book in your "My Blueprints" library.
4. Connect to the server. Open your blueprint library and pick up the book from My Blueprints.
5. It should immediately crash with the error "BlueprintRecord cannot be read while it is a preview."
Bug in the attempted fix:
1. Download the attached version of Cargo Ships.
2. Start a server with this version of Cargo Ships enabled.
3. Make sure the same blueprint book is in your My Blueprints library.
4. Connect to the server. Open your blueprint library and pick up the book from My Blueprints.
5. It should immediately crash with the error "Record is not a BlueprintRecord." on line __cargo-ships__/logic/pump_placement.lua:95: in function 'is_holding_pump'
[2.0.65] Cannot read "is_blueprint_preview" for blueprint books
[2.0.65] Cannot read "is_blueprint_preview" for blueprint books
- Attachments
-
- cargo-ships_1.0.23.zip
- (556.11 KiB) Downloaded 11 times
My mods: Multiple Unit Train Control, RGB Pipes, Shipping Containers, Rocket Log, Smart Artillery Wagons.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Maintainer of Auto Deconstruct, Cargo Ships, Vehicle Wagon, Honk, Shortwave.
Re: [2.0.65] Cannot read "is_blueprint_preview" for blueprint books
Given that you are trying to read a value that is documented as woking only on blueprints to check state of a book, i am classifying this as a modding interface request.
Re: [2.0.65] Cannot read "is_blueprint_preview" for blueprint books
In 2.0.66 there will be LuaRecord::is_preview that is not limited to blueprints.