<commit_before># Omega Client DefenseCapabilities Mixin
#
# Copyright (C) 2012-2014 <NAME> <<EMAIL>>
# Licensed under the AGPLv3 http://www.gnu.org/licenses/agpl.txt

module Omega
  module Client
    module DefenseCapabilities
      def self.included(base)
        base.entity_event \
          :defended =>
            { :subscribe    => "manufactured::subscribe_to",
              :notification => "manufactured::event_occurred",
              :match => proc { |entity, *a|
                a[0] == 'defended' && a[1].id == entity.id },
              :update => proc { |entity, *a|
                entity.hp,entity.shield_level =
                  a[1].hp, a[1].shield_level
              }},

          :defended_stop =>
            { :subscribe    => "manufactured::subscribe_to",
              :notification => "manufactured::event_occurred",
              :match => proc { |entity, *a|
                a[0] == 'defended_stop' && a[1].id == entity.id },
              :update => proc { |entity, *a|
                entity.hp,entity.shield_level =
                  a[1].hp, a[1].shield_level
              }},

          :destroyed_by =>
            { :subscribe    => "manufactured::subscribe_to",
              :notification => "manufactured::event_occurred",
              :match => proc { |entity, *a|
                a[0] == 'destroyed_by' && a[1].id == entity.id },
              :update => proc { |entity, *a|
                entity.hp,entity.shield_level =
                  a[1].hp, a[1].shield_level
              }}

        # automatically cleanup entity when destroyed
        base.server_state :destroyed,
          :check => lambda { |e| !e.alive? },
          :off   => lambda { |e| },
          :on    =>
            lambda { |e|
              # TODO remove rjr notifications
              e.clear_handlers
            }
      end
    end # module DefenseCapabilities
  end # module Client
end # module Omega<commit_msg>Do not clear client entity handlers in destroyed state<commit_after># Omega Client DefenseCapabilities Mixin
#
# Copyright (C) 2012-2014 <NAME> <<EMAIL>>
# Licensed under the AGPLv3 http://www.gnu.org/licenses/agpl.txt

module Omega
  module Client
    module DefenseCapabilities
      def self.included(base)
        base.entity_event \
          :defended =>
            { :subscribe    => "manufactured::subscribe_to",
              :notification => "manufactured::event_occurred",
              :match => proc { |entity, *a|
                a[0] == 'defended' && a[1].id == entity.id },
              :update => proc { |entity, *a|
                entity.hp,entity.shield_level =
                  a[1].hp, a[1].shield_level
              }},

          :defended_stop =>
            { :subscribe    => "manufactured::subscribe_to",
              :notification => "manufactured::event_occurred",
              :match => proc { |entity, *a|
                a[0] == 'defended_stop' && a[1].id == entity.id },
              :update => proc { |entity, *a|
                entity.hp,entity.shield_level =
                  a[1].hp, a[1].shield_level
              }},

          :destroyed_by =>
            { :subscribe    => "manufactured::subscribe_to",
              :notification => "manufactured::event_occurred",
              :match => proc { |entity, *a|
                a[0] == 'destroyed_by' && a[1].id == entity.id },
              :update => proc { |entity, *a|
                entity.hp,entity.shield_level =
                  a[1].hp, a[1].shield_level
              }}

        # automatically cleanup entity when destroyed
        base.server_state :destroyed,
          :check => lambda { |e| !e.alive? },
          :off   => lambda { |e| },
          :on    =>
            lambda { |e|
              # not handling for now to allow processing of any
              # final messages received, may want to remove eventually
              # TODO remove rjr notifications
              #e.clear_handlers
            }
      end
    end # module DefenseCapabilities
  end # module Client
end # module Omega
{'fraction_non_alphanumeric': 0.12958856861295887, 'fraction_numerical': 0.010347376201034738, 'mean_word_length': 1.6466753585397653, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2359890', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1109, 'n_words': 256}