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

◆ OnStepEvent()

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

Event Processing

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

3240 {
3241 vector orientation;
3243 HumanMovementState state = new HumanMovementState();
3244 GetMovementState(state);
3245
3246 #ifndef SERVER
3247 DayZPlayerTypeStepSoundLookupTable table = type.GetStepSoundLookupTable();
3248 SoundObjectBuilder soundBuilder = NULL;
3249 if (pUserInt < 100)
3250 {
3251 string surface;
3252 if (pUserInt % 2 == 1)
3253 {
3254 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3255 if (surface.Length() == 0)//if no surface found, try other leg
3256 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3257 }
3258 else
3259 {
3260 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3261 if (surface.Length() == 0)//if no surface found, try other leg
3262 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3263 }
3264
3265 if (surface.Length() != 0)
3266 m_LastSurfaceUnderHash = surface.Hash();
3267
3268 if (state.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
3269 {
3270 orientation = GetOrientation() * (-1);
3271 int stepParticleID = Surface.GetStepsParticleID(surface);
3272
3273 if (stepParticleID > 0)
3274 {
3275 ParticleManager.GetInstance().PlayInWorldEx(stepParticleID, null, GetPosition(), orientation);
3276 }
3277 }
3278
3279 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3280 }
3281 else
3282 {
3283 string surface2 = GetSurfaceType();
3284 if (surface2.Length() != 0)
3285 m_LastSurfaceUnderHash = surface2.Hash();
3286
3287 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3288 }
3289
3290 if (soundBuilder != NULL && GetGame().GetPlayer())
3291 {
3292 orientation = Vector(0, 0, 0);
3293 vector edgeLength = Vector(1.5, 3.0, 1.5);
3294 array<Object> excludedObjects = new array<Object>;
3295 excludedObjects.Insert(this);
3296 array<Object> collidedObjects = new array<Object>;
3297
3298 if (GetGame().IsBoxCollidingGeometry(GetPosition(), orientation, edgeLength, ObjIntersectView, ObjIntersectNone, excludedObjects, collidedObjects))
3299 {
3300 for (int i = 0; i < collidedObjects.Count(); ++i)
3301 {
3302 WoodBase colObject = WoodBase.Cast(collidedObjects.Get(i));
3303 if (colObject && colObject.HasPlayerCollisionParticle() && state.m_iMovement > DayZPlayerConstants.MOVEMENTIDX_WALK)
3304 MiscEffects.PlayVegetationCollideParticles(colObject, this);
3305
3306 if (colObject && colObject.HasPlayerCollisionSound())
3307 {
3308 for (int j = 0; j < type.GetVegetationSounds().Count(); ++j)
3309 {
3310 VegetationSound vegetationSound = type.GetVegetationSounds().Get(j);
3311
3312 if (vegetationSound.GetAnimEventIds().Find(pUserInt) >= 0)
3313 {
3314 SoundObjectBuilder vegSoundObjectBuilder = vegetationSound.GetSoundObjectBuilder();
3315 SoundObject vegSoundObject = vegetationSound.GetSoundObjectBuilder().BuildSoundObject();
3316
3317 if (vegSoundObject != NULL)
3318 {
3319 AttenuateSoundIfNecessary(vegSoundObject);
3320 PlaySound(vegSoundObject, vegSoundObjectBuilder);
3321 }
3322
3323 break;
3324 }
3325 }
3326
3327 break;
3328 }
3329 }
3330 }
3331
3332 SoundObject soundObject = soundBuilder.BuildSoundObject();
3333 if (soundObject != NULL)
3334 {
3335 AttenuateSoundIfNecessary(soundObject);
3336 PlaySound(soundObject, soundBuilder);
3337 }
3338 }
3339 #endif
3340
3341 if (GetGame().IsServer())
3342 {
3343 m_StepCounter++;//move outside of server condition if needed on client as well
3344
3345 float noiseMultiplier = 0;
3346
3347 NoiseParams noiseParams;
3348 if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
3349 noiseParams = type.GetNoiseParamsStand();
3350 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
3351 noiseParams = type.GetNoiseParamsCrouch();
3352 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3353 noiseParams = type.GetNoiseParamsProne();
3354 else
3355 {
3356 Debug.Log(string.Format("Wrong stance, id: %1 using backup with stand stance (id: 0)", state.m_iStanceIdx));
3357 noiseParams = type.GetNoiseParamsStand();
3358 }
3359
3360 noiseMultiplier = NoiseAIEvaluate.GetNoiseMultiplier(this) * NoiseAIEvaluate.GetNoiseReduction(GetGame().GetWeather());
3361
3362 AddNoise(noiseParams, noiseMultiplier);
3363
3364 if ((m_StepCounter % PlayerConstants.CHECK_EVERY_N_STEP) == 0)
3365 {
3366 ProcessFeetDamageServer(pUserInt);
3367 }
3368 }
3369 }
vector GetOrientation()
Определения AreaDamageManager.c:306
void PlaySound()
Определения HungerSoundHandler.c:38
PlayerBase GetPlayer()
Определения ModifierBase.c:51
class NoiseSystem NoiseParams()
Определения Noise.c:15
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
@ Count
Определения RandomGeneratorSyncManager.c:8
void Debug()
Определения UniversalTemperatureSource.c:349
void WoodBase()
Определения WoodBase.c:30
string GetSurfaceType(SurfaceAnimationBone limbType)
Определения DayZPlayerImplement.c:3203
void ProcessFeetDamageServer(int pUserInt)
void AttenuateSoundIfNecessary(SoundObject soundObject)
Определения DayZPlayerImplement.c:3849
int m_StepCounter
Определения DayZPlayerImplement.c:170
int m_LastSurfaceUnderHash
Определения DayZPlayerImplement.c:163
AnimBootsType GetBootsType()
Определения DayZPlayerImplement.c:3082
void AddNoise(NoiseParams noisePar, float noiseMultiplier=1.0)
Определения DayZPlayerImplement.c:3228
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:1155
int m_iStanceIdx
current command's id
Определения human.c:1154
SoundObjectBuilder GetSoundObjectBuilder()
Определения dayzplayer.c:201
TIntArray GetAnimEventIds()
Определения dayzplayer.c:206
void DayZPlayerType()
Определения dayzplayer.c:512
void VegetationSound(SoundObjectBuilder soundObjectBuilder, TIntArray animEventIds)
Определения dayzplayer.c:3
proto native DayZPlayerType GetDayZPlayerType()
returns appropriate DayZPlayerType
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
void SoundObject(SoundParams soundParams)
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
proto native int Length()
Returns length of string.
proto native int Hash()
Returns hash of string.

Перекрестные ссылки AddNoise(), AttenuateSoundIfNecessary(), PlayerConstants::CHECK_EVERY_N_STEP, Count, DayZPlayerType(), VegetationSound::GetAnimEventIds(), GetBootsType(), GetDayZPlayerType(), GetGame(), NoiseAIEvaluate::GetNoiseMultiplier(), NoiseAIEvaluate::GetNoiseReduction(), GetOrientation(), GetPlayer(), GetPosition, DayZPlayerTypeStepSoundLookupTable::GetSoundBuilder(), VegetationSound::GetSoundObjectBuilder(), Surface::GetStepsParticleID(), GetSurfaceType(), string::Hash(), string::Length(), Debug::Log(), HumanMovementState::m_iMovement, HumanMovementState::m_iStanceIdx, m_LastSurfaceUnderHash, m_StepCounter, NoiseParams(), ParticleManager(), PlaySound(), MiscEffects::PlayVegetationCollideParticles(), ProcessFeetDamageServer(), SoundObjectBuilder(), Vector() и WoodBase().