Closed s-lindenau closed 5 years ago
In issue #2 Mentioned I fixed a on_pre_player_mined_item issue I missed before.
Broke stuff when removing a rail.
Error while running event wireless-charging_v17::on_pre_player_mined_item (ID 11) wireless-charging_v17/src/main.lua:205: attempt to index local 'rail' (a nil value) stack traceback: wireless-charging_v17/src/main.lua:205: in function 'on_accumulator_mined' wireless-charging_v17/src/main.lua:328: in function <wireless-charging_v17/src/main.lua:326>
Update. Looks like this error solely occurs with old placed rails. Newly placed rails do not have this error and appear to be fixed. (full decon of rail and items by player and bot, bugfree)
old placed rails do allow themselves to be deconstructed by bots (they target the rail according to the code), but leave the (hidden) accumulator that the player can then target. This accumulator causes the error when removed by the player.
I did not get the same error on my map with the new code, but deconstruction works very well now. I have put in a check if the rail is not nil in case people have the same issue, so it at least won't break their games.
Just tested with the set of old rails and this allows them to be mined, however it still leaves certain hidden entities and graphics behind. (Especially noticeable when hovering over the location with a soon to be placed power pole)
ANY newly placed rail and chargepad leaves nothing behind when deconstructed by either player and bot. So from a purely 0.17.5 point of view it seems to be fully fixed.
So to deal with these 0.17.4 items we either need to do a validity check on entities or leave it as it is and tell 0.17.4 upgraders to either accept this quirk or restart the map. (not exactly looking forward to that though)
Fixed in 0.17.5
When the charge rail is deconstructed by hand it leaves all the graphics and hidden items behind. Deconstructing with the deconstruction blueprint does work ok.