diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-07 17:09:05 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-07-07 17:09:05 +0200 |
commit | a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d (patch) | |
tree | 555f8bc01382a32af53f112c7ac016073c8cef61 /source/Entity.cpp | |
parent | Added StringUtils functions to Lua API; added StripColorCodes(); ChatLog now strips color codes from logged messages. (diff) | |
download | cuberite-a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d.tar cuberite-a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d.tar.gz cuberite-a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d.tar.bz2 cuberite-a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d.tar.lz cuberite-a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d.tar.xz cuberite-a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d.tar.zst cuberite-a3c8b12ee99ec53fbbf3b36bd71a8f45cf274c1d.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Entity.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/Entity.cpp b/source/Entity.cpp index d9855afb0..80fe0d266 100644 --- a/source/Entity.cpp +++ b/source/Entity.cpp @@ -431,6 +431,15 @@ void cEntity::Heal(int a_HitPoints) +void cEntity::SetHealth(int a_Health) +{ + m_Health = std::max(0, std::min(m_MaxHealth, a_Health)); +} + + + + + void cEntity::Tick(float a_Dt, cChunk & a_Chunk) { if (m_AttachedTo != NULL) |