A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
632B

  1. using RobocraftX.DOTS;
  2. using TechbloxModdingAPI.Utility;
  3. using Unity.Entities;
  4. using Unity.Transforms;
  5. namespace TechbloxModdingAPI.Common.Traits;
  6. public interface IHasPhysics
  7. {
  8. }
  9. public static class HasPhysicsExtensions
  10. {
  11. internal static void UpdatePhysicsUECSComponent<T, O>(this O obj, T componentData)
  12. where O : EcsObjectBase, IHasPhysics where T : struct, IComponentData
  13. {
  14. var phyStruct = obj.GetComponentOptional<DOTSPhysicsEntityStruct>();
  15. if (phyStruct) //It exists
  16. FullGameFields._physicsWorld.EntityManager.SetComponentData(phyStruct.Get().dotsEntity, componentData);
  17. }
  18. }