home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 56 / CDPowerplay56Disc2.iso / demos / blade / data1.cab / Program_Executable_Files / Lib / heavyObjects.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-10-27  |  4.2 KB  |  94 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Bladex
  5. import math
  6. import SolidMask
  7. import Blood
  8. import Reference
  9. import Actions
  10. import Breakings
  11. MESSAGE_START_WEAPON = 7
  12. MESSAGE_STOP_WEAPON = 8
  13.  
  14. def levanteseHombre():
  15.     char = Bladex.GetEntity('Player1')
  16.     char.LaunchAnmType('Rlx')
  17.     Bladex.GetEntity('Camera').SetPersonView('Player1')
  18.     cam = Bladex.GetEntity('Camera')
  19.     cam.SetPersonView('Player1')
  20.     cam.Cut()
  21.  
  22.  
  23. def StoneStopFuncHitEvent(ent):
  24.     ent = Bladex.GetEntity(ent)
  25.     ent.ExclusionMask = ent.ExclusionMask & ~(SolidMask.EX_PERSON)
  26.  
  27.  
  28. def StoneHitEvent(EntityName, VictimName, ImpX, ImpY, ImpZ):
  29.     ent = Bladex.GetEntity(VictimName)
  30.     if ent.Person:
  31.         dir = (ImpX, ImpY, ImpZ)
  32.         size = math.sqrt(ImpX * ImpX + ImpY * ImpY + ImpZ * ImpZ)
  33.         if size > 0.1:
  34.             dirn = (dir[0] / size, dir[1] / size, dir[2] / size)
  35.             ang = math.asin(dirn[0])
  36.             if dirn[2] < 0.0:
  37.                 ang = ang + 3.1415
  38.             
  39.             char = Bladex.GetEntity('Player1')
  40.             difang = ang - char.Angle
  41.             difang = abs(difang - int(difang / 6.28) * 6.28)
  42.             ent.Life = -1
  43.             if difang < 3.14 * 0.5 or difang > 3.14 * 1.5:
  44.                 ent.SetTmpAnmFlags(1, 1, 1, 0, 5, 1, 0)
  45.                 ent.Wuea = Reference.WUEA_ENDED
  46.                 ent.LaunchAnmType('dth_rock')
  47.             else:
  48.                 ent.SetTmpAnmFlags(1, 1, 1, 0, 5, 1, 0)
  49.                 ent.Wuea = Reference.WUEA_ENDED
  50.                 ent.LaunchAnmType('dth_rockfront')
  51.             if VictimName != 'Player1':
  52.                 oname = ent.InvLeft
  53.                 Actions.RemoveFromInventory(ent, Bladex.GetEntity(ent.InvLeft), 0)
  54.                 Breakings.ExplodeSpecialObject(oname, 10000)
  55.                 oname = ent.InvRight
  56.                 Actions.RemoveFromInventory(ent, Bladex.GetEntity(ent.InvRight), 0)
  57.                 Breakings.ExplodeSpecialObject(oname, 10000)
  58.             
  59.             charPos = ent.Position
  60.             Blood.BleedingImpact(ent, charPos[0], charPos[1], charPos[2], 9999, 0, 0, None, 0, 0, 0, 0, 0, 0)
  61.             Blood.BleedingImpact(ent, charPos[0], charPos[1], charPos[2], 9999, 0, 9999, None, 0, 0, 0, 0, 0, 0)
  62.             Blood.BleedingImpact(ent, charPos[0], charPos[1], charPos[2], 3333, 0, 0, None, 0, 0, 0, 0, 0, 0)
  63.             Blood.BleedingImpact(ent, charPos[0], charPos[1], charPos[2], 9999, 0, 3333, None, 0, 0, 0, 0, 0, 0)
  64.             Blood.BleedingImpact(ent, charPos[0], charPos[1], charPos[2], 0, 0, 3333, None, 0, 0, 0, 0, 0, 0)
  65.             Blood.BleedingImpact(ent, charPos[0], charPos[1], charPos[2], 0, 0, 9999, None, 0, 0, 0, 0, 0, 0)
  66.             Blood.BleedingImpact(ent, charPos[0], charPos[1], charPos[2], 0, 0, 0, None, 0, 0, 0, 0, 0, 0)
  67.             pedrolo = Bladex.GetEntity(EntityName)
  68.             x = -(pedrolo.Mass) * 1e-006 * ImpX
  69.             y = -3500.0 * pedrolo.Mass
  70.             z = -(pedrolo.Mass) * 1e-006 * ImpZ
  71.             pedrolo.Impulse(x, y, z)
  72.             Bladex.AddScheduledFunc(Bladex.GetTime() + 0.0, RestoreInflictHitFunc, (pedrolo,))
  73.         
  74.     
  75.  
  76.  
  77. def RestoreInflictHitFunc(o):
  78.     o.ExclusionMask = o.ExclusionMask | SolidMask.EX_PERSON
  79.     o.MessageEvent(MESSAGE_START_WEAPON, 0, 0)
  80.     o.InflictHitFunc = StoneHitEvent
  81.  
  82.  
  83. def CreateHeavyObject(name, objtype, positionVec, orientationQuat, fScale, hitfunc):
  84.     o = Bladex.CreateEntity(name, objtype, positionVec[0], positionVec[1], positionVec[2])
  85.     o.Scale = fScale
  86.     o.Orientation = orientationQuat
  87.     o.Weapon = 1
  88.     o.ExclusionMask = o.ExclusionMask | SolidMask.EX_PERSON
  89.     o.MessageEvent(MESSAGE_START_WEAPON, 0, 0)
  90.     o.InflictHitFunc = hitfunc
  91.     o.OnStopFunc = StoneStopFuncHitEvent
  92.     return o
  93.  
  94.