Skip to content
This repository has been archived by the owner on Sep 17, 2023. It is now read-only.

attempt to perform arithmetic on field 'x' #9

Closed
alexaulbach opened this issue Jul 8, 2017 · 4 comments
Closed

attempt to perform arithmetic on field 'x' #9

alexaulbach opened this issue Jul 8, 2017 · 4 comments
Labels

Comments

@alexaulbach
Copy link

I just pasted a simple pastic factory:

Error while running event cut-and-paste::on_tick (ID 0)
cut-and-paste/control.lua:202: attempt to perform arithmetic on field 'x' (a nil value)

@alexaulbach
Copy link
Author

As far as I can currently say, this happens in the tick() function: placeholders center_pos and top_pos are empty tables.
screen shot 2017-07-09 at 09 40 44
The "XXXXXX" is some debug output I made into the sub_points() method. The same with "match pos src" somwhere (before the other call)

@alexaulbach
Copy link
Author

Some more information:
This bug "fixes itself", if you copy/paste first very small parts and then bigger and bigger parts of what you want to copy.
Some missing initialization of selection?

@mickael9 mickael9 added the bug label Jul 11, 2017
@mickael9
Copy link
Owner

mickael9 commented Jul 11, 2017

I think the bug is caused because you're trying to place the selection over tile ghosts.

FYI, the placeholders are used to detect in which direction the blueprint was placed. Since the game doesn't expose that information, I had to use a hack where you're actually placing is just a set of two tiles. Their position is recorded but they're not actually built. After that, the real blueprint is placed using the detected direction and is used later to match source entities with the destination entities in order to support features such as wire reconnections and removal of colliding entities

This seems to be a bug in the game: placing a regular blueprint with tiles won't replace the "conflicting" tile ghosts (although they would be replaced if they were real tiles of the same type). I reported a bug here: https://forums.factorio.com/viewtopic.php?f=7&t=50793

If this doesn't get fixed, then I guess I'll have to find yet another hack (or just cancel the operation with an error message rather than crashing) 😞

@aulbach
Copy link

aulbach commented Jul 12, 2017

ACK for the conflicting tile-ghosts: When I now think to it I placed the BP on tiles that where concrete-ghosts. And it suddenly worked after small tests, cause my personal bots did build the remaining concrete meanwhile.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants