def check_lockedness(self, t): u.active(t) if u.isType('PlayerControlObject'): locked = int(u.templateProperty('dontclearteamonexit')) self.check_mixed_lockedness(t, locked) return 1, locked return 0, 0
def check_mixed_lockedness(self, t, expect): u.active(t) subs = [] for s in u.walkTemplate(): subs.append(s) for s in subs: is_pco, is_locked = self.check_lockedness(s) if is_pco and is_locked != expect: self.log('!!! vehicle error: PCO', s, 'attached to', t, 'has mixed lockedness')
def checkmap(self): for spawner in bf2.objectManager.getObjectsOfType('dice.hfe.world.ObjectTemplate.ObjectSpawner'): u.active(spawner.templateName) script = u.printScriptTillItFuckingWorks() parser = ConParser() parser.run_string(script) if len(parser.templates) != 1: print 'parse failed for template script', spawner.templateName, ':' print script continue template = parser.templates[0] is_locked = int(template.properties.get('objecttemplate.teamonvehicle', [['0']])[0][0]) assert template.name.lower() == spawner.templateName.lower() l = template.properties.get('objecttemplate.setobjecttemplate', []) for team, object in l: needs_lock = self.is_locked_vehicle(object) if is_locked and needs_lock: continue if needs_lock and not is_locked: self.log('!!! map error: vehicle', object, 'needs locking -- spawner', spawner.templateName, 'is incorrect') if is_locked and not needs_lock: self.log('!!! map error: spawner', spawner.templateName, 'is locked but vehicle', object, 'does not support this')
def is_locked_vehicle(self, t): u.active(t) is_pco, is_locked = self.check_lockedness(t) return is_locked