Pulsar4xDevs / Pulsar4x

A Fan work recreation of Aurora4x in C#
Other
159 stars 67 forks source link

Look at a common interface for movement types. #405

Open se5a opened 2 months ago

se5a commented 2 months ago

Currently we've got a bunch of places that have to check what type of movement an enitity is using, eg: the entityExtensions GetRelativeState, Get AbsoluteState type functions. there are many other places which tend to need to do this and it's starting to grow a bit.

Need to look at whether we can do a common interface, or a parent base object to simplify the code around this.

se5a commented 3 weeks ago

This is mostly done now. MoveMath class holds a bunch of static functions to get typically move state and takes an entity. Most of the EntityExtensions functions have been moved into this class. PositionDB now stores some other movement related stuff, including a PositionDB.MoveType. usage eg: Vector3 futurePos = MoveMath.GetRelativeFuturePos(entity, atDateTime);

Still Todo: I think we can remove the tree from OrbitDB and just use the one in PositionDB still at least one function in the entityExtensions that needs shifting over to MoveMath.