1
0
forked from MTSR/mapserver

lua controller and digiterms overlay

This commit is contained in:
NatureFreshMilk 2019-02-08 10:07:59 +01:00
parent 631cdc0b10
commit e8c35a4089
9 changed files with 77 additions and 2 deletions

View File

@ -30,3 +30,7 @@
* jeija_luacontroller_top.png * jeija_luacontroller_top.png
** CC-BY-SA-3.0 ** CC-BY-SA-3.0
** Source [mesecons](https://github.com/minetest-mods/mesecons) ** 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)

View File

@ -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
}

View File

@ -122,6 +122,17 @@ func Setup(ctx *app.App) {
l.AddMapObject("mesecons_luacontroller:luacontroller0011", luac) l.AddMapObject("mesecons_luacontroller:luacontroller0011", luac)
l.AddMapObject("mesecons_luacontroller:luacontroller_burnt", 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 //missions
l.AddMapObject("missions:mission", &MissionBlock{}) l.AddMapObject("missions:mission", &MissionBlock{})

View File

@ -38,6 +38,8 @@
<script src="js/overlays/ProtectorOverlay.js"></script> <script src="js/overlays/ProtectorOverlay.js"></script>
<script src="js/overlays/BonesOverlay.js"></script> <script src="js/overlays/BonesOverlay.js"></script>
<script src="js/overlays/LcdOverlay.js"></script> <script src="js/overlays/LcdOverlay.js"></script>
<script src="js/overlays/DigitermOverlay.js"></script>
<script src="js/overlays/LuacontrollerOverlay.js"></script>
<!-- bootstrap --> <!-- bootstrap -->
<script src="js/main.js"></script> <script src="js/main.js"></script>

View File

@ -34,6 +34,8 @@ api.getConfig().then(function(cfg){
overlays["Travelnet"] = new TravelnetOverlay(wsChannel, layerMgr); overlays["Travelnet"] = new TravelnetOverlay(wsChannel, layerMgr);
overlays["Bones"] = new BonesOverlay(wsChannel, layerMgr); overlays["Bones"] = new BonesOverlay(wsChannel, layerMgr);
overlays["Digilines LCD"] = new LcdOverlay(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); //overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr);
//Default enabled overlays //Default enabled overlays

View File

@ -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 "<pre>" + lcd.attributes.display_text + "</pre>";
}
});

View File

@ -13,7 +13,7 @@ var LcdOverlay = AbstractIconOverlay.extend({
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "digilinelcd", LcdIcon); AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "digilinelcd", LcdIcon);
}, },
createPopup: function(bones){ createPopup: function(lcd){
return "<pre>" + bones.attributes.text + "</pre>"; return "<pre>" + lcd.attributes.text + "</pre>";
} }
}); });

View File

@ -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 "<pre>" + lcd.attributes.code + "</pre>";
}
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 B