diff --git a/doc/license.md b/doc/license.md index 8126d51..ea1fb14 100644 --- a/doc/license.md +++ b/doc/license.md @@ -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 diff --git a/server/mapobject/atm.go b/server/mapobject/atm.go index 031a3e7..2c02458 100644 --- a/server/mapobject/atm.go +++ b/server/mapobject/atm.go @@ -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 } diff --git a/server/mapobject/setup.go b/server/mapobject/setup.go index 5e4a5cd..dc98f99 100644 --- a/server/mapobject/setup.go +++ b/server/mapobject/setup.go @@ -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 diff --git a/server/static/js/Overlaysetup.js b/server/static/js/Overlaysetup.js index c0013d8..4de1aa1 100644 --- a/server/static/js/Overlaysetup.js +++ b/server/static/js/Overlaysetup.js @@ -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); + } + } } diff --git a/server/static/js/overlays/ATMOverlay.js b/server/static/js/overlays/ATMOverlay.js new file mode 100644 index 0000000..20f175d --- /dev/null +++ b/server/static/js/overlays/ATMOverlay.js @@ -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 "

" + title + "

"; + } +}); diff --git a/server/static/manifest.js b/server/static/manifest.js index 2e5e0bc..59b5d26 100644 --- a/server/static/manifest.js +++ b/server/static/manifest.js @@ -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", diff --git a/server/static/pics/atm2_front.png b/server/static/pics/atm2_front.png new file mode 100644 index 0000000..6675aef Binary files /dev/null and b/server/static/pics/atm2_front.png differ diff --git a/server/static/pics/atm3_front.png b/server/static/pics/atm3_front.png new file mode 100644 index 0000000..af81ec9 Binary files /dev/null and b/server/static/pics/atm3_front.png differ diff --git a/server/static/pics/atm_front.png b/server/static/pics/atm_front.png new file mode 100644 index 0000000..8aac188 Binary files /dev/null and b/server/static/pics/atm_front.png differ diff --git a/server/static/pics/atm_front_wt.png b/server/static/pics/atm_front_wt.png new file mode 100644 index 0000000..f40e05c Binary files /dev/null and b/server/static/pics/atm_front_wt.png differ