colored poi's
12
doc/internal/textures.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
# convert
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo apt install imagemagick
|
||||||
|
convert markers-soft.png -crop 36x46+0+0 -resize 28% mapserver_poi_red.png
|
||||||
|
convert markers-soft.png -crop 36x46+36+0 -resize 28% mapserver_poi_orange.png
|
||||||
|
convert markers-soft.png -crop 36x46+72+0 -resize 28% mapserver_poi_green.png
|
||||||
|
convert markers-soft.png -crop 36x46+108+0 -resize 28% mapserver_poi_blue.png
|
||||||
|
convert markers-soft.png -crop 36x46+144+0 -resize 28% mapserver_poi_violet.png
|
||||||
|
convert markers-soft.png -crop 36x46+180+0 -resize 28% mapserver_poi_brown.png
|
||||||
|
```
|
@ -54,3 +54,7 @@
|
|||||||
* minecart_logo.png
|
* minecart_logo.png
|
||||||
** License: CC0
|
** License: CC0
|
||||||
** Source [minecart](https://github.com/joe7575/minecart)
|
** Source [minecart](https://github.com/joe7575/minecart)
|
||||||
|
|
||||||
|
* mapserver_gold_block.png
|
||||||
|
** License: CC BY-SA 3.0
|
||||||
|
** Source [minetest_game](https://github.com/minetest/minetest_game)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
default
|
default
|
||||||
|
dye
|
||||||
advtrains?
|
advtrains?
|
||||||
minecart?
|
minecart?
|
||||||
|
@ -20,53 +20,63 @@ local update_formspec = function(meta)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local register_poi = function(color)
|
||||||
|
minetest.register_node("mapserver:poi:" .. color, {
|
||||||
|
description = "Mapserver POI (" .. color .. ")",
|
||||||
|
tiles = {
|
||||||
|
"[combine:16x16:0,0=mapserver_gold_block.png:3,2=mapserver_poi_" .. color .. ".png"
|
||||||
|
},
|
||||||
|
groups = {cracky=3,oddly_breakable_by_hand=3},
|
||||||
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
can_dig = mapserver.can_dig,
|
||||||
|
after_place_node = mapserver.after_place_node,
|
||||||
|
|
||||||
minetest.register_node("mapserver:poi", {
|
on_construct = function(pos)
|
||||||
description = "Mapserver POI",
|
local meta = minetest.get_meta(pos)
|
||||||
tiles = {
|
|
||||||
"mapserver_poi.png"
|
|
||||||
},
|
|
||||||
groups = {cracky=3,oddly_breakable_by_hand=3},
|
|
||||||
sounds = default.node_sound_glass_defaults(),
|
|
||||||
can_dig = mapserver.can_dig,
|
|
||||||
after_place_node = mapserver.after_place_node,
|
|
||||||
|
|
||||||
on_construct = function(pos)
|
meta:set_string("name", "<unconfigured>")
|
||||||
local meta = minetest.get_meta(pos)
|
meta:set_string("category", "main")
|
||||||
|
meta:set_string("url", "")
|
||||||
|
|
||||||
meta:set_string("name", "<unconfigured>")
|
update_formspec(meta)
|
||||||
meta:set_string("category", "main")
|
end,
|
||||||
meta:set_string("url", "")
|
|
||||||
|
|
||||||
update_formspec(meta)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
end,
|
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
if not mapserver.can_interact(pos, sender) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if not mapserver.can_interact(pos, sender) then
|
local meta = minetest.get_meta(pos)
|
||||||
return
|
|
||||||
|
if fields.save then
|
||||||
|
meta:set_string("name", fields.name)
|
||||||
|
meta:set_string("url", fields.url)
|
||||||
|
meta:set_string("category", fields.category)
|
||||||
|
end
|
||||||
|
|
||||||
|
update_formspec(meta)
|
||||||
end
|
end
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
|
|
||||||
if fields.save then
|
|
||||||
meta:set_string("name", fields.name)
|
|
||||||
meta:set_string("url", fields.url)
|
|
||||||
meta:set_string("category", fields.category)
|
|
||||||
end
|
|
||||||
|
|
||||||
update_formspec(meta)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
if mapserver.enable_crafting then
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'mapserver:poi',
|
|
||||||
recipe = {
|
|
||||||
{"", "dye:blue", ""},
|
|
||||||
{"default:paper", "default:goldblock", "default:paper"},
|
|
||||||
{"", "default:glass", ""}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
if mapserver.enable_crafting then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'mapserver:poi_' .. color,
|
||||||
|
recipe = {
|
||||||
|
{"", "dye:" .. color, ""},
|
||||||
|
{"default:paper", "default:goldblock", "default:paper"},
|
||||||
|
{"", "default:glass", ""}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
register_poi("blue")
|
||||||
|
register_poi("green")
|
||||||
|
register_poi("orange")
|
||||||
|
register_poi("red")
|
||||||
|
register_poi("purple")
|
||||||
|
|
||||||
|
-- default poi was always blue
|
||||||
|
minetest.register_alias("mapserver:poi", "mapserver:poi_blue")
|
||||||
|
BIN
mapserver_mod/mapserver/textures/mapserver_gold_block.png
Normal file
After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 313 B |
BIN
mapserver_mod/mapserver/textures/mapserver_poi_blue.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
mapserver_mod/mapserver/textures/mapserver_poi_green.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
mapserver_mod/mapserver/textures/mapserver_poi_orange.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
mapserver_mod/mapserver/textures/mapserver_poi_red.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
mapserver_mod/mapserver/textures/mapserver_poi_violet.png
Normal file
After Width: | Height: | Size: 891 B |
@ -5,7 +5,9 @@ import (
|
|||||||
"mapserver/mapobjectdb"
|
"mapserver/mapobjectdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PoiBlock struct{}
|
type PoiBlock struct {
|
||||||
|
Color string
|
||||||
|
}
|
||||||
|
|
||||||
func (this *PoiBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject {
|
func (this *PoiBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject {
|
||||||
md := block.Metadata.GetMetadata(x, y, z)
|
md := block.Metadata.GetMetadata(x, y, z)
|
||||||
@ -15,6 +17,8 @@ func (this *PoiBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *
|
|||||||
o.Attributes["category"] = md["category"]
|
o.Attributes["category"] = md["category"]
|
||||||
o.Attributes["url"] = md["url"]
|
o.Attributes["url"] = md["url"]
|
||||||
o.Attributes["owner"] = md["owner"]
|
o.Attributes["owner"] = md["owner"]
|
||||||
|
o.Attributes["icon"] = md["icon"]
|
||||||
|
o.Attributes["color"] = this.Color
|
||||||
|
|
||||||
return o
|
return o
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,12 @@ func Setup(ctx *app.App) {
|
|||||||
|
|
||||||
//mapserver stuff
|
//mapserver stuff
|
||||||
if ctx.Config.MapObjects.MapserverPOI {
|
if ctx.Config.MapObjects.MapserverPOI {
|
||||||
l.AddMapObject("mapserver:poi", &PoiBlock{})
|
l.AddMapObject("mapserver:poi", &PoiBlock{Color: "blue"})
|
||||||
|
l.AddMapObject("mapserver:poi_blue", &PoiBlock{Color: "blue"})
|
||||||
|
l.AddMapObject("mapserver:poi_green", &PoiBlock{Color: "green"})
|
||||||
|
l.AddMapObject("mapserver:poi_orange", &PoiBlock{Color: "orange"})
|
||||||
|
l.AddMapObject("mapserver:poi_red", &PoiBlock{Color: "red"})
|
||||||
|
l.AddMapObject("mapserver:poi_purple", &PoiBlock{Color: "purple"})
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Config.MapObjects.MapserverTrainline {
|
if ctx.Config.MapObjects.MapserverTrainline {
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
/* exported PoiOverlay */
|
/* exported PoiOverlay */
|
||||||
/* globals AbstractIconOverlay: true */
|
/* globals AbstractIconOverlay: true */
|
||||||
|
|
||||||
var PoiIcon = L.icon({
|
|
||||||
iconUrl: 'css/images/marker-icon.png',
|
|
||||||
shadowUrl: 'css/images/marker-shadow.png',
|
|
||||||
iconSize: [25, 41],
|
|
||||||
iconAnchor: [12, 41],
|
|
||||||
popupAnchor: [1, -34],
|
|
||||||
tooltipAnchor: [16, -28],
|
|
||||||
shadowSize: [41, 41]
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var PoiOverlay = AbstractIconOverlay.extend({
|
var PoiOverlay = AbstractIconOverlay.extend({
|
||||||
initialize: function(wsChannel, layerMgr) {
|
initialize: function(wsChannel, layerMgr) {
|
||||||
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "poi", PoiIcon);
|
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "poi", PoiIcon);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getIcon: function(obj){
|
||||||
|
return L.AwesomeMarkers.icon({
|
||||||
|
icon: obj.attributes.icon || "home",
|
||||||
|
prefix: "fa",
|
||||||
|
markerColor: obj.attributes.color || "blue"
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getMaxDisplayedZoom: function(){
|
getMaxDisplayedZoom: function(){
|
||||||
return 5;
|
return 5;
|
||||||
},
|
},
|
||||||
|