mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-14 22:10:29 +02:00
Fixes #14. mtseeder and mtwebmapper now have command line flags -ymin=block and -ymax=block to limit the y range of mapping. Defaults to full range.
This commit is contained in:
@ -35,16 +35,9 @@ func createTiles(
|
||||
}
|
||||
}
|
||||
|
||||
func order(a, b int) (int, int) {
|
||||
if a < b {
|
||||
return a, b
|
||||
}
|
||||
return b, a
|
||||
}
|
||||
|
||||
func createBaseLevel(
|
||||
address string,
|
||||
xMin, zMin, xMax, zMax int,
|
||||
xMin, yMin, zMin, xMax, yMax, zMax int,
|
||||
transparent bool, transparentDim float32,
|
||||
colorsFile, outDir string,
|
||||
numWorkers int) (err error) {
|
||||
@ -71,11 +64,14 @@ func createBaseLevel(
|
||||
return
|
||||
}
|
||||
done.Add(1)
|
||||
btc := common.NewBaseTileCreator(client, colors, transparent, baseDir, false)
|
||||
btc := common.NewBaseTileCreator(
|
||||
client, colors,
|
||||
int16(yMin), int16(yMax),
|
||||
transparent, baseDir, false)
|
||||
go createTiles(btc, jobs, &done)
|
||||
}
|
||||
|
||||
zMin, zMax = order(zMin, zMax)
|
||||
zMin, zMax = common.Order(zMin, zMax)
|
||||
|
||||
for x, i := int16(xMin), 0; x <= int16(xMax); x += 16 {
|
||||
xDir := filepath.Join(baseDir, strconv.Itoa(i))
|
||||
|
@ -14,18 +14,18 @@ import (
|
||||
|
||||
func main() {
|
||||
var (
|
||||
port int
|
||||
host string
|
||||
xMin, zMin int
|
||||
xMax, zMax int
|
||||
colorsFile string
|
||||
outDir string
|
||||
numWorkers int
|
||||
skipBaseLevel bool
|
||||
skipPyramid bool
|
||||
transparent bool
|
||||
transparentDim float64
|
||||
version bool
|
||||
port int
|
||||
host string
|
||||
xMin, yMin, zMin int
|
||||
xMax, yMax, zMax int
|
||||
colorsFile string
|
||||
outDir string
|
||||
numWorkers int
|
||||
skipBaseLevel bool
|
||||
skipPyramid bool
|
||||
transparent bool
|
||||
transparentDim float64
|
||||
version bool
|
||||
)
|
||||
|
||||
flag.IntVar(&port, "port", 6379, "port to of mtredisalize server")
|
||||
@ -33,6 +33,8 @@ func main() {
|
||||
flag.StringVar(&host, "host", "localhost", "host to mtredisalize server")
|
||||
flag.IntVar(&xMin, "xmin", -1933, "x min of the area to tile")
|
||||
flag.IntVar(&xMax, "xmax", 1932, "x max of the area to tile")
|
||||
flag.IntVar(&yMin, "ymin", common.MinHeight, "Minimum y in blocks.")
|
||||
flag.IntVar(&yMax, "ymax", common.MaxHeight, "Maximum y in blocks.")
|
||||
flag.IntVar(&zMin, "zmin", -1933, "z min of the area to tile")
|
||||
flag.IntVar(&zMax, "zmax", 1932, "z max of the area to tile")
|
||||
flag.StringVar(&colorsFile, "colors", "colors.txt", "definition of colors")
|
||||
@ -65,7 +67,7 @@ func main() {
|
||||
address := fmt.Sprintf("%s:%d", host, port)
|
||||
if err := createBaseLevel(
|
||||
address,
|
||||
xMin, zMin, xMax, zMax,
|
||||
xMin, yMin, zMin, xMax, yMax, zMax,
|
||||
transparent, td,
|
||||
colorsFile,
|
||||
outDir,
|
||||
|
@ -32,6 +32,8 @@ func main() {
|
||||
websockets bool
|
||||
playersFIFO string
|
||||
version bool
|
||||
yMin int
|
||||
yMax int
|
||||
)
|
||||
flag.IntVar(&webPort, "web-port", 8808, "port of the web server")
|
||||
flag.IntVar(&webPort, "p", 8808, "port of the web server (shorthand)")
|
||||
@ -64,6 +66,8 @@ func main() {
|
||||
flag.BoolVar(&websockets, "ws", false, "Forward tile changes to clients via websockets (shorthand).")
|
||||
flag.StringVar(&playersFIFO, "players", "", "Path to FIFO file to read active players from.")
|
||||
flag.StringVar(&playersFIFO, "ps", "", "Path to FIFO file to read active players from (shorthand).")
|
||||
flag.IntVar(&yMin, "ymin", common.MinHeight, "Minimum y in blocks.")
|
||||
flag.IntVar(&yMax, "ymax", common.MaxHeight, "Maximum y in blocks.")
|
||||
flag.BoolVar(&version, "version", false, "Print version and exit.")
|
||||
|
||||
flag.Parse()
|
||||
@ -113,6 +117,7 @@ func main() {
|
||||
redisAddress,
|
||||
allowedUpdateIps,
|
||||
colors,
|
||||
yMin, yMax,
|
||||
transparent,
|
||||
workers,
|
||||
btu)
|
||||
|
@ -35,6 +35,7 @@ type tileUpdater struct {
|
||||
redisAddress string
|
||||
ips []net.IP
|
||||
colors *common.Colors
|
||||
yMin, yMax int16
|
||||
workers int
|
||||
transparent bool
|
||||
cond *sync.Cond
|
||||
@ -71,6 +72,7 @@ func newTileUpdater(
|
||||
mapDir, redisAddress string,
|
||||
ips []net.IP,
|
||||
colors *common.Colors,
|
||||
yMin, yMax int,
|
||||
transparent bool,
|
||||
workers int,
|
||||
btu baseTilesUpdates) *tileUpdater {
|
||||
@ -82,6 +84,8 @@ func newTileUpdater(
|
||||
ips: ips,
|
||||
changes: map[xz]bool{},
|
||||
colors: colors,
|
||||
yMin: int16(yMin),
|
||||
yMax: int16(yMax),
|
||||
transparent: transparent,
|
||||
workers: workers}
|
||||
tu.cond = sync.NewCond(&tu.mu)
|
||||
@ -166,7 +170,10 @@ func (tu *tileUpdater) doUpdates() {
|
||||
log.Printf("WARN: Cannot connect to redis server: %s\n", err)
|
||||
continue
|
||||
}
|
||||
btc := common.NewBaseTileCreator(client, tu.colors, tu.transparent, baseDir, true)
|
||||
btc := common.NewBaseTileCreator(
|
||||
client, tu.colors,
|
||||
tu.yMin, tu.yMax,
|
||||
tu.transparent, baseDir, true)
|
||||
done.Add(1)
|
||||
go updateBaseTiles(jobs, btc, &done)
|
||||
}
|
||||
|
Reference in New Issue
Block a user