Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. local stored_ammo_num = nil
  2. local stored_it_id = nil
  3. function rigged_wpn_update()
  4. local aitem = db.actor:active_item()
  5. local aslot = db.actor:active_slot()
  6. if aitem and isWeapon(aitem) then
  7. local it_id = aitem:id()
  8. local ammo_num = aitem:get_ammo_in_magazine()
  9. if stored_it_id ~= nil and stored_ammo_num ~= nil then
  10. if stored_it_id == it_id and ammo_num < stored_ammo_num and string.find(aitem:section(), "rigged") then
  11. local explode_vec = vector():set(db.actor:position()):sub(aitem:position())
  12. local explode = hit()
  13. explode.direction = explode_vec
  14. explode.draftsman = db.actor
  15. explode.impulse = real_rand(0.1,0.7)
  16. explode.power = real_rand(0.2,0.6)
  17. explode.type = hit.explosion
  18. db.actor:hit(explode)
  19. remove_item(aitem)
  20. play_sound([[weapons\\wpn_explode]])
  21. particles_object("amik\\explosion\\explosion_f1"):play_at_pos(aitem:position())
  22. end
  23. end
  24. stored_ammo_num = ammo_num
  25. stored_it_id = it_id
  26. else
  27. stored_it_id = nil
  28. end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement