mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Preserve immortal group for players when damage is disabled
This commit is contained in:
parent
fd1c1a755e
commit
a01a02f7a1
4 changed files with 14 additions and 4 deletions
|
@ -355,6 +355,15 @@ int ObjectRef::l_set_armor_groups(lua_State *L)
|
|||
ItemGroupList groups;
|
||||
|
||||
read_groups(L, 2, groups);
|
||||
if (sao->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
|
||||
if (!g_settings->getBool("enable_damage") && !itemgroup_get(groups, "immortal")) {
|
||||
warningstream << "Mod tried to enable damage for a player, but it's "
|
||||
"disabled globally. Ignoring." << std::endl;
|
||||
infostream << script_get_backtrace(L) << std::endl;
|
||||
groups["immortal"] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sao->setArmorGroups(groups);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue