mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
[10362] Implement creature_movement_template
Template can be used for several cases: * Unique creature that are already spawned in database (requires creature.MovementType=2 like guid based creature_movement) * Summoned creature that has a pre-defined path (requires creature_template.MovementType=2) Note that creature_template.MovementType=2 should be used with care, and must not be used for creatures that may be summoned in random locations in world. Added additional startup checks for existing creature_movement-table Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
4dae2cfe89
commit
db7db6382a
8 changed files with 411 additions and 117 deletions
|
|
@ -50,11 +50,29 @@ void WaypointMovementGenerator<Creature>::LoadPath(Creature &creature)
|
|||
|
||||
i_path = sWaypointMgr.GetPath(creature.GetDBTableGUIDLow());
|
||||
|
||||
// We may LoadPath() for several occasions:
|
||||
|
||||
// 1: When creature.MovementType=2
|
||||
// 1a) Path is selected by creature.guid == creature_movement.id
|
||||
// 1b) Path for 1a) does not exist and then use path from creature.GetEntry() == creature_movement_template.entry
|
||||
|
||||
// 2: When creature_template.MovementType=2
|
||||
// 2a) Creature is summoned and has creature_template.MovementType=2
|
||||
// Creators need to be sure that creature_movement_template is always valid for summons.
|
||||
// Mob that can be summoned anywhere should not have creature_movement_template for example.
|
||||
|
||||
// No movement found for guid
|
||||
if (!i_path)
|
||||
{
|
||||
sLog.outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path",
|
||||
creature.GetName(), creature.GetEntry(), creature.GetDBTableGUIDLow());
|
||||
return;
|
||||
i_path = sWaypointMgr.GetPathTemplate(creature.GetEntry());
|
||||
|
||||
// No movement found for entry
|
||||
if (!i_path)
|
||||
{
|
||||
sLog.outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path",
|
||||
creature.GetName(), creature.GetEntry(), creature.GetDBTableGUIDLow());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// We have to set the destination here (for the first point), right after Initialize. Without, we may not have valid xyz for GetResetPosition
|
||||
|
|
@ -266,7 +284,7 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
|
|||
else
|
||||
{
|
||||
// If not stopped then stop it
|
||||
creature.StopMoving();
|
||||
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
|
||||
SetStoppedByPlayer(false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue