Advertisement
Guest User

actor_on_weapon_zoom

a guest
Mar 8th, 2014
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. local actor_reload
  2. local actor_scope
  3. -- put in bind_stalker update
  4. function actor_on_update(se_actor,delta)
  5. local wpn = db.actor:active_item()
  6. if (wpn) then
  7. if (alun_utils.item_is_fa(wpn)) then
  8. local inmag = wpn:get_ammo_in_magazine()
  9. if (inmag == 0) then
  10. if not (actor_reload) then
  11. actor_reload = true
  12. actor_on_weapon_no_ammo(wpn)
  13. end
  14. else
  15. actor_reload = nil
  16. end
  17. end
  18.  
  19. if (wpn:section() == "wpn_binoc" or alun_utils.addon_attached(wpn,"sc")) then
  20. if (device().fov < 50) then
  21. if not (actor_scope) then
  22. actor_scope = true
  23. actor_on_weapon_zoom_in(wpn)
  24. end
  25. else
  26. if (actor_scope) then
  27. actor_scope = nil
  28. actor_on_weapon_zoom_out(wpn)
  29. end
  30. end
  31. else
  32. if (actor_scope) then
  33. actor_scope = nil
  34. actor_on_weapon_zoom_out(wpn)
  35. end
  36. end
  37. end
  38. end
  39.  
  40. -------------------
  41. -- actor_on_weapon_no_ammo(wpn)
  42. -------------------
  43. function actor_on_weapon_no_ammo(wpn)
  44. for i=1, #intercepts.actor_on_weapon_no_ammo do
  45. intercepts.actor_on_weapon_no_ammo[i](wpn)
  46. end
  47. end
  48.  
  49. -------------------
  50. -- actor_on_weapon_zoom_in(wpn)
  51. -------------------
  52. function actor_on_weapon_zoom_in(wpn)
  53. for i=1, #intercepts.actor_on_weapon_zoom_in do
  54. intercepts.actor_on_weapon_zoom_in[i](wpn)
  55. end
  56. end
  57.  
  58. -------------------
  59. -- actor_on_weapon_zoom_out(wpn)
  60. -------------------
  61. function actor_on_weapon_zoom_out(wpn)
  62. for i=1, #intercepts.actor_on_weapon_zoom_out do
  63. intercepts.actor_on_weapon_zoom_out[i](wpn)
  64. end
  65. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement