samplemover.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import rxactor
  2. # TestMover not working at the moment. - Tuco
  3. import sys
  4. import clr
  5. asm = clr.LoadAssemblyByName('OpenSim.Region.ScriptEngine.Common')
  6. Vector3 = asm.OpenSim.Region.ScriptEngine.Common.LSL_Types.Vector3
  7. class TestMover(rxactor.Actor):
  8. def GetScriptClassName():
  9. return "samplemover.TestMover"
  10. def EventCreated(self):
  11. super(self.__class__,self).EventCreated()
  12. self.bActive = False
  13. def EventTouch(self,vAvatar):
  14. if(not self.bActive):
  15. self.Physics = True
  16. self.PhysicsMode = 1
  17. self.Gravity = False
  18. self.Velocity = Vector3(0,0,0)
  19. self.Dir = 0
  20. self.SetTimer(5.0,True)
  21. self.bActive = True
  22. else:
  23. self.Velocity = Vector3(0,0,0)
  24. self.Gravity = True
  25. self.PhysicsMode = 0
  26. self.Physics = False
  27. self.SetTimer(0,False)
  28. self.bActive = False
  29. def EventTimer(self):
  30. if(self.Dir == 0):
  31. self.Gravity = False
  32. self.Velocity = Vector3(5,0,5)
  33. self.Dir = 1
  34. return
  35. if(self.Dir == 1):
  36. self.Gravity = True
  37. self.Velocity = Vector3(0,0,0)
  38. self.Dir = 2
  39. return
  40. if(self.Dir == 2):
  41. self.Gravity = False
  42. self.Velocity = Vector3(-5,0,5)
  43. self.Dir = 3
  44. return
  45. if(self.Dir == 3):
  46. self.Gravity = True
  47. self.Velocity = Vector3(0,0,0)
  48. self.Dir = 0
  49. return