atm overlay

This commit is contained in:
NatureFreshMilk 2019-05-14 09:01:52 +02:00
parent 27b210d557
commit 5d7ba84d2c
10 changed files with 97 additions and 20 deletions

View File

@ -11,31 +11,31 @@
* sam.png
* heart.png
* default_tool_mesepick.png
** License: CC BY-SA 3.0
** Source: [minetest_game](https://github.com/minetest/minetest_game)
* License: CC BY-SA 3.0
* Source: [minetest_game](https://github.com/minetest/minetest_game)
* travelnet_inv.png
** License: CC BY-SA 3.0
** Source: [travelnet](https://github.com/Sokomine/travelnet)
* License: CC BY-SA 3.0
* Source: [travelnet](https://github.com/Sokomine/travelnet)
* technic_admin_anchor.png
* technic_hv_nuclear_reactor_core.png
* technic_water_mill_top_active.png
** LGPL, V2
** Source: [technic](https://github.com/minetest-mods/technic)
* LGPL, V2
* Source: [technic](https://github.com/minetest-mods/technic)
* lcd_lcd.png
** WTFPL
** Source: [digilines](https://github.com/minetest-mods/digilines)
* WTFPL
* Source: [digilines](https://github.com/minetest-mods/digilines)
* jeija_luacontroller_top.png
* jeija_luacontroller_burnt_top.png
** CC-BY-SA-3.0
** Source [mesecons](https://github.com/minetest-mods/mesecons)
* CC-BY-SA-3.0
* Source [mesecons](https://github.com/minetest-mods/mesecons)
* digiterms_beige_front.png
** License: CC BY-SA 3.0
** Source [digiterms](https://github.com/Pyrollo/digiterms)
* License: CC BY-SA 3.0
* Source [digiterms](https://github.com/Pyrollo/digiterms)
* advtrains_detailed_engine_steam_inv.png
@ -48,13 +48,20 @@
* advtrains_wagon_japan_inv.png
* advtrains_wagon_tank_inv.png
* advtrains_wagon_wood_inv.png
** License: CC BY-SA 3.0
** Source [advtrains](http://advtrains.bleipb.de/)
* License: CC BY-SA 3.0
* Source [advtrains](http://advtrains.bleipb.de/)
* minecart_logo.png
** License: CC0
** Source [minecart](https://github.com/joe7575/minecart)
* License: CC0
* 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)
* License: CC BY-SA 3.0
* Source [minetest_game](https://github.com/minetest/minetest_game)
* atm_front_wt.png
* atm_front.png
* atm2_front.png
* atm3_front.png
* WTFPL
* Source: http://git.gpcf.eu/?p=atm.git;a=summary

View File

@ -8,5 +8,23 @@ import (
type ATM struct{}
func (this *ATM) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject {
return mapobjectdb.NewMapObject(block.Pos, x, y, z, "atm")
nodename := block.GetNodeName(x, y, z)
o := mapobjectdb.NewMapObject(block.Pos, x, y, z, "atm")
if nodename == "atm:wtt" {
o.Attributes["type"] = "wiretransfer"
} else if nodename == "atm:atm2" {
o.Attributes["type"] = "atm2"
} else if nodename == "atm:atm3" {
o.Attributes["type"] = "atm3"
} else {
o.Attributes["type"] = "atm"
}
return o
}

View File

@ -147,7 +147,11 @@ func Setup(ctx *app.App) {
}
if ctx.Config.MapObjects.ATM {
l.AddMapObject("atm:atm", &ATM{})
atm := &ATM{}
l.AddMapObject("atm:atm", atm)
l.AddMapObject("atm:atm2", atm)
l.AddMapObject("atm:atm3", atm)
l.AddMapObject("atm:wtt", atm)
}
//locator

View File

@ -142,4 +142,11 @@ function Overlaysetup(cfg, map, overlays, wsChannel, layerMgr){
map.addLayer(overlays.Minecart);
}
}
if (cfg.mapobjects.atm) {
overlays.ATM = new ATMOverlay(wsChannel, layerMgr);
if (cfg.defaultoverlays.indexOf("atm") >= 0) {
map.addLayer(overlays.ATM);
}
}
}

View File

@ -0,0 +1,40 @@
/* exported ATMOverlay */
/* globals AbstractIconOverlay: true */
var ATMOverlay = AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "atm");
},
getMaxDisplayedZoom: function(){
return 10;
},
getIcon: function(obj){
var img = "pics/atm_front.png"
if (obj.attributes.type == "wiretransfer")
img = "pics/atm_front.png";
else if (obj.attributes.type == "atm2")
img = "pics/atm2_front.png";
else if (obj.attributes.type == "atm3")
img = "pics/atm3_front.png";
L.icon({
iconUrl: img,
iconSize: [16, 16],
iconAnchor: [8, 8],
popupAnchor: [0, -8]
});
},
createPopup: function(obj){
var title = "ATM";
if (obj.attributes.type == "wiretransfer")
title = "Wiretransfer";
return "<h4>" + title + "</h4>";
}
});

View File

@ -20,6 +20,7 @@
"/js/search/SearchInput.js",
"/js/overlays/AbstractIconOverlay.js",
"/js/overlays/AbstractGeoJsonOverlay.js",
"/js/overlays/ATMOverlay.js",
"/js/overlays/TravelnetOverlay.js",
"/js/overlays/ShopOverlay.js",
"/js/overlays/PoiOverlay.js",

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B