jpenilla / squaremap-addons

Various addons for squaremap
12 stars 14 forks source link

[Feature request] Show only certain regions #14

Closed VladOliinyk closed 1 year ago

VladOliinyk commented 2 years ago

Hello there!

I have a little feature request. Possibility to show only specific regions, set up in the config.

I bet you know how the current config looks:

settings:
    control:
        label: Regions
        show: true
        hide-by-default: false
    update-interval: 300
    style:
        stroke:
            color: '#000000'
            weight: 1
            opacity: 0.5
        fill:
            color: '#000000'
            opacity: 0.05
    region:
        tooltip: <span style=\"font-size:120%;\">{regionname}</span><br />" +
        "Owner <span style=\"font-weight:bold;\">{playerowners}</span><br />" +
        "Flags<br /><span style=\"font-weight:bold;\">{flags}</span>

MVP:

In my mind the MVP version of this feature will be something tiny like this:

regions: ["region1_name", "region2_name", "region_whatewer_name"]

So the web map will draw only regions in this list. Pretty straightforward: just compare the entered name from the array with the {regionname} before displaying it on the web.

*Maybe, it will be good also to have some pre-made options, like regions: all instead of typing all the regions the server has.

LVL 2

The extra setting, for each region: Full config idea:

settings:
    control:
        label: Regions
        show: true
        hide-by-default: false
    update-interval: 300
regions:
    first_region_world_guard_name:
        label: "My first region"
        style:
            stroke:
                color: '#000000'
                weight: 1
                opacity: 0.5
            fill:
                color: '#000000'
                opacity: 0.05
        tooltip: <span>{label}</span>
    second_region_world_guard_name:
        label: "My second region"
        style:
            stroke:
                color: '#ff0000'
                weight: 1
                opacity: 1
            fill:
                color: '#ff0000'
                opacity: 0.05
        tooltip: <span>{label}</span>

So the main idea is to separate the style and tooltip setting for each WG region.


I hope it is not really hard to implement and that you guys would have time for this feature. I bet this thing is useful because for me, on every server are so many tiny regions that are only related to the admin things, and are generally useless for normal players and can create a mess on a webpage.

Cheers <3

Phoenix616 commented 1 year ago

In my mind both, a whitelist and a blacklist functionality would probably good. As in some cases you might want to show dynamically created regions but not specific ones that overlap everything. (See this map)

VladOliinyk commented 1 year ago

See this map

yap, agree. Such maps look really a bit messy, and the informativeness of such a map is questionable

jpenilla commented 1 year ago

Whitelist/blacklist is added in https://github.com/jpenilla/squaremap-addons/commit/fd3adac556c91bcab52692f9aed076a74b7aeb67

I'll open a new issue for per-region style options

VladOliinyk commented 1 year ago

Dude, that’s awesome! Here we gooo

Thanks for the update!