Fork 20240605 um area forsale (#379)
* Add For Sale Sings for Unified Money * Change popup and icon size * Revert icon size * Add For Sale Sign into searches * Fix syntax * Minor display change * Skip unconfigured for sale signs --------- Co-authored-by: 1F616EMO <root@1f616emo.xyz>
This commit is contained in:
parent
a7bf46e9e9
commit
dc5a401d8b
@ -88,6 +88,7 @@ func ParseConfig(filename string) (*Config, error) {
|
|||||||
Locator: false,
|
Locator: false,
|
||||||
Signs: true,
|
Signs: true,
|
||||||
MapserverAirutils: true,
|
MapserverAirutils: true,
|
||||||
|
UnifiefMoneyAreaForSale: true,
|
||||||
Phonograph: true,
|
Phonograph: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ type MapObjectConfig struct {
|
|||||||
Signs bool `json:"signs"`
|
Signs bool `json:"signs"`
|
||||||
MapserverAirutils bool `json:"mapserver_airutils"`
|
MapserverAirutils bool `json:"mapserver_airutils"`
|
||||||
Phonograph bool `json:"phonograph"`
|
Phonograph bool `json:"phonograph"`
|
||||||
|
UnifiefMoneyAreaForSale bool `json:"um_area_forsale"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebApiConfig struct {
|
type WebApiConfig struct {
|
||||||
|
@ -76,3 +76,7 @@
|
|||||||
* phonograph_node_temp.png
|
* phonograph_node_temp.png
|
||||||
* License: CC By-SA 4.0
|
* License: CC By-SA 4.0
|
||||||
* Source: [phonograph](https://github.com/C-C-Minetest-Server/phonograph/)
|
* Source: [phonograph](https://github.com/C-C-Minetest-Server/phonograph/)
|
||||||
|
|
||||||
|
* 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
|
||||||
|
@ -197,5 +197,10 @@ func Setup(ctx *app.App) {
|
|||||||
l.AddMapObject("phonograph:phonograph", &Phonograph{})
|
l.AddMapObject("phonograph:phonograph", &Phonograph{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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)
|
||||||
}
|
}
|
||||||
|
26
mapobject/um_area_forsale.go
Normal file
26
mapobject/um_area_forsale.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
|
if _, ok := md["id"]; !ok {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
@ -30,7 +30,8 @@ function search(query){
|
|||||||
searchFor("locator", "name", query),
|
searchFor("locator", "name", query),
|
||||||
searchFor("label", "text", query),
|
searchFor("label", "text", query),
|
||||||
searchFor("digiterm", "display_text", query),
|
searchFor("digiterm", "display_text", query),
|
||||||
searchFor("digilinelcd", "text", query)
|
searchFor("digilinelcd", "text", query),
|
||||||
|
searchFor("um_area_forsale", "description", query)
|
||||||
];
|
];
|
||||||
|
|
||||||
Promise.all(prom_list)
|
Promise.all(prom_list)
|
||||||
|
@ -88,6 +88,12 @@ export default {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For Sale Sign
|
||||||
|
if (obj.type == "um_area_forsale"){
|
||||||
|
description = m("span", obj.attributes.description || "No Description");
|
||||||
|
type = m("img", { src: "pics/um_area_forsale_sign_alpha.png" });
|
||||||
|
}
|
||||||
|
|
||||||
//shop
|
//shop
|
||||||
if (obj.type == "shop") {
|
if (obj.type == "shop") {
|
||||||
if (obj.attributes.stock == 0){
|
if (obj.attributes.stock == 0){
|
||||||
|
@ -24,6 +24,7 @@ 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 PhonographOverlay from "./overlays/PhonographOverlay.js";
|
import PhonographOverlay from "./overlays/PhonographOverlay.js";
|
||||||
|
import UnifiedMoneyAreaForSaleOverlay from './overlays/UnifiedMoneyAreaForSaleOverlay.js';
|
||||||
|
|
||||||
export default function(cfg, map, overlays, wsChannel){
|
export default function(cfg, map, overlays, wsChannel){
|
||||||
|
|
||||||
@ -210,8 +211,15 @@ export default function(cfg, map, overlays, wsChannel){
|
|||||||
|
|
||||||
if (cfg.mapobjects.phonograph) {
|
if (cfg.mapobjects.phonograph) {
|
||||||
overlays.Phonographs = new PhonographOverlay();
|
overlays.Phonographs = new PhonographOverlay();
|
||||||
if (isDefault("phonograph")) {
|
if (isDefault("Phonographs")) {
|
||||||
map.addLayer(overlays.Phonographs);
|
map.addLayer(overlays.Phonographs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cfg.mapobjects.um_area_forsale) {
|
||||||
|
overlays["Area For Sale"] = new UnifiedMoneyAreaForSaleOverlay();
|
||||||
|
if (isDefault("Area For Sale")) {
|
||||||
|
map.addLayer(overlays["Area For Sale"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
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 () {
|
||||||
|
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>" +
|
||||||
|
"<h5>" + HtmlSanitizer.SanitizeHtml(obj.attributes.description || "No Description") + "</h5><hr>" +
|
||||||
|
"<b>Owner:</b> " + HtmlSanitizer.SanitizeHtml(obj.attributes.owner) + "<br>" +
|
||||||
|
"<b>Area ID(s):</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