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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Bladex
  5. import InitDataField
  6. import AuxFuncs
  7. import Actions
  8. OFF = 0
  9. ON = 1
  10. DEAD = 0
  11. ALIVE = 1
  12. tipos_antorcha = ('Antorcha', 'Antorchaenpared', 'Palangana')
  13.  
  14. class TorchObj:
  15.     pass
  16.  
  17.  
  18. def ExtingueGradual(torchobj, torchspot, torchfire, intensity_var, fire_var, fire_int, OnEndExtinctionFunc, OnEndExtinctionArgs):
  19.     if torchspot.Intensity > 0.0:
  20.         torchspot.Intensity = torchspot.Intensity - intensity_var
  21.     else:
  22.         torchspot.Intensity = 0
  23.     fire_int = fire_int + fire_var
  24.     torchfire.Intensity = fire_int
  25.     if torchfire.Intensity >= 30.0:
  26.         torchobj.LiveStatus = DEAD
  27.         torchobj.LightStatus = OFF
  28.         if OnEndExtinctionFunc:
  29.             apply(OnEndExtinctionFunc, OnEndExtinctionArgs)
  30.         
  31.         return None
  32.     
  33.     Bladex.AddScheduledFunc(Bladex.GetTime() + 0.1, ExtingueGradual, (torchobj, torchspot, torchfire, intensity_var, fire_var, fire_int, OnEndExtinctionFunc, OnEndExtinctionArgs))
  34.  
  35.  
  36. def ExtingueAntorcha(torch_name, OnEndExtinctionFunc = '', OnEndExtinctionArgs = ()):
  37.     torch = Bladex.GetEntity(torch_name)
  38.     torchspot = AuxFuncs.GetSpot(torch)
  39.     torchfire = AuxFuncs.GetFire(torch)
  40.     torchobj = torch.Data.torchobjdata
  41.     if torchspot.Intensity <= 0.0:
  42.         return None
  43.     
  44.     intensity_var = torchspot.Intensity / 20.0
  45.     fire_var = (30.0 - torchfire.Intensity) / 60.0
  46.     fire_int = torchfire.Intensity
  47.     Bladex.AddScheduledFunc(Bladex.GetTime() + 0.1, ExtingueGradual, (torchobj, torchspot, torchfire, intensity_var, fire_var, fire_int, OnEndExtinctionFunc, OnEndExtinctionArgs))
  48.  
  49.  
  50. def EnciendeGradual(torchobj, torchspot, torchfire, intensity_var, fire_var, fire_int):
  51.     torchspot.Intensity = torchspot.Intensity + intensity_var
  52.     fire_int = fire_int - fire_var
  53.     torchfire.Intensity = fire_int
  54.     if torchspot.Intensity >= torchobj.LightIntensity:
  55.         torchobj.LightStatus = ON
  56.         return None
  57.     
  58.     Bladex.AddScheduledFunc(Bladex.GetTime() + 0.1, EnciendeGradual, (torchobj, torchspot, torchfire, intensity_var, fire_var, fire_int))
  59.  
  60.  
  61. def EnciendeAntorcha(torch_name):
  62.     torch = Bladex.GetEntity(torch_name)
  63.     torchspot = AuxFuncs.GetSpot(torch)
  64.     torchfire = AuxFuncs.GetFire(torch)
  65.     torchobj = torch.Data.torchobjdata
  66.     if torchobj.LightStatus == ON:
  67.         return None
  68.     
  69.     intensity_var = torchobj.LightIntensity / 20.0
  70.     fire_var = (10.0 - torchobj.FireIntensity) / 20.0
  71.     torchfire.Intensity = 10.0
  72.     fire_int = torchfire.Intensity
  73.     Bladex.AddScheduledFunc(Bladex.GetTime() + 0.1, EnciendeGradual, (torchobj, torchspot, torchfire, intensity_var, fire_var, fire_int))
  74.  
  75.  
  76. def EnciendeEstaAntorcha(person_name, event_name):
  77.     pj = Bladex.GetEntity(person_name)
  78.     pj.DelAnmEventFunc(event_name)
  79.     torch = pj.Data.obj_used
  80.     torchobj = torch.Data.torchobjdata
  81.     objright = Bladex.GetEntity(pj.InvRight)
  82.     objrighttorch = objright.Data.torchobjdata
  83.     if objrighttorch.LightStatus == OFF and torchobj.LightStatus == ON:
  84.         EnciendeAntorcha(objright.Name)
  85.         if objrighttorch.Life > 0.0:
  86.             Bladex.AddScheduledFunc(Bladex.GetTime() + objrighttorch.Life, ExtingueAntorcha, (objright.Name,))
  87.         
  88.     else:
  89.         EnciendeAntorcha(torch.Name)
  90.         if torchobj.Life > 0.0:
  91.             Bladex.AddScheduledFunc(Bladex.GetTime() + torchobj.Life, ExtingueAntorcha, (torch.Name,))
  92.         
  93.  
  94.  
  95. def TorchUseFunc(torch_name, use_from):
  96.     torch = Bladex.GetEntity(torch_name)
  97.     pj = Bladex.GetEntity('Player1')
  98.     objright = Bladex.GetEntity(pj.InvRight)
  99.     if objright and torch.Kind in tipos_antorcha and objright.Kind in tipos_antorcha:
  100.         torchobj = torch.Data.torchobjdata
  101.         objrighttorch = objright.Data.torchobjdata
  102.         if objrighttorch.LightStatus == OFF and torchobj.LightStatus == OFF and objrighttorch.LightStatus == ON and torchobj.LightStatus == ON:
  103.             return None
  104.         
  105.         if torchobj.LiveStatus == DEAD or objrighttorch.LiveStatus == DEAD:
  106.             return None
  107.         
  108.         Actions.QuickTurnToFaceEntity('Player1', torch_name)
  109.         difalt = -(torch.Position[1] - (pj.Position[1] + pj.Dist2Floor))
  110.         chartype = Bladex.GetCharType(pj.CharType, pj.CharTypeExt)
  111.         if difalt <= chartype.MaxTake1:
  112.             pj.LaunchAnmType('fire_g')
  113.         elif difalt <= chartype.MaxTake2:
  114.             pj.LaunchAnmType('fire0')
  115.         elif difalt <= chartype.MaxTake3:
  116.             pj.LaunchAnmType('fire1')
  117.         elif difalt <= chartype.MaxTake4:
  118.             pj.LaunchAnmType('fire2')
  119.         elif difalt <= chartype.MaxTake5:
  120.             pj.LaunchAnmType('fire3')
  121.         else:
  122.             return None
  123.         if UseFunc:
  124.             UseFunc(torch.Name, objright.Name)
  125.         
  126.         pj.AddAnmEventFunc('SetAlightEvent', EnciendeEstaAntorcha)
  127.     
  128.  
  129.  
  130. def SetUsable(obj_name, light_int = 3.0, fire_int = 3.0, life = -1):
  131.     obj = Bladex.GetEntity(obj_name)
  132.     if obj.Kind not in tipos_antorcha:
  133.         return None
  134.     
  135.     torchobj = TorchObj()
  136.     torchobj.LightIntensity = light_int
  137.     torchobj.FireIntensity = fire_int
  138.     torchobj.Life = life
  139.     if AuxFuncs.GetSpot(obj).Intensity == 0.0:
  140.         torchobj.LightStatus = OFF
  141.     else:
  142.         torchobj.LightStatus = ON
  143.     if life == 0:
  144.         torchobj.LiveStatus = DEAD
  145.     else:
  146.         torchobj.LiveStatus = ALIVE
  147.     InitDataField.Initialise(obj)
  148.     obj.Data.torchobjdata = torchobj
  149.     if obj.Kind != 'Antorcha':
  150.         obj.UseFunc = TorchUseFunc
  151.     
  152.  
  153. UseFunc = None
  154.