Go to the documentation of this file.00001 '''
00002 Anoria (c) Gsk 2010
00003 '''
00004
00005 import BigWorld
00006 import GUI
00007 import Math
00008
00009 import Anoria
00010 from config import consts
00011 from Actor import Actor
00012 from Helpers import TargetCaps
00013 from Resources import ResourceDB as RDB
00014
00015
00016 class Mob(BigWorld.Entity, Actor):
00017
00018 def __init__(self):
00019 BigWorld.Entity.__init__(self)
00020 Actor.__init__(self)
00021
00022
00023
00024
00025
00026 def prerequisites( self ):
00027
00028
00029 return [ RDB.mobs[self.mobDefId].model ]
00030
00031 def onEnterWorld(self, prereqs):
00032
00033
00034
00035
00036
00037
00038
00039 self.targetCaps = [ TargetCaps.CAP_CAN_HIT ]
00040
00041
00042
00043 self.model = BigWorld.Model(RDB.mobs[self.mobDefId].model)
00044 self.buildActionTable()
00045
00046
00047 self.setupActionMatcher()
00048
00049
00050 BigWorld.addShadowEntity( self )
00051
00052
00053 self.filter = BigWorld.AvatarDropFilter()
00054
00055
00056 def onLeaveWorld( self ):
00057
00058
00059
00060
00061 BigWorld.delShadowEntity(self)
00062 self.model = None
00063
00064
00065
00066
00067
00068
00069 def rpcMeleeAttack(self, entityId, hitType, damage):
00070 print 'Mob.rpcMeleeAttack() entityId=%d hitType=%s damage=%d' % (entityId, hitType, damage)
00071
00072 self.model.Attack()
00073 try:
00074 entity=BigWorld.entities[entityId]
00075
00076 BigWorld.callback(0.8, entity.model.Recoil)
00077 except:
00078 print "Avatar.rpcMeleeAttack(): cant find entity for passed in target entityId=%d" % (entityId)
00079
00080
00081 player = BigWorld.player()
00082 text = '%s hits YOU for %d damage (hitType=%d)' % (self.name, damage, hitType)
00083 player.rpc_chatText(text, 2)
00084