Ahtenus / minecraft-init

Init script for minecraft and bukkit servers
404 stars 125 forks source link

filterFunction efficiency/usability #97

Closed lauxley closed 11 years ago

lauxley commented 11 years ago

Hi, i am trying to use Signs from the world to display different markers group on the map, but the current implementation doesn't allow me to do it easily, unless i am missing something obvious ?

this is how i am doing it right now


def signFilter(poi):
    town_list = ['\nKEBAB\nHARISSA\n', '\nMozafouka\n\n', '\nTSALTHGIN\n\n', 'welcome to\n\nSANDFALL\n', '\nEnderbourg\n\n', '\nFUNKY\nFAELJK\n']
    if poi['id'] == 'Sign':
        #print dict(poi)
        text =  "\n".join([poi['Text1'], poi['Text2'], poi['Text3'], poi['Text4']])
        if text not in town_list:
                return text

def townFilter(poi):
        town_list = ['\nKEBAB\nHARISSA\n', '\nMozafouka\n\n', '\nTSALTHGIN\n\n', 'welcome to\n\nSANDFALL\n', '\nEnderbourg\n\n', '\nFUNKY\nFAELJK\n'\
]
        if poi['id'] == 'Sign':
                text = "\n".join([poi['Text1'], poi['Text2'], poi['Text3'], poi['Text4']])
                if text in town_list:
                        poi['icon'] = 'SR-mapicon-Town.png'
                        return text

def playerIcons(poi):
    if poi['id'] == 'Player':
        poi['icon'] = 'avatar.png'
        return poi['EntityId']

renders["render1"] = {
        'world': 'PsshBam',
        'title': 'A regular render',
        'rendermode' : smooth_lighting,
        'forcerender':True,
        'markers':[     dict(name="Towns", filterFunction=townFilter, checked=True),
                        dict(name="Signs", filterFunction=signFilter, checked=False),
]
}
lauxley commented 11 years ago

sorry posted this by mistake