DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ OnStepEvent()

void DayZPlayer::OnStepEvent ( string pEventType,
string pUserString,
int pUserInt )
inlineprotected

Event Processing

См. определение в файле DayZPlayerImplement.c строка 3269

3270 {
3271 vector orientation;
3272 vector position = GetPosition();
3273 DayZPlayerType playerType = GetDayZPlayerType();
3274 HumanMovementState state = new HumanMovementState();
3275 GetMovementState(state);
3276
3277 SurfaceInfo surfaceInfo;
3278 if (pUserInt < 100)
3279 {
3280 string boneName = "";
3281 if (pUserInt % 2 == 1)
3282 {
3283 boneName = "leftfoot";
3284 surfaceInfo = g_Game.GetSurfaceInfoUnderObjectByBone(this, SurfaceAnimationBone.LeftBackLimb);
3285 if (!surfaceInfo)
3286 {
3287 surfaceInfo = g_Game.GetSurfaceInfoUnderObjectByBone(this, SurfaceAnimationBone.RightBackLimb);
3288 boneName = "rightfoot";
3289 }
3290 }
3291 else
3292 {
3293 boneName = "rightfoot";
3294 surfaceInfo = g_Game.GetSurfaceInfoUnderObjectByBone(this, SurfaceAnimationBone.RightBackLimb);
3295 if (!surfaceInfo)
3296 {
3297 surfaceInfo = g_Game.GetSurfaceInfoUnderObjectByBone(this, SurfaceAnimationBone.LeftBackLimb);
3298 boneName = "leftfoot";
3299 }
3300 }
3301
3302 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER || !GetGame().IsMultiplayer())
3303 {
3304 //synced dusty ceiling effect
3305 if (surfaceInfo)
3306 {
3307 HandleCeilingDustStepEffect(surfaceInfo, boneName);
3308 }
3309 }
3310
3311 #ifdef DIAG_DEVELOPER
3312 if (GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
3313 {
3314 if (DiagMenu.GetBool(DiagMenuIDs.MISC_PLAYER_SURFACE_DEBUG))
3315 {
3316 string surfaceType = "NULL";
3317 if (surfaceInfo)
3318 surfaceType = surfaceInfo.GetSurfaceType();
3319
3320 CharacterStepsDebug.SetStepData(boneName, surfaceType);
3321 }
3322 }
3323 #endif
3324 }
3325
3326 #ifndef SERVER
3327 #ifndef NO_GUI
3328 DayZPlayerTypeStepSoundLookupTable table = playerType.GetStepSoundLookupTable();
3329 SoundObjectBuilder soundBuilder = NULL;
3330 if (pUserInt < 100)
3331 {
3332 if (surfaceInfo)
3333 {
3334 m_LastSurfaceUnderHash = surfaceInfo.GetSurfaceType().Hash();
3335
3336 if (state.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
3337 {
3338 orientation = -GetDirection();//Using direction to compute forward dot product of surface in the direction oposite player
3339
3340 vector surfaceNormal = g_Game.SurfaceGetNormal(position[0], position[2]);
3341 float dotWithForward = vector.Dot(surfaceNormal, orientation);
3342
3343 float pitch = Math.Atan2(-dotWithForward, surfaceNormal[1]) * Math.RAD2DEG;
3344
3345 //VectorToYaw using first and second float insted of first and third then why it is need adjustment
3346 orientation[1] = orientation[2];
3347 orientation[2] = 0;
3348
3349 float yaw = orientation.VectorToYaw();
3350
3351 orientation[0] = -yaw + 90;
3352 orientation[1] = pitch;
3353
3354
3355 int stepParticleID = surfaceInfo.GetStepParticleId();
3356 if (stepParticleID > 0)
3357 {
3358 ParticleSource source = ParticleManager.GetInstance().PlayInWorldEx(stepParticleID, null, position);
3359 //Direction align with surface in the opposite direction to the player
3360 source.SetOrientation(orientation);
3361 }
3362 }
3363
3364 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3365 }
3366 }
3367 else
3368 {
3369 surfaceInfo = g_Game.GetSurfaceInfoUnderObject(this);
3370 if (surfaceInfo)
3371 m_LastSurfaceUnderHash = surfaceInfo.GetSurfaceType().Hash();
3372
3373 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3374 }
3375
3376 if (soundBuilder != null && g_Game.GetPlayer())
3377 {
3378 m_StepCounterVegetation++;
3379
3380 if (m_StepCounterVegetation >= 3)
3381 {
3382 m_StepCounterVegetation = 0;
3383 g_Game.ProfilerStart("Player_Vegetation_Sounds");
3384
3385 orientation = vector.Zero;
3386 vector edgeLength = Vector(0.75, 2.5, 0.75);
3387 array<Object> excludedObjects = new array<Object>();
3388 excludedObjects.Insert(this);
3389 array<Object> collidedObjects = new array<Object>();
3390
3391 if (g_Game.IsBoxCollidingGeometry(position, orientation, edgeLength, ObjIntersectView, ObjIntersectNone, excludedObjects, collidedObjects))
3392 {
3393 foreach (Object obj : collidedObjects)
3394 {
3395 WoodBase colPlant;
3396 if (Class.CastTo(colPlant, obj))
3397 {
3398 if (colPlant.HasPlayerCollisionParticle() && state.m_iMovement > DayZPlayerConstants.MOVEMENTIDX_WALK)
3399 MiscEffects.PlayVegetationCollideParticles(colPlant, this);
3400
3401 if (colPlant.HasPlayerCollisionSound())
3402 {
3403 SoundObject vegSoundObject;
3404
3405 StaticObjectType plantType = StaticObjectType.Cast(colPlant.GetEntityType());
3406
3407 //custom lookup first
3408 SoundObjectBuilder vegSoundObjectBuilder = plantType.GetVegetationSoundBuilderFromEventID(pUserInt);
3409 if (vegSoundObjectBuilder)
3410 {
3411 vegSoundObject = vegSoundObjectBuilder.BuildSoundObject();
3412 }
3413 else //then generic
3414 {
3415 array<ref VegetationSound> vegSoundArray = playerType.GetVegetationSounds();
3416 foreach (VegetationSound vegetationSound: vegSoundArray)
3417 {
3418 if (vegetationSound.GetAnimEventIds().Find(pUserInt) >= 0)
3419 {
3420 vegSoundObjectBuilder = vegetationSound.GetSoundObjectBuilder();
3421 vegSoundObject = vegSoundObjectBuilder.BuildSoundObject();
3422 break;
3423 }
3424 }
3425 }
3426
3427 if (vegSoundObject != null)
3428 {
3429 AttenuateSoundIfNecessary(vegSoundObject);
3430 PlaySound(vegSoundObject, vegSoundObjectBuilder);
3431 }
3432
3433 break;
3434 }
3435 }
3436 }
3437 }
3438
3439 g_Game.ProfilerStop("Player_Vegetation_Sounds");
3440 }
3441
3442 SoundObject soundObject = soundBuilder.BuildSoundObject();
3443 if (soundObject != null)
3444 {
3445 AttenuateSoundIfNecessary(soundObject);
3446 PlaySound(soundObject, soundBuilder);
3447 }
3448
3449 }
3450 #endif
3451 #endif
3452
3453 if (g_Game.IsServer())
3454 {
3455 m_StepCounter++;//move outside of server condition if needed on client as well
3456
3457 float noiseMultiplier = 0;
3458
3459 NoiseParams noiseParams;
3460 if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
3461 noiseParams = playerType.GetNoiseParamsStand();
3462 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
3463 noiseParams = playerType.GetNoiseParamsCrouch();
3464 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3465 noiseParams = playerType.GetNoiseParamsProne();
3466 else
3467 {
3468 Debug.Log(string.Format("Wrong stance, id: %1 using backup with stand stance (id: 0)", state.m_iStanceIdx));
3469 noiseParams = playerType.GetNoiseParamsStand();
3470 }
3471
3472 noiseMultiplier = NoiseAIEvaluate.GetNoiseMultiplier(this);
3473
3474 AddNoise(noiseParams, noiseMultiplier);
3475
3476 if ((m_StepCounter % PlayerConstants.CHECK_EVERY_N_STEP) == 0)
3477 {
3478 ProcessFeetDamageServer(pUserInt);
3479 m_StepCounter = 0;
3480 }
3481 }
3482 }
string Debug()
Определения CachedEquipmentStorageBase.c:26
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
vector orientation
Определения DustKickupEffects.c:21
DiagMenuIDs
Определения EDiagMenuIDs.c:2
void PlaySound()
Определения HungerSoundHandler.c:39
class NoiseSystem NoiseParams()
Определения Noise.c:18
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
int[] SurfaceInfo
Определения SurfaceInfo.c:1
void WoodBase()
Определения WoodBase.c:30
void HandleCeilingDustStepEffect(SurfaceInfo surfaceInfo, string boneName)
Определения DayZPlayerImplement.c:3800
void ProcessFeetDamageServer(int pUserInt)
void AttenuateSoundIfNecessary(SoundObject soundObject)
Определения DayZPlayerImplement.c:3976
int m_StepCounter
Определения DayZPlayerImplement.c:146
int m_LastSurfaceUnderHash
Определения DayZPlayerImplement.c:139
AnimBootsType GetBootsType()
Определения DayZPlayerImplement.c:3122
void AddNoise(NoiseParams noisePar, float noiseMultiplier=1.0)
Определения DayZPlayerImplement.c:3258
SoundObjectBuilder GetSoundBuilder(int eventId, int pMovement, int pSurfaceHash, AnimBootsType pBoots)
Определения dayzplayer.c:148
int m_iMovement
current stance (DayZPlayerConstants.STANCEIDX_ERECT, ...), only if the command has a stance
Определения human.c:1184
int m_iStanceIdx
current command's id
Определения human.c:1183
SoundObjectBuilder GetVegetationSoundBuilderFromEventID(int stepEventID)
Определения StaticObjectType.c:44
proto int GetStepParticleId()
proto string GetSurfaceType()
static const vector Zero
Определения EnConvert.c:123
proto float VectorToYaw()
Returns yaw of vector.
void DayZPlayerType()
Определения dayzplayer.c:512
void VegetationSound(SoundObjectBuilder soundObjectBuilder, TIntArray animEventIds)
Определения dayzplayer.c:3
DayZPlayerInstanceType
defined in C++
Определения dayzplayer.c:1084
proto native DayZPlayerType GetDayZPlayerType()
returns appropriate DayZPlayerType
proto native DayZPlayerInstanceType GetInstanceType()
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
class LOD Object
DayZGame GetGame()
Определения gameplay.c:636
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
void SoundObject(SoundParams soundParams)
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473
proto native int Hash()
Returns hash of string.

Перекрестные ссылки AddNoise(), Math::Atan2(), AttenuateSoundIfNecessary(), Class::CastTo(), PlayerConstants::CHECK_EVERY_N_STEP, DayZPlayerType(), vector::Dot(), g_Game, DiagMenu::GetBool(), GetBootsType(), GetDayZPlayerType(), GetGame(), GetInstanceType(), NoiseAIEvaluate::GetNoiseMultiplier(), GetPosition(), DayZPlayerTypeStepSoundLookupTable::GetSoundBuilder(), SurfaceInfo::GetStepParticleId(), SurfaceInfo::GetSurfaceType(), StaticObjectType::GetVegetationSoundBuilderFromEventID(), HandleCeilingDustStepEffect(), string::Hash(), Debug::Log(), HumanMovementState::m_iMovement, HumanMovementState::m_iStanceIdx, m_LastSurfaceUnderHash, m_StepCounter, NoiseParams(), orientation, ParticleManager(), PlaySound(), MiscEffects::PlayVegetationCollideParticles(), position, ProcessFeetDamageServer(), Math::RAD2DEG, SoundObjectBuilder(), Vector(), WoodBase() и vector::Zero.