Daemonion

simpler xr_motivator.script

Oct 20th, 2012
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. --[[--
  2. I tried to make this simpler. Still doesn't work, though.
  3.  
  4. I also re-enabled this bit of code near the top:
  5.  
  6. self.object:set_callback(callback.sound, motivator_binder.hear_callback, self)
  7.  
  8. -Dae
  9. --]]--
  10.  
  11. function motivator_binder:hear_callback(self, who, sound_type, sound_position, sound_power)
  12. if bit_and(sound_type, snd_type.weapon) == snd_type.weapon then
  13. type = "WPN"
  14. if bit_and(sound_type, snd_type.weapon_shoot) == snd_type.weapon_shoot then
  15. if who:id() == db.actor:id() then
  16. type = "WPN_shoot_actor"
  17. else
  18. type = "WPN_shoot"
  19. end
  20. elseif bit_and(sound_type, snd_type.weapon_empty) == snd_type.weapon_empty then
  21. type = "WPN_empty"
  22. elseif bit_and(sound_type, snd_type.weapon_bullet_hit) == snd_type.weapon_bullet_hit then
  23. type = "WPN_hit"
  24. elseif bit_and(sound_type, snd_type.weapon_reload) == snd_type.weapon_reload then
  25. type = "WPN_reload"
  26. end
  27. elseif bit_and(sound_type, snd_type.item) == snd_type.item then
  28. type = "ITM"
  29. if bit_and(sound_type, snd_type.item_pick_up) == snd_type.item_pick_up then
  30. type = "ITM_pckup"
  31. elseif bit_and(sound_type, snd_type.item_drop) == snd_type.item_drop then
  32. type = "ITM_drop"
  33. elseif bit_and(sound_type, snd_type.item_hide) == snd_type.item_hide then
  34. type = "ITM_hide"
  35. elseif bit_and(sound_type, snd_type.item_take) == snd_type.item_take then
  36. type = "ITM_take"
  37. elseif bit_and(sound_type, snd_type.item_use) == snd_type.item_use then
  38. type = "ITM_use"
  39. end
  40. elseif bit_and(sound_type, snd_type.monster) == snd_type.monster then
  41. type = "MST"
  42. if bit_and(sound_type, snd_type.monster_die) == snd_type.monster_die then
  43. type = "MST_die"
  44. elseif bit_and(sound_type, snd_type.monster_injure) == snd_type.monster_injure then
  45. type = "MST_damage"
  46. elseif bit_and(sound_type, snd_type.monster_step) == snd_type.monster_step then
  47. type = "MST_step"
  48. elseif bit_and(sound_type, snd_type.monster_talk) == snd_type.monster_talk then
  49. type = "MST_talk"
  50. elseif bit_and(sound_type, snd_type.monster_attack) == snd_type.monster_attack then
  51. type = "MST_attack"
  52. elseif bit_and(sound_type, snd_type.monster_eat) == snd_type.monster_eat then
  53. type = "MST_eat"
  54. end
  55. end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment