Add For Sale Sings for Unified Money
This commit is contained in:
parent
e667ca580a
commit
d6e65af8f2
@ -58,36 +58,37 @@ func ParseConfig(filename string) (*Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mapobjs := MapObjectConfig{
|
mapobjs := MapObjectConfig{
|
||||||
Areas: true,
|
Areas: true,
|
||||||
Bones: true,
|
Bones: true,
|
||||||
Protector: true,
|
Protector: true,
|
||||||
XPProtector: true,
|
XPProtector: true,
|
||||||
PrivProtector: true,
|
PrivProtector: true,
|
||||||
TechnicQuarry: true,
|
TechnicQuarry: true,
|
||||||
TechnicSwitch: true,
|
TechnicSwitch: true,
|
||||||
TechnicAnchor: true,
|
TechnicAnchor: true,
|
||||||
TechnicReactor: true,
|
TechnicReactor: true,
|
||||||
LuaController: true,
|
LuaController: true,
|
||||||
Digiterms: true,
|
Digiterms: true,
|
||||||
Digilines: true,
|
Digilines: true,
|
||||||
Travelnet: true,
|
Travelnet: true,
|
||||||
MapserverPlayer: true,
|
MapserverPlayer: true,
|
||||||
MapserverPOI: true,
|
MapserverPOI: true,
|
||||||
MapserverLabel: true,
|
MapserverLabel: true,
|
||||||
MapserverTrainline: true,
|
MapserverTrainline: true,
|
||||||
MapserverBorder: true,
|
MapserverBorder: true,
|
||||||
TileServerLegacy: true,
|
TileServerLegacy: true,
|
||||||
Mission: true,
|
Mission: true,
|
||||||
Jumpdrive: true,
|
Jumpdrive: true,
|
||||||
Smartshop: true,
|
Smartshop: true,
|
||||||
Fancyvend: true,
|
Fancyvend: true,
|
||||||
ATM: true,
|
ATM: true,
|
||||||
Train: true,
|
Train: true,
|
||||||
TrainSignal: true,
|
TrainSignal: true,
|
||||||
Minecart: false,
|
Minecart: false,
|
||||||
Locator: false,
|
Locator: false,
|
||||||
Signs: true,
|
Signs: true,
|
||||||
MapserverAirutils: true,
|
MapserverAirutils: true,
|
||||||
|
UnifiefMoneyAreaForSale: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
mapblockaccessor := MapBlockAccessorConfig{
|
mapblockaccessor := MapBlockAccessorConfig{
|
||||||
|
61
app/types.go
61
app/types.go
@ -34,36 +34,37 @@ type MapBlockAccessorConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MapObjectConfig struct {
|
type MapObjectConfig struct {
|
||||||
Areas bool `json:"areas"`
|
Areas bool `json:"areas"`
|
||||||
Bones bool `json:"bones"`
|
Bones bool `json:"bones"`
|
||||||
Protector bool `json:"protector"`
|
Protector bool `json:"protector"`
|
||||||
XPProtector bool `json:"xpprotector"`
|
XPProtector bool `json:"xpprotector"`
|
||||||
PrivProtector bool `json:"privprotector"`
|
PrivProtector bool `json:"privprotector"`
|
||||||
TechnicQuarry bool `json:"technic_quarry"`
|
TechnicQuarry bool `json:"technic_quarry"`
|
||||||
TechnicSwitch bool `json:"technic_switch"`
|
TechnicSwitch bool `json:"technic_switch"`
|
||||||
TechnicAnchor bool `json:"technic_anchor"`
|
TechnicAnchor bool `json:"technic_anchor"`
|
||||||
TechnicReactor bool `json:"technic_reactor"`
|
TechnicReactor bool `json:"technic_reactor"`
|
||||||
LuaController bool `json:"luacontroller"`
|
LuaController bool `json:"luacontroller"`
|
||||||
Digiterms bool `json:"digiterms"`
|
Digiterms bool `json:"digiterms"`
|
||||||
Digilines bool `json:"digilines"`
|
Digilines bool `json:"digilines"`
|
||||||
Travelnet bool `json:"travelnet"`
|
Travelnet bool `json:"travelnet"`
|
||||||
MapserverPlayer bool `json:"mapserver_player"`
|
MapserverPlayer bool `json:"mapserver_player"`
|
||||||
MapserverPOI bool `json:"mapserver_poi"`
|
MapserverPOI bool `json:"mapserver_poi"`
|
||||||
MapserverLabel bool `json:"mapserver_label"`
|
MapserverLabel bool `json:"mapserver_label"`
|
||||||
MapserverTrainline bool `json:"mapserver_trainline"`
|
MapserverTrainline bool `json:"mapserver_trainline"`
|
||||||
MapserverBorder bool `json:"mapserver_border"`
|
MapserverBorder bool `json:"mapserver_border"`
|
||||||
TileServerLegacy bool `json:"tileserverlegacy"`
|
TileServerLegacy bool `json:"tileserverlegacy"`
|
||||||
Mission bool `json:"mission"`
|
Mission bool `json:"mission"`
|
||||||
Jumpdrive bool `json:"jumpdrive"`
|
Jumpdrive bool `json:"jumpdrive"`
|
||||||
Smartshop bool `json:"smartshop"`
|
Smartshop bool `json:"smartshop"`
|
||||||
Fancyvend bool `json:"fancyvend"`
|
Fancyvend bool `json:"fancyvend"`
|
||||||
ATM bool `json:"atm"`
|
ATM bool `json:"atm"`
|
||||||
Train bool `json:"train"`
|
Train bool `json:"train"`
|
||||||
TrainSignal bool `json:"trainsignal"`
|
TrainSignal bool `json:"trainsignal"`
|
||||||
Minecart bool `json:"minecart"`
|
Minecart bool `json:"minecart"`
|
||||||
Locator bool `json:"locator"`
|
Locator bool `json:"locator"`
|
||||||
Signs bool `json:"signs"`
|
Signs bool `json:"signs"`
|
||||||
MapserverAirutils bool `json:"mapserver_airutils"`
|
MapserverAirutils bool `json:"mapserver_airutils"`
|
||||||
|
UnifiefMoneyAreaForSale bool `json:"um_area_forsale"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebApiConfig struct {
|
type WebApiConfig struct {
|
||||||
|
@ -72,3 +72,7 @@
|
|||||||
* unifieddyes_palette_extended.png
|
* unifieddyes_palette_extended.png
|
||||||
* GPL 2.0
|
* GPL 2.0
|
||||||
* Source: https://gitlab.com/VanessaE/unifieddyes
|
* Source: https://gitlab.com/VanessaE/unifieddyes
|
||||||
|
|
||||||
|
* um_area_forsale_sign_alpha.png
|
||||||
|
* By Gabriel Pérez-Cerezo; AGPL 3.0
|
||||||
|
* Modified from https://github.com/C-C-Minetest-Server/um_area_forsale/blob/main/textures/um_area_forsale_sign.png
|
||||||
|
@ -184,5 +184,10 @@ func Setup(ctx *app.App) {
|
|||||||
l.AddMapObject("default:sign_wall_steel", &SignBlock{Material: "steel"})
|
l.AddMapObject("default:sign_wall_steel", &SignBlock{Material: "steel"})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//For Sale Sign for Unified Money
|
||||||
|
if ctx.Config.MapObjects.UnifiefMoneyAreaForSale {
|
||||||
|
l.AddMapObject("um_area_forsale:for_sale_sign", &UnifiefMoneyAreaForSale{})
|
||||||
|
}
|
||||||
|
|
||||||
ctx.MapBlockAccessor.Eventbus.AddListener(&l)
|
ctx.MapBlockAccessor.Eventbus.AddListener(&l)
|
||||||
}
|
}
|
||||||
|
22
mapobject/um_area_forsale.go
Normal file
22
mapobject/um_area_forsale.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package mapobject
|
||||||
|
|
||||||
|
import (
|
||||||
|
"mapserver/mapobjectdb"
|
||||||
|
"mapserver/types"
|
||||||
|
|
||||||
|
"github.com/minetest-go/mapparser"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UnifiefMoneyAreaForSale struct{}
|
||||||
|
|
||||||
|
func (this *UnifiefMoneyAreaForSale) onMapObject(mbpos *types.MapBlockCoords, x, y, z int, block *mapparser.MapBlock) *mapobjectdb.MapObject {
|
||||||
|
md := block.Metadata.GetMetadata(x, y, z)
|
||||||
|
|
||||||
|
o := mapobjectdb.NewMapObject(mbpos, x, y, z, "um_area_forsale")
|
||||||
|
o.Attributes["owner"] = md["owner"]
|
||||||
|
o.Attributes["id"] = md["id"] // ", " seperated
|
||||||
|
o.Attributes["price"] = md["price"]
|
||||||
|
o.Attributes["description"] = md["description"]
|
||||||
|
|
||||||
|
return o
|
||||||
|
}
|
@ -23,6 +23,7 @@ import TrainOverlay from './overlays/TrainOverlay.js';
|
|||||||
import TrainsignalOverlay from './overlays/TrainsignalOverlay.js';
|
import TrainsignalOverlay from './overlays/TrainsignalOverlay.js';
|
||||||
import SignOverlay from './overlays/SignOverlay.js';
|
import SignOverlay from './overlays/SignOverlay.js';
|
||||||
import AirUtilsPlanesOverlay from "./overlays/AirUtilsPlanesOverlay.js";
|
import AirUtilsPlanesOverlay from "./overlays/AirUtilsPlanesOverlay.js";
|
||||||
|
import UnifiedMoneyAreaForSaleOverlay from './overlays/UnifiedMoneyAreaForSaleOverlay.js';
|
||||||
|
|
||||||
export default function(cfg, map, overlays, wsChannel){
|
export default function(cfg, map, overlays, wsChannel){
|
||||||
|
|
||||||
@ -207,4 +208,11 @@ export default function(cfg, map, overlays, wsChannel){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cfg.mapobjects.um_area_forsale) {
|
||||||
|
overlays.UnifiedMoneyAreaForSale = new UnifiedMoneyAreaForSaleOverlay();
|
||||||
|
if (isDefault("um_area_forsale")) {
|
||||||
|
map.addLayer(overlays.UnifiedMoneyAreaForSale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
29
public/js/map/overlays/UnifiedMoneyAreaForSaleOverlay.js
Normal file
29
public/js/map/overlays/UnifiedMoneyAreaForSaleOverlay.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import AbstractIconOverlay from './AbstractIconOverlay.js';
|
||||||
|
import {HtmlSanitizer} from '../../lib/HtmlSanitizer.js';
|
||||||
|
|
||||||
|
export default AbstractIconOverlay.extend({
|
||||||
|
initialize: function() {
|
||||||
|
AbstractIconOverlay.prototype.initialize.call(this, "um_area_forsale");
|
||||||
|
},
|
||||||
|
|
||||||
|
getMaxDisplayedZoom: function(){
|
||||||
|
return 8;
|
||||||
|
},
|
||||||
|
|
||||||
|
getIcon: function(obj){
|
||||||
|
return L.icon({
|
||||||
|
iconUrl: "pics/um_area_forsale_sign_alpha.png",
|
||||||
|
iconSize: [32, 32],
|
||||||
|
iconAnchor: [16, 16],
|
||||||
|
popupAnchor: [0, -16]
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
createPopup: function(obj){
|
||||||
|
return "<h4>Area for sale</h4><hr>" +
|
||||||
|
"<b>Description:</b> $" + HtmlSanitizer.SanitizeHtml(obj.attributes.description || "N/A") + "<br>" +
|
||||||
|
"<b>Owner:</b> " + HtmlSanitizer.SanitizeHtml(obj.attributes.owner) + "<br>" +
|
||||||
|
"<b>Area IDs:</b> " + HtmlSanitizer.SanitizeHtml(obj.attributes.id) + "<br>" +
|
||||||
|
"<b>Price:</b> $" + HtmlSanitizer.SanitizeHtml(obj.attributes.price) + "<br>";
|
||||||
|
}
|
||||||
|
});
|
BIN
public/pics/um_area_forsale_sign_alpha.png
Normal file
BIN
public/pics/um_area_forsale_sign_alpha.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 239 B |
Loading…
Reference in New Issue
Block a user