diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-05-06 18:49:04 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-05-06 18:49:04 +0000 |
commit | 7d559cbae9c713e15ae0c943a4d571122bf29bc6 (patch) | |
tree | d3edd6921006c28c62db25621f9ad1b44d1f0e69 /src/game-server/trigger.cpp | |
parent | 832584f65adff69659181d6fc884f779a79d62a9 (diff) | |
download | manaserv-7d559cbae9c713e15ae0c943a4d571122bf29bc6.tar.gz manaserv-7d559cbae9c713e15ae0c943a4d571122bf29bc6.tar.bz2 manaserv-7d559cbae9c713e15ae0c943a4d571122bf29bc6.tar.xz manaserv-7d559cbae9c713e15ae0c943a4d571122bf29bc6.zip |
Implemented script trigger areas which call a script function when an object steps into them.
Diffstat (limited to 'src/game-server/trigger.cpp')
-rw-r--r-- | src/game-server/trigger.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/game-server/trigger.cpp b/src/game-server/trigger.cpp index c0c9bd85..3309c754 100644 --- a/src/game-server/trigger.cpp +++ b/src/game-server/trigger.cpp @@ -28,6 +28,8 @@ #include "game-server/movingobject.hpp" #include "game-server/state.hpp" +#include "utils/logger.h" + void WarpAction::process(Object *obj) { if (obj->getType() == OBJECT_CHARACTER) @@ -36,6 +38,17 @@ void WarpAction::process(Object *obj) } } +void ScriptAction::process(Object *obj) +{ + LOG_DEBUG("Script trigger area activated: "<<mFunction<<"("<<obj<<", "<<mArg<<")"); + if (!mScript) return; + if (mFunction == "") return; + mScript->prepare(mFunction); + mScript->push(obj); + mScript->push(mArg); + mScript->execute(); +} + void TriggerArea::update() { for (MovingObjectIterator i(getMap()->getInsideRectangleIterator(mZone)); i; ++i) |