Advertisement
Guest User

Untitled

a guest
Jan 31st, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. _lastHeadshot = nil
  2. function check_headshot(self, attack_data)
  3. if self._dead or self._invulnerable then return end
  4. if attack_data.attacker_unit ~= managers.player:player_unit() then return end
  5.  
  6. -- Check headshot
  7. if self._head_body_name and attack_data.col_ray.body and attack_data.col_ray.body:name() == self._ids_head_body_name then
  8. -- Check last headshot
  9. if not _lastHeadshot or os.clock() - _lastHeadshot > 0.5 then
  10. _lastHeadshot = os.clock()
  11. io.stdout:write("PLAY headshot.wav\n")
  12. end
  13. end
  14. end
  15. if not _copDmg then _copDmg = CopDamage.damage_bullet end
  16. function CopDamage:damage_bullet( attack_data )
  17. check_headshot(self, attack_data)
  18. return _copDmg(self, attack_data)
  19. end
  20. if not _civDmg then _civDmg = CivilianDamage.damage_bullet end
  21. function CivilianDamage:damage_bullet( attack_data )
  22. check_headshot(self, attack_data)
  23. return _civDmg(self, attack_data)
  24. end
  25. HuskCivilianDamage.damage_bullet = CivilianDamage.damage_bullet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement