Implement walking sounds

These sounds change depending on what kind of block you're walking in.

Still to come: sound effects for mining and placing blocks
This commit is contained in:
Drew DeVault 2015-10-05 22:06:59 -04:00
parent 8f6e577550
commit a361703746
104 changed files with 628 additions and 35 deletions

View File

@ -17,6 +17,7 @@ namespace TrueCraft.API.Logic
byte LightOpacity { get; } byte LightOpacity { get; }
bool DiffuseSkyLight { get; } bool DiffuseSkyLight { get; }
bool Flammable { get; } bool Flammable { get; }
SoundEffectClass SoundEffect { get; }
ToolMaterial EffectiveToolMaterials { get; } ToolMaterial EffectiveToolMaterials { get; }
ToolType EffectiveTools { get; } ToolType EffectiveTools { get; }
string DisplayName { get; } string DisplayName { get; }

View File

@ -0,0 +1,17 @@
using System;
namespace TrueCraft.API.Logic
{
public enum SoundEffectClass
{
None,
Cloth,
Grass,
Gravel,
Sand,
Snow,
Stone,
Wood,
Glass
}
}

View File

@ -40,7 +40,7 @@
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="YamlDotNet"> <Reference Include="YamlDotNet">
<HintPath>..\packages\YamlDotNet.3.6.1\lib\net35\YamlDotNet.dll</HintPath> <HintPath>..\packages\YamlDotNet.3.7.0\lib\net35\YamlDotNet.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -122,6 +122,7 @@
<Compile Include="Physics\IPhysicsEngine.cs" /> <Compile Include="Physics\IPhysicsEngine.cs" />
<Compile Include="Physics\IPhysicsEntity.cs" /> <Compile Include="Physics\IPhysicsEntity.cs" />
<Compile Include="Physics\IAABBEntity.cs" /> <Compile Include="Physics\IAABBEntity.cs" />
<Compile Include="Logic\SoundEffectClass.cs" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup /> <ItemGroup />
@ -131,11 +132,11 @@
<Name>fNbt</Name> <Name>fNbt</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="AI\" /> <Folder Include="AI\" />
<Folder Include="Physics\" /> <Folder Include="Physics\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="YamlDotNet" version="3.6.1" targetFramework="net45" /> <package id="YamlDotNet" version="3.7.0" targetFramework="net45" />
</packages> </packages>

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using TrueCraft.Core; using TrueCraft.Core;
using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Content;
using NVorbis;
namespace TrueCraft.Client namespace TrueCraft.Client
{ {
@ -25,21 +26,47 @@ namespace TrueCraft.Client
{ {
string[][] packs = new[] string[][] packs = new[]
{ {
// TODO: step sound effects for cloth, sand, gravel, snow, wood
new[] new[]
{ {
"grass", "footstep.cloth",
"footstep_dirt_0.wav", "default_sand_footstep.1.ogg", "default_sand_footstep.2.ogg" // TODO: Cloth sound effects
"footstep_dirt_1.wav",
"footstep_dirt_2.wav",
}, },
new[] new[]
{ {
"stone", "footstep.grass",
"footstep_stone_0.wav", "default_grass_footstep.1.ogg", "default_grass_footstep.2.ogg", "default_grass_footstep.3.ogg"
"footstep_stone_1.wav",
"footstep_stone_2.wav",
}, },
new[]
{
"footstep.gravel",
"default_gravel_footstep.1.ogg", "default_gravel_footstep.2.ogg", "default_gravel_footstep.3.ogg",
"default_gravel_footstep.4.ogg"
},
new[]
{
"footstep.sand",
"default_sand_footstep.1.ogg", "default_sand_footstep.2.ogg"
},
new[]
{
"footstep.snow",
"default_snow_footstep.1.ogg", "default_snow_footstep.2.ogg", "default_snow_footstep.3.ogg"
},
new[]
{
"footstep.stone",
"default_hard_footstep.1.ogg", "default_hard_footstep.2.ogg", "default_hard_footstep.3.ogg"
},
new[]
{
"footstep.wood",
"default_wood_footstep.1.ogg", "default_wood_footstep.2.ogg"
},
new[]
{
"footstep.glass",
"default_glass_footstep.ogg"
}
}; };
foreach (var pack in packs) foreach (var pack in packs)
{ {
@ -48,22 +75,46 @@ namespace TrueCraft.Client
} }
} }
private SoundEffect LoadOgg(Stream stream)
{
using (var reader = new VorbisReader(stream, false))
{
float[] _buffer = new float[reader.TotalSamples];
byte[] buffer = new byte[reader.TotalSamples * 2];
reader.ReadSamples(_buffer, 0, _buffer.Length);
for (int i = 0; i < _buffer.Length; i++)
{
short val = (short)Math.Max(Math.Min(short.MaxValue * _buffer[i], short.MaxValue), short.MinValue);
var decoded = BitConverter.GetBytes(val);
buffer[i * 2] = decoded[0];
buffer[i * 2 + 1] = decoded[1];
}
return new SoundEffect(buffer, reader.SampleRate, reader.Channels == 1 ? AudioChannels.Mono : AudioChannels.Stereo);
}
}
public void LoadAudioPack(string pack, string[] filenames) public void LoadAudioPack(string pack, string[] filenames)
{ {
var effects = new SoundEffect[filenames.Length]; var effects = new SoundEffect[filenames.Length];
for (int i = 0; i < filenames.Length; i++) for (int i = 0; i < filenames.Length; i++)
{ {
using (var f = File.OpenRead(Path.Combine("Content", "Audio", filenames[i]))) using (var f = File.OpenRead(Path.Combine("Content", "Audio", filenames[i])))
effects[i] = SoundEffect.FromStream(f); {
if (filenames[i].EndsWith(".wav"))
effects[i] = SoundEffect.FromStream(f);
else if (filenames[i].EndsWith(".ogg"))
effects[i] = LoadOgg(f);
}
} }
AudioPacks[pack] = effects; AudioPacks[pack] = effects;
} }
public void PlayPack(string pack) public void PlayPack(string pack, float volume = 1.0f)
{ {
var i = MathHelper.Random.Next(0, AudioPacks[pack].Length); var i = MathHelper.Random.Next(0, AudioPacks[pack].Length);
i = 0; var instance = AudioPacks[pack][i].CreateInstance();
AudioPacks[pack][i].Play(); instance.Volume = volume * EffectVolume;
instance.Play();
} }
} }
} }

View File

@ -1,4 +1 @@
Dirt and Stone footsteps CC-BY-SA from http://www.littlerobotsoundfactory.com/ The footstep and mining/placement sound effects were sourced from Minetest under CC-BY-SA: https://github.com/minetest/minetest_game
Snow footsteps CC-BY-SA & public domain from http://freesound.org/people/iujhu/
Wood footsteps CC-BY-SA from http://www.ronaldvanwonderen.com/ and http://freesound.org/people/wildweasel/
Cloth footsteps CC-0/public domain from http://freesound.org/people/Yuval/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -8,6 +8,8 @@ using XVector3 = Microsoft.Xna.Framework.Vector3;
using TrueCraft.API; using TrueCraft.API;
using TrueCraft.Core.Logic; using TrueCraft.Core.Logic;
using TrueCraft.Core.Networking.Packets; using TrueCraft.Core.Networking.Packets;
using TrueCraft.Core.Logic.Blocks;
using TrueCraft.API.Logic;
namespace TrueCraft.Client.Modules namespace TrueCraft.Client.Modules
{ {
@ -266,6 +268,19 @@ namespace TrueCraft.Client.Modules
return false; return false;
} }
private void PlayFootstep()
{
var coords = (Coordinates3D)Game.Client.BoundingBox.Min.Floor();
var target = Game.Client.World.GetBlockID(coords);
if (target == AirBlock.BlockID)
target = Game.Client.World.GetBlockID(coords + Coordinates3D.Down);
var provider = Game.BlockRepository.GetBlockProvider(target);
if (provider.SoundEffect == SoundEffectClass.None)
return;
var effect = string.Format("footstep.{0}", Enum.GetName(typeof(SoundEffectClass), provider.SoundEffect).ToLower());
Game.Audio.PlayPack(effect, 0.1f);
}
public override void Update(GameTime gameTime) public override void Update(GameTime gameTime)
{ {
var delta = Delta; var delta = Delta;
@ -331,12 +346,13 @@ namespace TrueCraft.Client.Modules
lookAt.X *= (float)(gameTime.ElapsedGameTime.TotalSeconds * 4.3717); lookAt.X *= (float)(gameTime.ElapsedGameTime.TotalSeconds * 4.3717);
lookAt.Z *= (float)(gameTime.ElapsedGameTime.TotalSeconds * 4.3717); lookAt.Z *= (float)(gameTime.ElapsedGameTime.TotalSeconds * 4.3717);
var bobbing = Game.Bobbing;
Game.Bobbing += Math.Max(Math.Abs(lookAt.X), Math.Abs(lookAt.Z)); Game.Bobbing += Math.Max(Math.Abs(lookAt.X), Math.Abs(lookAt.Z));
Game.Client.Velocity = new TVector3(lookAt.X, Game.Client.Velocity.Y, lookAt.Z); Game.Client.Velocity = new TVector3(lookAt.X, Game.Client.Velocity.Y, lookAt.Z);
if ((int)Game.Bobbing % 2 == 0) if ((int)bobbing % 2 == 0 && (int)Game.Bobbing % 2 != 0)
Game.Audio.PlayPack("grass"); PlayFootstep();
} }
else else
Game.Client.Velocity *= new TVector3(0, 1, 0); Game.Client.Velocity *= new TVector3(0, 1, 0);

View File

@ -76,6 +76,9 @@
<Reference Include="MonoGame.Framework"> <Reference Include="MonoGame.Framework">
<HintPath>..\packages\MonoGame.Framework.Linux.3.4.0.459\lib\net40\MonoGame.Framework.dll</HintPath> <HintPath>..\packages\MonoGame.Framework.Linux.3.4.0.459\lib\net40\MonoGame.Framework.dll</HintPath>
</Reference> </Reference>
<Reference Include="NVorbis">
<HintPath>..\packages\NVorbis.0.8.4.0\lib\NVorbis.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Input\KeyboardEventArgs.cs" /> <Compile Include="Input\KeyboardEventArgs.cs" />
@ -246,22 +249,118 @@
<Content Include="Content\Audio\credits.txt"> <Content Include="Content\Audio\credits.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Audio\footstep_dirt_0.wav"> <Content Include="Content\Audio\default_break_glass.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Audio\footstep_dirt_1.wav"> <Content Include="Content\Audio\default_break_glass.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Audio\footstep_dirt_2.wav"> <Content Include="Content\Audio\default_break_glass.3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Audio\footstep_stone_0.wav"> <Content Include="Content\Audio\default_cool_lava.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Audio\footstep_stone_1.wav"> <Content Include="Content\Audio\default_cool_lava.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Audio\footstep_stone_2.wav"> <Content Include="Content\Audio\default_cool_lava.3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dig_choppy.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dig_cracky.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dig_crumbly.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dig_dig_immediate.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dig_oddly_breakable_by_hand.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dirt_footstep.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dirt_footstep.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dug_node.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_dug_node.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_glass_footstep.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_grass_footstep.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_grass_footstep.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_grass_footstep.3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_gravel_footstep.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_gravel_footstep.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_gravel_footstep.3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_gravel_footstep.4.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_hard_footstep.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_hard_footstep.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_hard_footstep.3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_place_node.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_place_node.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_place_node.3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_place_node_hard.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_place_node_hard.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_sand_footstep.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_sand_footstep.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_snow_footstep.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_snow_footstep.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_snow_footstep.3.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_wood_footstep.1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Audio\default_wood_footstep.2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>

View File

@ -358,7 +358,7 @@ namespace TrueCraft.Client
private void UpdateCamera() private void UpdateCamera()
{ {
const double bobbingMultiplier = 0.015; const double bobbingMultiplier = 0.05;
var bobbing = Bobbing * 1.5; var bobbing = Bobbing * 1.5;
var xbob = Math.Cos(bobbing + Math.PI / 2) * bobbingMultiplier; var xbob = Math.Cos(bobbing + Math.PI / 2) * bobbingMultiplier;

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="MonoGame.Framework.Linux" version="3.4.0.459" targetFramework="net45" userInstalled="true" /> <package id="MonoGame.Framework.Linux" version="3.4.0.459" targetFramework="net45" userInstalled="true" />
<package id="MonoGame.Framework.WindowsGL" version="3.4.0.459" targetFramework="net45" userInstalled="true" />
<package id="MonoGame.Framework.MacOS" version="3.4.0.459" targetFramework="net45" userInstalled="true" /> <package id="MonoGame.Framework.MacOS" version="3.4.0.459" targetFramework="net45" userInstalled="true" />
</packages> <package id="MonoGame.Framework.WindowsGL" version="3.4.0.459" targetFramework="net45" userInstalled="true" />
<package id="NVorbis" version="0.8.4.0" targetFramework="net45" />
</packages>

View File

@ -204,6 +204,8 @@ namespace TrueCraft.Core.Logic
return Coordinates3D.Zero; return Coordinates3D.Zero;
} }
public virtual SoundEffectClass SoundEffect { get { return SoundEffectClass.Stone; } }
/// <summary> /// <summary>
/// The maximum amount that can be in a single stack of this block. /// The maximum amount that can be in a single stack of this block.
/// </summary> /// </summary>

View File

@ -22,6 +22,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.None;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(0, 0); return new Tuple<int, int>(0, 0);

View File

@ -39,6 +39,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Bed"; } } public override string DisplayName { get { return "Bed"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(6, 8); return new Tuple<int, int>(6, 8);

View File

@ -19,6 +19,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Bookshelf"; } } public override string DisplayName { get { return "Bookshelf"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override bool Flammable { get { return true; } } public override bool Flammable { get { return true; } }
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)

View File

@ -30,6 +30,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Cactus"; } } public override string DisplayName { get { return "Cactus"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Cloth;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(6, 4); return new Tuple<int, int>(6, 4);

View File

@ -23,6 +23,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Cake"; } } public override string DisplayName { get { return "Cake"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Cloth;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(9, 7); return new Tuple<int, int>(9, 7);

View File

@ -27,6 +27,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Chest"; } } public override string DisplayName { get { return "Chest"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(10, 1); return new Tuple<int, int>(10, 1);

View File

@ -20,6 +20,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Clay"; } } public override string DisplayName { get { return "Clay"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Gravel;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(8, 4); return new Tuple<int, int>(8, 4);

View File

@ -21,6 +21,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Crafting Table"; } } public override string DisplayName { get { return "Crafting Table"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override bool BlockRightClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user) public override bool BlockRightClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
{ {
var window = new CraftingBenchWindow(user.Server.CraftingRepository, (InventoryWindow)user.Inventory); var window = new CraftingBenchWindow(user.Server.CraftingRepository, (InventoryWindow)user.Inventory);

View File

@ -24,6 +24,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Crops"; } } public override string DisplayName { get { return "Crops"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override BoundingBox? InteractiveBoundingBox public override BoundingBox? InteractiveBoundingBox

View File

@ -20,6 +20,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Flower"; } } public override string DisplayName { get { return "Flower"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override BoundingBox? InteractiveBoundingBox public override BoundingBox? InteractiveBoundingBox

View File

@ -20,6 +20,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Dead Bush"; } } public override string DisplayName { get { return "Dead Bush"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override BoundingBox? InteractiveBoundingBox public override BoundingBox? InteractiveBoundingBox

View File

@ -17,6 +17,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Dirt"; } } public override string DisplayName { get { return "Dirt"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Gravel;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(2, 0); return new Tuple<int, int>(2, 0);

View File

@ -44,6 +44,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Wooden Door"; } } public override string DisplayName { get { return "Wooden Door"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(1, 6); return new Tuple<int, int>(1, 6);

View File

@ -30,12 +30,20 @@ namespace TrueCraft.Core.Logic.Blocks
public override byte Luminance { get { return 0; } } public override byte Luminance { get { return 0; } }
public override bool Opaque { get { return true; } } // TODO: Distinguish between opaque and instantly destroyable public override bool Opaque { get { return true; } }
public override byte LightOpacity { get { return 255; } } public override byte LightOpacity { get { return 255; } }
public override string DisplayName { get { return "Farmland"; } } public override string DisplayName { get { return "Farmland"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Gravel;
}
}
protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item)
{ {
return new[] { new ItemStack(DirtBlock.BlockID) }; return new[] { new ItemStack(DirtBlock.BlockID) };

View File

@ -23,6 +23,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Fence"; } } public override string DisplayName { get { return "Fence"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(4, 0); return new Tuple<int, int>(4, 0);

View File

@ -26,6 +26,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Fire"; } } public override string DisplayName { get { return "Fire"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood; // Yeah, this is what Minecraft actually uses here
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(15, 1); return new Tuple<int, int>(15, 1);

View File

@ -22,6 +22,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override byte LightOpacity { get { return 0; } } public override byte LightOpacity { get { return 0; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Glass;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(1, 3); return new Tuple<int, int>(1, 3);

View File

@ -21,6 +21,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Glowstone"; } } public override string DisplayName { get { return "Glowstone"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Glass;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(9, 6); return new Tuple<int, int>(9, 6);

View File

@ -46,6 +46,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Grass"; } } public override string DisplayName { get { return "Grass"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(0, 0); return new Tuple<int, int>(0, 0);

View File

@ -23,6 +23,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Gravel"; } } public override string DisplayName { get { return "Gravel"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Gravel;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(3, 1); return new Tuple<int, int>(3, 1);

View File

@ -24,6 +24,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Ice"; } } public override string DisplayName { get { return "Ice"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Glass;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(3, 4); return new Tuple<int, int>(3, 4);

View File

@ -24,6 +24,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Jack 'o' Lantern"; } } public override string DisplayName { get { return "Jack 'o' Lantern"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(6, 6); return new Tuple<int, int>(6, 6);

View File

@ -34,6 +34,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Ladder"; } } public override string DisplayName { get { return "Ladder"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override BoundingBox? InteractiveBoundingBox public override BoundingBox? InteractiveBoundingBox

View File

@ -28,6 +28,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override bool Flammable { get { return true; } } public override bool Flammable { get { return true; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(4, 3); return new Tuple<int, int>(4, 3);

View File

@ -21,6 +21,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Lever"; } } public override string DisplayName { get { return "Lever"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(0, 6); return new Tuple<int, int>(0, 6);

View File

@ -19,6 +19,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Locked Chest"; } } public override string DisplayName { get { return "Locked Chest"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(10, 1); return new Tuple<int, int>(10, 1);

View File

@ -9,6 +9,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override double BlastResistance { get { return 0; } } public override double BlastResistance { get { return 0; } }
public override double Hardness { get { return 0; } } public override double Hardness { get { return 0; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
} }
public class BrownMushroomBlock : MushroomBlock public class BrownMushroomBlock : MushroomBlock

View File

@ -19,6 +19,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Portal"; } } public override string DisplayName { get { return "Portal"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Glass;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(14, 0); return new Tuple<int, int>(14, 0);

View File

@ -23,6 +23,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Wooden Pressure Plate"; } } public override string DisplayName { get { return "Wooden Pressure Plate"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public ItemStack[,] Pattern public ItemStack[,] Pattern
{ {
get get

View File

@ -20,6 +20,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Pumpkin"; } } public override string DisplayName { get { return "Pumpkin"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(6, 6); return new Tuple<int, int>(6, 6);

View File

@ -19,6 +19,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Redstone Repeater"; } } public override string DisplayName { get { return "Redstone Repeater"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(6, 0); return new Tuple<int, int>(6, 0);

View File

@ -21,6 +21,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Redstone Torch"; } } public override string DisplayName { get { return "Redstone Torch"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(3, 6); return new Tuple<int, int>(3, 6);

View File

@ -20,6 +20,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Rose"; } } public override string DisplayName { get { return "Rose"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override BoundingBox? InteractiveBoundingBox public override BoundingBox? InteractiveBoundingBox

View File

@ -22,6 +22,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Sand"; } } public override string DisplayName { get { return "Sand"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Sand;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(2, 1); return new Tuple<int, int>(2, 1);

View File

@ -30,6 +30,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Stone Slab"; } } public override string DisplayName { get { return "Stone Slab"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood; // TODO: Deal with metadata god dammit
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(6, 0); return new Tuple<int, int>(6, 0);
@ -134,6 +142,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Double Stone Slab"; } } public override string DisplayName { get { return "Double Stone Slab"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(6, 0); return new Tuple<int, int>(6, 0);

View File

@ -19,6 +19,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Snow Block"; } } public override string DisplayName { get { return "Snow Block"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Snow;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(2, 4); return new Tuple<int, int>(2, 4);
@ -73,6 +81,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Snow;
}
}
public override BoundingBox? InteractiveBoundingBox public override BoundingBox? InteractiveBoundingBox
{ {
get get

View File

@ -17,6 +17,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Soul Sand"; } } public override string DisplayName { get { return "Soul Sand"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Sand;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(8, 6); return new Tuple<int, int>(8, 6);

View File

@ -17,6 +17,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Sponge"; } } public override string DisplayName { get { return "Sponge"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(0, 3); return new Tuple<int, int>(0, 3);

View File

@ -69,6 +69,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override bool Flammable { get { return true; } } public override bool Flammable { get { return true; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public ItemStack[,] Pattern public ItemStack[,] Pattern
{ {
get get

View File

@ -28,6 +28,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Sugar cane"; } } public override string DisplayName { get { return "Sugar cane"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override BoundingBox? BoundingBox public override BoundingBox? BoundingBox
{ {
get get

View File

@ -19,6 +19,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "TNT"; } } public override string DisplayName { get { return "TNT"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(8, 0); return new Tuple<int, int>(8, 0);

View File

@ -28,6 +28,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Tall Grass"; } } public override string DisplayName { get { return "Tall Grass"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Grass;
}
}
public override bool Flammable { get { return true; } } public override bool Flammable { get { return true; } }
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }

View File

@ -35,6 +35,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Torch"; } } public override string DisplayName { get { return "Torch"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user) public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)

View File

@ -37,6 +37,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Trapdoor"; } } public override string DisplayName { get { return "Trapdoor"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override Tuple<int, int> GetTextureMap(byte metadata) public override Tuple<int, int> GetTextureMap(byte metadata)
{ {
return new Tuple<int, int>(4, 5); return new Tuple<int, int>(4, 5);

View File

@ -25,6 +25,14 @@ namespace TrueCraft.Core.Logic.Blocks
public override string DisplayName { get { return "Sign"; } } public override string DisplayName { get { return "Sign"; } }
public override SoundEffectClass SoundEffect
{
get
{
return SoundEffectClass.Wood;
}
}
public override BoundingBox? BoundingBox { get { return null; } } public override BoundingBox? BoundingBox { get { return null; } }
public override BoundingBox? InteractiveBoundingBox public override BoundingBox? InteractiveBoundingBox

Some files were not shown because too many files have changed in this diff Show More