From 8db89b8136686a5721080d18e8a14f03404aa095 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 9 Mar 2012 20:46:56 +0200 Subject: LuaEntity armor groups --- src/content_cao.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'src/content_cao.cpp') diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 836f719a3..33079fd11 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -240,6 +240,7 @@ private: int m_anim_num_frames; float m_anim_framelength; float m_anim_timer; + ItemGroupList m_armor_groups; public: LuaEntityCAO(IGameDef *gamedef, ClientEnvironment *env): @@ -594,14 +595,21 @@ public: m_hp = result_hp; // TODO: Execute defined fast response } + else if(cmd == LUAENTITY_CMD_UPDATE_ARMOR_GROUPS) + { + m_armor_groups.clear(); + int armor_groups_size = readU16(is); + for(int i=0; igetToolCapabilities(m_gamedef->idef()); @@ -613,7 +621,6 @@ public: if(result.did_punch) { - // TODO: Decrease hp by if(result.damage < m_hp) m_hp -= result.damage; else @@ -623,6 +630,19 @@ public: return false; } + + std::string debugInfoText() + { + std::ostringstream os(std::ios::binary); + os<<"LuaEntityCAO \n"; + os<<"armor={"; + for(ItemGroupList::const_iterator i = m_armor_groups.begin(); + i != m_armor_groups.end(); i++){ + os<first<<"="<second<<", "; + } + os<<"}"; + return os.str(); + } }; // Prototype -- cgit v1.2.3