Upload from upload_mods.ps1
This commit is contained in:
65
Scripts/Blocks/BlockSpawnPoint.cs
Normal file
65
Scripts/Blocks/BlockSpawnPoint.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
public class BlockSpawnPoint : Block
|
||||
{
|
||||
private float TakeDelay = RebirthVariables.takeDelay;
|
||||
private int waterMax = 6;
|
||||
private bool canPickUpBlock = true;
|
||||
public ulong TickRate = 1200UL;
|
||||
|
||||
public override bool HasBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual void addTileEntity(WorldBase world, Chunk _chunk, Vector3i _blockPos, BlockValue _blockValue)
|
||||
{
|
||||
TileEntitySpawnPoint tileEntity = new TileEntitySpawnPoint(_chunk);
|
||||
tileEntity.localChunkPos = World.toBlock(_blockPos);
|
||||
_chunk.AddTileEntity(tileEntity);
|
||||
//Log.Out("BlockSpawnPoint-addTileEntity _blockPos: " + _blockPos);
|
||||
}
|
||||
|
||||
protected virtual void removeTileEntity(WorldBase world, Chunk _chunk, Vector3i _blockPos, BlockValue _blockValue)
|
||||
{
|
||||
//Log.Out("BlockSpawnPoint-removeTileEntity START");
|
||||
_chunk.RemoveTileEntityAt<TileEntitySpawnPoint>((World)world, World.toBlock(_blockPos));
|
||||
}
|
||||
|
||||
public override void OnBlockRemoved(WorldBase world, Chunk _chunk, Vector3i _blockPos, BlockValue _blockValue)
|
||||
{
|
||||
//Log.Out("BlockSpawnPoint-OnBlockRemoved START");
|
||||
base.OnBlockRemoved(world, _chunk, _blockPos, _blockValue);
|
||||
TileEntitySpawnPoint tileEntity = world.GetTileEntity(_chunk.ClrIdx, _blockPos) as TileEntitySpawnPoint;
|
||||
if (tileEntity != null)
|
||||
{
|
||||
tileEntity.OnDestroy();
|
||||
}
|
||||
this.removeTileEntity(world, _chunk, _blockPos, _blockValue);
|
||||
}
|
||||
|
||||
public override void OnBlockAdded(WorldBase _world, Chunk _chunk, Vector3i _blockPos, BlockValue _blockValue)
|
||||
{
|
||||
//Log.Out("BlockSpawnPoint-OnBlockAdded START");
|
||||
base.OnBlockAdded(_world, _chunk, _blockPos, _blockValue);
|
||||
this.addTileEntity(_world, _chunk, _blockPos, _blockValue);
|
||||
|
||||
if (!SingletonMonoBehaviour<ConnectionManager>.Instance.IsServer)
|
||||
{
|
||||
//Log.Out("BlockSpawnPoint-OnBlockAdded 1");
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameManager.Instance.IsEditMode())
|
||||
{
|
||||
//Log.Out("BlockSpawnPoint-OnBlockAdded 2");
|
||||
return;
|
||||
}
|
||||
|
||||
_blockValue.meta = 0;
|
||||
}
|
||||
|
||||
public BlockSpawnPoint()
|
||||
{
|
||||
this.HasTileEntity = true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user