From e8c35a4089d43be6ce38bc39ef0a29cb056c2779 Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Fri, 8 Feb 2019 10:07:59 +0100 Subject: [PATCH] lua controller and digiterms overlay --- doc/license.md | 4 ++++ server/mapobject/digiterms.go | 18 +++++++++++++++++ server/mapobject/setup.go | 11 ++++++++++ server/static/index.html | 2 ++ server/static/js/main.js | 2 ++ server/static/js/overlays/DigitermOverlay.js | 19 ++++++++++++++++++ server/static/js/overlays/LcdOverlay.js | 4 ++-- .../js/overlays/LuacontrollerOverlay.js | 19 ++++++++++++++++++ server/static/pics/digiterms_beige_front.png | Bin 0 -> 571 bytes 9 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 server/mapobject/digiterms.go create mode 100644 server/static/js/overlays/DigitermOverlay.js create mode 100644 server/static/js/overlays/LuacontrollerOverlay.js create mode 100644 server/static/pics/digiterms_beige_front.png diff --git a/doc/license.md b/doc/license.md index 2d5394d..9ad9535 100644 --- a/doc/license.md +++ b/doc/license.md @@ -30,3 +30,7 @@ * jeija_luacontroller_top.png ** 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) diff --git a/server/mapobject/digiterms.go b/server/mapobject/digiterms.go new file mode 100644 index 0000000..7637645 --- /dev/null +++ b/server/mapobject/digiterms.go @@ -0,0 +1,18 @@ +package mapobject + +import ( + "mapserver/mapblockparser" + "mapserver/mapobjectdb" +) + +type DigitermsBlock struct{} + +func (this *DigitermsBlock) onMapObject(x, y, z int, block *mapblockparser.MapBlock) *mapobjectdb.MapObject { + md := block.Metadata.GetMetadata(x, y, z) + + o := mapobjectdb.NewMapObject(block.Pos, x, y, z, "digiterm") + o.Attributes["display_text"] = md["display_text"] + o.Attributes["channel"] = md["channel"] + + return o +} diff --git a/server/mapobject/setup.go b/server/mapobject/setup.go index 55babf8..9b9f520 100644 --- a/server/mapobject/setup.go +++ b/server/mapobject/setup.go @@ -122,6 +122,17 @@ func Setup(ctx *app.App) { l.AddMapObject("mesecons_luacontroller:luacontroller0011", luac) l.AddMapObject("mesecons_luacontroller:luacontroller_burnt", luac) + //digiterms + digiterms := &DigitermsBlock{} + l.AddMapObject("'digiterms:lcd_monitor", digiterms) + l.AddMapObject("'digiterms:cathodic_beige_monitor", digiterms) + l.AddMapObject("'digiterms:cathodic_white_monitor", digiterms) + l.AddMapObject("'digiterms:cathodic_black_monitor", digiterms) + l.AddMapObject("'digiterms:scifi_glassscreen", digiterms) + l.AddMapObject("'digiterms:scifi_widescreen", digiterms) + l.AddMapObject("'digiterms:scifi_tallscreen", digiterms) + l.AddMapObject("'digiterms:scifi_keysmonitor", digiterms) + //missions l.AddMapObject("missions:mission", &MissionBlock{}) diff --git a/server/static/index.html b/server/static/index.html index 532a198..e042dfb 100644 --- a/server/static/index.html +++ b/server/static/index.html @@ -38,6 +38,8 @@ + + diff --git a/server/static/js/main.js b/server/static/js/main.js index 4017af4..7bd5ac0 100644 --- a/server/static/js/main.js +++ b/server/static/js/main.js @@ -34,6 +34,8 @@ api.getConfig().then(function(cfg){ overlays["Travelnet"] = new TravelnetOverlay(wsChannel, layerMgr); overlays["Bones"] = new BonesOverlay(wsChannel, layerMgr); overlays["Digilines LCD"] = new LcdOverlay(wsChannel, layerMgr); + overlays["Digiterms"] = new DigitermOverlay(wsChannel, layerMgr); + overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr); //overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr); //Default enabled overlays diff --git a/server/static/js/overlays/DigitermOverlay.js b/server/static/js/overlays/DigitermOverlay.js new file mode 100644 index 0000000..7482c6b --- /dev/null +++ b/server/static/js/overlays/DigitermOverlay.js @@ -0,0 +1,19 @@ +'use strict'; + +var DigitermIcon = L.icon({ + iconUrl: 'pics/digiterms_beige_front.png', + + iconSize: [16, 16], + iconAnchor: [8, 8], + popupAnchor: [0, -16] +}); + +var DigitermOverlay = AbstractIconOverlay.extend({ + initialize: function(wsChannel, layerMgr) { + AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "digiterm", DigitermIcon); + }, + + createPopup: function(lcd){ + return "
" + lcd.attributes.display_text + "
"; + } +}); diff --git a/server/static/js/overlays/LcdOverlay.js b/server/static/js/overlays/LcdOverlay.js index c187777..693fdab 100644 --- a/server/static/js/overlays/LcdOverlay.js +++ b/server/static/js/overlays/LcdOverlay.js @@ -13,7 +13,7 @@ var LcdOverlay = AbstractIconOverlay.extend({ AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "digilinelcd", LcdIcon); }, - createPopup: function(bones){ - return "
" + bones.attributes.text + "
"; + createPopup: function(lcd){ + return "
" + lcd.attributes.text + "
"; } }); diff --git a/server/static/js/overlays/LuacontrollerOverlay.js b/server/static/js/overlays/LuacontrollerOverlay.js new file mode 100644 index 0000000..f510c4f --- /dev/null +++ b/server/static/js/overlays/LuacontrollerOverlay.js @@ -0,0 +1,19 @@ +'use strict'; + +var LuacontrollerIcon = L.icon({ + iconUrl: 'pics/jeija_luacontroller_top.png', + + iconSize: [16, 16], //TODO: 512px :O ... + iconAnchor: [8, 8], + popupAnchor: [0, -16] +}); + +var LuacontrollerOverlay = AbstractIconOverlay.extend({ + initialize: function(wsChannel, layerMgr) { + AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "luacontroller", LuacontrollerIcon); + }, + + createPopup: function(lcd){ + return "
" + lcd.attributes.code + "
"; + } +}); diff --git a/server/static/pics/digiterms_beige_front.png b/server/static/pics/digiterms_beige_front.png new file mode 100644 index 0000000000000000000000000000000000000000..ad523c5b6dabeca13088f19281a60a2b55ed5a01 GIT binary patch literal 571 zcmV-B0>u4^P)l28?opFEJU z`u3k25l*y5tVF*PR29?IXp+FdZLQ*lx#4bj1kr+s;PTZgT)TAxfDiB9^YiO>rfGvm z3;rLXfk03yyb6`05>>)7$yN4`FW-3k^3@+L%)6Pk%nMlsX_OV_N%pe}F_JS6nph=T zW{m`c>>z|1l!R9j9(!+C36M~U*3L`>vM1%DG1xr>>q7-ao2Kd9k}8(D z#yE2F0_D#iRZM3Q4*y78gn=t{1-$x_UYt#UwV(s zB(rdLj*c#onfs&JZnwCP!;*xV5fN-Q6V1Z0a$dhVCNswhdl2rFhLKewvm=SScW!e1 z_5)6jpRyR(=hGK`w_Bn`FwYA@gpIjZB~`*b0MUD{;)PTo_ywCt2X40S4mSV*002ov JPDHLkV1hH4^t=E7 literal 0 HcmV?d00001