130 lines
3.9 KiB
Text
130 lines
3.9 KiB
Text
|
|
|
|
--' Äâèæêîâîå ñîñòîÿíèå òåëà
|
|
--' ìû óæå íàõîäèìñÿ â íåîáõîäèìîì ñîñòîÿíèè?
|
|
class "eva_state_mgr_bodystate" (property_evaluator)
|
|
function eva_state_mgr_bodystate:__init(name, st) super (nil, name)
|
|
self.st = st
|
|
end
|
|
function eva_state_mgr_bodystate:evaluate()
|
|
return (state_lib.states[self.st.target_state].bodystate == nil) or
|
|
(state_lib.states[self.st.target_state].bodystate == self.object:target_body_state())
|
|
end
|
|
|
|
--' íóæíî ëè íàì ïåðåêëþ÷èòüñÿ â êðàó÷
|
|
class "eva_state_mgr_bodystate_crouch" (property_evaluator)
|
|
function eva_state_mgr_bodystate_crouch:__init(name, st) super (nil, name)
|
|
self.st = st
|
|
end
|
|
function eva_state_mgr_bodystate_crouch:evaluate()
|
|
return state_lib.states[self.st.target_state].bodystate == move.crouch
|
|
end
|
|
|
|
--' íóæíî ëè íàì ïåðåêëþ÷àòüñÿ â ñòåíä
|
|
class "eva_state_mgr_bodystate_standing" (property_evaluator)
|
|
function eva_state_mgr_bodystate_standing:__init(name, st) super (nil, name)
|
|
self.st = st
|
|
end
|
|
function eva_state_mgr_bodystate_standing:evaluate()
|
|
return state_lib.states[self.st.target_state].bodystate == move.standing
|
|
end
|
|
|
|
--' íàõîäèìñÿ ëè ìû ñåé÷àñ â êðàó÷å
|
|
class "eva_state_mgr_bodystate_crouch_now" (property_evaluator)
|
|
function eva_state_mgr_bodystate_crouch_now:__init(name, st) super (nil, name)
|
|
self.st = st
|
|
end
|
|
function eva_state_mgr_bodystate_crouch_now:evaluate()
|
|
return self.object:target_body_state() == move.crouch
|
|
end
|
|
|
|
--' íàõîäèìñÿ ëè ìû ñåé÷àñ â ñòåíäèíãå
|
|
class "eva_state_mgr_bodystate_standing_now" (property_evaluator)
|
|
function eva_state_mgr_bodystate_standing_now:__init(name, st) super (nil, name)
|
|
self.st = st
|
|
end
|
|
function eva_state_mgr_bodystate_standing_now:evaluate()
|
|
return self.object:target_body_state() == move.standing
|
|
end
|
|
|
|
--' Ïåðåõîäèì â êðàó÷
|
|
class "act_state_mgr_bodystate_crouch" (action_base)
|
|
function act_state_mgr_bodystate_crouch:__init(name) super (nil, name)
|
|
end
|
|
function act_state_mgr_bodystate_crouch:initialize()
|
|
action_base.initialize(self)
|
|
self.object:set_body_state(move.crouch)
|
|
|
|
|
|
end
|
|
function act_state_mgr_bodystate_crouch:execute()
|
|
action_base.execute(self)
|
|
end
|
|
function act_state_mgr_bodystate_crouch:finalize()
|
|
action_base.finalize(self)
|
|
end
|
|
|
|
--' Ïåðåõîäèì â ñòåíäèíã
|
|
class "act_state_mgr_bodystate_standing" (action_base)
|
|
function act_state_mgr_bodystate_standing:__init(name, st) super (nil, name)
|
|
self.st = st
|
|
end
|
|
function act_state_mgr_bodystate_standing:initialize()
|
|
action_base.initialize(self)
|
|
self.object:set_body_state(move.standing)
|
|
|
|
end
|
|
function act_state_mgr_bodystate_standing:execute()
|
|
action_base.execute(self)
|
|
end
|
|
function act_state_mgr_bodystate_standing:finalize()
|
|
action_base.finalize(self)
|
|
end
|
|
|
|
--'*********************************************************************
|
|
--'* smart actions *
|
|
--'*********************************************************************
|
|
|
|
|
|
|
|
--' Ïåðåõîäèì â êðàó÷
|
|
class "act_state_mgr_bodystate_crouch_danger" (action_base)
|
|
function act_state_mgr_bodystate_crouch_danger:__init(name) super (nil, name)
|
|
end
|
|
function act_state_mgr_bodystate_crouch_danger:initialize()
|
|
|
|
action_base.initialize(self)
|
|
|
|
self.object:set_mental_state(anim.danger)
|
|
|
|
self.object:set_body_state(move.crouch)
|
|
end
|
|
function act_state_mgr_bodystate_crouch_danger:execute()
|
|
action_base.execute(self)
|
|
end
|
|
function act_state_mgr_bodystate_crouch_danger:finalize()
|
|
action_base.finalize(self)
|
|
end
|
|
|
|
--' Ïåðåõîäèì â ñòåíäèíã
|
|
class "act_state_mgr_bodystate_standing_free" (action_base)
|
|
function act_state_mgr_bodystate_standing_free:__init(name, st) super (nil, name)
|
|
self.st = st
|
|
end
|
|
function act_state_mgr_bodystate_standing_free:initialize()
|
|
|
|
action_base.initialize(self)
|
|
|
|
self.object:set_body_state(move.standing)
|
|
|
|
self.object:set_mental_state(anim.free)
|
|
|
|
end
|
|
function act_state_mgr_bodystate_standing_free:execute()
|
|
action_base.execute(self)
|
|
end
|
|
function act_state_mgr_bodystate_standing_free:finalize()
|
|
action_base.finalize(self)
|
|
end
|
|
|
|
|