|
|
@@ -9,6 +9,7 @@ using RobocraftX.Blocks.Scaling; |
|
|
|
using RobocraftX.Character; |
|
|
|
using RobocraftX.Common; |
|
|
|
using RobocraftX.CR.MachineEditing; |
|
|
|
using RobocraftX.Rendering; |
|
|
|
using Svelto.ECS; |
|
|
|
using Svelto.ECS.EntityStructs; |
|
|
|
using Unity.Mathematics; |
|
|
@@ -55,12 +56,23 @@ namespace TechbloxModdingAPI.Blocks |
|
|
|
DBEntityStruct dbEntity = new DBEntityStruct {DBID = block}; |
|
|
|
|
|
|
|
EntityInitializer structInitializer = _blockEntityFactory.Build(CommonExclusiveGroups.nextBlockEntityID, block); //The ghost block index is only used for triggers |
|
|
|
uint prefabId = PrefabsID.GetOrCreatePrefabID(block, (byte) BlockMaterial.SteelBodywork, 0, false); |
|
|
|
uint prefabAssetID = structInitializer.Has<PrefabAssetIDComponent>() |
|
|
|
? structInitializer.Get<PrefabAssetIDComponent>().prefabAssetID |
|
|
|
: throw new BlockException("Prefab asset ID not found!"); //Set by the game |
|
|
|
uint prefabId = PrefabsID.GetOrCreatePrefabID((ushort) prefabAssetID, (byte) BlockMaterial.SteelBodywork, 1, false); |
|
|
|
structInitializer.Init(new GFXPrefabEntityStructGPUI(prefabId)); |
|
|
|
structInitializer.Init(new PhysicsPrefabEntityStruct(prefabId)); |
|
|
|
structInitializer.Init(dbEntity); |
|
|
|
structInitializer.Init(new PositionEntityStruct {position = position}); |
|
|
|
structInitializer.Init(new BlockPlacementInfoStruct() |
|
|
|
structInitializer.Init(new RotationEntityStruct {rotation = quaternion.identity}); |
|
|
|
structInitializer.Init(new ScalingEntityStruct {scale = new float3(1, 1, 1)}); |
|
|
|
structInitializer.Init(new GridRotationStruct |
|
|
|
{ |
|
|
|
position = position, |
|
|
|
rotation = quaternion.identity |
|
|
|
}); |
|
|
|
structInitializer.Init(new UniformBlockScaleEntityStruct {scaleFactor = 1}); |
|
|
|
structInitializer.Get<CubeMaterialStruct>().materialId = (byte) BlockMaterial.SteelBodywork; |
|
|
|
structInitializer.Init(new BlockPlacementInfoStruct() //TODO: Grid scale |
|
|
|
{ |
|
|
|
loadedFromDisk = false, |
|
|
|
placedBy = playerId, |
|
|
|