Added slabs

This commit is contained in:
2022-10-12 08:24:00 +08:00
parent 5f66b792c7
commit e4fc6f4d96
6 changed files with 230 additions and 5 deletions

View File

@@ -23,7 +23,8 @@ const (
PlayerPlaceCooldown = 200 * time.Millisecond
)
var placeId = [10]int{blocks.Stone, blocks.Dirt, blocks.Grass, blocks.LogOak, blocks.PlanksOak, blocks.LeavesOak, blocks.Glass, blocks.DebugDir, blocks.Bedrock, blocks.Water}
var placeId = [10]int{blocks.Stone, blocks.Slab, blocks.Grass, blocks.LogOak, blocks.PlanksOak, blocks.LeavesOak, blocks.Glass, blocks.DebugDir, blocks.Bedrock, blocks.Water}
var placeAux = [10]int{0, blocks.PlanksOak, 0, 0, 0, 0, 0, 0, 0, 0}
var placei = 0
var logs string
@@ -297,7 +298,11 @@ func (g *Game) Update(win *glfw.Window, delta time.Duration) {
}
if canplace {
g.world.SetBlock(bc.Add(itype.DirectionVeci[dir]), placeId[placei], 0, nil)
aux := placeAux[placei]
if win.GetKey(glfw.KeyLeftShift) == glfw.Press {
aux = -aux
}
g.world.SetBlock(bc.Add(itype.DirectionVeci[dir]), placeId[placei], aux, nil)
g.player.SetDatasetI("LastPlace", int64(g.runtime))
}
}