

--' Ментальное состояние тела
--' мы уже находимся в необходимом состоянии?
class "eva_state_mgr_mental" (property_evaluator)
function eva_state_mgr_mental:__init(name, st) super (nil, name)
	self.st = st
end
function eva_state_mgr_mental:evaluate()
	return (state_lib.states[self.st.target_state].mental == nil) or
		   (state_lib.states[self.st.target_state].mental == self.object:target_mental_state())
end
--' нужно ли нам быть в состоянии FREE
class "eva_state_mgr_mental_free" (property_evaluator)
function eva_state_mgr_mental_free:__init(name, st) super (nil, name)
	self.st = st
end
function eva_state_mgr_mental_free:evaluate()
	return state_lib.states[self.st.target_state].mental == anim.free
end
--' находимся ли мы сейчас во FREE
class "eva_state_mgr_mental_free_now" (property_evaluator)
function eva_state_mgr_mental_free_now:__init(name, st) super (nil, name)
	self.st = st
end
function eva_state_mgr_mental_free_now:evaluate()
	return self.object:target_mental_state() == anim.free
end


--' нужно ли нам быть в состоянии DANGER
class "eva_state_mgr_mental_danger" (property_evaluator)
function eva_state_mgr_mental_danger:__init(name, st) super (nil, name)
	self.st = st
end
function eva_state_mgr_mental_danger:evaluate()
	return state_lib.states[self.st.target_state].mental == anim.danger
end
--' находимся ли мы сейчас в 
class "eva_state_mgr_mental_danger_now" (property_evaluator)
function eva_state_mgr_mental_danger_now:__init(name, st) super (nil, name)
	self.st = st
end
function eva_state_mgr_mental_danger_now:evaluate()
	return self.object:target_mental_state() == anim.danger
end

--' нужно ли нам быть в состоянии PANIC
class "eva_state_mgr_mental_panic" (property_evaluator)
function eva_state_mgr_mental_panic:__init(name, st) super (nil, name)
	self.st = st
end
function eva_state_mgr_mental_panic:evaluate()
	return state_lib.states[self.st.target_state].mental == anim.panic
end
--' находимся ли мы сейчас в PANIC
class "eva_state_mgr_mental_panic_now" (property_evaluator)
function eva_state_mgr_mental_panic_now:__init(name, st) super (nil, name)
	self.st = st
end
function eva_state_mgr_mental_panic_now:evaluate()
	return self.object:target_mental_state() == anim.panic
end


--' Включаем свободное состояние
class "act_state_mgr_mental_free" (action_base)
function act_state_mgr_mental_free:__init(name) super (nil, name)
end
function act_state_mgr_mental_free:initialize()
	action_base.initialize(self)
	self.object:set_mental_state(anim.free)
end
function act_state_mgr_mental_free:execute()
	action_base.execute(self)
	self.object:set_mental_state(anim.free)
end
function act_state_mgr_mental_free:finalize()
	action_base.finalize(self)
end

--' Включаем возбужденное состояние
class "act_state_mgr_mental_danger" (action_base)
function act_state_mgr_mental_danger:__init(name) super (nil, name)
end
function act_state_mgr_mental_danger:initialize()
	action_base.initialize(self)
	self.object:set_mental_state(anim.danger)
end
function act_state_mgr_mental_danger:execute()
	action_base.execute(self)
	self.object:set_mental_state(anim.danger)
end
function act_state_mgr_mental_danger:finalize()
	action_base.finalize(self)
end

--' Включаем паническое состояние
class "act_state_mgr_mental_panic" (action_base)
function act_state_mgr_mental_panic:__init(name) super (nil, name)
end
function act_state_mgr_mental_panic:initialize()
	action_base.initialize(self)
	self.object:set_mental_state(anim.panic)
end
function act_state_mgr_mental_panic:execute()
	action_base.execute(self)
	self.object:set_mental_state(anim.panic)
end
function act_state_mgr_mental_panic:finalize()
	action_base.finalize(self)
end