1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef RYAI_LOGIC_ACTION_H
20 #define RYAI_LOGIC_ACTION_H
22 #include "alias_tree_owner.h"
23 #include "game_share/r2_basic_types.h"
27 class CAIEventReaction
;
32 //---------------------------------------------------------------------------------
33 // CAIEventReactionAction
34 //---------------------------------------------------------------------------------
35 // this is the base class for action types that can be used to process events for
36 // teams and other entiites
39 : public NLMISC::CRefCount
42 typedef NLMISC::CSmartPtr
<IAILogicAction
> TSmartPtr
;
44 // NOTE: ctor takes following form:
45 // CLASS(const std::vector<std::string> &args, const std::vector<CAIEventReactionAction *> &subActions)
47 // note that actions are NOT responsible for deleting child actions
48 virtual ~IAILogicAction()
51 // this is the execute 'callback' for the action type.
52 // NOTE: This code should be fast and compact as it may be called very large numbers of times
53 // depending on the whim of the level designers
54 // returns true on success, false on failure
55 virtual bool executeAction (CStateInstance
*entity
,const IAIEvent
*event
)=0;
57 virtual void addPropertyZone (CTmpPropertyZone::TSmartPtr zone
)
60 // attach a group family to the action if it supports it (assert otherwise)
61 virtual void addGroupFamily(CGroupFamily
*gf
) { nlassert(0); }
64 // Code use by native functions and LogicAction
65 class CAILogicActionDssStartActHelper
68 static void dssStartAct(TSessionId sessionId
, uint32 actId
);
71 class CAILogicActionSitDownHelper
74 static void sitDown(CGroup
* group
);
75 static void standUp(CGroup
* group
);
79 class CAILogicDynamicIfHelper
82 static void setConditionSuccess(bool value
) {_ConditionSuccess
= value
;}
83 static bool getConditionSuccess() { return _ConditionSuccess
;}
85 static bool _ConditionSuccess
;
87 //---------------------------------------------------------------------------------