TrinityCore
|
#include <Vehicle.h>
Public Member Functions | |
void | Install () |
Initializes power type for vehicle. Nothing more. More... | |
void | Uninstall () |
Removes all passengers and sets status to STATUS_UNINSTALLING. No new passengers can be added to the vehicle after this call. More... | |
void | Reset (bool evading=false) |
Reapplies immunities and reinstalls accessories. Only has effect for creatures. More... | |
void | InstallAllAccessories (bool evading) |
void | ApplyAllImmunities () |
Applies specific immunities that cannot be set in DB. More... | |
void | InstallAccessory (uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime) |
Installs an accessory. More... | |
Unit * | GetBase () const |
May be called from scripts. More... | |
VehicleEntry const * | GetVehicleInfo () const |
uint32 | GetCreatureEntry () const |
bool | HasEmptySeat (int8 seatId) const |
Checks if vehicle's seat specified by 'seatId' is empty. More... | |
Unit * | GetPassenger (int8 seatId) const |
Gets a passenger on specified seat. More... | |
SeatMap::const_iterator | GetNextEmptySeat (int8 seatId, bool next) const |
Gets the next empty seat based on current seat. More... | |
uint8 | GetAvailableSeatCount () const |
Gets the available seat count. More... | |
bool | AddPassenger (Unit *passenger, int8 seatId=-1) |
Attempts to add a passenger to the vehicle on 'seatId'. More... | |
void | EjectPassenger (Unit *passenger, Unit *controller) |
Vehicle * | RemovePassenger (Unit *passenger) |
Removes the passenger from the vehicle. More... | |
void | RelocatePassengers () |
Relocate passengers. Must be called after m_base::Relocate. More... | |
void | RemoveAllPassengers () |
Removes all current and pending passengers from the vehicle. More... | |
bool | IsVehicleInUse () const |
Returns information whether the vehicle is currently used by any unit. More... | |
void | SetLastShootPos (Position const &pos) |
Position const & | GetLastShootPos () const |
VehicleSeatEntry const * | GetSeatForPassenger (Unit const *passenger) const |
Returns information on the seat of specified passenger, represented by the format in VehicleSeat.dbc. More... | |
void | RemovePendingEventsForPassenger (Unit *passenger) |
Public Attributes | |
SeatMap | Seats |
The collection of all seats on the vehicle. Including vacant ones. More... | |
Protected Member Functions | |
Vehicle (Unit *unit, VehicleEntry const *vehInfo, uint32 creatureEntry) | |
~Vehicle () | |
Protected Member Functions inherited from TransportBase | |
TransportBase () | |
virtual | ~TransportBase () |
Protected Attributes | |
uint32 | UsableSeatNum |
Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags. More... | |
Private Types | |
enum | Status { STATUS_NONE, STATUS_INSTALLED, STATUS_UNINSTALLING } |
typedef std::list < VehicleJoinEvent * > | PendingJoinEventContainer |
Private Member Functions | |
SeatMap::iterator | GetSeatIteratorForPassenger (Unit *passenger) |
Gets seat iterator for specified passenger. More... | |
void | InitMovementInfoForBase () |
Sets correct MovementFlags2 based on VehicleFlags from DBC. More... | |
void | CalculatePassengerPosition (float &x, float &y, float &z, float *o) const override |
This method transforms supplied transport offsets into global coordinates. More... | |
void | CalculatePassengerOffset (float &x, float &y, float &z, float *o) const override |
This method transforms supplied global coordinates into local offsets. More... | |
void | RemovePendingEvent (VehicleJoinEvent *e) |
Removes objects from pending join event store. This method only removes it after it's executed or aborted to prevent leaving pointers to deleted events. More... | |
void | RemovePendingEventsForSeat (int8 seatId) |
Removes any pending events for given seatId. Executed when a ::Execute is called. More... | |
Private Attributes | |
Unit * | _me |
The underlying unit with the vehicle kit. Can be player or creature. More... | |
VehicleEntry const * | _vehicleInfo |
DBC data for vehicle. More... | |
GuidSet | vehiclePlayers |
uint32 | _creatureEntry |
Can be different than the entry of _me in case of players. More... | |
Status | _status |
Internal variable for sanity checks. More... | |
Position | _lastShootPos |
PendingJoinEventContainer | _pendingJoinEvents |
Collection of delayed join events for prospective passengers. More... | |
Friends | |
class | VehicleJoinEvent |
bool | Unit::CreateVehicleKit (uint32 id, uint32 creatureEntry, bool) |
void | Unit::RemoveVehicleKit (bool) |
Additional Inherited Members | |
Static Public Member Functions inherited from TransportBase | |
static void | CalculatePassengerPosition (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO) |
static void | CalculatePassengerOffset (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO) |
|
private |
|
private |
|
protected |
|
protected |
must be called before this.
Attempts to add a passenger to the vehicle on 'seatId'.
[in,out] | The | prospective passenger. |
seatId | Identifier for the seat. Value of -1 indicates the next available seat. |
adding passengers when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
void Vehicle::ApplyAllImmunities | ( | ) |
Applies specific immunities that cannot be set in DB.
|
inlineoverrideprivatevirtual |
This method transforms supplied global coordinates into local offsets.
Implements TransportBase.
|
inlineoverrideprivatevirtual |
This method transforms supplied transport offsets into global coordinates.
Implements TransportBase.
uint8 Vehicle::GetAvailableSeatCount | ( | ) | const |
|
inline |
May be called from scripts.
|
inline |
Gets the next empty seat based on current seat.
seatId | Identifier for the current seat. |
next | true if iterating forward, false means iterating backwards. |
Gets a passenger on specified seat.
seatId | Seat to look on. |
VehicleSeatEntry const * Vehicle::GetSeatForPassenger | ( | Unit const * | passenger | ) | const |
Returns information on the seat of specified passenger, represented by the format in VehicleSeat.dbc.
[in,out] | The | passenger for which we check the seat info. |
|
private |
Gets seat iterator for specified passenger.
[in,out] | passenger | Passenger to look up. |
|
inline |
Checks if vehicle's seat specified by 'seatId' is empty.
seatId | Identifier for the seat. |
|
private |
Sets correct MovementFlags2 based on VehicleFlags from DBC.
void Vehicle::Install | ( | ) |
Initializes power type for vehicle. Nothing more.
void Vehicle::InstallAccessory | ( | uint32 | entry, |
int8 | seatId, | ||
bool | minion, | ||
uint8 | type, | ||
uint32 | summonTime | ||
) |
Installs an accessory.
entry | The NPC entry of accessory. |
seatId | Identifier for the seat to add the accessory to. |
minion | true if accessory considered a 'minion'. Implies that the accessory will despawn when the vehicle despawns. Essentially that it has no life without the vehicle. Their fates are bound. |
type | See enum . |
summonTime | Time after which the minion is despawned in case of a timed despawn specified. |
adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
If for some reason adding accessory to vehicle fails it will unsummon in ::Abort
void Vehicle::InstallAllAccessories | ( | bool | evading | ) |
bool Vehicle::IsVehicleInUse | ( | ) | const |
Returns information whether the vehicle is currently used by any unit.
void Vehicle::RelocatePassengers | ( | ) |
Relocate passengers. Must be called after m_base::Relocate.
void Vehicle::RemoveAllPassengers | ( | ) |
Removes all current and pending passengers from the vehicle.
Setting to_Abort to true will cause ::Abort to be executed on next ::UpdateEvents call This will properly "reset" the pending join process for the passenger.
Update vehicle pointer in every pending join event - Abort may be called after vehicle is deleted
Removes the passenger from the vehicle.
[in,out] | unit | The passenger to remove. |
|
private |
Removes objects from pending join event store. This method only removes it after it's executed or aborted to prevent leaving pointers to deleted events.
[in] | e | The VehicleJoinEvent* to remove from pending event store. |
void Vehicle::RemovePendingEventsForPassenger | ( | Unit * | passenger | ) |
|
private |
Removes any pending events for given seatId. Executed when a ::Execute is called.
Removes any pending events for given passenger. Executed when vehicle control aura is removed while adding passenger is in progress.
seatId | Identifier for the seat. |
passenger | Unit that is supposed to enter the vehicle. |
Reapplies immunities and reinstalls accessories. Only has effect for creatures.
evading | true if called from CreatureAI::EnterEvadeMode |
void Vehicle::Uninstall | ( | ) |
Removes all passengers and sets status to STATUS_UNINSTALLING. No new passengers can be added to the vehicle after this call.
recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
|
friend |
|
friend |
|
friend |
|
private |
Can be different than the entry of _me in case of players.
|
private |
|
private |
The underlying unit with the vehicle kit. Can be player or creature.
|
private |
Collection of delayed join events for prospective passengers.
|
private |
Internal variable for sanity checks.
|
private |
DBC data for vehicle.
SeatMap Vehicle::Seats |
The collection of all seats on the vehicle. Including vacant ones.
|
protected |
Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags.
|
private |