mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11244] Collect in CreatureCreatePos data for delayed pos setup into Creature::Create.
* CreatureCreatePos work in 3 modes:
- exactly provided coordinates/orientation/map/phasemask
- exactly object + orientation as coordinates/map/phasemask
- delayed position calculation near provided object at specific dist/angle.
* Use in similar way and for Pet/Vehicle Create functions.
For Totem created new Totem::Create function with some moved in to it totem specific code.
* This let resolve recent problems with creature spawn and preserve fix for cases when
Creature::Create addon/script code expected known correct possition for creature.
This commit is contained in:
parent
44915f6f13
commit
2b65cdb3bb
13 changed files with 223 additions and 362 deletions
|
|
@ -663,30 +663,19 @@ bool ChatHandler::HandleDebugSpawnVehicleCommand(char* args)
|
|||
if (!ve)
|
||||
return false;
|
||||
|
||||
Player* chr = m_session->GetPlayer();
|
||||
|
||||
Vehicle *v = new Vehicle;
|
||||
|
||||
float px, py, pz;
|
||||
m_session->GetPlayer()->GetClosePoint(px, py, pz, m_session->GetPlayer()->GetObjectBoundingRadius());
|
||||
CreatureCreatePos pos(chr, chr->GetOrientation());
|
||||
|
||||
v->Relocate(px, py, pz, m_session->GetPlayer()->GetOrientation());
|
||||
|
||||
if (!v->IsPositionValid())
|
||||
{
|
||||
sLog.outError("Vehicle (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
|
||||
v->GetGUIDLow(), v->GetEntry(), v->GetPositionX(), v->GetPositionY());
|
||||
delete v;
|
||||
return false;
|
||||
}
|
||||
|
||||
Map *map = m_session->GetPlayer()->GetMap();
|
||||
|
||||
if (!v->Create(map->GenerateLocalLowGuid(HIGHGUID_VEHICLE), map, entry, id, m_session->GetPlayer()->GetTeam()))
|
||||
if (!v->Create(pos.GetMap()->GenerateLocalLowGuid(HIGHGUID_VEHICLE), pos, entry, id, chr->GetTeam()))
|
||||
{
|
||||
delete v;
|
||||
return false;
|
||||
}
|
||||
|
||||
map->Add((Creature*)v);
|
||||
pos.GetMap()->Add((Creature*)v);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue