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

◆ OnStepEvent()

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

Event Processing

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

3174 {
3175 vector orientation;
3177 HumanMovementState state = new HumanMovementState();
3178 GetMovementState(state);
3179
3180 #ifndef SERVER
3181 DayZPlayerTypeStepSoundLookupTable table = type.GetStepSoundLookupTable();
3182 SoundObjectBuilder soundBuilder = NULL;
3183 if (pUserInt < 100)
3184 {
3185 string surface;
3186 if (pUserInt % 2 == 1)
3187 {
3188 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3189 if (surface.Length() == 0)//if no surface found, try other leg
3190 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3191 }
3192 else
3193 {
3194 surface = GetSurfaceType(SurfaceAnimationBone.RightBackLimb);
3195 if (surface.Length() == 0)//if no surface found, try other leg
3196 surface = GetSurfaceType(SurfaceAnimationBone.LeftBackLimb);
3197 }
3198
3199 if (surface.Length() != 0)
3200 m_LastSurfaceUnderHash = surface.Hash();
3201
3202 if (state.m_iMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
3203 {
3204 orientation = GetOrientation() * (-1);
3205 int stepParticleID = Surface.GetStepsParticleID(surface);
3206
3207 if (stepParticleID > 0)
3208 {
3209 ParticleManager.GetInstance().PlayInWorldEx(stepParticleID, null, GetPosition(), orientation);
3210 }
3211 }
3212
3213 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3214 }
3215 else
3216 {
3217 string surface2 = GetSurfaceType();
3218 if (surface2.Length() != 0)
3219 m_LastSurfaceUnderHash = surface2.Hash();
3220
3221 soundBuilder = table.GetSoundBuilder(pUserInt, state.m_iMovement, m_LastSurfaceUnderHash, GetBootsType());
3222 }
3223
3224 if (soundBuilder != NULL && GetGame().GetPlayer())
3225 {
3226 orientation = Vector(0, 0, 0);
3227 vector edgeLength = Vector(1.5, 3.0, 1.5);
3228 array<Object> excludedObjects = new array<Object>;
3229 excludedObjects.Insert(this);
3230 array<Object> collidedObjects = new array<Object>;
3231
3232 if (GetGame().IsBoxCollidingGeometry(GetPosition(), orientation, edgeLength, ObjIntersectView, ObjIntersectNone, excludedObjects, collidedObjects))
3233 {
3234 for (int i = 0; i < collidedObjects.Count(); ++i)
3235 {
3236 WoodBase colObject = WoodBase.Cast(collidedObjects.Get(i));
3237 if (colObject && colObject.HasPlayerCollisionParticle() && state.m_iMovement > DayZPlayerConstants.MOVEMENTIDX_WALK)
3238 MiscEffects.PlayVegetationCollideParticles(colObject, this);
3239
3240 if (colObject && colObject.HasPlayerCollisionSound())
3241 {
3242 for (int j = 0; j < type.GetVegetationSounds().Count(); ++j)
3243 {
3244 VegetationSound vegetationSound = type.GetVegetationSounds().Get(j);
3245
3246 if (vegetationSound.GetAnimEventIds().Find(pUserInt) >= 0)
3247 {
3248 SoundObjectBuilder vegSoundObjectBuilder = vegetationSound.GetSoundObjectBuilder();
3249 SoundObject vegSoundObject = vegetationSound.GetSoundObjectBuilder().BuildSoundObject();
3250
3251 if (vegSoundObject != NULL)
3252 {
3253 AttenuateSoundIfNecessary(vegSoundObject);
3254 PlaySound(vegSoundObject, vegSoundObjectBuilder);
3255 }
3256
3257 break;
3258 }
3259 }
3260
3261 break;
3262 }
3263 }
3264 }
3265
3266 SoundObject soundObject = soundBuilder.BuildSoundObject();
3267 if (soundObject != NULL)
3268 {
3269 AttenuateSoundIfNecessary(soundObject);
3270 PlaySound(soundObject, soundBuilder);
3271 }
3272 }
3273 #endif
3274
3275 if (GetGame().IsServer())
3276 {
3277 m_StepCounter++;//move outside of server condition if needed on client as well
3278
3279 float noiseMultiplier = 0;
3280
3281 NoiseParams noiseParams;
3282 if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_ERECT || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDERECT)
3283 noiseParams = type.GetNoiseParamsStand();
3284 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_CROUCH || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDCROUCH)
3285 noiseParams = type.GetNoiseParamsCrouch();
3286 else if (state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_PRONE || state.m_iStanceIdx == DayZPlayerConstants.STANCEIDX_RAISEDPRONE)
3287 noiseParams = type.GetNoiseParamsProne();
3288 else
3289 {
3290 Debug.Log(string.Format("Wrong stance, id: %1 using backup with stand stance (id: 0)", state.m_iStanceIdx));
3291 noiseParams = type.GetNoiseParamsStand();
3292 }
3293
3294 noiseMultiplier = NoiseAIEvaluate.GetNoiseMultiplier(this) * NoiseAIEvaluate.GetNoiseReduction(GetGame().GetWeather());
3295
3296 AddNoise(noiseParams, noiseMultiplier);
3297
3298 if ((m_StepCounter % PlayerConstants.CHECK_EVERY_N_STEP) == 0)
3299 {
3300 ProcessFeetDamageServer(pUserInt);
3301 }
3302 }
3303 }
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:3137
void ProcessFeetDamageServer(int pUserInt)
void AttenuateSoundIfNecessary(SoundObject soundObject)
Определения DayZPlayerImplement.c:3783
int m_StepCounter
Определения DayZPlayerImplement.c:168
int m_LastSurfaceUnderHash
Определения DayZPlayerImplement.c:161
AnimBootsType GetBootsType()
Определения DayZPlayerImplement.c:3016
void AddNoise(NoiseParams noisePar, float noiseMultiplier=1.0)
Определения DayZPlayerImplement.c:3162
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:1142
int m_iStanceIdx
current command's id
Определения human.c:1141
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().