diff --git a/backend/model/functions.go b/backend/model/functions.go index 489b8e5..1cc7844 100644 --- a/backend/model/functions.go +++ b/backend/model/functions.go @@ -61,7 +61,7 @@ var AddMapRegion = func(w *DfWorld, id int) template.HTML { return "" } -var AddMapSite = func(w *DfWorld, id int) template.HTML { +var AddMapSite = func(w *DfWorld, id int, color bool) template.HTML { if site, ok := w.Sites[id]; ok { coords := strings.Split(site.Rectangle, ":") c1 := strings.Split(coords[0], ",") @@ -77,18 +77,25 @@ var AddMapSite = func(w *DfWorld, id int) template.HTML { if site.Ruin { c = "#aaa" } + if !color { + c = "#fff" + } return template.HTML(fmt.Sprintf(``, site.Id_, x1/16.0, y1/16.0-1, x2/16.0, y2/16.0-1, c)) } else { return "" } } -var AddMapMountain = func(w *DfWorld, id int) template.HTML { +var AddMapMountain = func(w *DfWorld, id int, color bool) template.HTML { if m, ok := w.MountainPeaks[id]; ok { c1 := strings.Split(m.Coords, ",") x, _ := strconv.Atoi(c1[0]) y, _ := strconv.Atoi(c1[1]) - return template.HTML(fmt.Sprintf(``, m.Id_, x, y)) + c := "#666" + if !color { + c = "#fff" + } + return template.HTML(fmt.Sprintf(``, m.Id_, x, y, c)) } return "" } diff --git a/backend/server/templates.go b/backend/server/templates.go index b784b12..e591ce4 100644 --- a/backend/server/templates.go +++ b/backend/server/templates.go @@ -64,8 +64,8 @@ func (srv *DfServer) LoadTemplates() { "addLandmass": func(id int) template.HTML { return model.AddMapLandmass(srv.context.world, id) }, "addRegion": func(id int) template.HTML { return model.AddMapRegion(srv.context.world, id) }, - "addSite": func(id int) template.HTML { return model.AddMapSite(srv.context.world, id) }, - "addMountain": func(id int) template.HTML { return model.AddMapMountain(srv.context.world, id) }, + "addSite": func(id int, color bool) template.HTML { return model.AddMapSite(srv.context.world, id, color) }, + "addMountain": func(id int, color bool) template.HTML { return model.AddMapMountain(srv.context.world, id, color) }, "addWorldConstruction": func(id int) template.HTML { return model.AddMapWorldConstruction(srv.context.world, id) }, "addRiver": func(id int) template.HTML { return model.AddMapRiver(srv.context.world, id) }, diff --git a/backend/static/js/map.js b/backend/static/js/map.js index a95778e..74268ea 100644 --- a/backend/static/js/map.js +++ b/backend/static/js/map.js @@ -62,8 +62,6 @@ var overlayMaps = { "Evilness": evilnessLayer, }; -L.control.layers(null, overlayMaps).addTo(map); - var imageLayer = L.imageOverlay(imageUrl, imageBounds, { opacity: 0.5 }); imageLayer.addTo(map); diff --git a/backend/templates/entity.html b/backend/templates/entity.html index 1662822..3eb90ed 100644 --- a/backend/templates/entity.html +++ b/backend/templates/entity.html @@ -25,6 +25,17 @@ {{- end }}

+{{- if gt (len .Sites) 0 }} +
+
+ +
+{{initMap}} +{{- range .Sites }} +{{ addSite . false }} +{{- end }} +{{- end }} +