<commit_before>local Class = require 'lib.hump.class'
local ModelComponent = getClass 'pud.component.ModelComponent'
local property = require 'pud.component.property'
local message = require 'pud.component.message'
local match = string.match


-- CollisionComponent
--
local CollisionComponent = Class{name='CollisionComponent',
	inherits=ModelComponent,
	function(self, properties)
		ModelComponent._addRequiredProperties(self, {
			'BlockedBy',
			'CanMove',
		})
		ModelComponent.construct(self, properties)
		self:_addMessages(
			'COLLIDE_ENEMY',
			'COLLIDE_HERO',
			'COLLIDE_BLOCKED',
			'COLLIDE_NONE'
		)
	end
}

-- destructor
function CollisionComponent:destroy()
	ModelComponent.destroy(self)
end

function CollisionComponent:_setProperty(prop, data)
	prop = property(prop)
	if nil == data then data = property.default(prop) end

	if prop == property('BlockedBy') then
		verify('table', data)
	elseif prop == property('CanMove') then
		verify('boolean', data)
	else<commit_msg>formatting<commit_after>local Class = require 'lib.hump.class'
local ModelComponent = getClass 'pud.component.ModelComponent'
local property = require 'pud.component.property'
local message = require 'pud.component.message'
local match = string.match


-- CollisionComponent
--
local CollisionComponent = Class{name='CollisionComponent',
	inherits=ModelComponent,
	function(self, properties)
		ModelComponent._addRequiredProperties(self, {
			'BlockedBy',
			'CanMove',
		})
		ModelComponent.construct(self, properties)
		self:_addMessages(
			'COLLIDE_ENEMY',
			'COLLIDE_HERO',
			'COLLIDE_BLOCKED',
			'COLLIDE_NONE')
	end
}

-- destructor
function CollisionComponent:destroy()
	ModelComponent.destroy(self)
end

function CollisionComponent:_setProperty(prop, data)
	prop = property(prop)
	if nil == data then data = property.default(prop) end

	if prop == property('BlockedBy') then
		verify('table', data)
	elseif prop == property('CanMove') then
		verify('boolean', data)
	else
{'fraction_non_alphanumeric': 0.11561866125760649, 'fraction_numerical': 0.0, 'mean_word_length': 5.66554054054054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2475117', 'n_tokens_mistral': 650, 'n_tokens_neox': 610, 'n_words': 133}