|
|
@@ -1,4 +1,3 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
|
|
|
@@ -11,11 +10,11 @@ using RobocraftX.Physics; |
|
|
|
using RobocraftX.Rendering; |
|
|
|
using RobocraftX.Rendering.GPUI; |
|
|
|
using Svelto.ECS.EntityStructs; |
|
|
|
|
|
|
|
using Svelto.DataStructures; |
|
|
|
using Svelto.ECS; |
|
|
|
using Svelto.ECS.Hybrid; |
|
|
|
using Unity.Mathematics; |
|
|
|
|
|
|
|
using TechbloxModdingAPI.Engines; |
|
|
|
using TechbloxModdingAPI.Utility; |
|
|
|
|
|
|
@@ -99,12 +98,22 @@ namespace TechbloxModdingAPI.Blocks |
|
|
|
entitiesDB.QueryEntity<RenderingDataStruct>(id).matrix = float4x4.TRS(pos.position, rot.rotation, scale.scale); |
|
|
|
} |
|
|
|
|
|
|
|
internal void UpdatePrefab(Block block, ushort type, byte material, bool flipped) |
|
|
|
{ |
|
|
|
uint pid = PrefabsID.GetOrCreatePrefabID(type, material, 0, flipped); |
|
|
|
entitiesDB.QueryEntityOrDefault<GFXPrefabEntityStructGPUI>(block).prefabID = pid; |
|
|
|
entitiesDB.QueryEntityOrDefault<PhysicsPrefabEntityStruct>(block) = new PhysicsPrefabEntityStruct(pid); |
|
|
|
} |
|
|
|
internal void UpdatePrefab(Block block, byte material, bool flipped) |
|
|
|
{ |
|
|
|
var prefabAssetIDOpt = entitiesDB.QueryEntityOptional<PrefabAssetIDComponent>(block); |
|
|
|
uint prefabAssetID = prefabAssetIDOpt |
|
|
|
? prefabAssetIDOpt.Get().prefabAssetID |
|
|
|
: throw new BlockException("Prefab asset ID not found!"); //Set by the game |
|
|
|
uint prefabId = |
|
|
|
PrefabsID.GetOrCreatePrefabID((ushort) prefabAssetID, material, 1, flipped); |
|
|
|
entitiesDB.QueryEntityOrDefault<GFXPrefabEntityStructGPUI>(block).prefabID = prefabId; |
|
|
|
if (block.Exists) |
|
|
|
entitiesDB.PublishEntityChange<GFXPrefabEntityStructGPUI>(block.Id); |
|
|
|
//Phyiscs prefab: prefabAssetID, set on block creation from the CubeListData |
|
|
|
/*Console.WriteLine("Materials:\n" + FullGameFields._dataDb.GetValues<MaterialPropertiesData>() |
|
|
|
.Select(kv => $"{kv.Key}: {((MaterialPropertiesData) kv.Value).Name}") |
|
|
|
.Aggregate((a, b) => a + "\n" + b));*/ |
|
|
|
} |
|
|
|
|
|
|
|
public bool BlockExists(EGID blockID) |
|
|
|
{ |
|
|
|