|
|
@@ -45,12 +45,10 @@ namespace TechbloxModdingAPI |
|
|
|
/// <param name="position">The block's position - default block size is 0.2</param> |
|
|
|
/// <param name="autoWire">Whether the block should be auto-wired (if functional)</param> |
|
|
|
/// <param name="player">The player who placed the block</param> |
|
|
|
/// <param name="force"></param> |
|
|
|
/// <returns>The placed block or null if failed</returns> |
|
|
|
public static Block PlaceNew(BlockIDs block, float3 position, bool autoWire = false, Player player = null, |
|
|
|
bool force = false) |
|
|
|
public static Block PlaceNew(BlockIDs block, float3 position, bool autoWire = false, Player player = null) |
|
|
|
{ |
|
|
|
if (PlacementEngine.IsInGame && (GameState.IsBuildMode() || force)) |
|
|
|
if (PlacementEngine.IsInGame && GameState.IsBuildMode()) |
|
|
|
{ |
|
|
|
var initializer = PlacementEngine.PlaceBlock(block, position, player, autoWire); |
|
|
|
var egid = initializer.EGID; |
|
|
@@ -162,11 +160,10 @@ namespace TechbloxModdingAPI |
|
|
|
/// <param name="position">The block's position (a block is 0.2 wide in terms of position)</param> |
|
|
|
/// <param name="autoWire">Whether the block should be auto-wired (if functional)</param> |
|
|
|
/// <param name="player">The player who placed the block</param> |
|
|
|
/// <param name="force">Place even if not in build mode</param> |
|
|
|
public Block(BlockIDs type, float3 position, bool autoWire = false, Player player = null, bool force = false) |
|
|
|
public Block(BlockIDs type, float3 position, bool autoWire = false, Player player = null) |
|
|
|
: base(block => |
|
|
|
{ |
|
|
|
if (!PlacementEngine.IsInGame || !GameState.IsBuildMode() && !force) |
|
|
|
if (!PlacementEngine.IsInGame || !GameState.IsBuildMode()) |
|
|
|
throw new BlockException("Blocks can only be placed in build mode."); |
|
|
|
var initializer = PlacementEngine.PlaceBlock(type, position, player, autoWire); |
|
|
|
block.InitData = initializer; |
|
|
|