GTX2GvO / wireless_charging

The 0.17 continuation of mknejp Wireless Charging mod
MIT License
2 stars 2 forks source link

Deconstruct rail #3

Closed s-lindenau closed 5 years ago

s-lindenau commented 5 years ago

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.

GTX2GvO commented 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>

GTX2GvO commented 5 years ago

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.

s-lindenau commented 5 years ago

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.

GTX2GvO commented 5 years ago

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)

s-lindenau commented 5 years ago

Fixed in 0.17.5