Allow water to destroy blocks with no hardness
This commit is contained in:
parent
e9b133a7f8
commit
d8c2d4c4ce
@ -16,6 +16,7 @@ namespace TrueCraft.API.Logic
|
||||
string DisplayName { get; }
|
||||
BoundingBox? BoundingBox { get; } // NOTE: Will this eventually need to be metadata-aware?
|
||||
Tuple<int, int> GetTextureMap(byte metadata);
|
||||
void GenerateDropEntity(BlockDescriptor descriptor, IWorld world, IMultiplayerServer server);
|
||||
bool BlockRightClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user);
|
||||
void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user);
|
||||
void BlockMined(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user);
|
||||
|
@ -30,7 +30,7 @@ namespace TrueCraft.Core.Logic
|
||||
world.SetBlockID(descriptor.Coordinates, 0);
|
||||
}
|
||||
|
||||
protected void GenerateDropEntity(BlockDescriptor descriptor, IWorld world, IMultiplayerServer server)
|
||||
public void GenerateDropEntity(BlockDescriptor descriptor, IWorld world, IMultiplayerServer server)
|
||||
{
|
||||
var entityManager = server.GetEntityManagerForWorld(world);
|
||||
var items = GetDrop(descriptor);
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using TrueCraft.API;
|
||||
using TrueCraft.API.Logic;
|
||||
|
||||
namespace TrueCraft.Core.Logic.Blocks
|
||||
{
|
||||
@ -22,5 +24,10 @@ namespace TrueCraft.Core.Logic.Blocks
|
||||
{
|
||||
return new Tuple<int, int>(0, 0);
|
||||
}
|
||||
|
||||
protected override ItemStack[] GetDrop(BlockDescriptor descriptor)
|
||||
{
|
||||
return new ItemStack[0];
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using TrueCraft.API.Logic;
|
||||
using TrueCraft.API;
|
||||
|
||||
namespace TrueCraft.Core.Logic.Blocks
|
||||
{
|
||||
@ -23,5 +24,10 @@ namespace TrueCraft.Core.Logic.Blocks
|
||||
{
|
||||
return new Tuple<int, int>(1, 3);
|
||||
}
|
||||
|
||||
protected override ItemStack[] GetDrop(BlockDescriptor descriptor)
|
||||
{
|
||||
return new ItemStack[0];
|
||||
}
|
||||
}
|
||||
}
|
@ -193,8 +193,8 @@ namespace TrueCraft.Core.Logic.Blocks
|
||||
if (Math.Abs(z) + Math.Abs(x) > maxDistance)
|
||||
continue;
|
||||
var check = new Coordinates3D(x, -1, z);
|
||||
var c = world.GetBlockID(check + coords);
|
||||
if (c == 0 || c == WaterBlock.BlockID || c == StationaryWaterBlock.BlockID)
|
||||
var c = world.BlockRepository.GetBlockProvider(world.GetBlockID(check + coords));
|
||||
if (!c.Opaque)
|
||||
{
|
||||
if (!LineOfSight(world, check + coords, coords))
|
||||
continue;
|
||||
@ -220,18 +220,26 @@ namespace TrueCraft.Core.Logic.Blocks
|
||||
{
|
||||
var location = extraLocations[i];
|
||||
location.Clamp(1);
|
||||
var xPotential = world.GetBlockID(new Coordinates3D(location.X, 0, 0) + coords);
|
||||
if (xPotential == 0)
|
||||
var xPotential = world.BlockRepository.GetBlockProvider(world.GetBlockID(new Coordinates3D(location.X, 0, 0) + coords));
|
||||
if (xPotential.Hardness == 0 && xPotential.ID != WaterBlock.BlockID && xPotential.ID != StationaryWaterBlock.BlockID)
|
||||
{
|
||||
if (PlaceWater(server, new Coordinates3D(location.X, 0, 0) + coords, world, (byte)(meta + 1)))
|
||||
{
|
||||
spread = true;
|
||||
xPotential.GenerateDropEntity(new BlockDescriptor
|
||||
{ Coordinates = new Coordinates3D(location.X, 0, 0) + coords, ID = xPotential.ID }, world, server);
|
||||
}
|
||||
}
|
||||
|
||||
var zPotential = world.GetBlockID(new Coordinates3D(0, 0, location.Z) + coords);
|
||||
if (zPotential == 0)
|
||||
var zPotential = world.BlockRepository.GetBlockProvider(world.GetBlockID(new Coordinates3D(0, 0, location.Z) + coords));
|
||||
if (zPotential.Hardness == 0 && zPotential.ID != WaterBlock.BlockID && zPotential.ID != StationaryWaterBlock.BlockID)
|
||||
{
|
||||
if (PlaceWater(server, new Coordinates3D(0, 0, location.Z) + coords, world, (byte)(meta + 1)))
|
||||
{
|
||||
spread = true;
|
||||
zPotential.GenerateDropEntity(new BlockDescriptor
|
||||
{ Coordinates = new Coordinates3D(0, 0, location.Z) + coords, ID = zPotential.ID }, world, server);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!spread)
|
||||
|
Loading…
x
Reference in New Issue
Block a user