|
|
@@ -32,6 +32,11 @@ namespace GamecraftModdingAPI |
|
|
|
/// Place a new block at the given position. If scaled, position means the center of the block. The default block size is 0.2 in terms of position. |
|
|
|
/// Place blocks next to each other to connect them. |
|
|
|
/// The placed block will be a complete block with a placement grid and collision which will be saved along with the game. |
|
|
|
/// <para></para> |
|
|
|
/// <para>When placing multiple blocks, do not access properties immediately after creation as this |
|
|
|
/// triggers a sync each time which can affect performance and may cause issues with the game. |
|
|
|
/// You may either use AsyncUtils.WaitForSubmission() after placing all of the blocks |
|
|
|
/// or simply access the block properties which will trigger the synchronization the first time a property is used.</para> |
|
|
|
/// </summary> |
|
|
|
/// <param name="block">The block's type</param> |
|
|
|
/// <param name="color">The block's color</param> |
|
|
@@ -60,7 +65,9 @@ namespace GamecraftModdingAPI |
|
|
|
/// Place blocks next to each other to connect them. |
|
|
|
/// The placed block will be a complete block with a placement grid and collision which will be saved along with the game. |
|
|
|
/// <para></para> |
|
|
|
/// <para>This method waits for the block to be constructed in the game.</para> |
|
|
|
/// <para>This method waits for the block to be constructed in the game which may take a significant amount of time. |
|
|
|
/// Only use this to place a single block. |
|
|
|
/// For placing multiple blocks, use PlaceNew() then AsyncUtils.WaitForSubmission() when done with placing blocks.</para> |
|
|
|
/// </summary> |
|
|
|
/// <param name="block">The block's type</param> |
|
|
|
/// <param name="color">The block's color</param> |
|
|
@@ -107,11 +114,11 @@ namespace GamecraftModdingAPI |
|
|
|
Id = id; |
|
|
|
if (!BlockEngine.BlockExists(Id)) |
|
|
|
{ |
|
|
|
Sync(); |
|
|
|
/*Sync(); |
|
|
|
if (!BlockEngine.BlockExists(Id)) |
|
|
|
{ |
|
|
|
throw new BlockDoesNotExistException($"Block {Id.entityID} must be placed using PlaceNew(...) since it does not exist yet"); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -119,17 +126,6 @@ namespace GamecraftModdingAPI |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Synchronize newly created entity components with entities DB. |
|
|
|
/// This forces a partial game tick, so it may be slow. |
|
|
|
/// This also has the potential to make Gamecraft unstable. |
|
|
|
/// Use this sparingly. |
|
|
|
/// </summary> |
|
|
|
protected static void Sync() |
|
|
|
{ |
|
|
|
DeterministicStepCompositionRootPatch.SubmitEntitiesNow(); |
|
|
|
} |
|
|
|
|
|
|
|
public EGID Id { get; protected set; } |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -159,6 +155,7 @@ namespace GamecraftModdingAPI |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// The block's non-uniform scale or zero if the block's invalid. Independent of the uniform scaling. |
|
|
|
/// The default scale of 1 means 0.2 in terms of position. |
|
|
|
/// </summary> |
|
|
|
public float3 Scale |
|
|
|
{ |
|
|
@@ -171,6 +168,7 @@ namespace GamecraftModdingAPI |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// The block's uniform scale or zero if the block's invalid. Also sets the non-uniform scale. |
|
|
|
/// The default scale of 1 means 0.2 in terms of position. |
|
|
|
/// </summary> |
|
|
|
public int UniformScale |
|
|
|
{ |
|
|
|