summaryrefslogtreecommitdiffstats
path: root/src/scripting
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-04-10 23:04:42 +0200
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-04-11 13:47:17 +0200
commitd7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da (patch)
tree1b4d200ba66c6afcdb7763951980476756339cf1 /src/scripting
parentaa04597c5f8bb806996d604699fc8ebff6d53bdd (diff)
downloadmanaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.tar.gz
manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.tar.xz
manaserv-d7fa7ea64f6bb0bc0b097e4bf1ceb4bd9620d0da.zip
Converted Being into a Component
I did not really care too much about staying consistent with the use of static_casts to Actors since they are only temporary anyway until Actor is a component too.
Diffstat (limited to 'src/scripting')
-rw-r--r--src/scripting/lua.cpp317
-rw-r--r--src/scripting/luascript.cpp6
-rw-r--r--src/scripting/luascript.h6
-rw-r--r--src/scripting/luautil.cpp32
-rw-r--r--src/scripting/luautil.h17
-rw-r--r--src/scripting/script.h3
-rw-r--r--src/scripting/scriptmanager.cpp2
-rw-r--r--src/scripting/scriptmanager.h2
8 files changed, 203 insertions, 182 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 622d186..39fc3e8 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -88,7 +88,7 @@ extern "C" {
static int on_update_derived_attribute(lua_State *s)
{
luaL_checktype(s, 1, LUA_TFUNCTION);
- Being::setUpdateDerivedAttributesCallback(getScript(s));
+ BeingComponent::setUpdateDerivedAttributesCallback(getScript(s));
return 0;
}
@@ -107,7 +107,7 @@ static int on_update_derived_attribute(lua_State *s)
static int on_recalculate_base_attribute(lua_State *s)
{
luaL_checktype(s, 1, LUA_TFUNCTION);
- Being::setRecalculateBaseAttributeCallback(getScript(s));
+ BeingComponent::setRecalculateBaseAttributeCallback(getScript(s));
return 0;
}
@@ -283,13 +283,15 @@ static int npc_create(lua_State *s)
NpcComponent *npcComponent = new NpcComponent(id);
- Being *npc = new Being(OBJECT_NPC);
+ Actor *npc = new Actor(OBJECT_NPC);
+ auto *beingComponent = new BeingComponent(*npc);
+ npc->addComponent(beingComponent);
npc->addComponent(npcComponent);
// some health so it doesn't spawn dead
- npc->setAttribute(ATTR_MAX_HP, 100);
- npc->setAttribute(ATTR_HP, 100);
- npc->setName(name);
- npc->setGender(getGender(gender));
+ beingComponent->setAttribute(*npc, ATTR_MAX_HP, 100);
+ beingComponent->setAttribute(*npc, ATTR_HP, 100);
+ beingComponent->setName(name);
+ beingComponent->setGender(getGender(gender));
npc->setWalkMask(Map::BLOCKMASK_WALL | Map::BLOCKMASK_MONSTER |
Map::BLOCKMASK_CHARACTER);
@@ -320,9 +322,9 @@ static int npc_create(lua_State *s)
*/
static int npc_enable(lua_State *s)
{
- Being *npc = checkNpc(s, 1);
+ Entity *npc = checkNpc(s, 1);
npc->getComponent<NpcComponent>()->setEnabled(true);
- GameState::enqueueInsert(npc);
+ GameState::enqueueInsert(static_cast<Actor *>(npc));
return 0;
}
@@ -333,7 +335,7 @@ static int npc_enable(lua_State *s)
*/
static int npc_disable(lua_State *s)
{
- Being *npc = checkNpc(s, 1);
+ Entity *npc = checkNpc(s, 1);
npc->getComponent<NpcComponent>()->setEnabled(false);
GameState::remove(npc);
return 0;
@@ -355,7 +357,8 @@ static int monster_create(lua_State *s)
const int y = luaL_checkint(s, 3);
MapComposite *m = checkCurrentMap(s);
- Being *monster = new Being(OBJECT_MONSTER);
+ Actor *monster = new Actor(OBJECT_MONSTER);
+ monster->addComponent(new BeingComponent(*monster));
monster->addComponent(new MonsterComponent(*monster, monsterClass));
monster->setMap(m);
monster->setPosition(Point(x, y));
@@ -375,7 +378,7 @@ static int monster_create(lua_State *s)
static int monster_remove(lua_State *s)
{
bool monsterRemoved = false;
- if (Being *m = getMonster(s, 1))
+ if (Entity *m = getMonster(s, 1))
{
GameState::remove(m);
monsterRemoved = true;
@@ -454,8 +457,8 @@ static int effect_create(lua_State *s)
if (lua_isuserdata(s, 2))
{
// being mode
- Being *b = checkBeing(s, 2);
- Effects::show(id, b);
+ Entity *b = checkBeing(s, 2);
+ Effects::show(id, static_cast<Actor *>(b));
}
else
{
@@ -501,14 +504,14 @@ static int item_drop(lua_State *s)
*/
static int npc_message(lua_State *s)
{
- Being *npc = checkNpc(s, 1);
- Being *q = checkCharacter(s, 2);
+ Entity *npc = checkNpc(s, 1);
+ Entity *q = checkCharacter(s, 2);
const char *m = luaL_checkstring(s, 3);
Script::Thread *thread = checkCurrentThread(s);
MessageOut msg(GPMSG_NPC_MESSAGE);
- msg.writeInt16(npc->getPublicID());
+ msg.writeInt16(static_cast<Actor *>(npc)->getPublicID());
msg.writeString(m);
gameHandler->sendTo(q, msg);
@@ -534,13 +537,13 @@ static int npc_message(lua_State *s)
*/
static int npc_choice(lua_State *s)
{
- Being *npc = checkNpc(s, 1);
- Being *q = checkCharacter(s, 2);
+ Entity *npc = checkNpc(s, 1);
+ Entity *q = checkCharacter(s, 2);
Script::Thread *thread = checkCurrentThread(s);
MessageOut msg(GPMSG_NPC_CHOICE);
- msg.writeInt16(npc->getPublicID());
+ msg.writeInt16(static_cast<Actor *>(npc)->getPublicID());
for (int i = 3, i_end = lua_gettop(s); i <= i_end; ++i)
{
if (lua_isstring(s, i))
@@ -590,8 +593,8 @@ static int npc_choice(lua_State *s)
*/
static int npc_ask_integer(lua_State *s)
{
- Being *npc = checkNpc(s, 1);
- Being *q = checkCharacter(s, 2);
+ Entity *npc = checkNpc(s, 1);
+ Entity *q = checkCharacter(s, 2);
int min = luaL_checkint(s, 3);
int max = luaL_checkint(s, 4);
int defaultValue = luaL_optint(s, 5, min);
@@ -599,7 +602,7 @@ static int npc_ask_integer(lua_State *s)
Script::Thread *thread = checkCurrentThread(s);
MessageOut msg(GPMSG_NPC_NUMBER);
- msg.writeInt16(npc->getPublicID());
+ msg.writeInt16(static_cast<Actor *>(npc)->getPublicID());
msg.writeInt32(min);
msg.writeInt32(max);
msg.writeInt32(defaultValue);
@@ -620,13 +623,13 @@ static int npc_ask_integer(lua_State *s)
*/
static int npc_ask_string(lua_State *s)
{
- Being *npc = checkNpc(s, 1);
- Being *q = checkCharacter(s, 2);
+ Entity *npc = checkNpc(s, 1);
+ Entity *q = checkCharacter(s, 2);
Script::Thread *thread = checkCurrentThread(s);
MessageOut msg(GPMSG_NPC_STRING);
- msg.writeInt16(npc->getPublicID());
+ msg.writeInt16(static_cast<Actor *>(npc)->getPublicID());
gameHandler->sendTo(q, msg);
thread->mState = Script::ThreadExpectingString;
@@ -640,11 +643,11 @@ static int npc_ask_string(lua_State *s)
*/
static int npc_post(lua_State *s)
{
- Being *npc = checkNpc(s, 1);
- Being *q = checkCharacter(s, 2);
+ Entity *npc = checkNpc(s, 1);
+ Entity *q = checkCharacter(s, 2);
MessageOut msg(GPMSG_NPC_POST);
- msg.writeInt16(npc->getPublicID());
+ msg.writeInt16(static_cast<Actor *>(npc)->getPublicID());
gameHandler->sendTo(q, msg);
return 0;
@@ -658,9 +661,9 @@ static int npc_post(lua_State *s)
*/
static int being_say(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const char *message = luaL_checkstring(s, 2);
- GameState::sayAround(being, message);
+ GameState::sayAround(static_cast<Actor *>(being), message);
return 0;
}
@@ -672,10 +675,10 @@ static int being_say(lua_State *s)
*/
static int chat_message(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const char *message = luaL_checkstring(s, 2);
- GameState::sayTo(being, NULL, message);
+ GameState::sayTo(static_cast<Actor *>(being), nullptr, message);
return 0;
}
@@ -767,8 +770,8 @@ static int announce(lua_State *s)
*/
static int npc_trade(lua_State *s)
{
- Being *npc = checkNpc(s, 1);
- Being *q = checkCharacter(s, 2);
+ Entity *npc = checkNpc(s, 1);
+ Entity *q = checkCharacter(s, 2);
if (!lua_isboolean(s, 3))
{
luaL_error(s, "npc_trade called with incorrect parameters.");
@@ -776,7 +779,7 @@ static int npc_trade(lua_State *s)
}
bool sellMode = lua_toboolean(s, 3);
- BuySell *t = new BuySell(q, sellMode);
+ BuySell *t = new BuySell(static_cast<Actor *>(q), sellMode);
if (!lua_istable(s, 4))
{
if (sellMode)
@@ -790,7 +793,7 @@ static int npc_trade(lua_State *s)
return 1;
}
- if (t->start(npc))
+ if (t->start(static_cast<Actor *>(npc)))
{
lua_pushinteger(s, 0);
return 1;
@@ -868,7 +871,7 @@ static int npc_trade(lua_State *s)
lua_pushinteger(s, 1);
return 1;
}
- if (t->start(npc))
+ if (t->start(static_cast<Actor *>(npc)))
{
lua_pushinteger(s, 0);
return 1;
@@ -892,7 +895,7 @@ static int npc_trade(lua_State *s)
*/
static int chr_inv_count(lua_State *s)
{
- Being *q = checkCharacter(s, 1);
+ Entity *q = checkCharacter(s, 1);
if (!lua_isboolean(s, 2) || !lua_isboolean(s, 3))
{
luaL_error(s, "chr_inv_count called with incorrect parameters.");
@@ -933,7 +936,7 @@ static int chr_inv_count(lua_State *s)
*/
static int chr_inv_change(lua_State *s)
{
- Being *q = checkCharacter(s, 1);
+ Entity *q = checkCharacter(s, 1);
int nb_items = (lua_gettop(s) - 1) / 2;
Inventory inv(q);
for (int i = 0; i < nb_items; ++i)
@@ -956,7 +959,9 @@ static int chr_inv_change(lua_State *s)
if (nb)
{
LOG_WARN("chr_inv_change() removed more items than owned: "
- << "character: " << q->getName() << " item id: " << id);
+ << "character: "
+ << q->getComponent<BeingComponent>()->getName()
+ << " item id: " << id);
}
}
else
@@ -964,8 +969,8 @@ static int chr_inv_change(lua_State *s)
nb = inv.insert(id, nb);
if (nb)
{
- Actor *item = Item::create(q->getMap(),
- q->getPosition(),
+ Actor *item = Item::create(q->getMap(), static_cast<Actor *>(q)
+ ->getPosition(),
ic, nb);
GameState::enqueueInsert(item);
}
@@ -997,7 +1002,7 @@ static int chr_inv_change(lua_State *s)
*/
static int chr_get_inventory(lua_State *s)
{
- Being *q = checkCharacter(s, 1);
+ Entity *q = checkCharacter(s, 1);
// Create a lua table with the inventory ids.
const InventoryData invData = q->getComponent<CharacterComponent>()
@@ -1062,7 +1067,7 @@ static int chr_get_inventory(lua_State *s)
*/
static int chr_get_equipment(lua_State *s)
{
- Being *q = checkCharacter(s, 1);
+ Entity *q = checkCharacter(s, 1);
// Create a lua table with the inventory ids.
const EquipData equipData = q->getComponent<CharacterComponent>()
@@ -1115,7 +1120,7 @@ static int chr_get_equipment(lua_State *s)
*/
static int chr_equip_slot(lua_State *s)
{
- Being *ch = checkCharacter(s, 1);
+ Entity *ch = checkCharacter(s, 1);
int inventorySlot = luaL_checkint(s, 2);
Inventory inv(ch);
@@ -1134,7 +1139,7 @@ static int chr_equip_slot(lua_State *s)
*/
static int chr_equip_item(lua_State *s)
{
- Being *ch = checkCharacter(s, 1);
+ Entity *ch = checkCharacter(s, 1);
ItemClass *it = checkItemClass(s, 2);
Inventory inv(ch);
@@ -1158,7 +1163,7 @@ static int chr_equip_item(lua_State *s)
*/
static int chr_unequip_slot(lua_State *s)
{
- Being *ch = checkCharacter(s, 1);
+ Entity *ch = checkCharacter(s, 1);
int equipmentSlot = luaL_checkint(s, 2);
Inventory inv(ch);
@@ -1178,7 +1183,7 @@ static int chr_unequip_slot(lua_State *s)
*/
static int chr_unequip_item(lua_State *s)
{
- Being *ch = checkCharacter(s, 1);
+ Entity *ch = checkCharacter(s, 1);
ItemClass *it = checkItemClass(s, 2);
Inventory inv(ch);
@@ -1199,7 +1204,7 @@ static int chr_unequip_item(lua_State *s)
*/
static int chr_get_quest(lua_State *s)
{
- Being *q = checkCharacter(s, 1);
+ Entity *q = checkCharacter(s, 1);
const char *name = luaL_checkstring(s, 2);
luaL_argcheck(s, name[0] != 0, 2, "empty variable name");
@@ -1228,7 +1233,7 @@ static int chr_get_quest(lua_State *s)
*/
static int chr_set_quest(lua_State *s)
{
- Being *q = checkCharacter(s, 1);
+ Entity *q = checkCharacter(s, 1);
const char *name = luaL_checkstring(s, 2);
const char *value = luaL_checkstring(s, 3);
luaL_argcheck(s, name[0] != 0, 2, "empty variable name");
@@ -1248,7 +1253,7 @@ static int chr_set_quest(lua_State *s)
*/
static int chr_set_special_recharge_speed(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int special = checkSpecial(s, 2);
const int speed = luaL_checkint(s, 3);
@@ -1274,7 +1279,7 @@ static int chr_set_special_recharge_speed(lua_State *s)
*/
static int chr_get_special_recharge_speed(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int special = checkSpecial(s, 2);
auto *characterComponent = c->getComponent<CharacterComponent>();
@@ -1300,7 +1305,7 @@ static int chr_get_special_recharge_speed(lua_State *s)
*/
static int chr_set_special_mana(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int special = checkSpecial(s, 2);
const int mana = luaL_checkint(s, 3);
if (!c->getComponent<CharacterComponent>()->setSpecialMana(special, mana))
@@ -1324,7 +1329,7 @@ static int chr_set_special_mana(lua_State *s)
*/
static int chr_get_special_mana(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
auto *characterComponent = c->getComponent<CharacterComponent>();
const int special = checkSpecial(s, 2);
SpecialMap::iterator it = characterComponent->findSpecial(special);
@@ -1345,17 +1350,22 @@ static int chr_get_special_mana(lua_State *s)
*/
static int being_walk(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const int x = luaL_checkint(s, 2);
const int y = luaL_checkint(s, 3);
- being->setDestination(Point(x, y));
+ auto *beingComponent = being->getComponent<BeingComponent>();
+
+ beingComponent->setDestination(*being, Point(x, y));
if (lua_gettop(s) >= 4)
{
- being->setAttribute(ATTR_MOVE_SPEED_TPS, luaL_checknumber(s, 4));
- being->setAttribute(ATTR_MOVE_SPEED_RAW, utils::tpsToRawSpeed(
- being->getModifiedAttribute(ATTR_MOVE_SPEED_TPS)));
+ const double speedTps = luaL_checknumber(s, 4);
+ beingComponent->setAttribute(*being, ATTR_MOVE_SPEED_TPS, speedTps);
+ const double modifiedSpeedTps =
+ beingComponent->getModifiedAttribute(ATTR_MOVE_SPEED_TPS);
+ beingComponent->setAttribute(*being, ATTR_MOVE_SPEED_RAW,
+ utils::tpsToRawSpeed(modifiedSpeedTps));
}
return 0;
@@ -1396,7 +1406,7 @@ static int being_walk(lua_State *s)
*/
static int being_damage(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
if (!being->canFight())
{
@@ -1410,7 +1420,7 @@ static int being_damage(lua_State *s)
dmg.cth = luaL_checkint(s, 4);
dmg.type = (DamageType)luaL_checkint(s, 5);
dmg.element = (Element)luaL_checkint(s, 6);
- Being *source = 0;
+ Entity *source = 0;
if (lua_gettop(s) >= 7)
{
source = checkBeing(s, 7);
@@ -1441,15 +1451,16 @@ static int being_damage(lua_State *s)
*/
static int being_heal(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
if (lua_gettop(s) == 1) // when there is only one argument
{
- being->heal();
+ being->getComponent<BeingComponent>()->heal(*being);
}
else
{
- being->heal(luaL_checkint(s, 2));
+ being->getComponent<BeingComponent>()->heal(*being,
+ luaL_checkint(s, 2));
}
return 0;
@@ -1462,8 +1473,8 @@ static int being_heal(lua_State *s)
*/
static int being_get_name(lua_State *s)
{
- Being *being = checkBeing(s, 1);
- push(s, being->getName());
+ Entity *being = checkBeing(s, 1);
+ push(s, being->getComponent<BeingComponent>()->getName());
return 1;
}
@@ -1483,7 +1494,7 @@ static int being_get_name(lua_State *s)
*/
static int being_type(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
lua_pushinteger(s, being->getType());
return 1;
}
@@ -1503,8 +1514,8 @@ static int being_type(lua_State *s)
*/
static int being_get_action(lua_State *s)
{
- Being *being = checkBeing(s, 1);
- lua_pushinteger(s, being->getAction());
+ Entity *being = checkBeing(s, 1);
+ lua_pushinteger(s, being->getComponent<BeingComponent>()->getAction());
return 1;
}
@@ -1515,9 +1526,10 @@ static int being_get_action(lua_State *s)
*/
static int being_set_action(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
int act = luaL_checkint(s, 2);
- being->setAction((BeingAction) act);
+ being->getComponent<BeingComponent>()->setAction(*being,
+ (BeingAction) act);
return 0;
}
@@ -1536,8 +1548,8 @@ static int being_set_action(lua_State *s)
*/
static int being_get_direction(lua_State *s)
{
- Being *being = checkBeing(s, 1);
- lua_pushinteger(s, being->getDirection());
+ Entity *being = checkBeing(s, 1);
+ lua_pushinteger(s, being->getComponent<BeingComponent>()->getDirection());
return 1;
}
@@ -1549,9 +1561,9 @@ static int being_get_direction(lua_State *s)
*/
static int being_set_direction(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
BeingDirection dir = (BeingDirection) luaL_checkint(s, 2);
- being->setDirection(dir);
+ being->getComponent<BeingComponent>()->setDirection(*being, dir);
return 0;
}
@@ -1570,7 +1582,7 @@ static int being_set_direction(lua_State *s)
*/
static int being_set_walkmask(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const char *stringMask = luaL_checkstring(s, 2);
unsigned char mask = 0x00;
if (strchr(stringMask, 'w'))
@@ -1579,7 +1591,7 @@ static int being_set_walkmask(lua_State *s)
mask |= Map::BLOCKMASK_CHARACTER;
else if (strchr(stringMask, 'm'))
mask |= Map::BLOCKMASK_MONSTER;
- being->setWalkMask(mask);
+ static_cast<Actor *>(being)->setWalkMask(mask);
return 0;
}
@@ -1591,8 +1603,8 @@ static int being_set_walkmask(lua_State *s)
*/
static int being_get_walkmask(lua_State *s)
{
- Being *being = checkBeing(s, 1);
- const unsigned char mask = being->getWalkMask();
+ Entity *being = checkBeing(s, 1);
+ const unsigned char mask = static_cast<Actor *>(being)->getWalkMask();
luaL_Buffer buffer;
luaL_buffinit(s, &buffer);
if (mask & Map::BLOCKMASK_WALL)
@@ -1616,7 +1628,7 @@ static int being_get_walkmask(lua_State *s)
*/
static int chr_warp(lua_State *s)
{
- Being *q = checkCharacter(s, 1);
+ Entity *q = checkCharacter(s, 1);
int x = luaL_checkint(s, 3);
int y = luaL_checkint(s, 4);
@@ -1670,8 +1682,8 @@ static int chr_warp(lua_State *s)
*/
static int posX(lua_State *s)
{
- Being *being = checkBeing(s, 1);
- lua_pushinteger(s, being->getPosition().x);
+ Entity *being = checkBeing(s, 1);
+ lua_pushinteger(s, static_cast<Actor *>(being)->getPosition().x);
return 1;
}
@@ -1683,8 +1695,8 @@ static int posX(lua_State *s)
*/
static int posY(lua_State *s)
{
- Being *being = checkBeing(s, 1);
- lua_pushinteger(s, being->getPosition().y);
+ Entity *being = checkBeing(s, 1);
+ lua_pushinteger(s, static_cast<Actor *>(being)->getPosition().y);
return 1;
}
@@ -1696,11 +1708,12 @@ static int posY(lua_State *s)
*/
static int being_get_base_attribute(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
int attr = luaL_checkint(s, 2);
luaL_argcheck(s, attr > 0, 2, "invalid attribute id");
- lua_pushinteger(s, being->getAttributeBase(attr));
+ lua_pushinteger(s, being->getComponent<BeingComponent>()
+ ->getAttributeBase(attr));
return 1;
}
@@ -1711,11 +1724,11 @@ static int being_get_base_attribute(lua_State *s)
*/
static int being_set_base_attribute(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
int attr = luaL_checkint(s, 2);
double value = luaL_checknumber(s, 3);
- being->setAttribute(attr, value);
+ being->getComponent<BeingComponent>()->setAttribute(*being, attr, value);
return 0;
}
@@ -1740,11 +1753,13 @@ static int being_set_base_attribute(lua_State *s)
*/
static int being_get_modified_attribute(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
int attr = luaL_checkint(s, 2);
luaL_argcheck(s, attr > 0, 2, "invalid attribute id");
- lua_pushinteger(s, being->getModifiedAttribute(attr));
+ const double value =
+ being->getComponent<BeingComponent>()->getModifiedAttribute(attr);
+ lua_pushinteger(s, value);
return 1;
}
@@ -1766,14 +1781,16 @@ static int being_get_modified_attribute(lua_State *s)
*/
static int being_apply_attribute_modifier(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
int attr = luaL_checkint(s,2);
double value = luaL_checknumber(s, 3);
int layer = luaL_checkint(s, 4);
int duration = luaL_optint(s, 5, 0);
int effectId = luaL_optint(s, 6, 0);
- being->applyModifier(attr, value, layer, duration, effectId);
+ being->getComponent<BeingComponent>()->applyModifier(*being, attr, value,
+ layer, duration,
+ effectId);
return 0;
}
@@ -1785,13 +1802,14 @@ static int being_apply_attribute_modifier(lua_State *s)
*/
static int being_remove_attribute_modifier(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
int attr = luaL_checkint(s, 2);
double value = luaL_checknumber(s, 3);
int layer = luaL_checkint(s, 4);
int effectId = luaL_optint(s, 5, 0);
- being->removeModifier(attr, value, layer, effectId);
+ being->getComponent<BeingComponent>()->removeModifier(*being, attr, value,
+ layer, effectId);
return 0;
}
@@ -1807,8 +1825,8 @@ static int being_remove_attribute_modifier(lua_State *s)
*/
static int being_get_gender(lua_State *s)
{
- Being *b = checkBeing(s, 1);
- lua_pushinteger(s, b->getGender());
+ Entity *b = checkBeing(s, 1);
+ lua_pushinteger(s, b->getComponent<BeingComponent>()->getGender());
return 1;
}
@@ -1825,9 +1843,9 @@ static int being_get_gender(lua_State *s)
*/
static int being_set_gender(lua_State *s)
{
- Being *b = checkBeing(s, 1);
+ Entity *b = checkBeing(s, 1);
const int gender = luaL_checkinteger(s, 2);
- b->setGender(getGender(gender));
+ b->getComponent<BeingComponent>()->setGender(getGender(gender));
return 0;
}
@@ -1844,7 +1862,7 @@ static int being_set_gender(lua_State *s)
*/
static int chr_get_level(lua_State *s)
{
- Being *ch = checkCharacter(s, 1);
+ Entity *ch = checkCharacter(s, 1);
auto *characterComponent = ch->getComponent<CharacterComponent>();
if (lua_gettop(s) > 1)
{
@@ -1870,7 +1888,7 @@ static int chr_get_level(lua_State *s)
*/
static int chr_get_exp(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
int skill = checkSkill(s, 2);
const int exp = c->getComponent<CharacterComponent>()->getExperience(skill);
@@ -1890,7 +1908,7 @@ static int chr_get_exp(lua_State *s)
*/
static int chr_give_exp(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
int skill = checkSkill(s, 2);
const int exp = luaL_checkint(s, 3);
const int optimalLevel = luaL_optint(s, 4, 0);
@@ -1920,7 +1938,7 @@ static int exp_for_level(lua_State *s)
*/
static int chr_get_hair_color(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
lua_pushinteger(s, c->getComponent<CharacterComponent>()->getHairColor());
return 1;
@@ -1933,12 +1951,12 @@ static int chr_get_hair_color(lua_State *s)
*/
static int chr_set_hair_color(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int color = luaL_checkint(s, 2);
luaL_argcheck(s, color >= 0, 2, "invalid color id");
c->getComponent<CharacterComponent>()->setHairColor(color);
- c->raiseUpdateFlags(UPDATEFLAG_LOOKSCHANGE);
+ static_cast<Actor *>(c)->raiseUpdateFlags(UPDATEFLAG_LOOKSCHANGE);
return 0;
}
@@ -1950,7 +1968,7 @@ static int chr_set_hair_color(lua_State *s)
*/
static int chr_get_hair_style(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
lua_pushinteger(s, c->getComponent<CharacterComponent>()->getHairStyle());
return 1;
@@ -1963,12 +1981,12 @@ static int chr_get_hair_style(lua_State *s)
*/
static int chr_set_hair_style(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int style = luaL_checkint(s, 2);
luaL_argcheck(s, style >= 0, 2, "invalid style id");
c->getComponent<CharacterComponent>()->setHairStyle(style);
- c->raiseUpdateFlags(UPDATEFLAG_LOOKSCHANGE);
+ static_cast<Actor *>(c)->raiseUpdateFlags(UPDATEFLAG_LOOKSCHANGE);
return 0;
}
@@ -1983,7 +2001,7 @@ static int chr_set_hair_style(lua_State *s)
*/
static int chr_get_kill_count(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
MonsterClass *monster = checkMonsterClass(s, 2);
lua_pushinteger(s, c->getComponent<CharacterComponent>()->getKillCount(monster->getId()));
@@ -1997,7 +2015,7 @@ static int chr_get_kill_count(lua_State *s)
*/
static int chr_get_rights(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
lua_pushinteger(s,
c->getComponent<CharacterComponent>()->getAccountLevel());
return 1;
@@ -2010,7 +2028,7 @@ static int chr_get_rights(lua_State *s)
*/
static int chr_kick(lua_State *s)
{
- Being *ch = checkCharacter(s, 1);
+ Entity *ch = checkCharacter(s, 1);
MessageOut kickmsg(GPMSG_CONNECT_RESPONSE);
kickmsg.writeInt8(ERRMSG_ADMINISTRATIVE_LOGOFF);
ch->getComponent<CharacterComponent>()->getClient()->disconnect(kickmsg);
@@ -2025,7 +2043,7 @@ static int chr_kick(lua_State *s)
*/
static int being_get_mapid(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
if (MapComposite *map = being->getMap())
lua_pushinteger(s, map->getID());
else
@@ -2043,7 +2061,7 @@ static int being_get_mapid(lua_State *s)
*/
static int chr_request_quest(lua_State *s)
{
- Being *ch = checkCharacter(s, 1);
+ Entity *ch = checkCharacter(s, 1);
const char *name = luaL_checkstring(s, 2);
luaL_argcheck(s, name[0] != 0, 2, "empty variable name");
luaL_checktype(s, 3, LUA_TFUNCTION);
@@ -2082,7 +2100,7 @@ static int chr_request_quest(lua_State *s)
*/
static int chr_try_get_quest(lua_State *s)
{
- Being *q = checkCharacter(s, 1);
+ Entity *q = checkCharacter(s, 1);
const char *name = luaL_checkstring(s, 2);
luaL_argcheck(s, name[0] != 0, 2, "empty variable name");
@@ -2106,7 +2124,7 @@ static int get_character_by_name(lua_State *s)
{
const char *name = luaL_checkstring(s, 1);
- Being *ch = gameHandler->getCharacterByNameSlow(name);
+ Entity *ch = gameHandler->getCharacterByNameSlow(name);
if (!ch)
lua_pushnil(s);
else
@@ -2122,7 +2140,7 @@ static int get_character_by_name(lua_State *s)
*/
static int chr_get_post(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
Script *script = getScript(s);
Script::Thread *thread = checkCurrentThread(s, script);
@@ -2145,10 +2163,11 @@ static int chr_get_post(lua_State *s)
*/
static int being_register(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
Script *script = getScript(s);
- being->signal_died.connect(sigc::mem_fun(script, &Script::processDeathEvent));
+ being->getComponent<BeingComponent>()->signal_died.connect(
+ sigc::mem_fun(script, &Script::processDeathEvent));
being->signal_removed.connect(sigc::mem_fun(script, &Script::processRemoveEvent));
return 0;
@@ -2161,7 +2180,7 @@ static int being_register(lua_State *s)
*/
static int chr_shake_screen(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int x = luaL_checkint(s, 2);
const int y = luaL_checkint(s, 3);
@@ -2187,7 +2206,7 @@ static int chr_shake_screen(lua_State *s)
*/
static int chr_create_text_particle(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const char *text = luaL_checkstring(s, 2);
MessageOut msg(GPMSG_CREATE_TEXT_PARTICLE);
@@ -2205,7 +2224,7 @@ static int chr_create_text_particle(lua_State *s)
static int chr_give_special(lua_State *s)
{
// cost_type is ignored until we have more than one cost type
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int special = checkSpecial(s, 2);
const int currentMana = luaL_optint(s, 3, 0);
@@ -2220,7 +2239,7 @@ static int chr_give_special(lua_State *s)
*/
static int chr_has_special(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int special = luaL_checkint(s, 2);
lua_pushboolean(s, c->getComponent<CharacterComponent>()->hasSpecial(
@@ -2238,7 +2257,7 @@ static int chr_has_special(lua_State *s)
*/
static int chr_take_special(lua_State *s)
{
- Being *c = checkCharacter(s, 1);
+ Entity *c = checkCharacter(s, 1);
const int special = luaL_checkint(s, 2);
lua_pushboolean(s, c->getComponent<CharacterComponent>()->hasSpecial(
@@ -2258,7 +2277,7 @@ static int chr_take_special(lua_State *s)
*/
static int monster_get_id(lua_State *s)
{
- Being *monster = checkMonster(s, 1);
+ Entity *monster = checkMonster(s, 1);
MonsterComponent *monsterComponent =
monster->getComponent<MonsterComponent>();
lua_pushinteger(s, monsterComponent->getSpecy()->getId());
@@ -2273,8 +2292,8 @@ static int monster_get_id(lua_State *s)
*/
static int monster_change_anger(lua_State *s)
{
- Being *monster = checkMonster(s, 1);
- Being *being = checkBeing(s, 2);
+ Entity *monster = checkMonster(s, 1);
+ Entity *being = checkBeing(s, 2);
const int anger = luaL_checkint(s, 3);
monster->getComponent<MonsterComponent>()->changeAnger(being, anger);
return 0;
@@ -2287,8 +2306,8 @@ static int monster_change_anger(lua_State *s)
*/
static int monster_drop_anger(lua_State *s)
{
- Being *monster = checkMonster(s, 1);
- Being *being = checkBeing(s, 2);
+ Entity *monster = checkMonster(s, 1);
+ Entity *being = checkBeing(s, 2);
monster->getComponent<MonsterComponent>()->forgetTarget(being);
return 0;
}
@@ -2301,7 +2320,7 @@ static int monster_drop_anger(lua_State *s)
*/
static int monster_get_angerlist(lua_State *s)
{
- Being *monster = checkMonster(s, 1);
+ Entity *monster = checkMonster(s, 1);
MonsterComponent *monsterComponent =
monster->getComponent<MonsterComponent>();
pushSTLContainer(s, monsterComponent->getAngerList());
@@ -2320,11 +2339,11 @@ static int monster_get_angerlist(lua_State *s)
*/
static int being_apply_status(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const int id = luaL_checkint(s, 2);
const int time = luaL_checkint(s, 3);
- being->applyStatusEffect(id, time);
+ being->getComponent<BeingComponent>()->applyStatusEffect(id, time);
return 0;
}
@@ -2335,10 +2354,10 @@ static int being_apply_status(lua_State *s)
*/
static int being_remove_status(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const int id = luaL_checkint(s, 2);
- being->removeStatusEffect(id);
+ being->getComponent<BeingComponent>()->removeStatusEffect(id);
return 0;
}
@@ -2349,10 +2368,11 @@ static int being_remove_status(lua_State *s)
*/
static int being_has_status(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const int id = luaL_checkint(s, 2);
- lua_pushboolean(s, being->hasStatusEffect(id));
+ lua_pushboolean(s, being->getComponent<BeingComponent>()
+ ->hasStatusEffect(id));
return 1;
}
@@ -2363,10 +2383,11 @@ static int being_has_status(lua_State *s)
*/
static int being_get_status_time(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const int id = luaL_checkint(s, 2);
- lua_pushinteger(s, being->getStatusEffectTime(id));
+ lua_pushinteger(s, being->getComponent<BeingComponent>()
+ ->getStatusEffectTime(id));
return 1;
}
@@ -2377,11 +2398,11 @@ static int being_get_status_time(lua_State *s)
*/
static int being_set_status_time(lua_State *s)
{
- Being *being = checkBeing(s, 1);
+ Entity *being = checkBeing(s, 1);
const int id = luaL_checkint(s, 2);
const int time = luaL_checkint(s, 3);
- being->setStatusEffectTime(id, time);
+ being->getComponent<BeingComponent>()->setStatusEffectTime(id, time);
return 0;
}
@@ -2664,8 +2685,8 @@ static int get_beings_in_circle(lua_State *s)
int x, y, r;
if (lua_islightuserdata(s, 1))
{
- Being *b = checkBeing(s, 1);
- const Point &pos = b->getPosition();
+ Entity *b = checkBeing(s, 1);
+ const Point &pos = static_cast<Actor *>(b)->getPosition();
x = pos.x;
y = pos.y;
r = luaL_checkint(s, 2);
@@ -2685,11 +2706,13 @@ static int get_beings_in_circle(lua_State *s)
int tableIndex = 1;
for (BeingIterator i(m->getAroundPointIterator(Point(x, y), r)); i; ++i)
{
- Being *b = *i;
+ Entity *b = *i;
char t = b->getType();
if (t == OBJECT_NPC || t == OBJECT_CHARACTER || t == OBJECT_MONSTER)
{
- if (Collision::circleWithCircle(b->getPosition(), b->getSize(),
+ Actor *actor = static_cast<Actor *>(b);
+ if (Collision::circleWithCircle(actor->getPosition(),
+ actor->getSize(),
Point(x, y), r))
{
lua_pushlightuserdata(s, b);
@@ -2724,10 +2747,10 @@ static int get_beings_in_rectangle(lua_State *s)
Rectangle rect = {x, y ,w, h};
for (BeingIterator i(m->getInsideRectangleIterator(rect)); i; ++i)
{
- Being *b = *i;
+ Entity *b = *i;
char t = b->getType();
if ((t == OBJECT_NPC || t == OBJECT_CHARACTER || t == OBJECT_MONSTER) &&
- rect.contains(b->getPosition()))
+ rect.contains(static_cast<Actor *>(b)->getPosition()))
{
lua_pushlightuserdata(s, b);
lua_rawseti(s, tableStackPosition, tableIndex);
@@ -2749,8 +2772,8 @@ static int get_distance(lua_State *s)
int x1, y1, x2, y2;
if (lua_gettop(s) == 2)
{
- Being *being1 = checkBeing(s, 1);
- Being *being2 = checkBeing(s, 2);
+ Actor *being1 = static_cast<Actor *>(checkBeing(s, 1));
+ Actor *being2 = static_cast<Actor *>(checkBeing(s, 2));
x1 = being1->getPosition().x;
y1 = being1->getPosition().y;
diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp
index 328ae8c..83ac36b 100644
--- a/src/scripting/luascript.cpp
+++ b/src/scripting/luascript.cpp
@@ -248,7 +248,7 @@ void LuaScript::load(const char *prog, const char *name,
mContext = previousContext;
}
-void LuaScript::processDeathEvent(Being *entity)
+void LuaScript::processDeathEvent(Entity *entity)
{
if (mDeathNotificationCallback.isValid())
{
@@ -275,7 +275,7 @@ void LuaScript::processRemoveEvent(Entity *entity)
/**
* Called when the server has recovered the value of a quest variable.
*/
-void LuaScript::getQuestCallback(Being *q,
+void LuaScript::getQuestCallback(Entity *q,
const std::string &value,
Script *script)
{
@@ -292,7 +292,7 @@ void LuaScript::getQuestCallback(Being *q,
/**
* Called when the server has recovered the post for a user.
*/
-void LuaScript::getPostCallback(Being *q,
+void LuaScript::getPostCallback(Entity *q,
const std::string &sender,
const std::string &letter,
Script *script)
diff --git a/src/scripting/luascript.h b/src/scripting/luascript.h
index b7bdde1..b874976 100644
--- a/src/scripting/luascript.h
+++ b/src/scripting/luascript.h
@@ -69,16 +69,16 @@ class LuaScript : public Script
void unref(Ref &ref);
- static void getQuestCallback(Being *,
+ static void getQuestCallback(Entity *,
const std::string &value,
Script *);
- static void getPostCallback(Being *,
+ static void getPostCallback(Entity *,
const std::string &sender,
const std::string &letter,
Script *);
- void processDeathEvent(Being *entity);
+ void processDeathEvent(Entity *entity);
void processRemoveEvent(Entity *entity);
diff --git a/src/scripting/luautil.cpp b/src/scripting/luautil.cpp
index f835be8..261acd1 100644
--- a/src/scripting/luautil.cpp
+++ b/src/scripting/luautil.cpp
@@ -121,21 +121,21 @@ Script *getScript(lua_State *s)
valid in the map.
TODO: do it. */
-Being *getBeing(lua_State *s, int p)
+Entity *getBeing(lua_State *s, int p)
{
if (!lua_islightuserdata(s, p))
return 0;
- return static_cast<Being *>(lua_touserdata(s, p));
+ return static_cast<Entity *>(lua_touserdata(s, p));
}
-Being *getCharacter(lua_State *s, int p)
+Entity *getCharacter(lua_State *s, int p)
{
if (!lua_islightuserdata(s, p))
return 0;
Entity *t = static_cast<Entity *>(lua_touserdata(s, p));
if (t->getType() != OBJECT_CHARACTER)
return 0;
- return static_cast<Being *>(t);
+ return static_cast<Entity *>(t);
}
ItemClass *getItemClass(lua_State *s, int p)
@@ -158,14 +158,14 @@ ItemClass *getItemClass(lua_State *s, int p)
return itemClass;
}
-Being *getMonster(lua_State *s, int p)
+Entity *getMonster(lua_State *s, int p)
{
if (!lua_islightuserdata(s, p))
return 0;
Entity *t = static_cast<Entity *>(lua_touserdata(s, p));
if (t->getType() != OBJECT_MONSTER)
return 0;
- return static_cast<Being*>(t);
+ return t;
}
MonsterClass *getMonsterClass(lua_State *s, int p)
@@ -188,27 +188,27 @@ MonsterClass *getMonsterClass(lua_State *s, int p)
return monsterClass;
}
-Being *getNpc(lua_State *s, int p)
+Entity *getNpc(lua_State *s, int p)
{
if (!lua_islightuserdata(s, p))
return 0;
Entity *t = static_cast<Entity *>(lua_touserdata(s, p));
if (t->getType() != OBJECT_NPC)
return 0;
- return static_cast<Being*>(t);
+ return t;
}
-Being *checkBeing(lua_State *s, int p)
+Entity *checkBeing(lua_State *s, int p)
{
- Being *being = getBeing(s, p);
+ Entity *being = getBeing(s, p);
luaL_argcheck(s, being, p, "being expected");
return being;
}
-Being *checkCharacter(lua_State *s, int p)
+Entity *checkCharacter(lua_State *s, int p)
{
- Being *character = getCharacter(s, p);
+ Entity *character = getCharacter(s, p);
luaL_argcheck(s, character, p, "character expected");
return character;
}
@@ -220,9 +220,9 @@ ItemClass *checkItemClass(lua_State *s, int p)
return itemClass;
}
-Being *checkMonster(lua_State *s, int p)
+Entity *checkMonster(lua_State *s, int p)
{
- Being *monster = getMonster(s, p);
+ Entity *monster = getMonster(s, p);
luaL_argcheck(s, monster, p, "monster expected");
return monster;
}
@@ -234,9 +234,9 @@ MonsterClass *checkMonsterClass(lua_State *s, int p)
return monsterClass;
}
-Being *checkNpc(lua_State *s, int p)
+Entity *checkNpc(lua_State *s, int p)
{
- Being *npc = getNpc(s, p);
+ Entity *npc = getNpc(s, p);
luaL_argcheck(s, npc, p, "npc expected");
return npc;
}
diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h
index bf335d2..1bc0293 100644
--- a/src/scripting/luautil.h
+++ b/src/scripting/luautil.h
@@ -37,7 +37,6 @@ extern "C" {
#include "game-server/attack.h"
#include "game-server/specialmanager.h"
-class Being;
class CharacterComponent;
class Entity;
class ItemClass;
@@ -165,19 +164,19 @@ typedef LuaUserData<SpecialManager::SpecialInfo> LuaSpecialInfo;
Script * getScript(lua_State *s);
-Being * getBeing(lua_State *s, int p);
-Being * getCharacter(lua_State *s, int p);
+Entity * getBeing(lua_State *s, int p);
+Entity * getCharacter(lua_State *s, int p);
ItemClass * getItemClass(lua_State *s, int p);
-Being * getMonster(lua_State *s, int p);
+Entity * getMonster(lua_State *s, int p);
MonsterClass * getMonsterClass(lua_State *s, int p);
-Being * getNpc(lua_State *s, int p);
+Entity * getNpc(lua_State *s, int p);
-Being * checkBeing(lua_State *s, int p);
-Being * checkCharacter(lua_State *s, int p);
+Entity * checkBeing(lua_State *s, int p);
+Entity * checkCharacter(lua_State *s, int p);
ItemClass * checkItemClass(lua_State *s, int p);
-Being * checkMonster(lua_State *s, int p);
+Entity * checkMonster(lua_State *s, int p);
MonsterClass * checkMonsterClass(lua_State *s, int p);
-Being * checkNpc(lua_State *s, int p);
+Entity * checkNpc(lua_State *s, int p);
int checkSkill(lua_State *s, int p);
int checkSpecial(lua_State *s, int p);
diff --git a/src/scripting/script.h b/src/scripting/script.h
index 574d1b9..694deed 100644
--- a/src/scripting/script.h
+++ b/src/scripting/script.h
@@ -31,7 +31,6 @@
#include <sigc++/trackable.h>
-class Being;
class MapComposite;
class Entity;
@@ -238,7 +237,7 @@ class Script : public sigc::trackable
const Context *getContext() const
{ return mContext; }
- virtual void processDeathEvent(Being *entity) = 0;
+ virtual void processDeathEvent(Entity *entity) = 0;
virtual void processRemoveEvent(Entity *entity) = 0;
diff --git a/src/scripting/scriptmanager.cpp b/src/scripting/scriptmanager.cpp
index 39a1a6a..ee23161 100644
--- a/src/scripting/scriptmanager.cpp
+++ b/src/scripting/scriptmanager.cpp
@@ -49,7 +49,7 @@ Script *ScriptManager::currentState()
return _currentState;
}
-bool ScriptManager::performCraft(Being *crafter,
+bool ScriptManager::performCraft(Entity *crafter,
const std::list<InventoryItem> &recipe)
{
if (!_craftCallback.isValid())
diff --git a/src/scripting/scriptmanager.h b/src/scripting/scriptmanager.h
index 03b6e64..14b01b6 100644
--- a/src/scripting/scriptmanager.h
+++ b/src/scripting/scriptmanager.h
@@ -55,7 +55,7 @@ bool loadMainScript(const std::string &file);
*/
Script *currentState();
-bool performCraft(Being *crafter, const std::list<InventoryItem> &recipe);
+bool performCraft(Entity *crafter, const std::list<InventoryItem> &recipe);
void setCraftCallback(Script *script);
void setSpecialCallback(Script *script);