home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 56 / CDPowerplay56Disc2.iso / demos / blade / data1.cab / Program_Executable_Files / Lib / heavyObjects.py < prev    next >
Encoding:
Text File  |  2000-10-27  |  4.0 KB  |  124 lines

  1. #######################################################################
  2. #
  3. # Nam: heavyObjects.py
  4. #
  5. # Com: objetos que aplastan
  6. #
  7. # Ath: Yui0
  8. #
  9. #######################################################################
  10.  
  11. import Bladex
  12. import math
  13. import SolidMask
  14. import Blood
  15. import Reference
  16. import Actions
  17. import Breakings
  18.  
  19. MESSAGE_START_WEAPON=7                                
  20. MESSAGE_STOP_WEAPON=8                                
  21.  
  22. def levanteseHombre():
  23.     char=Bladex.GetEntity("Player1")
  24.     char.LaunchAnmType("Rlx")
  25.     Bladex.GetEntity("Camera").SetPersonView("Player1")
  26.     cam = Bladex.GetEntity("Camera")    
  27.     cam.SetPersonView("Player1")
  28.     cam.Cut()
  29.  
  30. def StoneStopFuncHitEvent(ent):
  31.     #print("quita la mascara")
  32.     ent = Bladex.GetEntity(ent)
  33.     ent.ExclusionMask = ent.ExclusionMask & (~SolidMask.EX_PERSON)
  34.  
  35. def StoneHitEvent(EntityName, VictimName, ImpX, ImpY, ImpZ):
  36.     #print("nos hundimos!!: entname:%s victimname:%s x:%f y:%f z:%f"%(EntityName, VictimName, ImpX, ImpY, ImpZ))
  37.  
  38.     ent = Bladex.GetEntity ( VictimName )
  39.     if (ent.Person):
  40.         dir = ImpX, ImpY, ImpZ
  41.  
  42.         size = math.sqrt(ImpX*ImpX + ImpY*ImpY + ImpZ*ImpZ)    
  43.         if (size>0.1) :
  44.             #print("lleva suficiente fuerza como para matar a alguien")
  45.             dirn = dir[0]/size , dir[1]/size , dir[2]/size
  46.             ang = math.asin(dirn[0])
  47.             if (dirn[2]<0.0) : ang=ang+3.1415
  48.  
  49.             char = Bladex.GetEntity("Player1")
  50.             difang = ang - char.Angle
  51.             difang = abs( difang - int(difang/6.28)*6.28 )
  52.  
  53.             #print("b:%f c:%f d:%f"%(ang, char.Angle, difang))
  54.             
  55.             ent.Life=-1
  56.             
  57.             if (difang<(3.14*0.5) or difang>(3.14*1.5)):
  58.                 #print("se cae pa lante")
  59.                 ent.SetTmpAnmFlags(1,1,1,0,5,1,0)
  60.                 ent.Wuea=Reference.WUEA_ENDED
  61.                 ent.LaunchAnmType("dth_rock")
  62.             else:
  63.                 #print("se cae pa atras")
  64.                 ent.SetTmpAnmFlags(1,1,1,0,5,1,0)
  65.                 ent.Wuea=Reference.WUEA_ENDED                
  66.                 ent.LaunchAnmType("dth_rockfront")
  67.  
  68.             #if VictimName=="Player1":
  69.             #    Bladex.GetEntity("Camera").TType=0
  70.             #    Bladex.AddScheduledFunc(Bladex.GetTime()+3.0, levanteseHombre, ())
  71.             #
  72.             
  73.             if VictimName!="Player1":
  74.                 oname = ent.InvLeft
  75.                 Actions.RemoveFromInventory(ent,Bladex.GetEntity(ent.InvLeft),0)
  76.                 Breakings.ExplodeSpecialObject(oname,10000)
  77.     
  78.                 oname = ent.InvRight
  79.                 Actions.RemoveFromInventory(ent,Bladex.GetEntity(ent.InvRight),0)
  80.                 Breakings.ExplodeSpecialObject(oname,10000)
  81.  
  82.             #print("sangre")
  83.             charPos = ent.Position            
  84.             Blood.BleedingImpact(ent , charPos[0], charPos[1], charPos[2],9999,0,0,None,0,0,0,0,0,0)
  85.             Blood.BleedingImpact(ent , charPos[0], charPos[1], charPos[2],9999,0,9999,None,0,0,0,0,0,0)
  86.             Blood.BleedingImpact(ent , charPos[0], charPos[1], charPos[2],3333,0,0,None,0,0,0,0,0,0)
  87.             Blood.BleedingImpact(ent , charPos[0], charPos[1], charPos[2],9999,0,3333,None,0,0,0,0,0,0)
  88.             Blood.BleedingImpact(ent , charPos[0], charPos[1], charPos[2],0,0,3333,None,0,0,0,0,0,0)
  89.             Blood.BleedingImpact(ent , charPos[0], charPos[1], charPos[2],0,0,9999,None,0,0,0,0,0,0)
  90.             Blood.BleedingImpact(ent , charPos[0], charPos[1], charPos[2],0,0,0,None,0,0,0,0,0,0)
  91.  
  92.             #print("impulso")
  93.             pedrolo = Bladex.GetEntity(EntityName)
  94.             x = -pedrolo.Mass*0.000001*ImpX
  95.             y = -3500.0*pedrolo.Mass
  96.             z = -pedrolo.Mass*0.000001*ImpZ
  97.             #print(pedrolo.Mass)
  98.             #print((x,y,z))
  99.             pedrolo.Impulse(x,y,z)
  100.  
  101.             ##print("borra")
  102.             #stone.unlock(EntityName) 
  103.             #bolon.SubscribeToList("Pin")
  104.  
  105.             ##print("ok")
  106.             Bladex.AddScheduledFunc(Bladex.GetTime()+0.0, RestoreInflictHitFunc,(pedrolo,))
  107.  
  108. def RestoreInflictHitFunc(o):
  109.     o.ExclusionMask = o.ExclusionMask | SolidMask.EX_PERSON
  110.     o.MessageEvent(MESSAGE_START_WEAPON,0,0)    
  111.     o.InflictHitFunc    = StoneHitEvent            
  112.  
  113. def CreateHeavyObject(name,objtype,positionVec,orientationQuat,fScale, hitfunc ):
  114.     o=Bladex.CreateEntity(name,objtype,positionVec[0],positionVec[1],positionVec[2])
  115.     o.Scale=fScale
  116.     o.Orientation=orientationQuat
  117.     o.Weapon = 1
  118.     o.ExclusionMask = o.ExclusionMask | SolidMask.EX_PERSON
  119.     o.MessageEvent(MESSAGE_START_WEAPON,0,0)    
  120.     o.InflictHitFunc    = hitfunc
  121.     o.OnStopFunc        = StoneStopFuncHitEvent    
  122.  
  123.     return o
  124.