这篇教程C++ GetPassenger函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetPassenger函数的典型用法代码示例。如果您正苦于以下问题:C++ GetPassenger函数的具体用法?C++ GetPassenger怎么用?C++ GetPassenger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetPassenger函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: InstallAccessoryvoid Vehicle::InstallAccessory (uint32 entry, int8 seatId, bool minion){ if (Unit *passenger = GetPassenger(seatId)) { // already installed if (passenger->GetEntry() == entry) { ASSERT(passenger->GetTypeId() == TYPEID_UNIT); if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled) passenger->ToCreature()->AI()->EnterEvadeMode(); return; } passenger->ExitVehicle(); // this should not happen } if (Creature *accessory = me->SummonCreature(entry, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000)) { if (minion) accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); accessory->EnterVehicle(this, seatId); if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnInstallAccessory(this, accessory); }}
开发者ID:55887MX,项目名称:CCORE,代码行数:26,
示例2: InstallAccessoryvoid Vehicle::InstallAccessory(uint32 entry, int8 seatId){ if(Unit *passenger = GetPassenger(seatId)) { // already installed if(passenger->GetEntry() == entry) return; passenger->ExitVehicle(); // this should not happen } const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry); if(!cInfo) return; Creature *accessory; if(cInfo->VehicleId) accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ()); else accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ()); if(!accessory) return; accessory->EnterVehicle(this, seatId); // This is not good, we have to send update twice accessory->SendMovementFlagUpdate();}
开发者ID:MilchBuby,项目名称:riboncore,代码行数:27,
示例3: GetPassenger//-----------------------------------------------------------------------------// Purpose: //-----------------------------------------------------------------------------bool CBaseTFVehicle::GetPassengerExitPoint( int nRole, Vector *pAbsPosition, QAngle *pAbsAngles ){ // FIXME: Clean this up CBasePlayer *pPlayer = GetPassenger(nRole); GetPassengerExitPoint( pPlayer, nRole, pAbsPosition, pAbsAngles ); return true;}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:10,
示例4: InstallAccessoryvoid Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion){ if (Unit *passenger = GetPassenger(seatId)) { // already installed if (passenger->GetEntry() == entry) { assert(passenger->GetTypeId() == TYPEID_UNIT); if (me->GetTypeId() == TYPEID_UNIT && me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled) passenger->ToCreature()->AI()->EnterEvadeMode(); return; } passenger->ExitVehicle(); // this should not happen } //TODO: accessory should be minion if (Creature *accessory = me->SummonCreature(entry, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000)) { if (minion) accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); accessory->EnterVehicle(this, seatId); // This is not good, we have to send update twice accessory->SendMovementFlagUpdate(); }}
开发者ID:LolJK,项目名称:PhantomCore,代码行数:25,
示例5: InstallAccessoryvoid VehicleKit::InstallAccessory(VehicleAccessory const* accessory){ if (Unit *passenger = GetPassenger(accessory->uiSeat)) { // already installed if (passenger->GetEntry() == accessory->uiAccessory) return; passenger->ExitVehicle(); } if (Creature* summoned = m_pBase->SummonCreature(accessory->uiAccessory, m_pBase->GetPositionX() + accessory->m_offsetX, m_pBase->GetPositionY() + accessory->m_offsetY, m_pBase->GetPositionZ() + accessory->m_offsetZ, m_pBase->GetOrientation() + accessory->m_offsetX, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000)) { SetDestination(accessory->m_offsetX,accessory->m_offsetY,accessory->m_offsetZ,accessory->m_offsetO,0.0f,0.0f); summoned->SetCreatorGuid(ObjectGuid()); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); summoned->EnterVehicle(m_pBase, accessory->uiSeat); SetDestination(); if (summoned->GetVehicle()) DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->uiSeat, m_pBase->GetObjectGuid().GetString().c_str()); else { sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->uiSeat, m_pBase->GetObjectGuid().GetString().c_str()); summoned->ForcedDespawn(); } } else sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)",accessory->uiAccessory, accessory->uiSeat,m_pBase->GetObjectGuid().GetString().c_str());}
开发者ID:X-src,项目名称:VektorEmu_3.3.5a_mangos,代码行数:31,
示例6: GetDriverCClientPlayer * CClientVehicle::GetOccupant(BYTE byteSeatId){ if(byteSeatId == 0) return GetDriver(); return GetPassenger(byteSeatId - 1);}
开发者ID:Azon099,项目名称:networked-iv,代码行数:7,
示例7: InstallAccessoryvoid VehicleKit::InstallAccessory(VehicleAccessory const* accessory){ if (Unit* passenger = GetPassenger(accessory->seatId)) { // already installed if (passenger->GetEntry() == accessory->passengerEntry) return; GetBase()->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, passenger->GetObjectGuid()); } if (Creature* summoned = GetBase()->SummonCreature(accessory->passengerEntry, GetBase()->GetPositionX() + accessory->m_offsetX, GetBase()->GetPositionY() + accessory->m_offsetY, GetBase()->GetPositionZ() + accessory->m_offsetZ, GetBase()->GetOrientation() + accessory->m_offsetX, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000)) { summoned->SetCreatorGuid(ObjectGuid()); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); int32 seatId = accessory->seatId + 1; SetDestination(accessory->m_offsetX,accessory->m_offsetY,accessory->m_offsetZ,accessory->m_offsetO,0.0f,0.0f); summoned->CastCustomSpell(GetBase(), SPELL_RIDE_VEHICLE_HARDCODED, &seatId, &seatId, NULL, true); SetDestination(); if (summoned->GetVehicle()) DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %i (real %i) of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->seatId, GetSeatId(summoned), GetBase()->GetObjectGuid().GetString().c_str()); else { sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s",summoned->GetObjectGuid().GetString().c_str(), accessory->seatId, GetBase()->GetObjectGuid().GetString().c_str()); summoned->ForcedDespawn(); } } else sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)",accessory->passengerEntry, accessory->seatId,GetBase()->GetObjectGuid().GetString().c_str());}
开发者ID:mynew3,项目名称:mangos,代码行数:32,
示例8: InstallAccessoryvoid Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool isVehicle, bool minion){ if(Unit *passenger = GetPassenger(seatId)) { // already installed if(passenger->GetEntry() == entry) { assert(passenger->GetTypeId() == TYPEID_UNIT); return; } passenger->ExitVehicle(); // this should not happen } //TODO: accessory should be minion if(isVehicle) { if(Vehicle *accessory = SummonVehicle(entry, 0, 0, 0, 0)) { accessory->EnterVehicle(this, seatId, true); // This is not good, we have to send update twice accessory->BuildVehicleInfo(accessory); } }else{ if(Creature *accessory = SummonCreature(entry, 0, 0, 0, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000)) { accessory->EnterVehicle(this, seatId); // This is not good, we have to send update twice WorldPacket data; accessory->BuildHeartBeatMsg(&data); accessory->SendMessageToSet(&data, false); } }}
开发者ID:X-Core,项目名称:X-core-addons,代码行数:33,
示例9: GetPowervoid Vehicle::RegeneratePower(Powers power){ uint32 curValue = GetPower(power); uint32 maxValue = GetMaxPower(power); if (curValue >= maxValue) return; float addvalue = 0.0f; // hack: needs more research of power type from the dbc. // It must contains some info about vehicles like Salvaged Chopper. if(m_vehicleInfo->m_powerType == POWER_TYPE_PYRITE) return; addvalue = 10.0f; ModifyPower(power, (int32)addvalue); for(int i =0; i != MAX_SEAT; i++) { if(Unit *pPassanger = GetPassenger(i)) { if(pPassanger->GetTypeId() == TYPEID_PLAYER) SendCreateUpdateToPlayer((Player*)pPassanger); } }}
开发者ID:X-Core,项目名称:X-core-addons,代码行数:29,
示例10: Relocatevoid 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* plr = (*itr)) { // relocate/setposition doesn't work for player plr->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); //plr->TeleportTo(pPlayer->GetMapId(), triggerPos.GetPositionX(), triggerPos.GetPositionY(), triggerPos.GetPositionZ(), triggerPos.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT); } } _me->UpdatePosition(pos, true); // problems, and impossible to do delayed enter //pPlayer->EnterVehicle(veh);}
开发者ID:Anonymus123,项目名称:AtomicCore-3.3.5a,代码行数:25,
示例11: GetCreatureAddonvoid Vehicle::InstallAllAccessories(){ if(!GetMap()) return; CreatureDataAddon const *cainfo = GetCreatureAddon(); if(!cainfo || !cainfo->passengers) return; for (CreatureDataAddonPassengers const* cPassanger = cainfo->passengers; cPassanger->seat_idx != -1; ++cPassanger) { // Continue if seat already taken if(GetPassenger(cPassanger->seat_idx)) continue; uint32 guid = 0; bool isVehicle = false; // Set guid and check whatever it is if(cPassanger->guid != 0) guid = cPassanger->guid; else { CreatureDataAddon const* passAddon; passAddon = ObjectMgr::GetCreatureTemplateAddon(cPassanger->entry); if(passAddon && passAddon->vehicle_id != 0) isVehicle = true; else guid = sObjectMgr.GenerateLowGuid(HIGHGUID_UNIT); } // Create it Creature *pPassenger = new Creature; if(!isVehicle) { uint32 entry = cPassanger->entry; if(entry == 0) { CreatureData const* data = sObjectMgr.GetCreatureData(guid); if(!data) continue; entry = data->id; } if(!pPassenger->Create(guid, GetMap(), GetPhaseMask(), entry, 0)) continue; pPassenger->LoadFromDB(guid, GetMap()); pPassenger->Relocate(GetPositionX(), GetPositionY(), GetPositionZ()); GetMap()->Add(pPassenger); pPassenger->AIM_Initialize(); } else pPassenger = (Creature*)SummonVehicle(cPassanger->entry, GetPositionX(), GetPositionY(), GetPositionZ(), 0); // Enter vehicle... pPassenger->EnterVehicle(this, cPassanger->seat_idx, true); // ...and send update. Without this, client wont show this new creature/vehicle... WorldPacket data; pPassenger->BuildHeartBeatMsg(&data); pPassenger->SendMessageToSet(&data, false); }}
开发者ID:sc0rpio0o,项目名称:diamondcore,代码行数:58,
示例12: Assert//-----------------------------------------------------------------------------// Purpose: Modify the player view/camera while in a vehicle//-----------------------------------------------------------------------------void CFourWheelServerVehicle::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles ){ Assert( nRole == VEHICLE_DRIVER ); CBasePlayer *pPlayer = GetPassenger( VEHICLE_DRIVER ); Assert( pPlayer ); *pAbsAngles = pPlayer->EyeAngles(); // yuck. this is an in/out parameter. GetFourWheelVehiclePhysics()->GetVehicleViewPosition( "vehicle_driver_eyes", 1.0f, pAbsOrigin, pAbsAngles );}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:12,
示例13: GetOwnerint CBaseTFVehicle::LocateEntryPoint( CBaseTFPlayer *pPlayer, float* fBest2dDistanceSqr ){ // Get the players origin and compare it to all the entry points on the // vehicle. Vector vecPlayerPos = pPlayer->GetAbsOrigin(); Vector vecEntryPos; QAngle vecEntryAngle; int iMinEntry = -1; float flMinDistance2 = INITIAL_MAX_DISTANCE; // Is the player the owner of the vehicle? bool bOwner = ( pPlayer == GetOwner() ); char szPassengerEyes[32]; for( int iEntryPoint = 0; iEntryPoint < m_nMaxPassengers; ++iEntryPoint ) { // If not the owner, check to see if the entry point is available. The // entry point is always available for the owner. bool bOccupied = ( GetPassenger( iEntryPoint ) != NULL ); // Also check for child vehicles... if ( bOccupied && !bOwner ) continue; // FIXME: Cache off the entry point Q_snprintf( szPassengerEyes, sizeof( szPassengerEyes ), "vehicle_feet_passenger%d", iEntryPoint ); int nAttachmentIndex = LookupAttachment( szPassengerEyes ); float flDistance2; if (nAttachmentIndex > 0) { GetAttachment( nAttachmentIndex, vecEntryPos, vecEntryAngle ); Vector vecDelta = vecEntryPos - vecPlayerPos; flDistance2 = vecDelta.AsVector2D().LengthSqr(); } else { // No attachment? Choose it if we must as a last resort flDistance2 = INITIAL_MAX_DISTANCE - 1; } if ( flDistance2 < flMinDistance2 ) { flMinDistance2 = flDistance2; iMinEntry = iEntryPoint; } } if( fBest2dDistanceSqr ) { *fBest2dDistanceSqr = flMinDistance2; } return iMinEntry;}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:56,
示例14: Assertvoid CAPC2FourWheelServerVehicle::GetVehicleViewPosition( int nRole, Vector *pAbsOrigin, QAngle *pAbsAngles ){ //FixMe, wtf? #ifndef DEBUG Assert( nRole == VEHICLE_DRIVER ); #endif CBaseCombatCharacter *pPlayer = GetPassenger( VEHICLE_ROLE_DRIVER ); Assert( pPlayer ); float flPitchFactor=1.0; *pAbsAngles = pPlayer->EyeAngles(); matrix3x4_t vehicleEyePosToWorld; Vector vehicleEyeOrigin; QAngle vehicleEyeAngles; GetAPC()->GetAttachment( "cannon_muzzle", vehicleEyeOrigin, vehicleEyeAngles ); Vector up,forward; GetAPC()->GetVectors(NULL,&forward,&up); vehicleEyeOrigin+=(forward*37)+(up*35); AngleMatrix( vehicleEyeAngles, vehicleEyePosToWorld );//#ifdef HL2_DLL// // View dampening.// if ( r_VehicleViewDampen.GetInt() )// {// GetAPC()->DampenEyePosition( vehicleEyeOrigin, vehicleEyeAngles );// }//#endif // Compute the relative rotation between the unperterbed eye attachment + the eye angles matrix3x4_t cameraToWorld; AngleMatrix( *pAbsAngles, cameraToWorld ); matrix3x4_t worldToEyePos; MatrixInvert( vehicleEyePosToWorld, worldToEyePos ); matrix3x4_t vehicleCameraToEyePos; ConcatTransforms( worldToEyePos, cameraToWorld, vehicleCameraToEyePos ); // Now perterb the attachment point vehicleEyeAngles.x = RemapAngleRange( PITCH_CURVE_ZERO * flPitchFactor, PITCH_CURVE_LINEAR, vehicleEyeAngles.x ); vehicleEyeAngles.z = RemapAngleRange( ROLL_CURVE_ZERO * flPitchFactor, ROLL_CURVE_LINEAR, vehicleEyeAngles.z ); AngleMatrix( vehicleEyeAngles, vehicleEyeOrigin, vehicleEyePosToWorld ); // Now treat the relative eye angles as being relative to this new, perterbed view position... matrix3x4_t newCameraToWorld; ConcatTransforms( vehicleEyePosToWorld, vehicleCameraToEyePos, newCameraToWorld ); // output new view abs angles MatrixAngles( newCameraToWorld, *pAbsAngles ); // UNDONE: *pOrigin would already be correct in single player if the HandleView() on the server ran after vphysics MatrixGetColumn( newCameraToWorld, 3, *pAbsOrigin );}
开发者ID:WorldGamers,项目名称:Mobile-Forces-Source,代码行数:53,
示例15: TeleportVehiclevoid 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);}
开发者ID:DoGoodS,项目名称:SkyFireEMU,代码行数:13,
示例16: InstallAccessoryvoid VehicleKit::InstallAccessory(VehicleAccessory const* accessory){ if (Unit* passenger = GetPassenger(accessory->seatId)) { // already installed if (passenger->GetEntry() == accessory->passengerEntry) return; GetBase()->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, passenger->GetObjectGuid()); } if (Creature* summoned = GetBase()->SummonCreature(accessory->passengerEntry, GetBase()->GetPositionX() + accessory->m_offsetX, GetBase()->GetPositionY() + accessory->m_offsetY, GetBase()->GetPositionZ() + accessory->m_offsetZ, GetBase()->GetOrientation() + accessory->m_offsetO, TEMPSUMMON_DEAD_DESPAWN, 0)) { summoned->SetCreatorGuid(ObjectGuid()); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); bool hideAccessory = false; SeatMap::const_iterator seat = m_Seats.find(accessory->seatId); if (seat != m_Seats.end()) { if (seat->second.seatInfo->m_flags & SEAT_FLAG_HIDE_PASSENGER) // coommon case hideAccessory = true; } if (!hideAccessory && (accessory->m_flags & ACCESSORY_FLAG_HIDE)) hideAccessory = true; if (hideAccessory) summoned->SetDisplayId(DEFAULT_HIDDEN_MODEL_ID); // set to empty model SetDestination(accessory->m_offsetX, accessory->m_offsetY, accessory->m_offsetZ, accessory->m_offsetO, 0.0f, 0.0f); int32 seatId = accessory->seatId + 1; summoned->SetPhaseMask(GetBase()->GetPhaseMask(), true); summoned->CastCustomSpell(GetBase(), SPELL_RIDE_VEHICLE_HARDCODED, &seatId, &seatId, NULL, true); SetDestination(); if (summoned->GetVehicle()) DEBUG_LOG("Vehicle::InstallAccessory %s accessory added, seat %i (real %i) of %s", summoned->GetGuidStr().c_str(), accessory->seatId, GetSeatId(summoned), GetBase()->GetGuidStr().c_str()); else { sLog.outError("Vehicle::InstallAccessory cannot install %s to seat %u of %s", summoned->GetGuidStr().c_str(), accessory->seatId, GetBase()->GetGuidStr().c_str()); summoned->ForcedDespawn(); } } else sLog.outError("Vehicle::InstallAccessory cannot summon creature id %u (seat %u of %s)", accessory->passengerEntry, accessory->seatId, GetBase()->GetGuidStr().c_str());}
开发者ID:mangosR2,项目名称:mangos3,代码行数:51,
示例17: InstallAccessoryvoid VehicleKit::InstallAccessory( uint32 entry, int8 seatId, bool minion /*= true*/ ){ if (Unit *passenger = GetPassenger(seatId)) { // already installed if (passenger->GetEntry() == entry) return; passenger->ExitVehicle(); } if (Creature *accessory = m_pBase->SummonCreature(entry, m_pBase->GetPositionX(), m_pBase->GetPositionY(), m_pBase->GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000)) accessory->EnterVehicle(this, seatId);}
开发者ID:eviljared,项目名称:diamondcore,代码行数:14,
示例18: ASSERTvoid Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime){ if (Unit *passenger = GetPassenger(seatId)) { // already installed if (passenger->GetEntry() == entry) { ASSERT(passenger->GetTypeId() == TYPEID_UNIT); if (me->GetTypeId() == TYPEID_UNIT) { if (me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled) { passenger->ToCreature()->AI()->EnterEvadeMode(); return; } else if (passenger->ToTempSummon()->GetSummonType() == TEMPSUMMON_MANUAL_DESPAWN) { passenger->ExitVehicle(); passenger->ToTempSummon()->DespawnOrUnsummon(); ASSERT(!GetPassenger(seatId)) } } }
开发者ID:AlexTheBest,项目名称:ACore,代码行数:23,
示例19: Relocatevoid 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);}
开发者ID:FreedomEmu,项目名称:FreedomEmu,代码行数:17,
示例20: GetPassengervoid CWalkerMiniStrider::StartFiringLargeGun(){ CBasePlayer *pPlayer = GetPassenger( VEHICLE_DRIVER ); Assert( pPlayer ); if ( !pPlayer ) return; // Figure out what we're shooting at. Vector vSrc = GetLargeGunShootOrigin(); Vector vEyePos = pPlayer->EyePosition(); Vector vEyeForward; AngleVectors( pPlayer->LocalEyeAngles(), &vEyeForward ); trace_t trace; UTIL_TraceLine( vEyePos, vEyePos + vEyeForward * 2000, MASK_SOLID, this, COLLISION_GROUP_NONE, &trace ); if ( trace.fraction < 1 ) { m_vLargeGunForward = trace.endpos - vSrc; VectorNormalize( m_vLargeGunForward ); trace_t trace; UTIL_TraceLine( vSrc, vSrc + m_vLargeGunForward * 2000, MASK_SOLID, this, COLLISION_GROUP_NONE, &trace ); if ( trace.fraction < 1 ) { EnableWalkMode( false ); m_vLargeGunTargetPos = trace.endpos; m_flLargeGunCountdown = LARGE_GUN_FIRE_TIME; m_bFiringLargeGun = true; // Show an energy beam until we actually shoot. m_pEnergyBeam = CBeam::BeamCreate( "sprites/physbeam.vmt", 25 ); m_pEnergyBeam->SetColor( 255, 0, 0 ); m_pEnergyBeam->SetBrightness( 100 ); m_pEnergyBeam->SetNoise( 4 ); m_pEnergyBeam->PointsInit( vSrc, m_vLargeGunTargetPos ); m_pEnergyBeam->LiveForTime( LARGE_GUN_FIRE_TIME ); // Play a charge-up sound. CPASAttenuationFilter filter( this, "Skirmisher.GunChargeSound" ); EmitSound( filter, 0, "Skirmisher.GunChargeSound", &vSrc ); } }}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:45,
示例21: definedvoid Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime){ /// @Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING) { sLog->outError("Vehicle GuidLow: %u, Entry: %u attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry(), entry, (int32)seatId); return; }#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle: Installing accessory entry %u on vehicle entry %u (seat:%i)", entry, GetCreatureEntry(), seatId);#endif if (Unit* passenger = GetPassenger(seatId)) { // already installed if (passenger->GetEntry() == entry) { ASSERT(passenger->GetTypeId() == TYPEID_UNIT); if (_me->GetTypeId() == TYPEID_UNIT) { if (_me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled) passenger->ToCreature()->AI()->EnterEvadeMode(); return; } } else passenger->ExitVehicle(); // this should not happen } if (TempSummon* accessory = _me->SummonCreature(entry, *_me, TempSummonType(type), summonTime)) { if (minion) accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); if (!_me->HandleSpellClick(accessory, seatId)) { accessory->UnSummon(); return; } if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnInstallAccessory(this, accessory); }}
开发者ID:Helias,项目名称:azerothcore-wotlk,代码行数:45,
示例22: InstallAccessoryvoid Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime){ if (Unit *passenger = GetPassenger(seatId)) { // already installed if (passenger->GetEntry() == entry) { ASSERT(passenger->GetTypeId() == TYPEID_UNIT); if (me->GetTypeId() == TYPEID_UNIT) { if (me->ToCreature()->IsInEvadeMode() && passenger->ToCreature()->IsAIEnabled) passenger->ToCreature()->AI()->EnterEvadeMode(); return; } } else passenger->ExitVehicle(); // this should not happen } if (Creature *accessory = me->SummonCreature(entry, *me, TempSummonType(type), summonTime)) { if (minion) accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY); if (!me->HandleSpellClick(accessory, seatId)) { accessory->AddObjectToRemoveList(); return; } if (!accessory->IsOnVehicle(me)) { accessory->AddObjectToRemoveList(); return; // Something went wrong in the spellsystem } // This is not good, we have to send update twice accessory->SendMovementFlagUpdate(); if (GetBase()->GetTypeId() == TYPEID_UNIT) sScriptMgr->OnInstallAccessory(this, accessory); }}
开发者ID:Voltrex,项目名称:TrinityCore,代码行数:44,
示例23: GetTimeDeltavoid CWalkerMiniStrider::UpdateLargeGun(){ float dt = GetTimeDelta(); if ( !m_bFiringLargeGun ) return; m_flLargeGunCountdown -= dt; if ( m_flLargeGunCountdown <= 0 ) { // Fire! Vector vSrc = GetLargeGunShootOrigin(); trace_t trace; UTIL_TraceLine( vSrc, vSrc + m_vLargeGunForward * 2000, MASK_SOLID, this, COLLISION_GROUP_NONE, &trace ); if ( trace.fraction < 1 ) { CBasePlayer *pDriver = GetPassenger( VEHICLE_DRIVER ); if ( pDriver ) { UTIL_ImpactTrace( &trace, DMG_ENERGYBEAM, "Strider" ); Vector vHitPos = trace.endpos; float flDamageRadius = 100; float flDamage = 100; CPASFilter filter( vHitPos ); te->Explosion( filter, 0.0, &vHitPos, g_sModelIndexFireball, 2.0, 15, TE_EXPLFLAG_NONE, flDamageRadius, flDamage ); UTIL_ScreenShake( vHitPos, 10.0, 150.0, 1.0, 100, SHAKE_START ); RadiusDamage( CTakeDamageInfo( this, pDriver, flDamage, DMG_BLAST ), vHitPos, flDamageRadius, CLASS_NONE ); } } StopFiringLargeGun(); }}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:43,
示例24: Relocatevoid 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);}
开发者ID:55887MX,项目名称:CCORE,代码行数:22,
示例25: InstallAccessoryvoid VehicleKit::InstallAccessory(VehicleAccessory const* accessory){ if (Unit *passenger = GetPassenger(accessory->uiSeat)) { // already installed if (passenger->GetEntry() == accessory->uiAccessory) return; passenger->ExitVehicle(); } if (Creature* summoned = m_pBase->SummonCreature(accessory->uiAccessory, m_pBase->GetPositionX() + accessory->m_offsetX, m_pBase->GetPositionY() + accessory->m_offsetY, m_pBase->GetPositionZ() + accessory->m_offsetZ, m_pBase->GetOrientation() + accessory->m_offsetX, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000)) { SetDestination(accessory->m_offsetX,accessory->m_offsetY,accessory->m_offsetZ,accessory->m_offsetO,0.0f,0.0f); summoned->SetCreatorGuid(ObjectGuid()); summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); summoned->EnterVehicle(this, accessory->uiSeat); SetDestination(); }}
开发者ID:Erotix8210,项目名称:WoWBaseEmu,代码行数:22,
示例26: LocateEntryPoint//-----------------------------------------------------------------------------// Purpose: Try to board the vehicle//-----------------------------------------------------------------------------void CBaseTFVehicle::AttemptToBoardVehicle( CBaseTFPlayer *pPlayer ){ if ( !CanGetInVehicle( pPlayer ) ) return; // Locate the entry point. int nRole = LocateEntryPoint( pPlayer ); if ( nRole != -1 ) { // Set the owner flag. bool bOwner = ( pPlayer == GetOwner() ); if ( bOwner ) { // Check to see if a player exists at this location (role). CBaseTFPlayer *pExistingPlayer = static_cast<CBaseTFPlayer*>( GetPassenger( nRole ) ); if ( pExistingPlayer ) { pExistingPlayer->LeaveVehicle(); // Get in the vehicle. pPlayer->GetInVehicle( this, nRole ); // Then see if we can move the other player to another slot in this vehicle int nEmptyRole = GetEmptyRole(); if ( nEmptyRole != -1 ) { pExistingPlayer->GetInVehicle( this, nEmptyRole ); } return; } } // Get in the vehicle. pPlayer->GetInVehicle( this, nRole ); }}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:39,
注:本文中的GetPassenger函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetPassword函数代码示例 C++ GetParsedAttr函数代码示例 |