Cuberite Forum
Renaming item health to item damage - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Renaming item health to item damage (/thread-500.html)



Renaming item health to item damage - xoft - 06-20-2012

Hi all,
I believe it would be a change for the better to rename cItem:m_ItemHealth to cItem:m_ItemDamage. Because that's what the value really is - a value of 0 specifies an undamaged item and increasing the number degrades the item.

I believe I can make the change incremental - first add the m_ItemDamage variable, providing the same value as m_ItemHealth, and then later remove the m_ItemHealth variable, when the plugins have adjusted.


RE: Renaming item health to item damage - FakeTruth - 06-21-2012

Yea, you can even use a unionTongue

Code:
union
{
   short m_ItemDamage, m_ItemHealth;
};

And they will be the same thingBig Grin


RE: Renaming item health to item damage - xoft - 06-21-2012

I'm not sure if tolua would eat that, I was planning on renaming it in C++ and adding the m_ItemHealth binding to ManualBindings. But hey, if it works this simply, why not?


RE: Renaming item health to item damage - FakeTruth - 06-21-2012

This works, because ToLua does not need to know about the union