[Quest API] Add CopyHateList() to Perl/Lua. (#2623)

* [Quest API] Add CopyHateList() to Perl/Lua.

# Perl
- Add `$mob->CopyHateList(to_mob)`.

# Lua
- Add `mob:CopyHateList(to_mob)`.

# Notes
- Allows operators to easily copy and entire hatelist from one mob to another.

* Update mob.cpp
This commit is contained in:
Alex King
2022-12-06 08:38:51 -05:00
committed by GitHub
parent 3774dc50d9
commit 91ea6462f2
5 changed files with 27 additions and 0 deletions
+12
View File
@@ -7051,3 +7051,15 @@ void Mob::CloneAppearance(Mob* other, bool clone_name)
TempName(other->GetCleanName());
}
}
void Mob::CopyHateList(Mob* to) {
if (hate_list.IsHateListEmpty() || !to || to->IsClient()) {
return;
}
for (const auto& h : hate_list.GetHateList()) {
if (h->entity_on_hatelist) {
to->AddToHateList(h->entity_on_hatelist, h->stored_hate_amount, h->hatelist_damage);
}
}
}