ClaudeMetz / FactoryPlanner

A mod for Factorio. Allows you to plan out your production in detail.
https://mods.factorio.com/mod/factoryplanner
MIT License
85 stars 43 forks source link

Crash on Ctrl+RMB on machine module #315

Open iassasin opened 1 month ago

iassasin commented 1 month ago

Problem Description

I just tried to clear modules of machine (space thermal radiator, mouse cursor on that module at screenshot) with mouse shortcut (Ctrl+RMB), but something went wrong:

Error while running event factoryplanner::on_gui_click (ID 1)
__factoryplanner__/ui/main/production_handler.lua:183: attempt to index local 'module_set' (a nil value)
stack traceback:
    __factoryplanner__/ui/main/production_handler.lua:183: in function 'handler'
    __factoryplanner__/ui/event_handler.lua:157: in function <__factoryplanner__/ui/event_handler.lua:114>

изображение

Reproduction

I can't reproduce it. My case was something like this:

  1. Change tier of radiator from 1 to 2
  2. Revert to tier 1
  3. Copy beacon from other machine in this subfactory and paste over radiator
  4. Add 2 speed modules to radiator
  5. Remove beacon from radiator by Ctrl+RMB
  6. Again paste beacon from clipboard over radiator
  7. Remove modules from radiator by Ctrl+RMB (crash here)

But when I load autosave, this scenario doesn't crash game anymore. Probably I miss some very important little step :(

iassasin commented 1 month ago

I dug up something interesting. Bugs, but not crash. But maybe related to crash somehow.

Map for tests: https://sinair.ru/f/BCxTPg (70 MB) Video of these steps: https://discord.com/channels/600791114814980141/600791114831757416/1261028290760540210

Machine with broken modules slot:

  1. Set any 2 modules in radiator
  2. Ctrl+RMB on machine to reset it
  3. Modules gone. Slot for it too.

Paste modules on machine module slot doesn't work:

  1. Copy modules to clipboard
  2. Open machine module slot gui
  3. Does NOT change anything, leave slot empty and close gui (escape)
  4. Try paste (Shift+LMB) over machine modules slot
  5. Slot stays empty
  6. Second try successfully inserting modules