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.

39 lines
1.0KB

  1. using Svelto.ECS;
  2. using Techblox.FlyCam;
  3. using TechbloxModdingAPI.Engines;
  4. using TechbloxModdingAPI.Utility;
  5. namespace TechbloxModdingAPI.Players
  6. {
  7. public class FlyCamEngine : IApiEngine
  8. {
  9. public void Ready()
  10. {
  11. }
  12. public EntitiesDB entitiesDB { get; set; }
  13. public void Dispose()
  14. {
  15. }
  16. public string Name => "TechbloxModdingAPIFlyCamEngine";
  17. public bool isRemovable => false;
  18. public ref T GetComponent<T>(FlyCam cam) where T : unmanaged, IEntityComponent
  19. {
  20. return ref entitiesDB.QueryEntityOrDefault<T>(cam);
  21. }
  22. public ushort GetSelectedBlock(FlyCam cam)
  23. {
  24. var oc = entitiesDB.QueryEntityOptional<EquippedPartStruct>(cam);
  25. return oc ? (ushort) oc.Get().SelectedDBPartID : ushort.MaxValue;
  26. }
  27. public byte GetSelectedColor(FlyCam cam)
  28. {
  29. var oc = entitiesDB.QueryEntityOptional<EquippedColourStruct>(cam);
  30. return oc ? oc.Get().indexInPalette : (byte) 255;
  31. }
  32. }
  33. }