Open hhyyrylainen opened 3 years ago
I think that this can be solved pretty easily by calculating the cell's center of mass in that CalculateSpeed method and then using that instead of 0,0. If we want to get fancy the editor could have a center of mass property that is calculated only whenever needed (similarly to the placed visuals that skip updating for each organelle in a multi organelle edit).
There's a very closely related problem with the ATP calculation as that's also affected by the flagella position: https://github.com/Revolutionary-Games/Thrive/issues/3432
Just tested this as I'm looking into fixing https://github.com/Revolutionary-Games/Thrive/issues/3432, and it appears this part of the issue was already fixed by https://github.com/Revolutionary-Games/Thrive/pull/2754. At least, I can't reproduce this issue anymore. No matter where I build a given cell, its speed is the same.
EDIT: Unless there's a flagellum at (0, 0), explained in that other issue.
This issue might also be the root cause for: https://github.com/Revolutionary-Games/Thrive/issues/3552
When placed normally speed is correct:
When offset (which works as the hexes are repositioned when exiting the editor):
So the speed calculation algorithm needs to be updated to take offset into account. In case it turns out to be too slow now, it'll need to be moved to run in a background task.
For reference the code the editor uses to calculate the speed is here: https://github.com/Revolutionary-Games/Thrive/blob/68f6dc2ae6cb8185241ce44335b8be3b0f43d97c/src/microbe_stage/editor/MicrobeEditor.cs#L764