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

◆ OnRPC() [1/2]

override void CGame::OnRPC ( PlayerIdentity sender,
Object target,
int rpc_type,
ParamsReadContext ctx )
inlineprotected

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

3142 {
3143 super.OnRPC(sender, target, rpc_type, ctx);
3144 Event_OnRPC.Invoke(sender, target, rpc_type, ctx);
3145
3146 //Print("["+ g_Game.GetTime().ToString() +"] => DayZGame::OnRPC = "+ EnumTools.EnumToString(ERPCs,rpc_type));
3147
3148 if (target)
3149 {
3150 // call rpc on target
3151 target.OnRPC(sender, rpc_type, ctx);
3152 }
3153 else
3154 {
3155 switch (rpc_type)
3156 {
3157 #ifndef SERVER
3158 #ifndef NO_GUI
3159 case ERPCs.RPC_CFG_GAMEPLAY_SYNC:
3160 {
3161 CfgGameplayHandler.OnRPC(null, ctx);
3162 break;
3163 }
3164 case ERPCs.RPC_BUNKERBROADCAST_CONFIG_SYNC:
3165 {
3166 CfgBunkerBroadcastHandler.OnRPC(ctx);
3167 break;
3168 }
3169 case ERPCs.RPC_UNDERGROUND_SYNC:
3170 {
3171 UndergroundAreaLoader.OnRPC(ctx);
3172 break;
3173 }
3174 case ERPCs.RPC_PLAYERRESTRICTEDAREAS_SYNC:
3175 {
3176 CfgPlayerRestrictedAreaHandler.OnRPC(ctx);
3177 break;
3178 }
3179 case ERPCs.RPC_SEND_NOTIFICATION:
3180 {
3181 NotificationType type;
3182 float show_time;
3183 string detail_text;
3184
3185 ctx.Read(type);
3186 ctx.Read(show_time);
3187 ctx.Read(detail_text);
3188
3189 NotificationSystem.AddNotification(type, show_time, detail_text);
3190 break;
3191 }
3192 case ERPCs.RPC_SEND_NOTIFICATION_EXTENDED:
3193 {
3194 float show_time_ext;
3195 string title_text_ext;
3196 string detail_text_ext;
3197 string icon_ext;
3198
3199 ctx.Read(show_time_ext);
3200 ctx.Read(title_text_ext);
3201 ctx.Read(detail_text_ext);
3202 ctx.Read(icon_ext);
3203
3204 NotificationSystem.AddNotificationExtended(show_time_ext, title_text_ext, detail_text_ext, icon_ext);
3205 break;
3206 }
3207
3208
3209 case ERPCs.RPC_SOUND_HELICRASH:
3210 {
3211 bool playSound;
3212 vector pos;
3213 string sound_set;
3214
3215 //Helicrash is a world event, we want anyone to be able to hear it
3216 Param3<bool, vector, int> playCrashSound = new Param3<bool, vector, int>(false, "0 0 0",0);
3217 if (ctx.Read(playCrashSound))
3218 {
3219 playSound = playCrashSound.param1;
3220 pos = playCrashSound.param2;
3221 sound_set = CrashSoundSets.GetSoundSetByHash(playCrashSound.param3);
3222 }
3223
3224 if (playSound)
3225 {
3226 m_CrashSound = SEffectManager.PlaySound(sound_set, pos, 0.1, 0.1);
3227 m_CrashSound.SetAutodestroy(true);
3228 }
3229
3230 break;
3231 }
3232 //Random off map artillery barrage
3233 case ERPCs.RPC_SOUND_ARTILLERY:
3234 {
3235 vector position;
3236 Param1<vector> playArtySound = new Param1<vector>(vector.Zero);
3237 if (ctx.Read(playArtySound))
3238 {
3239 position = playArtySound.param1;
3240 if (position == vector.Zero)
3241 break;
3242 }
3243 else
3244 break;
3245
3246 if (!g_Game.GetPlayer())
3247 break;
3248
3249 if (vector.DistanceSq(g_Game.GetPlayer().GetPosition(), position) <= (MIN_ARTY_SOUND_RANGE * MIN_ARTY_SOUND_RANGE))
3250 break;
3251
3252 m_ArtySound = SEffectManager.PlaySound("Artillery_Distant_Barrage_SoundSet", position, 0.1, 0.1);
3253 m_ArtySound.SetAutodestroy(true);
3254
3255 break;
3256 }
3257 case ERPCs.RPC_SOUND_CONTAMINATION:
3258 {
3259 vector soundPos;
3260
3261 Param1<vector> playContaminatedSound = new Param1<vector>(vector.Zero);
3262 if (ctx.Read(playContaminatedSound))
3263 {
3264 soundPos = playContaminatedSound.param1;
3265 if (soundPos == vector.Zero)
3266 break;
3267 }
3268 else
3269 break;
3270
3271 if (!g_Game.GetPlayer())
3272 break;
3273
3274 EffectSound closeArtySound = SEffectManager.PlaySound("Artillery_Close_SoundSet", soundPos);
3275 closeArtySound.SetAutodestroy(true);
3276
3277 // We add camera shake upon shell detonation
3278 float distance_to_player = vector.DistanceSq(soundPos, g_Game.GetPlayer().GetPosition());
3279 if (distance_to_player <= GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE2)
3280 {
3281 float strength_factor = Math.InverseLerp(GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE, 0, Math.Sqrt(distance_to_player));
3282 DayZPlayerCamera camera = g_Game.GetPlayer().GetCurrentCamera();
3283 if (camera)
3284 camera.SpawnCameraShake(strength_factor * 4);
3285 }
3286
3287 ParticleManager.GetInstance().PlayInWorld(ParticleList.CONTAMINATED_AREA_GAS_SHELL, soundPos);
3288 break;
3289 }
3290 // Single artillery shot to announce dynamic contaminated area
3291 case ERPCs.RPC_SOUND_ARTILLERY_SINGLE:
3292 {
3293 vector soundPosition;
3294 vector delayedSoundPos;
3295 float soundDelay;
3296
3297 Param3<vector, vector, float> playArtyShotSound = new Param3<vector, vector, float>(vector.Zero, vector.Zero, 0);
3298 if (ctx.Read(playArtyShotSound))
3299 {
3300 soundPosition = playArtyShotSound.param1;
3301 delayedSoundPos = playArtyShotSound.param2;
3302 soundDelay = playArtyShotSound.param3;
3303 if (soundPosition == vector.Zero)
3304 break;
3305 }
3306 else
3307 break;
3308
3309 if (!g_Game.GetPlayer())
3310 break;
3311
3312 m_ArtySound = SEffectManager.PlaySound("Artillery_Distant_SoundSet", soundPosition, 0.1, 0.1);
3313 m_ArtySound.SetAutodestroy(true);
3314
3315 // We remove the amount of time the incoming sound lasts
3316 soundDelay -= 5;
3317 // We convert to milliseconds
3318 soundDelay *= 1000;
3319 GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(DelayedMidAirDetonation, soundDelay, false, delayedSoundPos[0], delayedSoundPos[1], delayedSoundPos[2]);
3320 break;
3321 }
3322 case ERPCs.RPC_SET_BILLBOARDS:
3323 {
3325 m_BillboardSetHandler = new BillboardSetHandler();
3326
3327 Param1<int> indexP = new Param1<int>(-1);
3328 if (ctx.Read(indexP))
3329 {
3330 int index = indexP.param1;
3331 m_BillboardSetHandler.OnRPCIndex(index);
3332 }
3333 break;
3334 }
3335 #endif
3336 #endif
3337
3338 case ERPCs.RPC_USER_SYNC_PERMISSIONS:
3339 {
3340 map<string, bool> mute_list;
3341 if (ctx.Read(mute_list))
3342 {
3343 for (int i = 0; i < mute_list.Count(); i++)
3344 {
3345 string uid = mute_list.GetKey(i);
3346 bool mute = mute_list.GetElement(i);
3347 MutePlayer(uid, sender.GetPlainId(), mute);
3348 }
3349 }
3350 break;
3351 }
3352
3353 /*
3354 case ERPCs.RPC_SERVER_RESPAWN_MODE:
3355 {
3356 int mode;
3357 if (ctx.Read(mode) && !IsServer())
3358 {
3359 GetMission().SetRespawnModeClient(mode);
3360 }
3361 }
3362 */
3363
3364 #ifdef DEVELOPER
3365 Weather weather;
3366 case ERPCs.DEV_SET_WEATHER:
3367 {
3368 Param1<DebugWeatherRPCData> p1data = new Param1<DebugWeatherRPCData>(null);
3369
3370 if ( ctx.Read(p1data) )
3371 {
3372 DebugWeatherRPCData data = p1data.param1;
3373 weather = g_Game.GetWeather();
3374
3375 if (data.m_FogValue >= 0)
3376 weather.GetFog().Set(data.m_FogValue, data.m_FogInterpolation, data.m_FogDuration);
3377
3378 if (data.m_OvercastValue >= 0)
3380
3381 if (data.m_RainValue >= 0)
3382 weather.GetRain().Set(data.m_RainValue, data.m_RainInterpolation, data.m_RainDuration);
3383
3384 if (data.m_SnowfallValue >= 0)
3386
3387 if (data.m_VolFogDistanceDensity >= 0)
3389
3390 if (data.m_VolFogHeightDensity >= 0)
3392
3393 if (data.m_VolFogHeightBias >= -500)
3395
3396 if (data.m_WindMagnitudeValue >= 0)
3398
3399 if (data.m_WindDirectionValue >= -3.14)
3401 }
3402 else
3403 {
3404 ErrorEx("Failed to read weather debug data");
3405 }
3406 break;
3407 }
3408 case ERPCs.DEV_SET_SANDSTORM:
3409 {
3410 Param1<DebugSandstormRPCData> p1SandstormData = new Param1<DebugSandstormRPCData>(null);
3411
3412 if (ctx.Read(p1SandstormData))
3413 {
3414 DebugSandstormRPCData sandstormData = p1SandstormData.param1;
3415 weather = g_Game.GetWeather();
3416
3417 // Determine the wind dir so it can align with the predefined sandstorm direction
3418 vector stormDir = weather.GetSandstorm().GetDirection();
3419 float stormAngle = weather.WindDirectionToAngle(stormDir);
3420
3421 // Set accompanying properties like wind and overcast to desired values
3422 weather.GetWindDirection().Set(stormAngle, sandstormData.m_FadeInTime, sandstormData.m_Duration);
3423
3424 if (sandstormData.m_OvercastValue < 0.8)
3425 sandstormData.m_OvercastValue = 0.8;
3426
3427 weather.GetOvercast().Set(sandstormData.m_OvercastValue, sandstormData.m_FadeInTime, sandstormData.m_Duration);
3428
3429 if (sandstormData.m_WindMagnitudeValue < 18.0)
3430 sandstormData.m_WindMagnitudeValue = 18.0;
3431
3432 weather.GetWindMagnitude().Set(sandstormData.m_WindMagnitudeValue, sandstormData.m_FadeInTime, sandstormData.m_Duration);
3433 weather.GetRain().Set(0, sandstormData.m_FadeInTime, sandstormData.m_Duration);
3434
3435 if (sandstormData.m_StartStorm)
3436 weather.GetSandstorm().Start(sandstormData.m_FadeInTime, false);
3437 }
3438 }
3439 case ERPCs.DEV_STOP_SANDSTORM:
3440 {
3441 weather = g_Game.GetWeather();
3442 if (!weather.GetSandstorm().IsActive())
3443 return;
3444
3445 weather.GetSandstorm().Stop(0, false);
3446 }
3447 case ERPCs.DEV_SET_SANDSTORM_WEATHER:
3448 {
3449 weather = g_Game.GetWeather();
3450 if (weather.GetSandstorm().IsActive())
3451 return;
3452
3453 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).RemoveByName(this, "ForceOvercastReset");
3454 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(ForceOvercastReset, 0.05, true);
3455 }
3456 case ERPCs.DEV_STOP_SANDSTORM_WEATHER:
3457 {
3458 weather = g_Game.GetWeather();
3459 if (!weather.GetSandstorm().IsActive())
3460 return;
3461
3462 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).RemoveByName(this, "ForceOvercastReset");
3463 weather.GetSandstorm().Stop(0, false);
3464 }
3465 #endif
3466
3467
3468 #ifdef DIAG_DEVELOPER
3469 #ifdef SERVER
3470 case ERPCs.DIAG_CAMERATOOLS_CAM_DATA:
3471 {
3472 if (!m_CameraToolsMenuServer)
3473 {
3474 m_CameraToolsMenuServer = new CameraToolsMenuServer;
3475 }
3476 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3477 break;
3478 }
3479
3480 case ERPCs.DIAG_CAMERATOOLS_CAM_SUBSCRIBE:
3481 {
3482 if (!m_CameraToolsMenuServer)
3483 {
3484 m_CameraToolsMenuServer = new CameraToolsMenuServer;
3485 }
3486 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3487 break;
3488 }
3489 case ERPCs.DIAG_GEYSER_VALUES:
3490 {
3491 auto geyserParams = new Param3<bool, float, float>(false, 0, 0);
3492 if (ctx.Read(geyserParams))
3493 {
3494 if (!m_GeyserDiagData)
3495 m_GeyserDiagData = new GeyserDebugData();
3496
3497 m_GeyserDiagData.SetData(geyserParams.param1, geyserParams.param2, geyserParams.param3);
3498 }
3499 break;
3500 }
3501 #endif
3502 #endif
3503
3504 }
3505 // global rpc's handling
3506 }
3507 }
DayZGame g_Game
Определения DayZGame.c:4074
vector position
Определения DustKickupEffects.c:20
ERPCs
Определения ERPCs.c:2
NotificationType
DEPRECATED (moved into NotificationSystem)
Определения NotificationSystem.c:4
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
ref EffectSound m_ArtySound
Определения DayZGame.c:1002
void DelayedMidAirDetonation(float x, float y, float z)
Определения DayZGame.c:3509
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1233
proto native void MutePlayer(string muteUID, string playerUID, bool mute)
Mutes voice of source player to target player.
static ref ScriptInvoker Event_OnRPC
Определения DayZGame.c:991
void ForceOvercastReset()
Определения DayZGame.c:3129
ref EffectSound m_CrashSound
Определения DayZGame.c:999
ref BillboardSetHandler m_BillboardSetHandler
Определения DayZGame.c:910
const int MIN_ARTY_SOUND_RANGE
Определения DayZGame.c:1003
float m_FogValue
Определения DebugWeatherRPCData.c:3
float m_RainDuration
Определения DebugWeatherRPCData.c:15
float m_OvercastInterpolation
Определения DebugWeatherRPCData.c:9
float m_SnowfallInterpolation
Определения DebugWeatherRPCData.c:11
float m_WindDirectionValue
Определения DebugWeatherRPCData.c:35
float m_SnowfallDuration
Определения DebugWeatherRPCData.c:16
float m_VolFogDistanceDensity
Определения DebugWeatherRPCData.c:18
float m_VolFogHeightBiasTime
Определения DebugWeatherRPCData.c:25
float m_VolFogDistanceDensityTime
Определения DebugWeatherRPCData.c:19
float m_VolFogHeightDensityTime
Определения DebugWeatherRPCData.c:22
float m_WindDInterpolation
Определения DebugWeatherRPCData.c:36
float m_VolFogHeightDensity
Определения DebugWeatherRPCData.c:21
float m_SnowfallValue
Определения DebugWeatherRPCData.c:6
float m_WindDDuration
Определения DebugWeatherRPCData.c:37
float m_OvercastValue
Определения DebugWeatherRPCData.c:4
float m_FogInterpolation
Определения DebugWeatherRPCData.c:8
float m_FogDuration
Определения DebugWeatherRPCData.c:13
float m_RainValue
Определения DebugWeatherRPCData.c:5
float m_RainInterpolation
Определения DebugWeatherRPCData.c:10
float m_VolFogHeightBias
Определения DebugWeatherRPCData.c:24
float m_OvercastDuration
Определения DebugWeatherRPCData.c:14
float m_WindMagnitudeValue
Определения DebugWeatherRPCData.c:31
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:607
proto string GetPlainId()
plaintext unique id of player (cannot be used in database or logs)
proto native void Stop(float duration, bool calledByWeather)
Stops the sandstorm, leaving it to fade out over duration seconds. The sandstorm must be active prior...
proto native bool Start(float duration, bool calledByWeather)
proto native vector GetDirection()
Returns the direction from the start position to the end position of the sandstorm.
proto native bool IsActive()
Returns whether sandstorm is currently active.
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Read(void value_in)
proto native Fog GetFog()
Returns a fog phenomenon object.
proto native void SetDynVolFogHeightBias(float value, float time=0)
Sets the 'dynamic' volumetric height bias. Takes effect only if enabled via world config.
proto native WindMagnitude GetWindMagnitude()
Returns a wind magnitude phenomenon object.
proto native void SetDynVolFogDistanceDensity(float value, float time=0)
Sets the dynamic volumetric fog distance density. Only takes effect if dynamic volumetric fog is enab...
proto native Sandstorm GetSandstorm()
Returns the sandstorm phenomenon weather controller.
proto native Snowfall GetSnowfall()
Returns a snowfall phenomenon object.
static proto float WindDirectionToAngle(vector dir)
Returns the xz angle of the provided wind vector.
proto native WindDirection GetWindDirection()
Returns a wind direction phenomenon object.
proto native void SetDynVolFogHeightDensity(float value, float time=0)
Sets the dynamic volumetric fog height density. Only takes effect if dynamic volumetric fog is enable...
proto native Rain GetRain()
Returns a rain phenomenon object.
proto native Overcast GetOvercast()
Returns an overcast phenomenon object.
proto native void Set(float forecast, float time=0, float minDuration=0)
Sets the forecast.
static const vector Zero
Определения EnConvert.c:123
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Определения dayzplayer.c:56
enum ShapeType ErrorEx
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/DayZ/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/DayZ/tools/tools.c:8

Перекрестные ссылки NotificationSystem::AddNotification(), NotificationSystem::AddNotificationExtended(), CALL_CATEGORY_GAMEPLAY, CALL_CATEGORY_SYSTEM, ScriptCallQueue::CallLater(), GameConstants::CAMERA_SHAKE_ARTILLERY_DISTANCE, GameConstants::CAMERA_SHAKE_ARTILLERY_DISTANCE2, ParticleList::CONTAMINATED_AREA_GAS_SHELL, DayZPlayerCamera(), DelayedMidAirDetonation(), vector::DistanceSq(), ErrorEx, Event_OnRPC, ForceOvercastReset(), g_Game, GetCallQueue(), SandstormController::GetDirection(), Weather::GetFog(), Weather::GetOvercast(), PlayerIdentityBase::GetPlainId(), Weather::GetRain(), Weather::GetSandstorm(), Weather::GetSnowfall(), CrashSoundSets::GetSoundSetByHash(), Weather::GetWindDirection(), Weather::GetWindMagnitude(), Math::InverseLerp(), SandstormController::IsActive(), m_ArtySound, m_BillboardSetHandler, m_CrashSound, DebugWeatherRPCData::m_FogDuration, DebugWeatherRPCData::m_FogInterpolation, DebugWeatherRPCData::m_FogValue, DebugWeatherRPCData::m_OvercastDuration, DebugWeatherRPCData::m_OvercastInterpolation, DebugWeatherRPCData::m_OvercastValue, DebugWeatherRPCData::m_RainDuration, DebugWeatherRPCData::m_RainInterpolation, DebugWeatherRPCData::m_RainValue, DebugWeatherRPCData::m_SnowfallDuration, DebugWeatherRPCData::m_SnowfallInterpolation, DebugWeatherRPCData::m_SnowfallValue, DebugWeatherRPCData::m_VolFogDistanceDensity, DebugWeatherRPCData::m_VolFogDistanceDensityTime, DebugWeatherRPCData::m_VolFogHeightBias, DebugWeatherRPCData::m_VolFogHeightBiasTime, DebugWeatherRPCData::m_VolFogHeightDensity, DebugWeatherRPCData::m_VolFogHeightDensityTime, DebugWeatherRPCData::m_WindDDuration, DebugWeatherRPCData::m_WindDInterpolation, DebugWeatherRPCData::m_WindDirectionValue, DebugWeatherRPCData::m_WindMagnitudeValue, MIN_ARTY_SOUND_RANGE, MutePlayer(), CfgBunkerBroadcastHandler::OnRPC(), CfgGameplayHandler::OnRPC(), CfgPlayerRestrictedAreaHandler::OnRPC(), UndergroundAreaLoader::OnRPC(), ParticleManager(), SEffectManager::PlaySound(), position, Serializer::Read(), WeatherPhenomenon::Set(), EffectSound::SetAutodestroy(), Weather::SetDynVolFogDistanceDensity(), Weather::SetDynVolFogHeightBias(), Weather::SetDynVolFogHeightDensity(), Math::Sqrt(), SandstormController::Start(), SandstormController::Stop(), Weather::WindDirectionToAngle() и vector::Zero.