[Rseding91] Inactive entities from 0.18 can't be made active in 1.1

This subforum contains all the issues which we already resolved.
Post Reply
Pi-C
Smart Inserter
Smart Inserter
Posts: 1644
Joined: Sun Oct 14, 2018 8:13 am
Contact:

[Rseding91] Inactive entities from 0.18 can't be made active in 1.1

Post by Pi-C »

TLDR: It seems that entities which have not been active when a game was saved in 0.18 can't be set to active once the game has been loaded into Factorio 1.1.x.

I've struggled with some strange behavior while trying to upgrade one of my mods for Factorio 1.1. The mod allows to "lock" an entity by setting the properties active, minable, and operable to false. I've tried to load an old save from 0.18 where two entities were locked and on was unlocked.

To change the lock status, I use this code:

Code: Select all

    local v_data = v_id and global.GCKI_vehicles[v_id]
    local v = v_data and v_data.entity

    if v and v.valid then
      -- Unlock vehicle on account of locker
      if v_data.locker and v_data.locker == player then
log("Unlocking")
        v.active = true
        v.operable = true
        -- If setting from Unminable Vehicles is enabled, no vehicle may be mined
        v.minable = true

        remove_vehicle_locker(v_id, player)
      -- Don't unlock a vehicle that has been locked by somebody else!
      elseif v_data.locker and v_data.locker ~= player then

      -- Lock vehicle on account of player
      else
log("Locking")
        v.active = false
        v.operable = false
        v.minable = false
        add_vehicle_locker(v_id, player)
      end
After importing the save, when I try to unlock one of the locked vehicles, "Unlocking" is logged, and v.minable and v.operable are set to true, but v.active remains at false. When I try to lock the unlocked vehicle, all properties (including active) are set to false, and when I then unlock that vehicle, all values are set to true again. The screenshots show the results for unlocking/locking the originally locked car:
The car already was locked in 0.18. "locker" is set, so all properties should be "false".
The car already was locked in 0.18. "locker" is set, so all properties should be "false".
locked.png (3.23 MiB) Viewed 1958 times
After unlocking the car in 1.1, "locker" isn't set, so all properties should be "true". However, "active" still is "false".
After unlocking the car in 1.1, "locker" isn't set, so all properties should be "true". However, "active" still is "false".
unlocked.png (3.08 MiB) Viewed 1958 times
I've suspected that perhaps something would be wrong with the saved game, so I started a new game in 0.18 where I reproduced the issue. The attachment contains the WIP version of my mod and the saved game from 0.18. (If Alt-mode is on, locked vehicles will be marked with an icon and can't be entered. Use the keys from the quickbar with the tank to unlock it. You now will be able to open its inventory and enter it, but you can't drive. Enter "/gvv" on the chat console if you want to get the GUI of "Global variable viewer".)
Attachments
save+mod.zip
(1.45 MiB) Downloaded 94 times
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Rseding91
Factorio Staff
Factorio Staff
Posts: 13198
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Inactive entities from 0.18 can't be made active in 1.1

Post by Rseding91 »

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

Pi-C
Smart Inserter
Smart Inserter
Posts: 1644
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [Rseding91] Inactive entities from 0.18 can't be made active in 1.1

Post by Pi-C »

Great -- thanks for the quick fix! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Resolved Problems and Bugs”