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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Bladex
  5. import Actions
  6.  
  7. def ChangeObject(person, object, finish_func):
  8.     char = Bladex.GetEntity(person)
  9.     char.Data.obj_used = object
  10.     char.Data.hand = 0
  11.     char.Data.FinishAnm = finish_func
  12.     if char.InvRight == '':
  13.         GetObject(person)
  14.     elif Actions.IsRightHandStandardObject(person):
  15.         GetObject(person)
  16.         if Actions.TryDropRight(person):
  17.             Actions.DropReleaseEventHandler(person, 'DropRightEvent')
  18.         
  19.     else:
  20.         char.AddAnmEventFunc('ChangeREvent', Actions.ToggleWEvent)
  21.         char.LaunchAnmType('Chg_r')
  22.         char.Data.o_hand = char.InvRight
  23.         char.Data.hand = 1
  24.         char.AnmEndedFunc = GetObject
  25.  
  26.  
  27. def GetObject(entity):
  28.     char = Bladex.GetEntity(entity)
  29.     char.AddAnmEventFunc('ChangeREvent', GetingObject)
  30.     if char.Kind[0] == 'D':
  31.         char.LaunchAnmType('Dwf_bag')
  32.     else:
  33.         char.LaunchAnmType('Kgt_bag')
  34.  
  35.  
  36. def GetingObject(entity, event):
  37.     char = Bladex.GetEntity(entity)
  38.     inv = char.GetInventory()
  39.     inv.LinkRightHand(char.Data.obj_used)
  40.     char.AnmEndedFunc = FinishAnm
  41.  
  42.  
  43. def FinishAnm(entity):
  44.     char = Bladex.GetEntity(entity)
  45.     char.Data.FinishAnm(entity, char.Data.obj_used)
  46.  
  47.  
  48. def Keep(ent, event):
  49.     char = Bladex.GetEntity(ent)
  50.     inv = char.GetInventory()
  51.     inv.LinkRightHand('None')
  52.  
  53.  
  54. def Toggle(ent, event):
  55.     Actions.ToggleWEvent(ent, 'ChangeREvent')
  56.  
  57.  
  58. def RestoreHand(entity, launch):
  59.     char = Bladex.GetEntity(entity)
  60.     inv = char.GetInventory()
  61.     if launch:
  62.         if launch == 2:
  63.             object = Bladex.GetEntity(char.InvRight)
  64.             impulse = char.Rel2AbsVector(-1000.0 * object.Mass, -1000.0 * object.Mass, 0.0)
  65.             object.Impulse(impulse[0], impulse[1], impulse[2])
  66.         
  67.         if char.Data.hand:
  68.             char.LaunchAnmType('Chg_r')
  69.             char.AddAnmEventFunc('ChangeREvent', Toggle)
  70.         
  71.         inv.RemoveObject(char.InvRight)
  72.     elif char.Data.hand:
  73.         char.LaunchAnmType('Chg_r')
  74.         char.AddAnmEventFunc('ChangeREvent', Toggle)
  75.     elif char.Kind[0] == 'D':
  76.         char.LaunchAnmType('Dwf_bag')
  77.     else:
  78.         char.LaunchAnmType('Kgt_bag')
  79.     char.AddAnmEventFunc('ChangeREvent', Keep)
  80.     inv.LinkRightHand('None')
  81.  
  82.