[2.1.9] Vehicle inventory bonus reset when teleported to another surface

Bugs which we just recently fixed in our development version and will reach you in the next release.
robot256
Smart Inserter
Smart Inserter
Posts: 1379
Joined: Sun Mar 17, 2019 1:52 am
Contact:

[2.1.9] Vehicle inventory bonus reset when teleported to another surface

Post by robot256 »

What did you do?
1. Load the attached save in stock Space Age.
2. Observe the Tank has one Toolbelt equipment installed in its equipment grid, so its inventory is 90 slots instead of the usual 80. It is filled with 900 water barrels.
3. Run the displayed Code Snippet by selecting the Tank. It will be teleported to Vulcanus, and the inventory contents before and after will be printed to the console. This is what the code snippet contains:

Code: Select all

local tank = game.get_entity_by_unit_number(15)
local trunk = tank.get_inventory(defines.inventory.car_trunk)
game.print("Tank inventory size before teleporting: "..tostring(#trunk))
game.print("Tank inventory contents before teleporting:\n"..serpent.block(trunk.get_contents()))
if tank.teleport({0,0},"vulcanus") then
    game.print("Tank was teleported to Vulcanus.")
else
    game.print("Error teleporting tank to Vulcanus.")
end
game.print("Tank inventory size after teleporting: "..tostring(#trunk))
game.print("Tank inventory contents after teleporting:\n"..serpent.block(trunk.get_contents()))
What happened?
The result of the last two commands shows that after teleporting to Vulcanus, the Tank trunk inventory only has 80 slots and 800 water barrels in it.
In this state, removing and replacing the toolbelt from the equipment grid adds 10 empty slots to the inventory.
What did you expect to happen?
I expected the toolbelt inventory bonus to remain after teleporting to Vulcanus, and for all 900 water barrels to remain in the inventory.

Note that the inventory bonus remains intact when teleporting to another position on the same surface, and when cloning the vehicle to another surface. Only teleporting to another surface resets the bonus.

This was reported to me weeks ago by a user of VehicleWagon2 because in that mod, I teleport vehicles to hidden surface while they are "on the train". When the player unloaded his tank from the train (teleporting it back to the visible surface), it had fewer items than when it was first loaded.
Attachments
spaceage_vehicle_toolbelt_bug.zip
(1.96 MiB) Downloaded 6 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 17091
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.1.9] Vehicle inventory bonus reset when teleported to another surface

Post by Rseding91 »

Thanks for the report. This is now fixed for the next release.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved for the next release”