summaryrefslogtreecommitdiff
path: root/src/scripting/lua.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-17 21:11:41 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2013-03-25 20:32:36 +0100
commit8ebd7ef2c200009e6d22b2cfaa3dd0d849155db6 (patch)
treee77633d3d4e2c2538a1044589b5cc927cfa4e125 /src/scripting/lua.cpp
parent626e4c98353f2111ae21123756396fc845447b57 (diff)
downloadmanaserv-8ebd7ef2c200009e6d22b2cfaa3dd0d849155db6.tar.gz
manaserv-8ebd7ef2c200009e6d22b2cfaa3dd0d849155db6.tar.bz2
manaserv-8ebd7ef2c200009e6d22b2cfaa3dd0d849155db6.tar.xz
manaserv-8ebd7ef2c200009e6d22b2cfaa3dd0d849155db6.zip
Changed SpawnArea and TriggerArea to components of Entity
Well, first visible change is that everything just gets longer to read. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/scripting/lua.cpp')
-rw-r--r--src/scripting/lua.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 838ced6d..dfc1bb0a 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -1,7 +1,7 @@
/*
* The Mana Server
* Copyright (C) 2007-2010 The Mana World Development Team
- * Copyright (C) 2010 The Mana Developers
+ * Copyright (C) 2010-2013 The Mana Developers
*
* This file is part of The Mana Server.
*
@@ -49,7 +49,7 @@ extern "C" {
#include "game-server/state.h"
#include "game-server/statuseffect.h"
#include "game-server/statusmanager.h"
-#include "game-server/trigger.h"
+#include "game-server/triggerareacomponent.h"
#include "net/messageout.h"
#include "scripting/luautil.h"
#include "scripting/luascript.h"
@@ -407,14 +407,18 @@ static int trigger_create(lua_State *s)
script->assignCallback(function);
lua_pop(s, 1);
+ Entity *triggerEntity = new Entity(OBJECT_OTHER, m);
+
ScriptAction *action = new ScriptAction(script, function, id);
Rectangle r = { x, y, width, height };
- TriggerArea *area = new TriggerArea(m, r, action, once);
+ TriggerAreaComponent *area = new TriggerAreaComponent(r, action, once);
+
+ triggerEntity->addComponent(area);
LOG_INFO("Created script trigger at " << x << "," << y
<< " (" << width << "x" << height << ") id: " << id);
- bool ret = GameState::insert(area);
+ bool ret = GameState::insertOrDelete(triggerEntity);
lua_pushboolean(s, ret);
return 1;
}