class LZRTag::Hook::Damager

Public Class Methods

new(handler, **options) click to toggle source
Calls superclass method LZRTag::Hook::Base::new
# File lib/lzrtag/hooks/standard_hooks.rb, line 171
def initialize(handler, **options)
        super(handler);

        @dmgPerShot = options[:dmgPerShot] || 40;
        @useDamageMultiplier = options[:useDamageMultiplier] || true;
        @friendlyFire = options[:friendlyFire] || false;
        @hitThreshold = options[:hitThreshold] || 10;
end

Public Instance Methods

process_raw_hit(hitPlayer, sourcePlayer) click to toggle source
# File lib/lzrtag/hooks/standard_hooks.rb, line 180
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