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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Bladex
  5. import math
  6. Evaporation = 0
  7. AfterCreateBlood = None
  8.  
  9. def BloodPrtlHit(prtl_name, hit_entity, x, y, z, vx, vy, vz, wcx, wcy, wcz, wdx, wdy, wdz):
  10.     p = Bladex.CreateEntity('BloodPool', 'Entity Pool', x, y, z)
  11.     if Evaporation:
  12.         p.DeathTime = Bladex.GetTime() + 50.0
  13.     
  14.     if AfterCreateBlood:
  15.         AfterCreateBlood(x, y, z)
  16.     
  17.  
  18.  
  19. def GreenBloodPrtlHit(prtl_name, hit_entity, x, y, z, vx, vy, vz, wcx, wcy, wcz, wdx, wdy, wdz):
  20.     p = Bladex.CreateEntity('BloodPool', 'Entity Pool', x, y, z)
  21.     p.Color = (96, 192, 96)
  22.     p.DeepColor = (64, 128, 64)
  23.     if Evaporation:
  24.         p.DeathTime = Bladex.GetTime() + 50.0
  25.     
  26.     smoke = Bladex.CreateEntity('FuegoVerde', 'Entity Particle System D1', x, y, z)
  27.     smoke.ParticleType = 'VenomSmoke'
  28.     smoke.YGravity = -100.0
  29.     smoke.Friction = 0.05
  30.     smoke.PPS = 8
  31.     smoke.Velocity = (0.0, -800.0, 0.0)
  32.     smoke.RandomVelocity = 5.0
  33.     smoke.DeathTime = Bladex.GetTime() + 1.5
  34.  
  35.  
  36. def GreyBloodPrtlHit(prtl_name, hit_entity, x, y, z, vx, vy, vz, wcx, wcy, wcz, wdx, wdy, wdz):
  37.     p = Bladex.CreateEntity('BloodPool', 'Entity Pool', x, y, z)
  38.     p.Color = (96, 96, 96)
  39.     p.DeepColor = (80, 80, 80)
  40.     if Evaporation:
  41.         p.DeathTime = Bladex.GetTime() + 50.0
  42.     
  43.  
  44.  
  45. def BleedFunc(blood_name, end_time, period):
  46.     blood = Bladex.GetEntity(blood_name)
  47.     if blood:
  48.         prtl = blood.GetParticleEntity()
  49.         if blood.ParticleType == 'GreenBlood':
  50.             prtl.HitFunc = GreenBloodPrtlHit
  51.         elif blood.ParticleType == 'GreyBlood':
  52.             prtl.HitFunc = GreyBloodPrtlHit
  53.         else:
  54.             prtl.HitFunc = BloodPrtlHit
  55.         if Bladex.GetTime() < end_time:
  56.             Bladex.AddScheduledFunc(Bladex.GetTime() + period, BleedFunc, (blood_name, end_time, period), blood.Name + ' BleedFunc')
  57.         
  58.     
  59.  
  60. AGE_Number = 0
  61.  
  62. def Bleed(objname, start_time, end_time, period, x = 0.0, y = 0.0, z = 0.0, vx = 0, vy = 0, vz = 0, ParticleType = 'Blood'):
  63.     global AGE_Number
  64.     AGE_Number = AGE_Number + 1
  65.     blood = Bladex.CreateEntity('bleed_AGE_' + str(AGE_Number), 'Entity Particle System D1', x, y, z)
  66.     blood.ParticleType = ParticleType
  67.     blood.YGravity = 9800.0
  68.     blood.Friction = 0.075
  69.     blood.PPS = 512
  70.     blood.DeathTime = end_time + 1.0 / 60.0
  71.     blood.Velocity = (vx, vy, vz)
  72.     Bladex.GetEntity(objname).Link(blood)
  73.     Bladex.AddScheduledFunc(start_time, BleedFunc, (blood.Name, end_time, period), blood.Name + ' BleedFunc')
  74.  
  75.  
  76. def PersonBleed(per, start_time, end_time, period, x = 0.0, y = 0.0, z = 0.0, vx = 0, vy = 0, vz = 0, node = 0):
  77.     global AGE_Number
  78.     if node < 0:
  79.         print 'invalid node'
  80.         return None
  81.     
  82.     AGE_Number = AGE_Number + 1
  83.     blood = Bladex.CreateEntity('bleed_AGE_' + str(AGE_Number), 'Entity Particle System D1', x, y, z)
  84.     if per.Kind == 'Spidersmall':
  85.         blood.ParticleType = 'GreenBlood'
  86.     elif per.Kind == 'Lich':
  87.         blood.ParticleType = 'GreyBlood'
  88.     else:
  89.         blood.ParticleType = 'Blood'
  90.     blood.YGravity = 9800.0
  91.     blood.Friction = 0.075
  92.     blood.PPS = 512
  93.     blood.DeathTime = end_time + 1.0 / 60.0
  94.     blood.Velocity = (vx, vy, vz)
  95.     per.LinkToNode(blood, node)
  96.     Bladex.AddScheduledFunc(start_time, BleedFunc, (blood.Name, end_time, period), blood.Name + ' BleedFunc')
  97.  
  98. SparkEntities = [
  99.     'Golem_metal',
  100.     'ChaosKnight']
  101. DustDeathEntities = [
  102.     'Skeleton',
  103.     'Lich',
  104.     'Golem_stone',
  105.     'Golem_clay',
  106.     'Golem_lava',
  107.     'Knight_Zombie'] + SparkEntities
  108.  
  109. def Mutilate(pj_name, obj_name, x, y, z, nx, ny, nz, node):
  110.     vx = nx * 2000.0
  111.     vy = ny * 2000.0
  112.     vz = nz * 2000.0
  113.     per = Bladex.GetEntity(pj_name)
  114.     if per.Kind in DustDeathEntities:
  115.         return None
  116.     
  117.     if per.Kind == 'Spidersmall':
  118.         Bleed(obj_name, Bladex.GetTime() + 0.0, Bladex.GetTime() + 1.0, 0.2, x, y, z, vx, vy, vz, 'GreenBlood')
  119.     elif per.Kind == 'Lich':
  120.         Bleed(obj_name, Bladex.GetTime() + 0.0, Bladex.GetTime() + 1.0, 0.2, x, y, z, vx, vy, vz, 'GreyBlood')
  121.     else:
  122.         Bleed(obj_name, Bladex.GetTime() + 0.0, Bladex.GetTime() + 1.0, 0.2, x, y, z, vx, vy, vz)
  123.     (x, y, z) = Bladex.GetEntity(obj_name).Rel2AbsPoint(x, y, z)
  124.     PersonBleed(per, Bladex.GetTime() + 0.0, Bladex.GetTime() + 1.5, 0.125, x, y, z, -2.0 * vx, -2.0 * vy, -2.0 * vz, node)
  125.  
  126.  
  127. def BleedingImpact(entity, x, y, z, ImpX, ImpY, ImpZ, weapon_entity, WeaponCx, WeaponCy, WeaponCz, WeaponDx, WeaponDy, WeaponDz):
  128.     global AGE_Number
  129.     AGE_Number = AGE_Number + 1
  130.     if entity.Kind in DustDeathEntities:
  131.         dust = Bladex.CreateEntity('dust_AGE_' + str(AGE_Number), 'Entity Particle System D1', x, y, z)
  132.         if entity.Kind == 'Golem_clay':
  133.             dust.ParticleType = 'ShitSmoke'
  134.             dust.Time2Live = 63
  135.             dust.PPS = 60
  136.             dust.RandomVelocity = 30.0
  137.         elif entity.Kind == 'Golem_lava':
  138.             dust.ParticleType = 'LargeFire'
  139.             dust.Time2Live = 31
  140.             dust.PPS = 60
  141.             dust.RandomVelocity = 30.0
  142.         elif entity.Kind in SparkEntities:
  143.             dust.ParticleType = 'Splinter'
  144.             dust.Time2Live = 16
  145.             dust.PPS = 128
  146.             dust.RandomVelocity = 50.0
  147.         else:
  148.             dust.ParticleType = 'MediumDust'
  149.             dust.Time2Live = 63
  150.             dust.PPS = 60
  151.             dust.RandomVelocity = 30.0
  152.         dust.YGravity = 0.0
  153.         dust.Friction = 0.1
  154.         dust.Velocity = (0.0, 0.0, 0.0)
  155.         dust.DeathTime = Bladex.GetTime() + 4.0 / 60.0
  156.     else:
  157.         time = Bladex.GetTime()
  158.         if weapon_entity:
  159.             stickblood = Bladex.CreateEntity('stickbleed_AGE_' + str(AGE_Number), 'Entity Particle System D2', WeaponCx, WeaponCy, WeaponCz)
  160.             stickblood.D = (WeaponDx, WeaponDy, WeaponDz)
  161.             stickblood.YGravity = 9800.0
  162.             stickblood.Friction = 0.15
  163.             stickblood.Friction2 = 0.0
  164.             stickblood.DeathTime = time + 0.4
  165.             stickblood.RandomVelocity = 100.0 / 60
  166.             stickblood.RandomVelocity_V = 100.0 / 60
  167.             stickblood.Time2Live = 26.0
  168.             stickblood.Time2Live_V = 6.0
  169.             stickblood.PPS = 600
  170.             weapon_entity.Link(stickblood)
  171.         else:
  172.             stickblood = None
  173.         blood = Bladex.CreateEntity('bleed_AGE_' + str(AGE_Number), 'Entity Particle System D1', x, y, z)
  174.         blood.YGravity = 9800.0
  175.         blood.Friction = 0.075
  176.         blood.PPS = 600
  177.         blood.DeathTime = time + 10.0 / 60.0
  178.         blood.Position = (x, y, z)
  179.         scale = math.sqrt(ImpX * ImpX + ImpY * ImpY + ImpZ * ImpZ)
  180.         if scale == 0.0:
  181.             scale = 1.0
  182.         
  183.         scale = -2000.0 / scale
  184.         blood.Velocity = (ImpX * scale, ImpY * scale - 2000.0, ImpZ * scale)
  185.         blood.RandomVelocity = 15.0
  186.         blood.RandomVelocity_V = 10.0
  187.         blood.Time2Live = 32
  188.         if stickblood:
  189.             prtl1 = stickblood.GetParticleEntity()
  190.         else:
  191.             prtl1 = blood.GetParticleEntity()
  192.         prtl2 = blood.GetParticleEntity()
  193.         if entity.Kind == 'Spidersmall':
  194.             blood.ParticleType = 'GreenBlood'
  195.             if stickblood:
  196.                 stickblood.ParticleType = 'GreenBlood'
  197.             
  198.             prtl1.HitFunc = GreenBloodPrtlHit
  199.             prtl2.HitFunc = GreenBloodPrtlHit
  200.         elif entity.Kind == 'Lich':
  201.             blood.ParticleType = 'GreyBlood'
  202.             if stickblood:
  203.                 stickblood.ParticleType = 'GreyBlood'
  204.             
  205.             prtl1.HitFunc = GreyBloodPrtlHit
  206.             prtl2.HitFunc = GreyBloodPrtlHit
  207.         else:
  208.             blood.ParticleType = 'Blood'
  209.             if stickblood:
  210.                 stickblood.ParticleType = 'Blood'
  211.             
  212.             prtl1.HitFunc = BloodPrtlHit
  213.             prtl2.HitFunc = BloodPrtlHit
  214.  
  215.