Exemplo n.º 1
0
def _add_custom_multi(w):
    for mp in get_all_packages_paths():
        d = os.path.join(mp, "multi")
        if os.path.isdir(d):
            for n in os.listdir(d):
                p = os.path.join(d, n)
                if os.path.normpath(p) not in (os.path.normpath(x.mapfile) for x in w):
                    w.append(Map(p, None))
Exemplo n.º 2
0
 def available_mods():
     result = []
     for path in get_all_packages_paths():
         mods_path = os.path.join(path, "mods")
         for mod in os.listdir(mods_path):
             if os.path.isdir(os.path.join(mods_path, mod)) \
                and mod not in result and mod not in mods:
                 result.append(mod)
     return result
Exemplo n.º 3
0
def _add_custom_multi(w):
    for mp in get_all_packages_paths():
        d = os.path.join(mp, "multi")
        if os.path.isdir(d):
            for n in os.listdir(d):
                p = os.path.join(d, n)
                if os.path.normpath(p) not in (os.path.normpath(x.mapfile)
                                               for x in w):
                    w.append(Map(p, None))
Exemplo n.º 4
0
def _get_campaigns():
    w = []
    for mp in get_all_packages_paths():
        d = os.path.join(mp, "single")
        if os.path.isdir(d):
            for n in os.listdir(d):
                p = os.path.join(d, n)
                if os.path.isdir(p):
                    if n == "campaign":
                        w.append(Campaign(p, [4267]))
                    else:
                        w.append(Campaign(p))
    return w
Exemplo n.º 5
0
 def update_mods_list(self):
     self.mods = []
     self.mods.append("res") # "vanilla mod"
     for p in config.mods.split(","):
         p = p.strip()
         if p:
             mod_found = False
             # get_all_packages_paths() is reversed so the latest path
             # takes precedence over the previous ones.  
             for root in reversed(get_all_packages_paths()):
                 path = os.path.join(root, "mods", p)
                 if os.path.exists(path):
                     self.mods.append(path)
                     mod_found = True
                     break
             if not mod_found:
                 mods = config.mods.split(",")
                 mods.remove(p)
                 config.mods = ",".join(mods)
                 self.alerts.append([1029, 4330, p])
Exemplo n.º 6
0
 def update_mods_list(self):
     self.mods = []
     self.mods.append("res")  # "vanilla mod"
     for p in config.mods.split(","):
         p = p.strip()
         if p:
             mod_found = False
             # get_all_packages_paths() is reversed so the latest path
             # takes precedence over the previous ones.
             for root in reversed(get_all_packages_paths()):
                 path = os.path.join(root, "mods", p)
                 if os.path.exists(path):
                     self.mods.append(path)
                     mod_found = True
                     break
             if not mod_found:
                 mods = config.mods.split(",")
                 mods.remove(p)
                 config.mods = ",".join(mods)
                 self.alerts.append([1029, 4330, p])