void Vehicle::InstallAllAccessories(bool evading) { if (GetBase()->GetTypeId() == TYPEID_PLAYER || !evading) RemoveAllPassengers(); // We might have aura's saved in the DB with now invalid casters - remove VehicleAccessoryList const* accessories = sObjectMgr->GetVehicleAccessoryList(this); if (!accessories) return; for (VehicleAccessoryList::const_iterator itr = accessories->begin(); itr != accessories->end(); ++itr) if (!evading || itr->IsMinion) // only install minions on evade mode InstallAccessory(itr->AccessoryEntry, itr->SeatId, itr->IsMinion, itr->SummonedType, itr->SummonTime); }
void Vehicle::TeleportVehicle(float x, float y, float z, float ang) { vehiclePlayers.clear(); for (int8 i = 0; i < 8; i++) if (Unit* player = GetPassenger(i)) vehiclePlayers.insert(player->GetGUID()); RemoveAllPassengers(); // this can unlink Guns from Siege Engines _me->NearTeleportTo(x, y, z, ang); for (GuidSet::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr) if (Unit* player = sObjectAccessor->FindUnit(*itr)) player->NearTeleportTo(x, y, z, ang); }
void Vehicle::Uninstall(bool dismount/* = false*/) { /// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING) { sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry()); return; } _status = STATUS_UNINSTALLING; sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); RemoveAllPassengers(dismount); if (GetBase() && GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnUninstall(this); }
void Vehicle::Dismiss() { for(SeatMap::iterator itr = m_Seats.begin(); itr != m_Seats.end(); ++itr) { if(Unit *passenger = itr->second.passenger) if(passenger->GetTypeId() == TYPEID_UNIT && ((Creature*)passenger)->isVehicle()) { passenger->ExitVehicle(); ((Vehicle*)passenger)->Dismiss(); } } RemoveAllPassengers(); SendObjectDeSpawnAnim(GetGUID()); CombatStop(); AddObjectToRemoveList(); }
void Vehicle::Uninstall() { /// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION)) { TC_LOG_ERROR(LOG_FILTER_VEHICLES, "Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry()); return; } _status = STATUS_UNINSTALLING; TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); RemoveAllPassengers(); if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnUninstall(this); }
void Vehicle::Relocate(Position pos) { std::set<Unit*> vehiclePlayers; for(int8 i = 0; i < 8; i++) vehiclePlayers.insert(GetPassenger(i)); // passengers should be removed or they will have movement stuck RemoveAllPassengers(); for(std::set<Unit*>::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr) { if(Unit* plr = (*itr)) plr->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); } _me->SetPosition(pos, true); }
void Vehicle::Uninstall() { /// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION)) { TC_LOG_ERROR("entities.vehicle", "%s, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUID().ToString().c_str(), _creatureEntry); return; } _status = STATUS_UNINSTALLING; TC_LOG_DEBUG("entities.vehicle", "Vehicle::Uninstall Entry: %u, %s", _creatureEntry, _me->GetGUID().ToString().c_str()); RemoveAllPassengers(); if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnUninstall(this); }
void Vehicle::Uninstall() { /// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING) { sLog->outError("Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry()); return; } _status = STATUS_UNINSTALLING; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); #endif RemoveAllPassengers(); if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnUninstall(this); }
void Vehicle::Relocate (Position pos) { sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Relocate %u", me->GetEntry()); std::set<Unit*> vehiclePlayers; for (int8 i = 0; i < 8; i++) vehiclePlayers.insert(GetPassenger(i)); // passengers should be removed or they will have movement stuck RemoveAllPassengers(); for (std::set<Unit*>::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr) { if (Unit* player = (*itr)) { // relocate/setposition doesn't work for player player->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); } } me->UpdatePosition(pos, true); }
void Vehicle::SetVehicleId(uint32 id) { if(_vehicleInfo && id == _vehicleInfo->m_ID) return; VehicleEntry const *ve = sVehicleStore.LookupEntry(id); if(!ve) return; _vehicleInfo = ve; RemoveAllPassengers(); Seats.clear(); for(uint32 i = 0; i < 8; ++i) { uint32 seatId = _vehicleInfo->m_seatID[i]; if(seatId) if(VehicleSeatEntry const *veSeat = sVehicleSeatStore.LookupEntry(seatId)) Seats.insert(std::make_pair(i, VehicleSeat(veSeat))); } }
void VehicleKit::Reset() { RemoveAllPassengers(); InstallAllAccessories(m_pBase->GetEntry()); UpdateFreeSeatCount(); }
void VehicleKit::Reset() { RemoveAllPassengers(); UpdateFreeSeatCount(); m_isInitialized = false; }
TransportKit::~TransportKit() { RemoveAllPassengers(); }