aboutsummaryrefslogtreecommitdiff
path: root/src/script/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/common')
-rw-r--r--src/script/common/c_content.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index ddcdd803d..47443493b 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -183,7 +183,9 @@ void read_object_properties(lua_State *L, int index,
if(!lua_istable(L, index))
return;
- prop->hp_max = getintfield_default(L, -1, "hp_max", 10);
+ int hp_max = 0;
+ if (getintfield(L, -1, "hp_max", hp_max))
+ prop->hp_max = (s16)rangelim(hp_max, 0, S16_MAX);
getboolfield(L, -1, "physical", prop->physical);
getboolfield(L, -1, "collide_with_objects", prop->collideWithObjects);