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

◆ OnRPC() [1/2]

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

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

3013 {
3014 super.OnRPC(sender, target, rpc_type, ctx);
3015 Event_OnRPC.Invoke(sender, target, rpc_type, ctx);
3016
3017 //Print("["+ GetGame().GetTime().ToString() +"] => DayZGame::OnRPC = "+ EnumTools.EnumToString(ERPCs,rpc_type));
3018
3019 if (target)
3020 {
3021 // call rpc on target
3022 target.OnRPC(sender, rpc_type, ctx);
3023 }
3024 else
3025 {
3026 switch (rpc_type)
3027 {
3028 #ifndef SERVER
3029 #ifndef NO_GUI
3030 case ERPCs.RPC_CFG_GAMEPLAY_SYNC:
3031 {
3032 CfgGameplayHandler.OnRPC(null, ctx);
3033 break;
3034 }
3035 case ERPCs.RPC_UNDERGROUND_SYNC:
3036 {
3037 UndergroundAreaLoader.OnRPC(ctx);
3038 break;
3039 }
3040 case ERPCs.RPC_PLAYERRESTRICTEDAREAS_SYNC:
3041 {
3042 CfgPlayerRestrictedAreaHandler.OnRPC(ctx);
3043 break;
3044 }
3045 case ERPCs.RPC_SEND_NOTIFICATION:
3046 {
3047 NotificationType type;
3048 float show_time;
3049 string detail_text;
3050
3051 ctx.Read(type);
3052 ctx.Read(show_time);
3053 ctx.Read(detail_text);
3054
3055 NotificationSystem.AddNotification(type, show_time, detail_text);
3056 break;
3057 }
3058 case ERPCs.RPC_SEND_NOTIFICATION_EXTENDED:
3059 {
3060 float show_time_ext;
3061 string title_text_ext;
3062 string detail_text_ext;
3063 string icon_ext;
3064
3065 ctx.Read(show_time_ext);
3066 ctx.Read(title_text_ext);
3067 ctx.Read(detail_text_ext);
3068 ctx.Read(icon_ext);
3069
3070 NotificationSystem.AddNotificationExtended(show_time_ext, title_text_ext, detail_text_ext, icon_ext);
3071 break;
3072 }
3073
3074
3075 case ERPCs.RPC_SOUND_HELICRASH:
3076 {
3077 bool playSound;
3078 vector pos;
3079 string sound_set;
3080
3081 //Helicrash is a world event, we want anyone to be able to hear it
3082 Param3<bool, vector, int> playCrashSound = new Param3<bool, vector, int>(false, "0 0 0",0);
3083 if (ctx.Read(playCrashSound))
3084 {
3085 playSound = playCrashSound.param1;
3086 pos = playCrashSound.param2;
3087 sound_set = CrashSoundSets.GetSoundSetByHash(playCrashSound.param3);
3088 }
3089
3090 if (playSound)
3091 {
3092 m_CrashSound = SEffectManager.PlaySound(sound_set, pos, 0.1, 0.1);
3093 m_CrashSound.SetAutodestroy(true);
3094 }
3095
3096 break;
3097 }
3098 //Random off map artillery barrage
3099 case ERPCs.RPC_SOUND_ARTILLERY:
3100 {
3101 vector position;
3102 Param1<vector> playArtySound = new Param1<vector>(vector.Zero);
3103 if (ctx.Read(playArtySound))
3104 {
3105 position = playArtySound.param1;
3106 if (position == vector.Zero)
3107 break;
3108 }
3109 else
3110 break;
3111
3112 if (!GetGame().GetPlayer())
3113 break;
3114
3115 if (vector.DistanceSq(GetGame().GetPlayer().GetPosition(), position) <= (MIN_ARTY_SOUND_RANGE * MIN_ARTY_SOUND_RANGE))
3116 break;
3117
3118 m_ArtySound = SEffectManager.PlaySound("Artillery_Distant_Barrage_SoundSet", position, 0.1, 0.1);
3119 m_ArtySound.SetAutodestroy(true);
3120
3121 break;
3122 }
3123 case ERPCs.RPC_SOUND_CONTAMINATION:
3124 {
3125 vector soundPos;
3126
3127 Param1<vector> playContaminatedSound = new Param1<vector>(vector.Zero);
3128 if (ctx.Read(playContaminatedSound))
3129 {
3130 soundPos = playContaminatedSound.param1;
3131 if (soundPos == vector.Zero)
3132 break;
3133 }
3134 else
3135 break;
3136
3137 if (!GetGame().GetPlayer())
3138 break;
3139
3140 EffectSound closeArtySound = SEffectManager.PlaySound("Artillery_Close_SoundSet", soundPos);
3141 closeArtySound.SetAutodestroy(true);
3142
3143 // We add camera shake upon shell detonation
3144 float distance_to_player = vector.DistanceSq(soundPos, GetGame().GetPlayer().GetPosition());
3145 if (distance_to_player <= GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE2)
3146 {
3147 float strength_factor = Math.InverseLerp(GameConstants.CAMERA_SHAKE_ARTILLERY_DISTANCE, 0, Math.Sqrt(distance_to_player));
3148 DayZPlayerCamera camera = GetGame().GetPlayer().GetCurrentCamera();
3149 if (camera)
3150 camera.SpawnCameraShake(strength_factor * 4);
3151 }
3152
3153 ParticleManager.GetInstance().PlayInWorld(ParticleList.CONTAMINATED_AREA_GAS_SHELL, soundPos);
3154 break;
3155 }
3156 // Single artillery shot to announce dynamic contaminated area
3157 case ERPCs.RPC_SOUND_ARTILLERY_SINGLE:
3158 {
3159 vector soundPosition;
3160 vector delayedSoundPos;
3161 float soundDelay;
3162
3163 Param3<vector, vector, float> playArtyShotSound = new Param3<vector, vector, float>(vector.Zero, vector.Zero, 0);
3164 if (ctx.Read(playArtyShotSound))
3165 {
3166 soundPosition = playArtyShotSound.param1;
3167 delayedSoundPos = playArtyShotSound.param2;
3168 soundDelay = playArtyShotSound.param3;
3169 if (soundPosition == vector.Zero)
3170 break;
3171 }
3172 else
3173 break;
3174
3175 if (!GetGame().GetPlayer())
3176 break;
3177
3178 m_ArtySound = SEffectManager.PlaySound("Artillery_Distant_SoundSet", soundPosition, 0.1, 0.1);
3179 m_ArtySound.SetAutodestroy(true);
3180
3181 // We remove the amount of time the incoming sound lasts
3182 soundDelay -= 5;
3183 // We convert to milliseconds
3184 soundDelay *= 1000;
3185 GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(DelayedMidAirDetonation, soundDelay, false, delayedSoundPos[0], delayedSoundPos[1], delayedSoundPos[2]);
3186 break;
3187 }
3188 case ERPCs.RPC_SET_BILLBOARDS:
3189 {
3191 m_BillboardSetHandler = new BillboardSetHandler();
3192
3193 Param1<int> indexP = new Param1<int>(-1);
3194 if (ctx.Read(indexP))
3195 {
3196 int index = indexP.param1;
3197 m_BillboardSetHandler.OnRPCIndex(index);
3198 }
3199 break;
3200 }
3201 #endif
3202 #endif
3203
3204 case ERPCs.RPC_USER_SYNC_PERMISSIONS:
3205 {
3206 map<string, bool> mute_list;
3207 if (ctx.Read(mute_list))
3208 {
3209 for (int i = 0; i < mute_list.Count(); i++)
3210 {
3211 string uid = mute_list.GetKey(i);
3212 bool mute = mute_list.GetElement(i);
3213 MutePlayer(uid, sender.GetPlainId(), mute);
3214 }
3215 }
3216 break;
3217 }
3218
3219 /*
3220 case ERPCs.RPC_SERVER_RESPAWN_MODE:
3221 {
3222 int mode;
3223 if (ctx.Read(mode) && !IsServer())
3224 {
3225 GetMission().SetRespawnModeClient(mode);
3226 }
3227 }
3228 */
3229
3230 #ifdef DEVELOPER
3231 case ERPCs.DEV_SET_WEATHER:
3232 {
3233 Param1<DebugWeatherRPCData> p1data = new Param1<DebugWeatherRPCData>(null);
3234
3235 if ( ctx.Read(p1data) )
3236 {
3237 DebugWeatherRPCData data = p1data.param1;
3238
3239 if (data.m_FogValue >= 0)
3241
3242 if (data.m_OvercastValue >= 0)
3244
3245 if (data.m_RainValue >= 0)
3247
3248 if (data.m_SnowfallValue >= 0)
3250
3251 if (data.m_VolFogDistanceDensity >= 0)
3253
3254 if (data.m_VolFogHeightDensity >= 0)
3256
3257 if (data.m_VolFogHeightBias >= -500)
3259
3260 if (data.m_WindMagnitudeValue >= 0)
3262
3263 if (data.m_WindDirectionValue >= -3.14)
3265 }
3266 else
3267 {
3268 ErrorEx("Failed to read weather debug data");
3269 }
3270 break;
3271 }
3272 #endif
3273
3274
3275 #ifdef DIAG_DEVELOPER
3276 #ifdef SERVER
3277 case ERPCs.DIAG_CAMERATOOLS_CAM_DATA:
3278 {
3279 if (!m_CameraToolsMenuServer)
3280 {
3281 m_CameraToolsMenuServer = new CameraToolsMenuServer;
3282 }
3283 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3284 break;
3285 }
3286
3287 case ERPCs.DIAG_CAMERATOOLS_CAM_SUBSCRIBE:
3288 {
3289 if (!m_CameraToolsMenuServer)
3290 {
3291 m_CameraToolsMenuServer = new CameraToolsMenuServer;
3292 }
3293 m_CameraToolsMenuServer.OnRPC(rpc_type, ctx);
3294 break;
3295 }
3296
3297 #endif
3298 #endif
3299
3300 }
3301 // global rpc's handling
3302 }
3303 }
map
Определения ControlsXboxNew.c:4
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:979
void DelayedMidAirDetonation(float x, float y, float z)
Определения DayZGame.c:3305
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
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:968
ref EffectSound m_CrashSound
Определения DayZGame.c:976
ref BillboardSetHandler m_BillboardSetHandler
Определения DayZGame.c:891
proto native DayZPlayer GetPlayer()
proto native Weather GetWeather()
Returns weather controller object.
const int MIN_ARTY_SOUND_RANGE
Определения DayZGame.c:980
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)
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 Snowfall GetSnowfall()
Returns a snowfall phenomenon object.
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.
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
Определения dayzplayer.c:56
proto native CGame GetGame()
enum ShapeType ErrorEx
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
const int CALL_CATEGORY_GAMEPLAY
Определения 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, GetCallQueue(), Weather::GetFog(), GetGame(), Weather::GetOvercast(), PlayerIdentityBase::GetPlainId(), GetPlayer(), GetPosition, Weather::GetRain(), Weather::GetSnowfall(), CrashSoundSets::GetSoundSetByHash(), GetWeather(), Weather::GetWindDirection(), Weather::GetWindMagnitude(), 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(), WeatherPhenomenon::Set(), EffectSound::SetAutodestroy(), Weather::SetDynVolFogDistanceDensity(), Weather::SetDynVolFogHeightBias(), Weather::SetDynVolFogHeightDensity(), Math::Sqrt() и vector::Zero.