mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11316] Implement a basic system to restore default faction for creatures after changes
A new specialized function SetFactionTemporary for creatures are added. It work just like setFaction but has in addition option to set flags. The flags determine if default faction should be restored and when; most commonly just before respawn and when reaching home after evade. SCRIPT_COMMAND_SET_FACTION for DB scripts and ACTION_T_SET_FACTION for creature_ai_scripts are now capable of using the system (documentation updated) The intention of the system is to be able to solve basic events that include faction changes, with the use of database only and in easier ways. It is advised that DB devs revise current database scripts to check if changes should be made. The same goes for EventAI devs regarding ACTION_T_SET_FACTION. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
0ceb42ff9a
commit
889ce13264
11 changed files with 71 additions and 16 deletions
|
|
@ -5713,8 +5713,15 @@ void Unit::CombatStop(bool includingCast)
|
|||
|
||||
AttackStop();
|
||||
RemoveAllAttackers();
|
||||
|
||||
if( GetTypeId()==TYPEID_PLAYER )
|
||||
((Player*)this)->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
|
||||
else if (GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (((Creature*)this)->GetTemporaryFactionFlags() & TEMPFACTION_RESTORE_COMBAT_STOP)
|
||||
((Creature*)this)->ClearTemporaryFaction();
|
||||
}
|
||||
|
||||
ClearInCombat();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue