Class: LZRTag::Hook::Damager
- Defined in:
- lib/lzrtag/hooks/standard_hooks.rb
Instance Method Summary collapse
-
#initialize(handler, **options) ⇒ Damager
constructor
A new instance of Damager.
- #process_raw_hit(hitPlayer, sourcePlayer) ⇒ Object
Methods inherited from Base
#consume_event, describe_option, getCBs, getOptionDescriptions, on, #on, #on_hookin, #on_hookout
Constructor Details
#initialize(handler, **options) ⇒ Damager
Returns a new instance of Damager.
144 145 146 147 148 149 150 151 |
# File 'lib/lzrtag/hooks/standard_hooks.rb', line 144 def initialize(handler, **) super(handler); @dmgPerShot = [:dmgPerShot] || 40; @useDamageMultiplier = [:useDamageMultiplier] || true; @friendlyFire = [:friendlyFire] || false; @hitThreshold = [:hitThreshold] || 10; end |
Instance Method Details
#process_raw_hit(hitPlayer, sourcePlayer) ⇒ Object
153 154 155 156 157 158 159 160 |
# File 'lib/lzrtag/hooks/standard_hooks.rb', line 153 def process_raw_hit(hitPlayer, sourcePlayer) unless(@friendlyFire) return false if hitPlayer.team == sourcePlayer.team end return false if(hitPlayer.dead && (hitPlayer.life < @hitThreshold)); return true; end |