switching station object

This commit is contained in:
NatureFreshMilk 2019-02-08 15:40:30 +01:00
parent 9e145b8711
commit 3f531d65c0
5 changed files with 45 additions and 0 deletions

View File

@ -134,6 +134,7 @@ func Setup(ctx *app.App) {
l.AddMapObject("technic:quarry", &QuarryBlock{})
l.AddMapObject("technic:hv_nuclear_reactor_core_active", &NuclearReactorBlock{})
l.AddMapObject("technic:admin_anchor", &TechnicAnchorBlock{})
l.AddMapObject("technic:switching_station", &TechnicSwitchBlock{})
//digilines
l.AddMapObject("digilines:lcd", &DigilineLcdBlock{})

View File

@ -0,0 +1,20 @@
package mapobject
import (
"mapserver/mapblockparser"
"mapserver/mapobjectdb"
)
type TechnicSwitchBlock struct{}
func (this *TechnicSwitchBlock) 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, "technicswitch")
o.Attributes["active"] = md["active"]
o.Attributes["channel"] = md["channel"]
o.Attributes["supply"] = md["supply"]
o.Attributes["demand"] = md["demand"]
return o
}

View File

@ -43,6 +43,7 @@
<script src="js/overlays/LuacontrollerOverlay.js"></script>
<script src="js/overlays/TechnicAnchorOverlay.js"></script>
<script src="js/overlays/TechnicQuarryOverlay.js"></script>
<script src="js/overlays/TechnicSwitchOverlay.js"></script>
<script src="js/overlays/MissionOverlay.js"></script>
<!-- bootstrap -->

View File

@ -39,6 +39,7 @@ api.getConfig().then(function(cfg){
overlays["Lua Controller"] = new LuacontrollerOverlay(wsChannel, layerMgr);
overlays["Technic Anchor"] = new TechnicAnchorOverlay(wsChannel, layerMgr);
overlays["Technic Quarry"] = new TechnicQuarryOverlay(wsChannel, layerMgr);
overlays["Technic Switching station"] = new TechnicSwitchOverlay(wsChannel, layerMgr);
overlays["Protector"] = new ProtectorOverlay(wsChannel, layerMgr);
overlays["Missions"] = new MissionOverlay(wsChannel, layerMgr);

View File

@ -0,0 +1,22 @@
'use strict';
var TechnicSwitchIcon = L.icon({
iconUrl: 'pics/technic_water_mill_top_active.png.png',
iconSize: [16, 16],
iconAnchor: [8, 8],
popupAnchor: [0, -16]
});
var TechnicSwitchOverlay = AbstractIconOverlay.extend({
initialize: function(wsChannel, layerMgr) {
AbstractIconOverlay.prototype.initialize.call(this, wsChannel, layerMgr, "technicswitch", TechnicQuarryIcon);
},
createPopup: function(sw){
return "<p>Active: " + sw.attributes.active + "</p>" +
"<p>Channel: " + sw.attributes.channel + "</p>" +
"<p>Supply: " + sw.attributes.supply + "</p>" +
"<p>Demand: " + sw.attributes.demand + "</p>";
}
});