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

◆ OnStepEvent()

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

Event Processing

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

3216 {
3217 vector orientation;
3219 HumanMovementState state = new HumanMovementState();
3220 GetMovementState(state);
3221
3222 #ifndef SERVER
3223 DayZPlayerTypeStepSoundLookupTable table = type.GetStepSoundLookupTable();
3224 SoundObjectBuilder soundBuilder = NULL;
3225 if (pUserInt < 100)
3226 {
3227 string surface;
3228 if (pUserInt % 2 == 1)
3229 {
3230 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3231 if (surface.Length() == 0)//if no surface found, try other leg
3232 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3233 }
3234 else
3235 {
3236 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3237 if (surface.Length() == 0)//if no surface found, try other leg
3238 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3239 }
3240
3241 if (surface.Length() != 0)
3242 m_LastSurfaceUnderHash = surface.Hash();
3243
3244 if (state.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
3245 {
3246 orientation = GetOrientation() * (-1);
3247 int stepParticleID = Surface.GetStepsParticleID(surface);
3248
3249 if (stepParticleID > 0)
3250 {
3251 ParticleManager.GetInstance().PlayInWorldEx(stepParticleID, null, GetPosition(), orientation);
3252 }
3253 }
3254
3255 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3256 }
3257 else
3258 {
3259 string surface2 = GetSurfaceType();
3260 if (surface2.Length() != 0)
3261 m_LastSurfaceUnderHash = surface2.Hash();
3262
3263 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3264 }
3265
3266 if (soundBuilder != NULL && g_Game.GetPlayer())
3267 {
3268 orientation = Vector(0, 0, 0);
3269 vector edgeLength = Vector(1.5, 3.0, 1.5);
3270 array<Object> excludedObjects = new array<Object>;
3271 excludedObjects.Insert(this);
3272 array<Object> collidedObjects = new array<Object>;
3273
3274 if (g_Game.IsBoxCollidingGeometry(GetPosition(), orientation, edgeLength, ObjIntersectView, ObjIntersectNone, excludedObjects, collidedObjects))
3275 {
3276 for (int i = 0; i < collidedObjects.Count(); ++i)
3277 {
3278 WoodBase colObject = WoodBase.Cast(collidedObjects.Get(i));
3279 if (colObject && colObject.HasPlayerCollisionParticle() && state.m_iMovement > DayZPlayerConstants.MOVEMENTIDX_WALK)
3280 MiscEffects.PlayVegetationCollideParticles(colObject, this);
3281
3282 if (colObject && colObject.HasPlayerCollisionSound())
3283 {
3284 for (int j = 0; j < type.GetVegetationSounds().Count(); ++j)
3285 {
3286 VegetationSound vegetationSound = type.GetVegetationSounds().Get(j);
3287
3288 if (vegetationSound.GetAnimEventIds().Find(pUserInt) >= 0)
3289 {
3290 SoundObjectBuilder vegSoundObjectBuilder = vegetationSound.GetSoundObjectBuilder();
3291 SoundObject vegSoundObject = vegetationSound.GetSoundObjectBuilder().BuildSoundObject();
3292
3293 if (vegSoundObject != NULL)
3294 {
3295 AttenuateSoundIfNecessary(vegSoundObject);
3296 PlaySound(vegSoundObject, vegSoundObjectBuilder);
3297 }
3298
3299 break;
3300 }
3301 }
3302
3303 break;
3304 }
3305 }
3306 }
3307
3308 SoundObject soundObject = soundBuilder.BuildSoundObject();
3309 if (soundObject != NULL)
3310 {
3311 AttenuateSoundIfNecessary(soundObject);
3312 PlaySound(soundObject, soundBuilder);
3313 }
3314 }
3315 #endif
3316
3317 if (g_Game.IsServer())
3318 {
3319 m_StepCounter++;//move outside of server condition if needed on client as well
3320
3321 float noiseMultiplier = 0;
3322
3323 NoiseParams noiseParams;
3324 if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
3325 noiseParams = type.GetNoiseParamsStand();
3326 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
3327 noiseParams = type.GetNoiseParamsCrouch();
3328 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3329 noiseParams = type.GetNoiseParamsProne();
3330 else
3331 {
3332 Debug.Log(string.Format("Wrong stance, id: %1 using backup with stand stance (id: 0)", state.m_iStanceIdx));
3333 noiseParams = type.GetNoiseParamsStand();
3334 }
3335
3336 noiseMultiplier = NoiseAIEvaluate.GetNoiseMultiplier(this) * NoiseAIEvaluate.GetNoiseReduction(g_Game.GetWeather());
3337
3338 AddNoise(noiseParams, noiseMultiplier);
3339
3340 if ((m_StepCounter % PlayerConstants.CHECK_EVERY_N_STEP) == 0)
3341 {
3342 ProcessFeetDamageServer(pUserInt);
3343 }
3344 }
3345 }
vector GetOrientation()
Определения AreaDamageManager.c:306
string Debug()
Определения CachedEquipmentStorageBase.c:29
DayZGame g_Game
Определения DayZGame.c:3942
void PlaySound()
Определения HungerSoundHandler.c:39
class NoiseSystem NoiseParams()
Определения Noise.c:15
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
@ Count
Определения RandomGeneratorSyncManager.c:8
void WoodBase()
Определения WoodBase.c:30
string GetSurfaceType(SurfaceAnimationBone limbType)
Определения DayZPlayerImplement.c:3179
void ProcessFeetDamageServer(int pUserInt)
void AttenuateSoundIfNecessary(SoundObject soundObject)
Определения DayZPlayerImplement.c:3832
int m_StepCounter
Определения DayZPlayerImplement.c:146
int m_LastSurfaceUnderHash
Определения DayZPlayerImplement.c:139
AnimBootsType GetBootsType()
Определения DayZPlayerImplement.c:3058
void AddNoise(NoiseParams noisePar, float noiseMultiplier=1.0)
Определения DayZPlayerImplement.c:3204
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:1157
int m_iStanceIdx
current command's id
Определения human.c:1156
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 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 Length()
Returns length of string.
proto native int Hash()
Returns hash of string.

Перекрестные ссылки AddNoise(), AttenuateSoundIfNecessary(), PlayerConstants::CHECK_EVERY_N_STEP, Count, DayZPlayerType(), g_Game, VegetationSound::GetAnimEventIds(), GetBootsType(), GetDayZPlayerType(), NoiseAIEvaluate::GetNoiseMultiplier(), NoiseAIEvaluate::GetNoiseReduction(), GetOrientation(), 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().