Merge branch 'master' into mapparser-lib
This commit is contained in:
commit
e7b7ce2e2f
4
.github/workflows/go-test.yml
vendored
4
.github/workflows/go-test.yml
vendored
@ -9,13 +9,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-go@v2.1.4
|
||||
- uses: actions/setup-go@v2.1.5
|
||||
with:
|
||||
go-version: '1.16'
|
||||
|
||||
- name: test
|
||||
run: go test ./... -coverprofile=profile.cov
|
||||
|
||||
- uses: shogo82148/actions-goveralls@v1.4.7
|
||||
- uses: shogo82148/actions-goveralls@v1.5.1
|
||||
with:
|
||||
path-to-profile: profile.cov
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.17.0-alpine as builder
|
||||
FROM golang:1.17.6-alpine as builder
|
||||
|
||||
RUN apk --no-cache add ca-certificates gcc libc-dev nodejs npm git make
|
||||
|
||||
@ -8,7 +8,7 @@ RUN cd /server &&\
|
||||
npm install -g jshint rollup &&\
|
||||
make test jshint all
|
||||
|
||||
FROM alpine:3.14.2
|
||||
FROM alpine:3.15.0
|
||||
RUN apk --no-cache add ca-certificates curl
|
||||
WORKDIR /app
|
||||
COPY --from=builder /server/output/mapserver-linux-x86_64 /bin/mapserver
|
||||
|
@ -99,7 +99,8 @@ func Setup(p params.ParamsType, cfg *Config) *App {
|
||||
"colors/vanessa.txt",
|
||||
"colors/advtrains.txt",
|
||||
"colors/scifi_nodes.txt",
|
||||
"colors/mcl2_colors.txt",
|
||||
"colors/mc2.txt",
|
||||
"colors/mtg.txt",
|
||||
"colors/miles.txt",
|
||||
"colors/custom.txt",
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ services:
|
||||
command: ["npm", "i"]
|
||||
|
||||
mapserver:
|
||||
image: golang:1.17.0
|
||||
image: golang:1.17.6
|
||||
depends_on:
|
||||
- minetest
|
||||
- mapserver_frontend
|
||||
|
8
go.sum
8
go.sum
@ -62,8 +62,16 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
|
||||
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/lib/pq v1.10.3 h1:v9QZf2Sn6AmjXtQeFpdoq/eaNtYP6IN+7lcrygsIAtg=
|
||||
github.com/lib/pq v1.10.3/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk=
|
||||
github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
|
||||
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=
|
||||
github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.9 h1:10HX2Td0ocZpYEjhilsuo6WWtUqttj2Kb0KtD86/KYA=
|
||||
github.com/mattn/go-sqlite3 v1.14.9/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.10 h1:MLn+5bFRlWMGoSRmJour3CL1w/qL96mvipqpwQW/Sfk=
|
||||
github.com/mattn/go-sqlite3 v1.14.10/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/minetest-go/mapparser v0.1.0 h1:wjVrS2QXURnphPlqqPRD6vt1gvkT55RRUjroT3G5Two=
|
||||
|
@ -55,7 +55,7 @@ func (a *MapBlockAccessor) FindNextLegacyBlocks(s settings.Settings, layers []*l
|
||||
"z": block.Pos.Z,
|
||||
"err": err,
|
||||
}
|
||||
logrus.WithFields(fields).Error("mapblock-pars")
|
||||
logrus.WithFields(fields).Error("mapblock-parse")
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ func (this *TrainBlock) onMapObject(mbpos *coords.MapBlockCoords, x, y, z int, b
|
||||
o.Attributes["index"] = md["index"]
|
||||
o.Attributes["owner"] = md["owner"]
|
||||
o.Attributes["color"] = md["color"]
|
||||
o.Attributes["rail_pos"] = md["rail_pos"]
|
||||
o.Attributes["linepath_from_prv"] = md["linepath_from_prv"]
|
||||
|
||||
return o
|
||||
}
|
||||
|
@ -4,19 +4,15 @@ import (
|
||||
"database/sql"
|
||||
"mapserver/coords"
|
||||
"mapserver/mapobjectdb"
|
||||
"github.com/sirupsen/logrus"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (db *PostgresAccessor) GetMapData(q *mapobjectdb.SearchQuery) ([]*mapobjectdb.MapObject, error) {
|
||||
|
||||
var rows *sql.Rows
|
||||
var err error
|
||||
var limit = 1000
|
||||
|
||||
if q.Limit != nil {
|
||||
limit = *q.Limit
|
||||
}
|
||||
|
||||
if q.AttributeLike == nil {
|
||||
//plain pos search
|
||||
@ -24,7 +20,7 @@ func (db *PostgresAccessor) GetMapData(q *mapobjectdb.SearchQuery) ([]*mapobject
|
||||
q.Type,
|
||||
q.Pos1.X, q.Pos1.Y, q.Pos1.Z,
|
||||
q.Pos2.X, q.Pos2.Y, q.Pos2.Z,
|
||||
limit,
|
||||
*q.Limit,
|
||||
)
|
||||
|
||||
} else {
|
||||
@ -34,7 +30,7 @@ func (db *PostgresAccessor) GetMapData(q *mapobjectdb.SearchQuery) ([]*mapobject
|
||||
q.Pos1.X, q.Pos1.Y, q.Pos1.Z,
|
||||
q.Pos2.X, q.Pos2.Y, q.Pos2.Z,
|
||||
q.AttributeLike.Key, q.AttributeLike.Value,
|
||||
limit,
|
||||
*q.Limit,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,9 @@ import (
|
||||
"database/sql"
|
||||
"mapserver/coords"
|
||||
"mapserver/mapobjectdb"
|
||||
"github.com/sirupsen/logrus"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func (db *Sqlite3Accessor) GetMapData(q *mapobjectdb.SearchQuery) ([]*mapobjectdb.MapObject, error) {
|
||||
@ -13,18 +14,13 @@ func (db *Sqlite3Accessor) GetMapData(q *mapobjectdb.SearchQuery) ([]*mapobjectd
|
||||
var rows *sql.Rows
|
||||
var err error
|
||||
|
||||
var limit = 1000
|
||||
if q.Limit != nil {
|
||||
limit = *q.Limit
|
||||
}
|
||||
|
||||
if q.AttributeLike == nil {
|
||||
//plain pos search
|
||||
rows, err = db.db.Query(getMapDataPosQuery,
|
||||
q.Type,
|
||||
q.Pos1.X, q.Pos1.Y, q.Pos1.Z,
|
||||
q.Pos2.X, q.Pos2.Y, q.Pos2.Z,
|
||||
limit,
|
||||
*q.Limit,
|
||||
)
|
||||
|
||||
} else {
|
||||
@ -34,7 +30,7 @@ func (db *Sqlite3Accessor) GetMapData(q *mapobjectdb.SearchQuery) ([]*mapobjectd
|
||||
q.Type,
|
||||
q.Pos1.X, q.Pos1.Y, q.Pos1.Z,
|
||||
q.Pos2.X, q.Pos2.Y, q.Pos2.Z,
|
||||
limit,
|
||||
*q.Limit,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -65,10 +65,12 @@ func TestMapObjects(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
limit := 1000
|
||||
q := mapobjectdb.SearchQuery{
|
||||
Pos1: pos,
|
||||
Pos2: pos,
|
||||
Type: "xy",
|
||||
Limit: &limit,
|
||||
}
|
||||
|
||||
objs, err := db.GetMapData(&q)
|
||||
@ -120,6 +122,7 @@ func TestMapObjectsQueryWithAttribute(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
limit := 1000
|
||||
q := mapobjectdb.SearchQuery{
|
||||
Pos1: pos,
|
||||
Pos2: pos,
|
||||
@ -128,6 +131,7 @@ func TestMapObjectsQueryWithAttribute(t *testing.T) {
|
||||
Key: "X",
|
||||
Value: "%y",
|
||||
},
|
||||
Limit: &limit,
|
||||
}
|
||||
|
||||
objs, err := db.GetMapData(&q)
|
||||
@ -182,6 +186,7 @@ func TestMapObjectsQueryWithAttributeIgnoreCase(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
limit := 1000
|
||||
q := mapobjectdb.SearchQuery{
|
||||
Pos1: pos,
|
||||
Pos2: pos,
|
||||
@ -190,6 +195,7 @@ func TestMapObjectsQueryWithAttributeIgnoreCase(t *testing.T) {
|
||||
Key: "X",
|
||||
Value: "%bc",
|
||||
},
|
||||
Limit: &limit,
|
||||
}
|
||||
|
||||
objs, err := db.GetMapData(&q)
|
||||
|
@ -2,7 +2,7 @@ version: "2"
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:13
|
||||
image: postgres:14
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_PASSWORD: enter
|
||||
|
@ -1,4 +1,7 @@
|
||||
|
||||
# Assorted node-colors
|
||||
# move them to their own file if the list gets bigger
|
||||
|
||||
# planetoidgen
|
||||
planetoidgen:sun 255 100 0
|
||||
|
||||
@ -15,4 +18,16 @@ default:stone_with_iron 146 73 36
|
||||
default:stone_with_mese 186 194 0
|
||||
default:stone_with_tin 202 202 202
|
||||
|
||||
# technic
|
||||
technic:sulfur_block 189 169 00
|
||||
|
||||
# planet_mars
|
||||
planet_mars:blackmarble 50 50 50
|
||||
planet_mars:blackmarble_bricks 57 57 57
|
||||
planet_mars:blackmarble_polished 43 43 43
|
||||
planet_mars:bluemarble 59 77 101
|
||||
planet_mars:bluemarble_bricks 64 79 99
|
||||
planet_mars:bluemarble_polished 99 128 167
|
||||
planet_mars:redmarble 167 74 63
|
||||
planet_mars:redmarble_bricks 170 81 73
|
||||
planet_mars:redmarble_polished 166 75 65
|
||||
|
1698
public/colors/mc2.txt
Normal file
1698
public/colors/mc2.txt
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
430
public/colors/mtg.txt
Normal file
430
public/colors/mtg.txt
Normal file
@ -0,0 +1,430 @@
|
||||
# Minetest Game
|
||||
|
||||
beds:bed_bottom 130 3 3
|
||||
beds:bed_top 178 116 116
|
||||
beds:fancy_bed_bottom 135 23 14
|
||||
beds:fancy_bed_top 172 112 103
|
||||
bones:bones 86 86 86
|
||||
butterflies:butterfly_red 189 46 62
|
||||
butterflies:butterfly_violet 114 22 167
|
||||
butterflies:butterfly_white 241 238 233
|
||||
carts:brakerail 147 110 81
|
||||
carts:powerrail 154 136 81
|
||||
carts:rail 143 123 90
|
||||
default:acacia_bush_leaves 76 109 47
|
||||
default:acacia_bush_sapling 85 118 58
|
||||
default:acacia_bush_stem 84 76 69
|
||||
default:acacia_leaves 60 96 37
|
||||
default:acacia_sapling 84 110 59
|
||||
default:acacia_tree 188 109 90
|
||||
default:acacia_wood 146 60 37
|
||||
default:apple 145 20 9
|
||||
default:aspen_leaves 70 104 27
|
||||
default:aspen_sapling 81 109 43
|
||||
default:aspen_tree 218 197 166
|
||||
default:aspen_wood 209 198 169
|
||||
default:blueberry_bush_leaves 60 93 21
|
||||
default:blueberry_bush_leaves_with_berries 59 87 35
|
||||
default:blueberry_bush_sapling 79 109 30
|
||||
default:bookshelf 128 99 55
|
||||
default:brick 117 71 69
|
||||
default:bronzeblock 185 110 15
|
||||
default:bush_leaves 34 52 29
|
||||
default:bush_sapling 65 60 40
|
||||
default:bush_stem 45 33 23
|
||||
default:cactus 52 116 15
|
||||
default:cave_ice 167 206 247
|
||||
default:chest 140 108 65
|
||||
default:chest_locked 140 108 65
|
||||
default:chest_locked_open 140 108 65
|
||||
default:chest_open 140 108 65
|
||||
default:clay 182 182 182
|
||||
default:cloud 255 255 255
|
||||
default:coalblock 57 57 57
|
||||
default:cobble 88 84 82
|
||||
default:copperblock 192 126 63
|
||||
default:coral_brown 139 104 72
|
||||
default:coral_cyan 235 230 214
|
||||
default:coral_green 235 230 214
|
||||
default:coral_orange 191 62 12
|
||||
default:coral_pink 235 230 214
|
||||
default:coral_skeleton 235 230 214
|
||||
default:desert_cobble 107 65 49
|
||||
default:desert_sand 206 165 98
|
||||
default:desert_sandstone 195 152 92
|
||||
default:desert_sandstone_block 192 151 94
|
||||
default:desert_sandstone_brick 191 151 94
|
||||
default:desert_stone 129 79 60
|
||||
default:desert_stonebrick 129 79 60
|
||||
default:desert_stone_block 130 79 60
|
||||
default:diamondblock 135 217 223
|
||||
default:dirt 96 67 41
|
||||
default:dirt_with_coniferous_litter 107 88 68
|
||||
default:dirt_with_dry_grass 187 148 77
|
||||
default:dirt_with_grass 64 111 25
|
||||
default:dirt_with_grass_footsteps 64 110 26
|
||||
default:dirt_with_rainforest_litter 74 38 8
|
||||
default:dirt_with_snow 224 225 238
|
||||
default:dry_dirt 178 136 90
|
||||
default:dry_dirt_with_dry_grass 187 148 77
|
||||
default:dry_grass_1 208 172 87
|
||||
default:dry_grass_2 210 174 87
|
||||
default:dry_grass_3 210 174 87
|
||||
default:dry_grass_4 211 175 88
|
||||
default:dry_grass_5 213 178 92
|
||||
default:dry_shrub 101 66 17
|
||||
default:emergent_jungle_sapling 48 39 15
|
||||
default:fence_acacia_wood 147 60 38
|
||||
default:fence_aspen_wood 210 199 170
|
||||
default:fence_junglewood 54 37 11
|
||||
default:fence_pine_wood 221 184 129
|
||||
default:fence_rail_acacia_wood 146 59 37
|
||||
default:fence_rail_aspen_wood 209 198 169
|
||||
default:fence_rail_junglewood 53 36 11
|
||||
default:fence_rail_pine_wood 221 184 128
|
||||
default:fence_rail_wood 128 99 55
|
||||
default:fence_wood 129 100 55
|
||||
default:fern_1 81 114 48
|
||||
default:fern_2 85 114 48
|
||||
default:fern_3 83 115 49
|
||||
default:furnace 100 96 94
|
||||
default:furnace_active 100 96 94
|
||||
default:glass 247 247 247
|
||||
default:goldblock 230 201 29
|
||||
default:grass_1 97 138 53
|
||||
default:grass_2 95 136 54
|
||||
default:grass_3 91 133 52
|
||||
default:grass_4 86 130 45
|
||||
default:grass_5 83 124 47
|
||||
default:gravel 131 131 131
|
||||
default:ice 167 206 247
|
||||
default:junglegrass 63 105 25
|
||||
default:jungleleaves 20 28 15
|
||||
default:junglesapling 50 40 16
|
||||
default:jungletree 105 76 41
|
||||
default:junglewood 54 37 11
|
||||
default:ladder_steel 126 126 126
|
||||
default:ladder_wood 123 90 34
|
||||
default:large_cactus_seedling 44 101 16
|
||||
default:lava_flowing 196 76 6
|
||||
default:lava_source 201 78 6
|
||||
default:leaves 34 52 29
|
||||
default:marram_grass_1 96 133 89
|
||||
default:marram_grass_2 87 126 83
|
||||
default:marram_grass_3 85 125 82
|
||||
default:mese 220 220 0
|
||||
default:meselamp 211 213 139
|
||||
default:mese_post_light 129 100 55
|
||||
default:mese_post_light_acacia_wood 147 60 38
|
||||
default:mese_post_light_aspen_wood 210 199 170
|
||||
default:mese_post_light_junglewood 54 37 11
|
||||
default:mese_post_light_pine_wood 221 184 129
|
||||
default:mossycobble 86 90 68
|
||||
default:obsidian 19 21 24
|
||||
default:obsidianbrick 20 22 24
|
||||
default:obsidian_block 20 22 25
|
||||
default:obsidian_glass 19 21 23
|
||||
default:papyrus 94 132 33
|
||||
default:permafrost 70 65 60
|
||||
default:permafrost_with_moss 106 147 49
|
||||
default:permafrost_with_stones 84 80 78
|
||||
default:pine_bush_needles 11 48 18
|
||||
default:pine_bush_sapling 55 50 39
|
||||
default:pine_bush_stem 73 62 53
|
||||
default:pine_needles 11 48 18
|
||||
default:pine_sapling 29 48 25
|
||||
default:pine_tree 182 155 124
|
||||
default:pine_wood 221 184 128
|
||||
default:river_water_flowing 30 180 223
|
||||
default:river_water_source 30 180 223
|
||||
default:sand 214 207 158
|
||||
default:sandstone 197 193 143
|
||||
default:sandstonebrick 193 189 140
|
||||
default:sandstone_block 195 190 141
|
||||
default:sand_with_kelp 214 207 158
|
||||
default:sapling 65 58 40
|
||||
default:sign_wall_steel 144 144 144
|
||||
default:sign_wall_wood 145 101 64
|
||||
default:silver_sand 193 191 179
|
||||
default:silver_sandstone 195 192 181
|
||||
default:silver_sandstone_block 192 190 179
|
||||
default:silver_sandstone_brick 190 188 178
|
||||
default:snow 224 225 238
|
||||
default:snowblock 224 225 238
|
||||
default:steelblock 194 194 194
|
||||
default:stone 97 94 93
|
||||
default:stonebrick 99 96 95
|
||||
default:stone_block 99 96 95
|
||||
default:stone_with_coal 86 83 82
|
||||
default:stone_with_copper 110 99 89
|
||||
default:stone_with_diamond 102 123 122
|
||||
default:stone_with_gold 119 112 77
|
||||
default:stone_with_iron 109 92 84
|
||||
default:stone_with_mese 108 107 73
|
||||
default:stone_with_tin 117 115 114
|
||||
default:tinblock 149 149 149
|
||||
default:torch 121 95 59
|
||||
default:torch_ceiling 121 95 59
|
||||
default:torch_wall 121 95 59
|
||||
default:tree 164 131 88
|
||||
default:water_flowing 29 130 224
|
||||
default:water_source 29 130 223
|
||||
default:wood 128 99 55
|
||||
doors:door_glass_a 244 244 244
|
||||
doors:door_glass_b 244 244 244
|
||||
doors:door_glass_c 244 244 244
|
||||
doors:door_glass_d 244 244 244
|
||||
doors:door_obsidian_glass_a 23 24 25
|
||||
doors:door_obsidian_glass_b 23 24 25
|
||||
doors:door_obsidian_glass_c 23 24 25
|
||||
doors:door_obsidian_glass_d 23 24 25
|
||||
doors:door_steel_a 200 200 200
|
||||
doors:door_steel_b 200 200 200
|
||||
doors:door_steel_c 200 200 200
|
||||
doors:door_steel_d 200 200 200
|
||||
doors:door_wood_a 87 66 35
|
||||
doors:door_wood_b 87 66 35
|
||||
doors:door_wood_c 87 66 35
|
||||
doors:door_wood_d 87 66 35
|
||||
doors:gate_acacia_wood_closed 146 60 37
|
||||
doors:gate_acacia_wood_open 146 60 37
|
||||
doors:gate_aspen_wood_closed 209 198 169
|
||||
doors:gate_aspen_wood_open 209 198 169
|
||||
doors:gate_junglewood_closed 54 37 11
|
||||
doors:gate_junglewood_open 54 37 11
|
||||
doors:gate_pine_wood_closed 221 184 128
|
||||
doors:gate_pine_wood_open 221 184 128
|
||||
doors:gate_wood_closed 128 99 55
|
||||
doors:gate_wood_open 128 99 55
|
||||
doors:trapdoor 128 99 50
|
||||
doors:trapdoor_open 34 26 14
|
||||
doors:trapdoor_steel 199 199 199
|
||||
doors:trapdoor_steel_open 48 48 48
|
||||
farming:cotton_1 88 116 39
|
||||
farming:cotton_2 87 116 38
|
||||
farming:cotton_3 97 120 41
|
||||
farming:cotton_4 106 113 47
|
||||
farming:cotton_5 114 104 53
|
||||
farming:cotton_6 119 94 59
|
||||
farming:cotton_7 92 69 37
|
||||
farming:cotton_8 110 91 61
|
||||
farming:cotton_wild 101 96 87
|
||||
farming:desert_sand_soil 159 131 70
|
||||
farming:desert_sand_soil_wet 119 98 52
|
||||
farming:dry_soil 109 78 50
|
||||
farming:dry_soil_wet 80 56 35
|
||||
farming:seed_cotton 90 85 57
|
||||
farming:seed_wheat 175 159 93
|
||||
farming:soil 68 43 25
|
||||
farming:soil_wet 52 32 18
|
||||
farming:straw 211 182 67
|
||||
farming:wheat_1 107 174 32
|
||||
farming:wheat_2 133 175 50
|
||||
farming:wheat_3 162 182 82
|
||||
farming:wheat_4 169 187 93
|
||||
farming:wheat_5 169 178 94
|
||||
farming:wheat_6 172 176 85
|
||||
farming:wheat_7 192 181 81
|
||||
farming:wheat_8 186 161 35
|
||||
fire:basic_flame 220 125 38
|
||||
fire:permanent_flame 220 125 38
|
||||
fireflies:firefly 247 229 37
|
||||
fireflies:firefly_bottle 190 191 198
|
||||
flowers:chrysanthemum_green 101 140 39
|
||||
flowers:dandelion_white 178 176 140
|
||||
flowers:dandelion_yellow 194 159 17
|
||||
flowers:geranium 72 87 155
|
||||
flowers:mushroom_brown 106 79 72
|
||||
flowers:mushroom_red 192 85 85
|
||||
flowers:rose 118 48 24
|
||||
flowers:tulip 130 99 36
|
||||
flowers:tulip_black 72 103 63
|
||||
flowers:viola 106 60 159
|
||||
flowers:waterlily 102 158 61
|
||||
flowers:waterlily_waving 102 158 61
|
||||
stairs:slab_acacia_wood 146 60 37
|
||||
stairs:slab_aspen_wood 209 198 169
|
||||
stairs:slab_brick 117 71 69
|
||||
stairs:slab_bronzeblock 185 110 15
|
||||
stairs:slab_cobble 88 84 82
|
||||
stairs:slab_copperblock 192 126 63
|
||||
stairs:slab_desert_cobble 107 65 49
|
||||
stairs:slab_desert_sandstone 195 152 92
|
||||
stairs:slab_desert_sandstone_block 192 151 94
|
||||
stairs:slab_desert_sandstone_brick 191 151 94
|
||||
stairs:slab_desert_stone 129 79 60
|
||||
stairs:slab_desert_stonebrick 129 79 60
|
||||
stairs:slab_desert_stone_block 130 79 60
|
||||
stairs:slab_glass 247 247 247
|
||||
stairs:slab_goldblock 230 201 29
|
||||
stairs:slab_ice 167 206 247
|
||||
stairs:slab_junglewood 54 37 11
|
||||
stairs:slab_mossycobble 86 90 68
|
||||
stairs:slab_obsidian 19 21 24
|
||||
stairs:slab_obsidianbrick 20 22 24
|
||||
stairs:slab_obsidian_block 20 22 25
|
||||
stairs:slab_obsidian_glass 19 21 23
|
||||
stairs:slab_pine_wood 221 184 128
|
||||
stairs:slab_sandstone 197 193 143
|
||||
stairs:slab_sandstonebrick 193 189 140
|
||||
stairs:slab_sandstone_block 195 190 141
|
||||
stairs:slab_silver_sandstone 195 192 181
|
||||
stairs:slab_silver_sandstone_block 192 190 179
|
||||
stairs:slab_silver_sandstone_brick 190 188 178
|
||||
stairs:slab_snowblock 224 225 238
|
||||
stairs:slab_steelblock 194 194 194
|
||||
stairs:slab_stone 97 94 93
|
||||
stairs:slab_stonebrick 99 96 95
|
||||
stairs:slab_stone_block 99 96 95
|
||||
stairs:slab_straw 211 182 67
|
||||
stairs:slab_tinblock 149 149 149
|
||||
stairs:slab_wood 128 99 55
|
||||
stairs:stair_acacia_wood 146 60 37
|
||||
stairs:stair_aspen_wood 209 198 169
|
||||
stairs:stair_brick 117 71 69
|
||||
stairs:stair_bronzeblock 185 110 15
|
||||
stairs:stair_cobble 88 84 82
|
||||
stairs:stair_copperblock 192 126 63
|
||||
stairs:stair_desert_cobble 107 65 49
|
||||
stairs:stair_desert_sandstone 195 152 92
|
||||
stairs:stair_desert_sandstone_block 192 151 94
|
||||
stairs:stair_desert_sandstone_brick 191 151 94
|
||||
stairs:stair_desert_stone 129 79 60
|
||||
stairs:stair_desert_stonebrick 129 79 60
|
||||
stairs:stair_desert_stone_block 130 79 60
|
||||
stairs:stair_glass 249 249 249
|
||||
stairs:stair_goldblock 230 201 29
|
||||
stairs:stair_ice 167 206 247
|
||||
stairs:stair_inner_acacia_wood 146 60 37
|
||||
stairs:stair_inner_aspen_wood 209 198 169
|
||||
stairs:stair_inner_brick 117 71 69
|
||||
stairs:stair_inner_bronzeblock 185 110 15
|
||||
stairs:stair_inner_cobble 88 84 82
|
||||
stairs:stair_inner_copperblock 192 126 63
|
||||
stairs:stair_inner_desert_cobble 107 65 49
|
||||
stairs:stair_inner_desert_sandstone 195 152 92
|
||||
stairs:stair_inner_desert_sandstone_block 192 151 94
|
||||
stairs:stair_inner_desert_sandstone_brick 191 151 94
|
||||
stairs:stair_inner_desert_stone 129 79 60
|
||||
stairs:stair_inner_desert_stonebrick 129 79 60
|
||||
stairs:stair_inner_desert_stone_block 130 79 60
|
||||
stairs:stair_inner_glass 250 250 250
|
||||
stairs:stair_inner_goldblock 230 201 29
|
||||
stairs:stair_inner_ice 167 206 247
|
||||
stairs:stair_inner_junglewood 54 37 11
|
||||
stairs:stair_inner_mossycobble 86 90 68
|
||||
stairs:stair_inner_obsidian 19 21 24
|
||||
stairs:stair_inner_obsidianbrick 20 22 24
|
||||
stairs:stair_inner_obsidian_block 20 22 25
|
||||
stairs:stair_inner_obsidian_glass 19 21 23
|
||||
stairs:stair_inner_pine_wood 221 184 128
|
||||
stairs:stair_inner_sandstone 197 193 143
|
||||
stairs:stair_inner_sandstonebrick 193 189 140
|
||||
stairs:stair_inner_sandstone_block 195 190 141
|
||||
stairs:stair_inner_silver_sandstone 195 192 181
|
||||
stairs:stair_inner_silver_sandstone_block 192 190 179
|
||||
stairs:stair_inner_silver_sandstone_brick 190 188 178
|
||||
stairs:stair_inner_snowblock 224 225 238
|
||||
stairs:stair_inner_steelblock 194 194 194
|
||||
stairs:stair_inner_stone 97 94 93
|
||||
stairs:stair_inner_stonebrick 99 96 95
|
||||
stairs:stair_inner_stone_block 99 96 95
|
||||
stairs:stair_inner_straw 211 182 67
|
||||
stairs:stair_inner_tinblock 149 149 149
|
||||
stairs:stair_inner_wood 128 99 55
|
||||
stairs:stair_junglewood 54 37 11
|
||||
stairs:stair_mossycobble 86 90 68
|
||||
stairs:stair_obsidian 19 21 24
|
||||
stairs:stair_obsidianbrick 20 22 24
|
||||
stairs:stair_obsidian_block 20 22 25
|
||||
stairs:stair_obsidian_glass 19 21 23
|
||||
stairs:stair_outer_acacia_wood 146 60 37
|
||||
stairs:stair_outer_aspen_wood 209 198 169
|
||||
stairs:stair_outer_brick 117 71 69
|
||||
stairs:stair_outer_bronzeblock 185 110 15
|
||||
stairs:stair_outer_cobble 88 84 82
|
||||
stairs:stair_outer_copperblock 192 126 63
|
||||
stairs:stair_outer_desert_cobble 107 65 49
|
||||
stairs:stair_outer_desert_sandstone 195 152 92
|
||||
stairs:stair_outer_desert_sandstone_block 192 151 94
|
||||
stairs:stair_outer_desert_sandstone_brick 191 151 94
|
||||
stairs:stair_outer_desert_stone 129 79 60
|
||||
stairs:stair_outer_desert_stonebrick 129 79 60
|
||||
stairs:stair_outer_desert_stone_block 130 79 60
|
||||
stairs:stair_outer_glass 250 250 250
|
||||
stairs:stair_outer_goldblock 230 201 29
|
||||
stairs:stair_outer_ice 167 206 247
|
||||
stairs:stair_outer_junglewood 54 37 11
|
||||
stairs:stair_outer_mossycobble 86 90 68
|
||||
stairs:stair_outer_obsidian 19 21 24
|
||||
stairs:stair_outer_obsidianbrick 20 22 24
|
||||
stairs:stair_outer_obsidian_block 20 22 25
|
||||
stairs:stair_outer_obsidian_glass 19 21 23
|
||||
stairs:stair_outer_pine_wood 221 184 128
|
||||
stairs:stair_outer_sandstone 197 193 143
|
||||
stairs:stair_outer_sandstonebrick 193 189 140
|
||||
stairs:stair_outer_sandstone_block 195 190 141
|
||||
stairs:stair_outer_silver_sandstone 195 192 181
|
||||
stairs:stair_outer_silver_sandstone_block 192 190 179
|
||||
stairs:stair_outer_silver_sandstone_brick 190 188 178
|
||||
stairs:stair_outer_snowblock 224 225 238
|
||||
stairs:stair_outer_steelblock 194 194 194
|
||||
stairs:stair_outer_stone 97 94 93
|
||||
stairs:stair_outer_stonebrick 99 96 95
|
||||
stairs:stair_outer_stone_block 99 96 95
|
||||
stairs:stair_outer_straw 211 182 67
|
||||
stairs:stair_outer_tinblock 149 149 149
|
||||
stairs:stair_outer_wood 128 99 55
|
||||
stairs:stair_pine_wood 221 184 128
|
||||
stairs:stair_sandstone 197 193 143
|
||||
stairs:stair_sandstonebrick 193 189 140
|
||||
stairs:stair_sandstone_block 195 190 141
|
||||
stairs:stair_silver_sandstone 195 192 181
|
||||
stairs:stair_silver_sandstone_block 192 190 179
|
||||
stairs:stair_silver_sandstone_brick 190 188 178
|
||||
stairs:stair_snowblock 224 225 238
|
||||
stairs:stair_steelblock 194 194 194
|
||||
stairs:stair_stone 97 94 93
|
||||
stairs:stair_stonebrick 99 96 95
|
||||
stairs:stair_stone_block 99 96 95
|
||||
stairs:stair_straw 211 182 67
|
||||
stairs:stair_tinblock 149 149 149
|
||||
stairs:stair_wood 128 99 55
|
||||
tnt:gunpowder 6 6 6
|
||||
tnt:gunpowder_burning 93 86 4
|
||||
tnt:tnt 181 0 0
|
||||
tnt:tnt_burning 191 8 0
|
||||
vessels:drinking_glass 206 214 228
|
||||
vessels:glass_bottle 188 190 201
|
||||
vessels:shelf 128 99 55
|
||||
vessels:steel_bottle 193 192 191
|
||||
walls:cobble 88 84 82
|
||||
walls:desertcobble 107 65 49
|
||||
walls:mossycobble 86 90 68
|
||||
wool:black 29 29 29
|
||||
wool:blue 0 72 145
|
||||
wool:brown 86 42 0
|
||||
wool:cyan 0 130 139
|
||||
wool:dark_green 32 102 0
|
||||
wool:dark_grey 59 59 59
|
||||
wool:green 92 216 28
|
||||
wool:grey 131 131 131
|
||||
wool:magenta 200 3 109
|
||||
wool:orange 213 81 21
|
||||
wool:pink 255 131 131
|
||||
wool:red 168 17 17
|
||||
wool:violet 92 2 169
|
||||
wool:white 220 220 220
|
||||
wool:yellow 254 225 15
|
||||
xpanes:bar 114 114 114
|
||||
xpanes:bar_flat 114 114 114
|
||||
xpanes:door_steel_bar_a 129 129 129
|
||||
xpanes:door_steel_bar_b 129 129 129
|
||||
xpanes:door_steel_bar_c 129 129 129
|
||||
xpanes:door_steel_bar_d 129 129 129
|
||||
xpanes:obsidian_pane 16 16 17
|
||||
xpanes:obsidian_pane_flat 16 16 17
|
||||
xpanes:pane 249 249 249
|
||||
xpanes:pane_flat 249 249 249
|
||||
xpanes:trapdoor_steel_bar 125 125 125
|
||||
xpanes:trapdoor_steel_bar_open 38 38 38
|
@ -4,3 +4,7 @@ unifiedbricks:brickblock_multicolor_dark
|
||||
unifiedbricks:brickblock_multicolor_medium
|
||||
unifiedbricks:brickblock_multicolor_light
|
||||
prefab:concrete_colored
|
||||
scifi_nodes:white2_colored
|
||||
scifi_nodes:white_colored
|
||||
scifi_nodes:whiteoct_colored
|
||||
scifi_nodes:whitetile_colored
|
||||
|
@ -1,13 +1,41 @@
|
||||
import AbstractGeoJsonOverlay from './AbstractGeoJsonOverlay.js';
|
||||
import { getMapObjects } from '../../api.js';
|
||||
|
||||
var string_to_pos = function(str){
|
||||
if (typeof(str) == "string" && str.length > 0 &&
|
||||
str[0] == '(' && str[str.length-1] == ')') {
|
||||
var a = str.slice(1, -1).split(',');
|
||||
a = a.map(parseFloat);
|
||||
if (a.length == 3 && a.indexOf(NaN) < 0) {
|
||||
return {
|
||||
x: a[0],
|
||||
y: a[1],
|
||||
z: a[2]
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
var pos_to_string = function(pos){
|
||||
if (isNaN(parseFloat(pos.x)) ||
|
||||
isNaN(parseFloat(pos.y)) ||
|
||||
isNaN(parseFloat(pos.z))) {
|
||||
return null;
|
||||
}
|
||||
return "("+[pos.x, pos.y, pos.z].join(',')+")";
|
||||
};
|
||||
|
||||
export default AbstractGeoJsonOverlay.extend({
|
||||
initialize: function() {
|
||||
AbstractGeoJsonOverlay.prototype.initialize.call(this, "train");
|
||||
},
|
||||
|
||||
createGeoJson: function(objects){
|
||||
|
||||
var geoJsonLayer = L.geoJSON([], {
|
||||
this.cache = {
|
||||
lines: {}, // { "A1":[] }
|
||||
lineColors: {}, // { "A1": "red" }
|
||||
lineFeat: []
|
||||
};
|
||||
this.pendingQueries = [];
|
||||
this.lastLayer = L.geoJSON([], {
|
||||
onEachFeature: function(feature, layer){
|
||||
if (feature.properties && feature.properties.popupContent) {
|
||||
layer.bindPopup(feature.properties.popupContent);
|
||||
@ -29,86 +57,116 @@ export default AbstractGeoJsonOverlay.extend({
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
var lines = {}; // { "A1":[] }
|
||||
var lineColors = {}; // { "A1": "red" }
|
||||
createGeoJson: function(objects){
|
||||
var self = this;
|
||||
|
||||
//Sort and add lines
|
||||
// which unique lines do objects belong to?
|
||||
var lines = [];
|
||||
objects.forEach(function(obj){
|
||||
if (!obj.attributes.line)
|
||||
return;
|
||||
|
||||
var line = lines[obj.attributes.line];
|
||||
if (!line){
|
||||
line = [];
|
||||
lines[obj.attributes.line] = line;
|
||||
//default or new color
|
||||
lineColors[obj.attributes.line] = "#ff7800";
|
||||
if (obj.attributes.line && lines.indexOf(obj.attributes.line) == -1) {
|
||||
lines.push(obj.attributes.line);
|
||||
}
|
||||
|
||||
if (obj.attributes.color){
|
||||
//new color
|
||||
lineColors[obj.attributes.line] = obj.attributes.color;
|
||||
}
|
||||
|
||||
line.push(obj);
|
||||
});
|
||||
|
||||
//Order by index and display
|
||||
Object.keys(lines).forEach(function(linename){
|
||||
lines[linename].sort(function(a,b){
|
||||
// query for each line, add to cache
|
||||
lines.forEach(function(linename){
|
||||
if (!self.cache.lines[linename]){
|
||||
// only request if not in cache.
|
||||
// if someone changed the train lines, the user has to reload. sorry.
|
||||
self.pendingQueries.push(linename);
|
||||
getMapObjects({
|
||||
type: self.type,
|
||||
attributelike: {
|
||||
key: "line",
|
||||
value: linename
|
||||
}
|
||||
})
|
||||
.then(function(objects){
|
||||
objects.sort(function(a,b){
|
||||
return parseInt(a.attributes.index) - parseInt(b.attributes.index);
|
||||
});
|
||||
|
||||
var coords = [];
|
||||
var stations = [];
|
||||
self.cache.lines[linename] = objects;
|
||||
// already sorted, determine color
|
||||
self.cache.lineColors[linename] = "#ff7800";
|
||||
for (var i = objects.length-1; i >= 0; i--) {
|
||||
// find the last element specifying a color
|
||||
// as was previous behaviour, but be more efficient
|
||||
if (objects[i].attributes.color){
|
||||
self.cache.lineColors[linename] = objects[i].attributes.color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var feat = {
|
||||
coords: [],
|
||||
stations: [],
|
||||
feature: null
|
||||
};
|
||||
//Add stations
|
||||
lines[linename].forEach(function(entry){
|
||||
coords.push([entry.x, entry.z]);
|
||||
objects.forEach(function(entry){
|
||||
var rail_pos = string_to_pos(entry.attributes.rail_pos);
|
||||
if (entry.attributes.linepath_from_prv) {
|
||||
var points = entry.attributes.linepath_from_prv.split(';');
|
||||
points.forEach(function(p) {
|
||||
var pos = string_to_pos(p);
|
||||
if (pos == null) {
|
||||
console.warn("[Trainlines][linepath_from_prv]", "line "+linename, "block "+pos_to_string(entry), "index "+entry.attributes.index, "Invalid point:", p);
|
||||
} else {
|
||||
feat.coords.push([pos.x, pos.z]);
|
||||
}
|
||||
});
|
||||
} else if (rail_pos) {
|
||||
feat.coords.push([rail_pos.x, rail_pos.z]);
|
||||
} else {
|
||||
feat.coords.push([entry.x, entry.z]);
|
||||
}
|
||||
|
||||
if (entry.attributes.station) {
|
||||
stations.push({
|
||||
feat.stations.push({
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"name": entry.attributes.station,
|
||||
"color": lineColors[linename],
|
||||
"color": self.cache.lineColors[linename],
|
||||
"popupContent": "<b>Train-station (Line " + entry.attributes.line + ")</b><hr>" +
|
||||
entry.attributes.station
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [entry.x, entry.z]
|
||||
"coordinates": feat.coords[feat.coords.length-1]
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var feature = {
|
||||
feat.feature = {
|
||||
"type":"Feature",
|
||||
"geometry": {
|
||||
"type":"LineString",
|
||||
"coordinates":coords
|
||||
"coordinates": feat.coords
|
||||
},
|
||||
"properties":{
|
||||
"name": linename,
|
||||
"color": lineColors[linename],
|
||||
"color": self.cache.lineColors[linename],
|
||||
"popupContent": "<b>Train-line (" + linename + ")</b>"
|
||||
}
|
||||
};
|
||||
|
||||
self.cache.lineFeat[linename] = feat;
|
||||
|
||||
//line-points
|
||||
geoJsonLayer.addData(feature);
|
||||
self.lastLayer.addData(feat.feature);
|
||||
|
||||
//stations
|
||||
stations.forEach(function(stationfeature){
|
||||
geoJsonLayer.addData(stationfeature);
|
||||
feat.stations.forEach(function(stationfeature){
|
||||
self.lastLayer.addData(stationfeature);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
return geoJsonLayer;
|
||||
}
|
||||
});
|
||||
|
||||
return self.lastLayer;
|
||||
},
|
||||
});
|
||||
|
28
public/package-lock.json
generated
28
public/package-lock.json
generated
@ -16,8 +16,8 @@
|
||||
"vue-router": "^3.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint": "2.13.1",
|
||||
"rollup": "2.56.3"
|
||||
"jshint": "2.13.3",
|
||||
"rollup": "2.64.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fortawesome/fontawesome-free": {
|
||||
@ -254,9 +254,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/jshint": {
|
||||
"version": "2.13.1",
|
||||
"resolved": "https://registry.npmjs.org/jshint/-/jshint-2.13.1.tgz",
|
||||
"integrity": "sha512-vymzfR3OysF5P774x6zYv0bD4EpH6NWRxpq54wO9mA9RuY49yb1teKSICkLx2Ryx+mfzlVVNNbTBtsRtg78t7g==",
|
||||
"version": "2.13.3",
|
||||
"resolved": "https://registry.npmjs.org/jshint/-/jshint-2.13.3.tgz",
|
||||
"integrity": "sha512-zlVQz8XAl1ODXEOVMPkDNuntPebPIE39Xn7ex/JAI9+TmBIf/fcUuj58FaLCC88rOHy8leq0N5ChBB+V5fmpzA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cli": "~1.0.0",
|
||||
@ -321,9 +321,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "2.56.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.3.tgz",
|
||||
"integrity": "sha512-Au92NuznFklgQCUcV96iXlxUbHuB1vQMaH76DHl5M11TotjOHwqk9CwcrT78+Tnv4FN9uTBxq6p4EJoYkpyekg==",
|
||||
"version": "2.64.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.64.0.tgz",
|
||||
"integrity": "sha512-+c+lbw1lexBKSMb1yxGDVfJ+vchJH3qLbmavR+awDinTDA2C5Ug9u7lkOzj62SCu0PKUExsW36tpgW7Fmpn3yQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"rollup": "dist/bin/rollup"
|
||||
@ -582,9 +582,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"jshint": {
|
||||
"version": "2.13.1",
|
||||
"resolved": "https://registry.npmjs.org/jshint/-/jshint-2.13.1.tgz",
|
||||
"integrity": "sha512-vymzfR3OysF5P774x6zYv0bD4EpH6NWRxpq54wO9mA9RuY49yb1teKSICkLx2Ryx+mfzlVVNNbTBtsRtg78t7g==",
|
||||
"version": "2.13.3",
|
||||
"resolved": "https://registry.npmjs.org/jshint/-/jshint-2.13.3.tgz",
|
||||
"integrity": "sha512-zlVQz8XAl1ODXEOVMPkDNuntPebPIE39Xn7ex/JAI9+TmBIf/fcUuj58FaLCC88rOHy8leq0N5ChBB+V5fmpzA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"cli": "~1.0.0",
|
||||
@ -640,9 +640,9 @@
|
||||
}
|
||||
},
|
||||
"rollup": {
|
||||
"version": "2.56.3",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.56.3.tgz",
|
||||
"integrity": "sha512-Au92NuznFklgQCUcV96iXlxUbHuB1vQMaH76DHl5M11TotjOHwqk9CwcrT78+Tnv4FN9uTBxq6p4EJoYkpyekg==",
|
||||
"version": "2.64.0",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.64.0.tgz",
|
||||
"integrity": "sha512-+c+lbw1lexBKSMb1yxGDVfJ+vchJH3qLbmavR+awDinTDA2C5Ug9u7lkOzj62SCu0PKUExsW36tpgW7Fmpn3yQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fsevents": "~2.3.2"
|
||||
|
@ -18,7 +18,7 @@
|
||||
"vue-router": "^3.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jshint": "2.13.1",
|
||||
"rollup": "2.56.3"
|
||||
"jshint": "2.13.3",
|
||||
"rollup": "2.64.0"
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ func initialRender(ctx *app.App) {
|
||||
result, err := ctx.MapBlockAccessor.FindNextLegacyBlocks(ctx.Settings, ctx.Config.Layers, ctx.Config.RenderingFetchLimit)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
logrus.Error("Error in initial rendering run, trying to continue: " + err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
if len(result.List) == 0 && !result.HasMore {
|
||||
|
@ -2,6 +2,7 @@ package web
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"mapserver/coords"
|
||||
"mapserver/mapobjectdb"
|
||||
"net/http"
|
||||
|
||||
@ -23,6 +24,20 @@ func (api *Api) QueryMapobjects(resp http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// apply defaults
|
||||
limit := 1000
|
||||
if q.Limit == nil {
|
||||
q.Limit = &limit
|
||||
}
|
||||
|
||||
if q.Pos1 == nil {
|
||||
q.Pos1 = &coords.MapBlockCoords{X: -2048, Y: -2048, Z: -2048}
|
||||
}
|
||||
|
||||
if q.Pos2 == nil {
|
||||
q.Pos2 = &coords.MapBlockCoords{X: 2048, Y: 2048, Z: 2048}
|
||||
}
|
||||
|
||||
objects, err := api.Context.Objectdb.GetMapData(&q)
|
||||
if err != nil {
|
||||
resp.WriteHeader(500)
|
||||
|
Loading…
Reference in New Issue
Block a user