Updated Iron visibility + Added Workbench recipe
This commit is contained in:
parent
ed4231d777
commit
8525ea8c69
Binary file not shown.
|
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 279 B |
Binary file not shown.
|
Before Width: | Height: | Size: 191 B After Width: | Height: | Size: 200 B |
Binary file not shown.
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 284 B |
|
|
@ -39,8 +39,8 @@ public class Breaking
|
|||
{
|
||||
var tileRegistry = ctx.TileRegistry;
|
||||
var hardness = tileRegistry.GetTile(tileId).Hardness;
|
||||
var hardnessBonus = Math.Min(1, player.GetHarvestLevel() / hardness);
|
||||
player.MiningCooldown = 50 - (player.GetMiningSpeed() * hardnessBonus);
|
||||
var hardnessBonus = Math.Min(1, player.GetHarvestLevel() / (double)hardness);
|
||||
player.MiningCooldown = (int)(50 - (player.GetMiningSpeed() * hardnessBonus));
|
||||
if(tile.Hits == 0) {
|
||||
ctx.GameState.World.Cracks.Enqueue(new CrackQueueEntry
|
||||
{
|
||||
|
|
|
|||
|
|
@ -76,8 +76,8 @@ public class PlayerEntity
|
|||
bool hasCollision;
|
||||
do
|
||||
{
|
||||
var pL = player.Position + new Vector2(0, -8);
|
||||
var pL2 = player.Position + new Vector2(0, -24);
|
||||
var pL = player.Position + new Vector2(3, -2);
|
||||
var pL2 = player.Position + new Vector2(3, -24);
|
||||
hasCollision =
|
||||
(world.HasChunkAt(pL) && world.GetChunkAt(pL).HasSolidTileAt(pL))
|
||||
|| (world.HasChunkAt(pL2) && world.GetChunkAt(pL2).HasSolidTileAt(pL2));
|
||||
|
|
@ -89,8 +89,8 @@ public class PlayerEntity
|
|||
} while (hasCollision);
|
||||
do
|
||||
{
|
||||
var pR = player.Position + new Vector2(14, -8);
|
||||
var pR2 = player.Position + new Vector2(14, -24);
|
||||
var pR = player.Position + new Vector2(12, -2);
|
||||
var pR2 = player.Position + new Vector2(12, -24);
|
||||
hasCollision =
|
||||
(world.HasChunkAt(pR) && world.GetChunkAt(pR).HasSolidTileAt(pR))
|
||||
|| (world.HasChunkAt(pR2) && world.GetChunkAt(pR2).HasSolidTileAt(pR2));
|
||||
|
|
@ -102,8 +102,8 @@ public class PlayerEntity
|
|||
} while (hasCollision);
|
||||
do
|
||||
{
|
||||
var pL = player.Position + new Vector2(0, 0);
|
||||
var pR = player.Position + new Vector2(14, 0);
|
||||
var pL = player.Position + new Vector2(3, 0);
|
||||
var pR = player.Position + new Vector2(12, 0);
|
||||
hasCollision =
|
||||
(world.HasChunkAt(pL) && world.GetChunkAt(pL).HasSolidTileAt(pL))
|
||||
|| (world.HasChunkAt(pR) && world.GetChunkAt(pR).HasSolidTileAt(pR));
|
||||
|
|
@ -115,8 +115,8 @@ public class PlayerEntity
|
|||
} while (hasCollision);
|
||||
do
|
||||
{
|
||||
var pL = player.Position + new Vector2(0, -28);
|
||||
var pR = player.Position + new Vector2(14, -28);
|
||||
var pL = player.Position + new Vector2(3, -28);
|
||||
var pR = player.Position + new Vector2(12, -28);
|
||||
hasCollision =
|
||||
(world.HasChunkAt(pL) && world.GetChunkAt(pL).HasSolidTileAt(pL))
|
||||
|| (world.HasChunkAt(pR) && world.GetChunkAt(pR).HasSolidTileAt(pR));
|
||||
|
|
@ -129,8 +129,8 @@ public class PlayerEntity
|
|||
|
||||
{
|
||||
var groundCheckPosition = player.Position - new Vector2(0, -1f);
|
||||
var pL = groundCheckPosition + new Vector2(0, 0);
|
||||
var pR = groundCheckPosition + new Vector2(14, 0);
|
||||
var pL = groundCheckPosition + new Vector2(3, 0);
|
||||
var pR = groundCheckPosition + new Vector2(12, 0);
|
||||
movement.IsGrounded = (world.HasChunkAt(pL) && world.GetChunkAt(pL).HasSolidTileAt(pL))
|
||||
|| (world.HasChunkAt(pR) && world.GetChunkAt(pR).HasSolidTileAt(pR));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,4 +36,9 @@ public class ItemStack
|
|||
{
|
||||
return Context.Get().ItemRegistry.GetItem(this.Id).GetKind();
|
||||
}
|
||||
|
||||
public ItemStack Clone()
|
||||
{
|
||||
return new ItemStack(this.Id, this.Count);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ public class ItemRegistry
|
|||
// Pickaxes
|
||||
this.Register(ItemId.PickaxeBasic, new PickaxeItem(ItemId.PickaxeBasic, "Basic Pickaxe", "items.pickaxe-basic", 15, 4));
|
||||
this.Register(ItemId.PickaxeStone, new PickaxeItem(ItemId.PickaxeStone, "Stone Pickaxe", "items.pickaxe-stone", 25, 6));
|
||||
this.Register(ItemId.PickaxeIron, new PickaxeItem(ItemId.PickaxeIron, "Iron Pickaxe", "items.pickaxe-iron", 40, 7));
|
||||
this.Register(ItemId.PickaxeGold, new PickaxeItem(ItemId.PickaxeGold, "Gold Pickaxe", "items.pickaxe-gold", 60, 8));
|
||||
this.Register(ItemId.PickaxeIron, new PickaxeItem(ItemId.PickaxeIron, "Iron Pickaxe", "items.pickaxe-iron", 30, 7));
|
||||
this.Register(ItemId.PickaxeGold, new PickaxeItem(ItemId.PickaxeGold, "Gold Pickaxe", "items.pickaxe-gold", 35, 9));
|
||||
// Materials
|
||||
this.Register(ItemId.CopperWire, new Item(ItemId.CopperWire, "Copper Wire", "items.copper-wire" ));
|
||||
this.Register(ItemId.Silicon, new Item(ItemId.Silicon, "Silicon", "items.silicon" ));
|
||||
|
|
|
|||
|
|
@ -33,17 +33,13 @@ public class TileRegistry
|
|||
public void RegisterTile()
|
||||
{
|
||||
this.Tiles.Add(1, new Tile("stone", "stone", 5, ItemId.Stone));
|
||||
this.Tiles.Add(2, new OreTile("ore1", new[] { "stone", "ore1" }, 5));
|
||||
this.Tiles.Add(3, new OreTile("ore2", new[] { "stone", "ore2" }, 7));
|
||||
this.Tiles.Add(4, new OreTile("ore3", new[] { "stone", "ore3" }, 8));
|
||||
this.Tiles.Add(5, new OreTile("ore4", new[] { "stone", "ore4" }, 10));
|
||||
this.Tiles.Add(6, new Workbench("workbench", "workbench", 10));
|
||||
this.Tiles.Add(7, new OreTile("iron-ore", new[] { "stone", "iron-ore" }, 6, ItemId.RawIron));
|
||||
this.Tiles.Add(8, new OreTile("copper-ore", new[] { "stone", "copper-ore" }, 6, ItemId.RawCopper));
|
||||
this.Tiles.Add(9, new OreTile("tin-ore", new[] { "stone", "tin-ore" }, 6, ItemId.RawTin));
|
||||
this.Tiles.Add(9, new OreTile("tin-ore", new[] { "stone", "tin-ore" }, 7, ItemId.RawTin));
|
||||
this.Tiles.Add(10, new OreTile("silver-ore", new[] { "stone", "silver-ore" }, 7, ItemId.RawSilver));
|
||||
this.Tiles.Add(11, new OreTile("gold-ore", new[] { "stone", "gold-ore" }, 8, ItemId.RawGold));
|
||||
this.Tiles.Add(12, new OreTile("lead-ore", new[] { "stone", "lead-ore" }, 9, ItemId.RawLead));
|
||||
this.Tiles.Add(12, new OreTile("lead-ore", new[] { "stone", "lead-ore" }, 8, ItemId.RawLead));
|
||||
this.Tiles.Add(11, new OreTile("gold-ore", new[] { "stone", "gold-ore" }, 9, ItemId.RawGold));
|
||||
this.Tiles.Add(13, new OreTile("platinum-ore", new[] { "stone", "platinum-ore" }, 10, ItemId.RawPlatinum));
|
||||
this.Tiles.Add(14, new OreTile("cobalt-ore", new[] { "stone", "cobalt-ore" }, 11, ItemId.RawCobalt));
|
||||
this.Tiles.Add(15, new OreTile("tungsten-ore", new[] { "stone", "tungsten-ore" }, 15, ItemId.RawTungsten));
|
||||
|
|
|
|||
|
|
@ -134,6 +134,16 @@ public class Workbench : Tile
|
|||
new ItemStack(ItemId.Fuse, 1),
|
||||
}
|
||||
});
|
||||
Recipes.Add(new Recipe
|
||||
{
|
||||
Result = new ItemStack(ItemId.Workbench, 1),
|
||||
Ingredients = new List<ItemStack>
|
||||
{
|
||||
new ItemStack(ItemId.Stone, 1),
|
||||
new ItemStack(ItemId.Fuse, 1),
|
||||
new ItemStack(ItemId.CopperWire, 3),
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override bool IsSolid()
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class ChunkGenerator
|
|||
else
|
||||
{
|
||||
fill.Id = (int)WG.GetRandomOreAt(j + (y * 32));
|
||||
if (new Random().NextInt64(0, 130) < 1)
|
||||
if (new Random().NextInt64(0, 100) < 1)
|
||||
{
|
||||
fill.Id = (int)Tiles.CoalOre;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class WorkbenchInventory : Inventory
|
|||
{
|
||||
player.Inventory.RemoveItemStack(i);
|
||||
}
|
||||
player.Inventory.PickupItemStack(r.Result);
|
||||
player.Inventory.PickupItemStack(r.Result.Clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue