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

◆ OnRPC() [1/2]

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

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

3087 {
3088 super.OnRPC(sender, target, rpc_type, ctx);
3089 Event_OnRPC.Invoke(sender, target, rpc_type, ctx);
3090
3091 //Print("["+ g_Game.GetTime().ToString() +"] => DayZGame::OnRPC = "+ EnumTools.EnumToString(ERPCs,rpc_type));
3092
3093 if (target)
3094 {
3095 // call rpc on target
3096 target.OnRPC(sender, rpc_type, ctx);
3097 }
3098 else
3099 {
3100 switch (rpc_type)
3101 {
3102 #ifndef SERVER
3103 #ifndef NO_GUI
3104 case ERPCs.RPC_CFG_GAMEPLAY_SYNC:
3105 {
3106 CfgGameplayHandler.OnRPC(null, ctx);
3107 break;
3108 }
3109 case ERPCs.RPC_UNDERGROUND_SYNC:
3110 {
3111 UndergroundAreaLoader.OnRPC(ctx);
3112 break;
3113 }
3114 case ERPCs.RPC_PLAYERRESTRICTEDAREAS_SYNC:
3115 {
3116 CfgPlayerRestrictedAreaHandler.OnRPC(ctx);
3117 break;
3118 }
3119 case ERPCs.RPC_SEND_NOTIFICATION:
3120 {
3121 NotificationType type;
3122 float show_time;
3123 string detail_text;
3124
3125 ctx.Read(type);
3126 ctx.Read(show_time);
3127 ctx.Read(detail_text);
3128
3129 NotificationSystem.AddNotification(type, show_time, detail_text);
3130 break;
3131 }
3132 case ERPCs.RPC_SEND_NOTIFICATION_EXTENDED:
3133 {
3134 float show_time_ext;
3135 string title_text_ext;
3136 string detail_text_ext;
3137 string icon_ext;
3138
3139 ctx.Read(show_time_ext);
3140 ctx.Read(title_text_ext);
3141 ctx.Read(detail_text_ext);
3142 ctx.Read(icon_ext);
3143
3144 NotificationSystem.AddNotificationExtended(show_time_ext, title_text_ext, detail_text_ext, icon_ext);
3145 break;
3146 }
3147
3148
3149 case ERPCs.RPC_SOUND_HELICRASH:
3150 {
3151 bool playSound;
3152 vector pos;
3153 string sound_set;
3154
3155 //Helicrash is a world event, we want anyone to be able to hear it
3156 Param3<bool, vector, int> playCrashSound = new Param3<bool, vector, int>(false, "0 0 0",0);
3157 if (ctx.Read(playCrashSound))
3158 {
3159 playSound = playCrashSound.param1;
3160 pos = playCrashSound.param2;
3161 sound_set = CrashSoundSets.GetSoundSetByHash(playCrashSound.param3);
3162 }
3163
3164 if (playSound)
3165 {
3166 m_CrashSound = SEffectManager.PlaySound(sound_set, pos, 0.1, 0.1);
3167 m_CrashSound.SetAutodestroy(true);
3168 }
3169
3170 break;
3171 }
3172 //Random off map artillery barrage
3173 case ERPCs.RPC_SOUND_ARTILLERY:
3174 {
3175 vector position;
3176 Param1<vector> playArtySound = new Param1<vector>(vector.Zero);
3177 if (ctx.Read(playArtySound))
3178 {
3179 position = playArtySound.param1;
3180 if (position == vector.Zero)
3181 break;
3182 }
3183 else
3184 break;
3185
3186 if (!g_Game.GetPlayer())
3187 break;
3188
3189 if (vector.DistanceSq(g_Game.GetPlayer().GetPosition(), position) <= (MIN_ARTY_SOUND_RANGE * MIN_ARTY_SOUND_RANGE))
3190 break;
3191
3192 m_ArtySound = SEffectManager.PlaySound("Artillery_Distant_Barrage_SoundSet", position, 0.1, 0.1);
3193 m_ArtySound.SetAutodestroy(true);
3194
3195 break;
3196 }
3197 case ERPCs.RPC_SOUND_CONTAMINATION:
3198 {
3199 vector soundPos;
3200
3201 Param1<vector> playContaminatedSound = new Param1<vector>(vector.Zero);
3202 if (ctx.Read(playContaminatedSound))
3203 {
3204 soundPos = playContaminatedSound.param1;
3205 if (soundPos == vector.Zero)
3206 break;
3207 }
3208 else
3209 break;
3210
3211 if (!g_Game.GetPlayer())
3212 break;
3213
3214 EffectSound closeArtySound = SEffectManager.PlaySound("Artillery_Close_SoundSet", soundPos);
3215 closeArtySound.SetAutodestroy(true);
3216
3217 // We add camera shake upon shell detonation
3218 float distance_to_player = vector.DistanceSq(soundPos, g_Game.GetPlayer().GetPosition());
3219 if (distance_to_player <= GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE2)
3220 {
3221 float strength_factor = Math.InverseLerp(GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE, 0, Math.Sqrt(distance_to_player));
3222 DayZPlayerCamera camera = g_Game.GetPlayer().GetCurrentCamera();
3223 if (camera)
3224 camera.SpawnCameraShake(strength_factor * 4);
3225 }
3226
3227 ParticleManager.GetInstance().PlayInWorld(ParticleList.CONTAMINATED_AREA_GAS_SHELL, soundPos);
3228 break;
3229 }
3230 // Single artillery shot to announce dynamic contaminated area
3231 case ERPCs.RPC_SOUND_ARTILLERY_SINGLE:
3232 {
3233 vector soundPosition;
3234 vector delayedSoundPos;
3235 float soundDelay;
3236
3237 Param3<vector, vector, float> playArtyShotSound = new Param3<vector, vector, float>(vector.Zero, vector.Zero, 0);
3238 if (ctx.Read(playArtyShotSound))
3239 {
3240 soundPosition = playArtyShotSound.param1;
3241 delayedSoundPos = playArtyShotSound.param2;
3242 soundDelay = playArtyShotSound.param3;
3243 if (soundPosition == vector.Zero)
3244 break;
3245 }
3246 else
3247 break;
3248
3249 if (!g_Game.GetPlayer())
3250 break;
3251
3252 m_ArtySound = SEffectManager.PlaySound("Artillery_Distant_SoundSet", soundPosition, 0.1, 0.1);
3253 m_ArtySound.SetAutodestroy(true);
3254
3255 // We remove the amount of time the incoming sound lasts
3256 soundDelay -= 5;
3257 // We convert to milliseconds
3258 soundDelay *= 1000;
3259 GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(DelayedMidAirDetonation, soundDelay, false, delayedSoundPos[0], delayedSoundPos[1], delayedSoundPos[2]);
3260 break;
3261 }
3262 case ERPCs.RPC_SET_BILLBOARDS:
3263 {
3265 m_BillboardSetHandler = new BillboardSetHandler();
3266
3267 Param1<int> indexP = new Param1<int>(-1);
3268 if (ctx.Read(indexP))
3269 {
3270 int index = indexP.param1;
3271 m_BillboardSetHandler.OnRPCIndex(index);
3272 }
3273 break;
3274 }
3275 #endif
3276 #endif
3277
3278 case ERPCs.RPC_USER_SYNC_PERMISSIONS:
3279 {
3280 map<string, bool> mute_list;
3281 if (ctx.Read(mute_list))
3282 {
3283 for (int i = 0; i < mute_list.Count(); i++)
3284 {
3285 string uid = mute_list.GetKey(i);
3286 bool mute = mute_list.GetElement(i);
3287 MutePlayer(uid, sender.GetPlainId(), mute);
3288 }
3289 }
3290 break;
3291 }
3292
3293 /*
3294 case ERPCs.RPC_SERVER_RESPAWN_MODE:
3295 {
3296 int mode;
3297 if (ctx.Read(mode) && !IsServer())
3298 {
3299 GetMission().SetRespawnModeClient(mode);
3300 }
3301 }
3302 */
3303
3304 #ifdef DEVELOPER
3305 case ERPCs.DEV_SET_WEATHER:
3306 {
3307 Param1<DebugWeatherRPCData> p1data = new Param1<DebugWeatherRPCData>(null);
3308
3309 if ( ctx.Read(p1data) )
3310 {
3311 DebugWeatherRPCData data = p1data.param1;
3312
3313 if (data.m_FogValue >= 0)
3314 g_Game.GetWeather().GetFog().Set(data.m_FogValue, data.m_FogInterpolation, data.m_FogDuration);
3315
3316 if (data.m_OvercastValue >= 0)
3317 g_Game.GetWeather().GetOvercast().Set(data.m_OvercastValue, data.m_OvercastInterpolation, data.m_OvercastDuration);
3318
3319 if (data.m_RainValue >= 0)
3320 g_Game.GetWeather().GetRain().Set(data.m_RainValue, data.m_RainInterpolation, data.m_RainDuration);
3321
3322 if (data.m_SnowfallValue >= 0)
3323 g_Game.GetWeather().GetSnowfall().Set(data.m_SnowfallValue, data.m_SnowfallInterpolation, data.m_SnowfallDuration);
3324
3325 if (data.m_VolFogDistanceDensity >= 0)
3326 g_Game.GetWeather().SetDynVolFogDistanceDensity(data.m_VolFogDistanceDensity, data.m_VolFogDistanceDensityTime);
3327
3328 if (data.m_VolFogHeightDensity >= 0)
3329 g_Game.GetWeather().SetDynVolFogHeightDensity(data.m_VolFogHeightDensity, data.m_VolFogHeightDensityTime);
3330
3331 if (data.m_VolFogHeightBias >= -500)
3332 g_Game.GetWeather().SetDynVolFogHeightBias(data.m_VolFogHeightBias, data.m_VolFogHeightBiasTime);
3333
3334 if (data.m_WindMagnitudeValue >= 0)
3335 g_Game.GetWeather().GetWindMagnitude().Set(data.m_WindMagnitudeValue, data.m_WindDInterpolation, data.m_WindDDuration);
3336
3337 if (data.m_WindDirectionValue >= -3.14)
3338 g_Game.GetWeather().GetWindDirection().Set(data.m_WindDirectionValue, data.m_WindDInterpolation, data.m_WindDDuration);
3339 }
3340 else
3341 {
3342 ErrorEx("Failed to read weather debug data");
3343 }
3344 break;
3345 }
3346 #endif
3347
3348
3349 #ifdef DIAG_DEVELOPER
3350 #ifdef SERVER
3351 case ERPCs.DIAG_CAMERATOOLS_CAM_DATA:
3352 {
3353 if (!m_CameraToolsMenuServer)
3354 {
3355 m_CameraToolsMenuServer = new CameraToolsMenuServer;
3356 }
3357 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3358 break;
3359 }
3360
3361 case ERPCs.DIAG_CAMERATOOLS_CAM_SUBSCRIBE:
3362 {
3363 if (!m_CameraToolsMenuServer)
3364 {
3365 m_CameraToolsMenuServer = new CameraToolsMenuServer;
3366 }
3367 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3368 break;
3369 }
3370
3371 #endif
3372 #endif
3373
3374 }
3375 // global rpc's handling
3376 }
3377 }
DayZGame g_Game
Определения DayZGame.c:3942
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:981
void DelayedMidAirDetonation(float x, float y, float z)
Определения DayZGame.c:3379
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1198
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:970
ref EffectSound m_CrashSound
Определения DayZGame.c:978
ref BillboardSetHandler m_BillboardSetHandler
Определения DayZGame.c:893
const int MIN_ARTY_SOUND_RANGE
Определения DayZGame.c:982
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:603
proto string GetPlainId()
plaintext unique id of player (cannot be used in database or logs)
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)
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

Перекрестные ссылки NotificationSystem::AddNotification(), NotificationSystem::AddNotificationExtended(), CALL_CATEGORY_GAMEPLAY, ScriptCallQueue::CallLater(), GameConstants::CAMERA_SHAKE_ARTILLERY_DISTANCE, GameConstants::CAMERA_SHAKE_ARTILLERY_DISTANCE2, ParticleList::CONTAMINATED_AREA_GAS_SHELL, DayZPlayerCamera(), DelayedMidAirDetonation(), vector::DistanceSq(), ErrorEx, Event_OnRPC, g_Game, GetCallQueue(), PlayerIdentityBase::GetPlainId(), CrashSoundSets::GetSoundSetByHash(), Math::InverseLerp(), 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(), CfgGameplayHandler::OnRPC(), CfgPlayerRestrictedAreaHandler::OnRPC(), UndergroundAreaLoader::OnRPC(), ParticleManager(), SEffectManager::PlaySound(), Serializer::Read(), EffectSound::SetAutodestroy(), Math::Sqrt() и vector::Zero.