def announceGenerate(self): entnum = self.cEntity.getBspEntnum() suitId = self.getEntityValueInt("suitPlan") suitPlan = SuitBank.getSuitById(suitId) level = self.getEntityValueInt("level") variant = self.getEntityValueInt("variant") self.b_setLevel(level) self.b_setSuit(suitPlan, variant) self.b_setPlace(self.zoneId) self.b_setName(suitPlan.getName()) self.setPos(self.cEntity.getOrigin()) self.setHpr(self.cEntity.getAngles()) pos = self.getPos() hpr = self.getHpr() self.d_setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2]) DistributedEntityAI.announceGenerate(self) DistributedSuitAI.announceGenerate(self) self.stopAI() self.b_setParent(CIGlobals.SPRender) taskMgr.add(self.monitorHealth, self.uniqueName('monitorHealth')) self.startPosHprBroadcast() spawnflags = self.getEntityValueInt("spawnflags") if spawnflags & self.StartsActive: self.Activate()
def announceGenerate(self): DistributedSuitAI.announceGenerate(self) self.stopAI() self.b_setParent(CIGlobals.SPRender) self.startPosHprBroadcast() taskMgr.add(self.monitorHealth, self.uniqueName('monitorHealth')) self.setState('guard')
def __init__(self, air, index, tut, avatarId): DistributedSuitAI.__init__(self, air) self.tutPartIndex = index self.tutorial = tut self.avatarId = avatarId self.currentPath = None self.walkTrack = None
def __init__(self, air, mg): DistributedSuitAI.__init__(self, air) self.mg = mg self.truck = random.choice(self.mg.getTrucksWithBarrels()) self.truckIndex = self.truck.getIndex() self.spawnPoint = None self.holdingBarrel = False self.track = None
def delete(self): self.stopPosHprBroadcast() del self.isChair self.fsm.requestFinalState() del self.fsm del self.battle del self.stateExtraArgs DistributedSuitAI.delete(self)
def delete(self): del self.currentFlyPoint del self.mg if self.flyTrack: self.ignore(self.flyTrack.getDoneEvent()) self.flyTrack.pause() self.flyTrack = None DistributedSuitAI.delete(self)
def __init__(self, air, planner, bldg, doorDoId): DistributedSuitAI.__init__(self, air) self.planner = planner self.bldg = bldg self.doorDoId = doorDoId self.takeOverTrack = None self.state = 'off' self.stateTimestamp = 0 self.setAllowHits(False)
def delete(self): base.taskMgr.remove(self.uniqueName('finishSuit')) if hasattr(self, 'walkTrack') and self.walkTrack: self.ignore(self.walkTrack.getDoneEvent()) self.walkTrack.finish() self.walkTrack = None self.mg = None self.truck = None self.truckIndex = None self.spawnPoint = None DistributedSuitAI.delete(self)
def delete(self): base.taskMgr.remove(self.uniqueName('monitorHealth')) base.taskMgr.remove(self.uniqueName('doAttack')) base.taskMgr.remove(self.uniqueName('scwaa')) self.stopAttacks() if self.track: self.track.pause() self.track = None if self.walkTrack: self.walkTrack.pause() self.walkTrack = None if self.currentPath: self.currentPath = None self.tutorial = None self.tutPartIndex = None self.avatarId = None DistributedSuitAI.delete(self)
def monitorHealth(self, task): if not hasattr(self, 'battle') or hasattr( self, 'battle') and self.battle is None: return task.done if self.isDead(): self.battle.suitHPAtZero(self.doId) return DistributedSuitAI.monitorHealth(self, task)
def monitorHealth(self, task): ret = DistributedSuitAI.monitorHealth(self, task) if self.isDead(): try: self.vp.suitDie() except: pass return task.done return ret
def monitorHealth(self, task): if self.isDead(): # No! I'm dead! I lost my building! self.bldg.takenBySuit = False self.sendUpdate('interruptTakeOver') if self.takeOverTrack: self.takeOverTrack.pause() self.takeOverTrack = None return DistributedSuitAI.monitorHealth(self, task)
def __init__(self, air, battle, spawnData, hangoutData, isChair, hood): DistributedSuitAI.__init__(self, air) self.hood = hood self.battle = battle self.battleDoId = self.battle.doId self.flyToPoint = None self.hangoutData = hangoutData self.floorSection = spawnData[0] self.initPoint = spawnData[1] if isChair: self.flyToPoint = spawnData[2] flyToPoint = spawnData[2] self.isChair = isChair self.fsm = ClassicFSM.ClassicFSM('DistributedCogOfficeSuitAI', [ State.State('off', self.enterOff, self.exitOff), State.State('guard', self.enterGuard, self.exitGuard, ['think']), State.State('think', self.enterThink, self.exitThink, ['off']) ], 'off', 'off') self.fsm.enterInitialState() self.stateExtraArgs = [] if isChair: self.chairPoint = [(self.initPoint[0], self.initPoint[1], self.initPoint[2]), self.initPoint[3]] else: self.chairPoint = [(0, 0, 0), 0] if isChair: self.guardPoint = [(flyToPoint[0], flyToPoint[1], flyToPoint[2]), flyToPoint[3]] else: self.guardPoint = [(self.initPoint[0], self.initPoint[1], self.initPoint[2]), self.initPoint[3]] if hangoutData[0]: self.hangoutPoint = [ 1, (hangoutData[1][0], hangoutData[1][1], hangoutData[1][2]), hangoutData[2][0] ] else: self.hangoutPoint = [0, (0, 0, 0), 0]
def announceGenerate(self): entnum = self.cEntity.getBspEntnum() suitId = self.getEntityValueInt("suitPlan") suitPlan = SuitBank.getSuitById(suitId) level = self.getEntityValueInt("level") variant = self.getEntityValueInt("variant") self.b_setLevel(level) self.b_setSuit(suitPlan, variant) self.b_setPlace(self.zoneId) self.b_setName(suitPlan.getName()) attackNames = self.getEntityValue("attacklist") if len(attackNames) > 0: attackNames = attackNames.split(';') attackIds = [] for name in attackNames: attackIds.append(AttackEnum[name]) self.b_setAttackIds(attackIds) #hp = self.getEntityValueInt("health") #if hp != -1: # self.b_setMaxHealth(hp) # self.b_setHealth(hp) self.setPos(self.cEntity.getOrigin()) self.setHpr(self.cEntity.getAngles()) pos = self.getPos() hpr = self.getHpr() self.d_setPosHpr(pos[0], pos[1], pos[2], hpr[0], hpr[1], hpr[2]) DistributedSuitAI.announceGenerate(self) self.stopAI() #self.b_setParent(CIGlobals.SPRender) taskMgr.add(self.monitorHealth, self.uniqueName('monitorHealth')) self.startPosHprBroadcast() if self.spawnflags & self.StartsActive: self.Activate()
def resetFwdSpeed(self): DistributedSuitAI.resetFwdSpeed(self) self.motor.fwdSpeed *= self.getEntityValueFloat("speedMod")
def __init__(self, air, vp): DistributedSuitAI.__init__(self, air) BaseVPEnemy.__init__(self, vp)
def delete(self): taskMgr.remove(self.uniqueName('monitorHealth')) DistributedSuitAI.delete(self) self.battleZone = None
def monitorHealth(self, task): ret = DistributedSuitAI.monitorHealth(self, task) if self.isDead(): self.dispatchOutput("OnDie") return task.done return ret
def Spawn(self, dept = None): from src.coginvasion.cog.DistributedSuitAI import DistributedSuitAI from src.coginvasion.cog import Dept, SuitBank, Variant from src.coginvasion.arcade.BatchCogSpawnerAI import BatchCogSpawnerAI import random level, availableSuits = SuitBank.chooseLevelAndGetAvailableSuits( [1, 4], random.choice([Dept.BOSS, Dept.SALES, Dept.CASH, Dept.LAW]) if not dept else dept, False) plan = random.choice(availableSuits) suit = DistributedSuitAI(self.air) suit.setPos(self.cEntity.getOrigin()) suit.setHpr(self.cEntity.getAngles()) suit.setBattleZone(self.dispatch) variant = Variant.NORMAL suit.setLevel(level) suit.setSuit(plan, variant) suit.generateWithRequired(self.dispatch.zoneId) #suit.d_setHood(suit.hood) suit.b_setPlace(self.dispatch.zoneId) suit.b_setName(plan.getName()) suit.spawnGeneric() self.spawned.append(suit) if self.hasSpawnFlags(self.DoSupaFlyIn): suit.changeSchedule(suit.getScheduleByName("SUPA_FLY_IN_MOVE")) if self.spawnScript: self.spawnScript.ExecuteScript(suit) BatchCogSpawnerAI.NumSuits += 1 self.dispatchOutput("OnSpawnCog") return suit
def __init__(self, air, dispatch): DistributedSuitAI.__init__(self, air) self.setDispatch(dispatch) self.setBattleZone(dispatch)
def delete(self): if self.takeOverTrack: self.takeOverTrack.pause() self.takeOverTrack = None DistributedSuitAI.delete(self)
def createSuit(self, anySuit = 0, levelRange = None, variant = Variant.NORMAL, plan = None): if self.isCogCountFull(): return if anySuit: if not levelRange: levelRange = CogBattleGlobals.HoodIndex2LevelRange[self.battle.getHoodIndex()] availableSuits = [] level = random.choice(levelRange) for suit in SuitBank.getSuits(): if level >= suit.getLevelRange()[0] and level <= suit.getLevelRange()[1]: availableSuits.append(suit) plan = random.choice(availableSuits) else: if not plan: return level = random.randint(plan.getLevelRange()[0], plan.getLevelRange()[1]) if self.battle.getHoodIndex() == CogBattleGlobals.SkeletonHoodIndex and variant == Variant.NORMAL: variant = Variant.SKELETON elif self.battle.getHoodIndex() == CogBattleGlobals.WaiterHoodIndex and variant == Variant.NORMAL: variant = Variant.WAITER suit = DistributedSuitAI(self.air) suit.setManager(self) suit.generateWithRequired(self.zoneId) suit.d_setHood(suit.hood) suit.b_setLevel(level) suit.b_setSuit(plan, variant) suit.b_setPlace(self.zoneId) if variant == Variant.SKELETON: suit.b_setName(CIGlobals.Skelesuit) else: suit.b_setName(plan.getName()) #suit.startPosHprBroadcast() #suit.d_clearSmoothing() #suit.d_broadcastPosHpr() suit.b_setParent(CIGlobals.SPHidden) self.suits[suit.doId] = suit self.numSuits += 1 if self.numSuits == 1: if (self.tournament.inTournament and self.tournament.getRound() == 1 or not self.tournament.inTournament): self.sendUpdate('newSuit', []) if self.tournament.inTournament and self.tournament.getRound() == 1: self.sendUpdate('tournamentSpawned', []) if self.getActiveInvasion(): self.suitsSpawnedThisInvasion += 1 if self.suitsSpawnedThisInvasion == 1: if not self.tournament.inTournament: self.sendUpdate('invasionSpawned', []) if plan in [SuitBank.VicePresident, SuitBank.LucyCrossbill]: self.sendUpdate('bossSpawned', []) return suit
def setSuit(self, plan, variant=0): DistributedSuitAI.setSuit(self, plan, variant, self.tutorial)
def closeSuit(self): DistributedSuitAI.closeSuit(self) self.tutorial.sendUpdateToAvatarId(self.avatarId, 'suitExploded', [self.tutPartIndex])
def __init__(self, air, dispatch): DistributedEntityAI.__init__(self, air, dispatch) DistributedSuitAI.__init__(self, air) self.setBattleZone(dispatch) dispatch.suits.append(self)
def __init__(self, air): DistributedSuitAI.__init__(self, air) self.mg = None self.flyTrack = None self.currentFlyPoint = None self.flySpeed = 0.0
def delete(self): BaseVPEnemy.delete(self) DistributedSuitAI.delete(self)