DayZ 1.26
DayZ Explorer by KGB
Загрузка...
Поиск...
Не найдено
Файл EasterEgg.c

См. исходные тексты.

Перечисления

enum  eCaptureState {
  CAPTURE = 0 , RELEASE = 1 , STASIS = 2 , CAPTUREFX = 3 ,
  RELEASEFX = 4 , END
}
 

Функции

void EasterEgg ()
 
void ~EasterEgg ()
 
void ContactEvent (IEntity other, vector pos)
 
override void EOnTouch (IEntity other, int extra)
 
override void EOnContact (IEntity other, Contact extra)
 
override void OnInventoryExit (Man player)
 
override void OnInventoryEnter (Man player)
 
override void EEItemLocationChanged (notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
 
void Capture (DayZCreatureAI capAnimal)
 
void Release (vector pos)
 
void PlayVFX ()
 
void ResizeParticle (DayZCreatureAI capAnimal)
 
void PlaySFX (int releaseCase=eCaptureState.CAPTURE)
 
override void OnVariablesSynchronized ()
 
void RegisterSoundSetMap ()
 
override void OnStoreSave (ParamsWriteContext ctx)
 
override bool OnStoreLoad (ParamsReadContext ctx, int version)
 
void DestroyEg ()
 

Переменные

enum eCaptureState m_StoredCreature = null
 
string m_CreatureType
 
int m_CreatureHash = 0
 
int m_CaptureState = eCaptureState.STASIS
 
const vector CAPTURE_VELOCITY = { 0, 0, 0 }
 
Particle m_ParCapture
 
float m_ParScale = 1
 
const float PARTICLE_SCALE_MULT = 0.1
 
EffectSound m_CaptureSound
 
EffectSound m_CreatureSound
 
bool m_DangerSound = false
 
ref map< int, stringm_CreatureSoundMap
 
int m_CaptureSoundHash
 
int m_ReleaseSoundHash
 

Перечисления

◆ eCaptureState

Элементы перечислений
CAPTURE 
RELEASE 
STASIS 
CAPTUREFX 
RELEASEFX 
END 
2{
3 CAPTURE = 0,
4 RELEASE = 1,
5 STASIS = 2,
6 CAPTUREFX = 3,
7 RELEASEFX = 4,
8
9 //Keep this last value at the end, add any new states before
10 END
11}
@ CAPTURE
Definition EasterEgg.c:3
@ RELEASEFX
Definition EasterEgg.c:7
@ STASIS
Definition EasterEgg.c:5
@ RELEASE
Definition EasterEgg.c:4
@ END
Definition EasterEgg.c:10
@ CAPTUREFX
Definition EasterEgg.c:6

Функции

◆ Capture()

void Capture ( DayZCreatureAI capAnimal)
private
158 {
159 if ( !IsAlive() )
160 {
161 if ( m_ParCapture )
162 m_ParCapture.Delete();
163 Delete();
164 return;
165 }
166
170 m_CaptureState = eCaptureState.CAPTUREFX;
171 m_DangerSound = m_StoredCreature.IsDanger();
172 m_CaptureSoundHash = m_StoredCreature.CaptureSound().Hash();
173 m_ReleaseSoundHash = m_StoredCreature.ReleaseSound().Hash();
174
175 //Resize particle upon capture as there is enough delay to be sure value is synced
177
178 SetSynchDirty();
179
180 capAnimal.Delete();
183 }
eCaptureState
Definition EasterEgg.c:2
string m_CreatureType
Definition EasterEgg.c:17
void ResizeParticle(DayZCreatureAI capAnimal)
Definition EasterEgg.c:228
int m_CaptureState
Definition EasterEgg.c:19
int m_ReleaseSoundHash
Definition EasterEgg.c:34
const vector CAPTURE_VELOCITY
Definition EasterEgg.c:20
bool m_DangerSound
Definition EasterEgg.c:30
Particle m_ParCapture
Definition EasterEgg.c:23
enum eCaptureState m_StoredCreature
int m_CaptureSoundHash
Definition EasterEgg.c:33
int m_CreatureHash
Definition EasterEgg.c:18
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Set item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Definition ItemBase.c:7981
override int GetQuantityMax()
Definition ItemBase.c:8081
Definition EntityAI.c:95
proto native void SetVelocity(notnull IEntity ent, vector vel)
Sets linear velocity (for Rigid bodies)
proto native int Hash()
Returns hash of string.

Перекрестные ссылки CAPTURE_VELOCITY, GetQuantityMax(), string::Hash(), m_CaptureSoundHash, m_CaptureState, m_CreatureHash, m_CreatureType, m_DangerSound, m_ParCapture, m_ReleaseSoundHash, m_StoredCreature, ResizeParticle(), SetQuantity() и SetVelocity().

Используется в ContactEvent().

◆ ContactEvent()

void ContactEvent ( IEntity other,
vector pos )
protected
62 {
63 switch ( m_CaptureState )
64 {
65 case eCaptureState.CAPTURE:
67 if ( capAnimal && capAnimal.IsAlive() )
68 {
69 if ( GetGame().IsServer() )
71 }
72 else
73 m_CaptureState = eCaptureState.STASIS; //We did not capture anything, go back to stasis
74 break;
75
76 case eCaptureState.RELEASE:
77 Release( pos );
78 PlayVFX();
79 PlaySFX( eCaptureState.RELEASE );
80 break;
81
82 case eCaptureState.CAPTUREFX:
83 case eCaptureState.RELEASEFX:
84 //Intermediate state to play FX on next client side contact event
85 //Creates slight delay but saves network traffic
86 if ( m_CreatureHash != 0 )
87 {
88 //Make sure to go back in stasis
90 SetSynchDirty();
91 }
92 break;
93
94 case eCaptureState.STASIS:
95 //Do nothing here, feel free to add logic for fun fumble effects when nothing happens :)
96
97 break;
98
99 default: //default in case state is somehow not initialized
100
101 break;
102 }
103 }
void PlayVFX()
Definition EasterEgg.c:212
void Release(vector pos)
Definition EasterEgg.c:185
void Capture(DayZCreatureAI capAnimal)
Definition EasterEgg.c:157
void PlaySFX(int releaseCase=eCaptureState.CAPTURE)
Definition EasterEgg.c:239
do not process rotations !
Definition DayZAnimal.c:612
proto native CGame GetGame()

Перекрестные ссылки Capture(), GetGame(), m_CaptureState, m_CreatureHash, PlaySFX(), PlayVFX() и Release().

Используется в EOnContact() и EOnTouch().

◆ DestroyEg()

void DestroyEg ( )
private
406 {
407 Delete();
408 }

◆ EasterEgg()

void EasterEgg ( )
protected
38 {
39 m_CreatureType = "";
40 SetEventMask( EntityEvent.CONTACT | EntityEvent.TOUCH );
41 SetFlags( EntityFlags.TRIGGER, false );
42 RegisterNetSyncVariableInt( "m_CaptureState", 0, eCaptureState.END );
43 RegisterNetSyncVariableInt( "m_CreatureHash", 0, 0 );
44 RegisterNetSyncVariableFloat( "m_ParScale", 0, 0, 0.1 );
45 RegisterNetSyncVariableBool( "m_DangerSound" );
46 RegisterNetSyncVariableInt( "m_CaptureSoundHash", 0, 0 );
47 RegisterNetSyncVariableInt( "m_ReleaseSoundHash", 0, 0 );
48
50 }
void RegisterSoundSetMap()
Definition EasterEgg.c:289
proto native void SetFlags(ShapeFlags flags)
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:45
EntityFlags
Entity flags.
Definition EnEntity.c:115

Перекрестные ссылки m_CreatureType, RegisterSoundSetMap() и SetFlags().

◆ EEItemLocationChanged()

override void EEItemLocationChanged ( notnull InventoryLocation oldLoc,
notnull InventoryLocation newLoc )
protected
148 {
149 super.EEItemLocationChanged(oldLoc, newLoc);
150
151 //DestroyEg();
152 }

◆ EOnContact()

override void EOnContact ( IEntity other,
Contact extra )
protected
113 {
114 ContactEvent( other, extra.Position );
115 }
void ContactEvent(IEntity other, vector pos)
Definition EasterEgg.c:61

Перекрестные ссылки ContactEvent().

◆ EOnTouch()

override void EOnTouch ( IEntity other,
int extra )
protected
107 {
109 }
class JsonUndergroundAreaTriggerData GetPosition
Definition UndergroundAreaLoader.c:9

Перекрестные ссылки ContactEvent() и GetPosition.

◆ OnInventoryEnter()

override void OnInventoryEnter ( Man player)
protected
138 {
139 //Make sure to stop particles once in inventory
140 if ( GetGame().IsClient() && m_ParCapture )
141 {
143 m_ParCapture.Delete();
144 }
145 }
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Definition Particle.c:266

Перекрестные ссылки GetGame(), m_ParCapture и Particle::Stop().

◆ OnInventoryExit()

override void OnInventoryExit ( Man player)
protected
118 {
119 //Do not execute on simple drop as it may cause issues
121 if ( player_PB && player_PB.GetThrowing().IsThrowingAnimationPlaying() )
122 {
123 if ( m_CreatureType != "" )
125 else
127 }
128 else
129 {
131 }
132
133 //Make sure state is properly synchronized or VFX might bug out
134 SetSynchDirty();
135 }
Definition PlayerBaseClient.c:2

Перекрестные ссылки m_CaptureState и m_CreatureType.

◆ OnStoreLoad()

override bool OnStoreLoad ( ParamsReadContext ctx,
int version )
private
379 {
380 if ( !super.OnStoreLoad( ctx, version ) )
381 return false;
382
383 if ( !ctx.Read( m_CaptureState ) )
384 return false;
385
386 if ( !ctx.Read( m_CreatureType ) )
387 return false;
388
389 if ( !ctx.Read( m_ParScale ) )
390 return false;
391
392 if ( !ctx.Read( m_DangerSound ) )
393 return false;
394
395 if ( !ctx.Read( m_CaptureSoundHash ) )
396 return false;
397
398 if ( !ctx.Read( m_ReleaseSoundHash ) )
399 return false;
400
401 return true;
402 }
float m_ParScale
Definition EasterEgg.c:24

Перекрестные ссылки m_CaptureSoundHash, m_CaptureState, m_CreatureType, m_DangerSound, m_ParScale и m_ReleaseSoundHash.

◆ OnStoreSave()

override void OnStoreSave ( ParamsWriteContext ctx)
private
367 {
368 super.OnStoreSave( ctx );
369
370 ctx.Write( m_CaptureState );
371 ctx.Write( m_CreatureType );
372 ctx.Write( m_ParScale );
373 ctx.Write( m_DangerSound );
374 ctx.Write( m_CaptureSoundHash );
375 ctx.Write( m_ReleaseSoundHash );
376 }

Перекрестные ссылки m_CaptureSoundHash, m_CaptureState, m_CreatureType, m_DangerSound, m_ParScale и m_ReleaseSoundHash.

◆ OnVariablesSynchronized()

override void OnVariablesSynchronized ( )
private
273 {
274 if ( m_CaptureState == eCaptureState.CAPTUREFX )
275 {
276 PlayVFX();
277 PlaySFX();
278 }
279 else if ( m_CaptureState == eCaptureState.RELEASEFX )
280 {
281 PlayVFX();
282 PlaySFX( eCaptureState.RELEASE );
283 }
284 }

Перекрестные ссылки m_CaptureState, PlaySFX() и PlayVFX().

◆ PlaySFX()

void PlaySFX ( int releaseCase = eCaptureState.CAPTURE)
private
240 {
241 if ( !GetGame().IsDedicatedServer() )
242 {
243 string soundSet = "";
244 if ( releaseCase == eCaptureState.CAPTURE )
245 {
246 PlaySoundSet( m_CaptureSound, "EasterEgg_Catch_SoundSet", 0, 0 );
247
249 PlaySoundSet( m_CreatureSound, soundSet, 0, 0 );
250 }
251 else
252 {
253 if ( !m_DangerSound )
254 {
255 PlaySoundSet( m_CaptureSound, "EasterEgg_Spawn_SoundSet", 0, 0 );
256
258 PlaySoundSet( m_CreatureSound, soundSet, 0, 0 );
259 }
260 else
261 {
262 PlaySoundSet( m_CaptureSound, "EasterEgg_Spawn_Danger_SoundSet", 0, 0 );
263
265 PlaySoundSet( m_CreatureSound, soundSet, 0, 0 );
266 }
267 }
268 }
269 }
EffectSound m_CreatureSound
Definition EasterEgg.c:29
ref map< int, string > m_CreatureSoundMap
Definition EasterEgg.c:32
EffectSound m_CaptureSound
Definition EasterEgg.c:28

Перекрестные ссылки GetGame(), m_CaptureSound, m_CaptureSoundHash, m_CreatureSound, m_CreatureSoundMap, m_DangerSound и m_ReleaseSoundHash.

Используется в ContactEvent() и OnVariablesSynchronized().

◆ PlayVFX()

void PlayVFX ( )
private
213 {
214 if ( !GetGame().IsDedicatedServer() )
215 {
216 if ( !m_ParCapture && m_CaptureState != eCaptureState.STASIS )
217 {
218 //Ideally play a one time effect such as an explosion
220
221 //Resize, -1 signifies ALL emitors
223 m_ParCapture.SetWiggle( 7, 0.3 );
224 }
225 }
226 }
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Definition ParticleManager.c:84
void SetParameter(int emitter, int parameter, float value)
Set the value of a parameter of an emitor in the particle.
Definition Particle.c:625
void SetWiggle(float random_angle, float random_interval)
Makes the particle change direction by random_angle every random_interval seconds.
Definition Particle.c:775
Definition ParticleList.c:12
static const int EASTER_EGG_ACTIVATE
Definition ParticleList.c:138
EmitorParam
Definition EnVisual.c:114

Перекрестные ссылки ParticleList::EASTER_EGG_ACTIVATE, GetGame(), GetPosition, m_CaptureState, m_ParCapture, m_ParScale, ParticleManager(), Particle::SetParameter() и Particle::SetWiggle().

Используется в ContactEvent() и OnVariablesSynchronized().

◆ RegisterSoundSetMap()

void RegisterSoundSetMap ( )
private
290 {
291 //Register all possible creature sounds in map with their respective hash
292 string soundSet;
294
295 //Cow sounds
296 soundSet = "CattleMooA_SoundSet";
297 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
298 soundSet = "CattleBellow_SoundSet";
299 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
300
301 //Deer sounds
302 soundSet = "DeerRoar_SoundSet";
303 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
304 soundSet = "DeerBleat_SoundSet";
305 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
306
307 //Goat sounds
308 soundSet = "GoatBleat_A_SoundSet";
309 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
310 soundSet = "GoatBleat_B_SoundSet";
311 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
312
313 //Hare sounds
314 soundSet = "HareChirp_SoundSet";
315 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
316 soundSet = "HareSquawk_SoundSet";
317 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
318
319 //Hen sounds
320 soundSet = "HenCluck_X_SoundSet";
321 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
322 soundSet = "HenScream_SoundSet";
323 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
324
325 //Hog sounds
326 soundSet = "HogGrunt_G_SoundSet";
327 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
328 soundSet = "HogSqueal_SoundSet";
329 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
330
331 //Sheep sounds
332 soundSet = "SheepBleat_G_SoundSet";
333 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
334 soundSet = "SheepBleat_E_SoundSet";
335 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
336
337 //Wolf sounds
338 soundSet = "WolfBark_SoundSet";
339 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
340 soundSet = "WolfWhimper_SoundSet";
341 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
342
343 //Zmb F sounds
344 soundSet = "ZmbF_Normal_CallToArmsShort_Soundset";
345 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
346 soundSet = "ZmbF_Normal_HeavyHit_Soundset";
347 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
348
349 //Zmb M sounds
350 soundSet = "ZmbM_Normal_CallToArmsShort_Soundset";
351 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
352 soundSet = "ZmbM_Normal_HeavyHit_Soundset";
353 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
354
355 //Bear sounds
356 soundSet = "BearRoarShort_SoundSet";
357 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
358 soundSet = "BearSnarl_SoundSet";
359 m_CreatureSoundMap.Insert( soundSet.Hash(), soundSet );
360 }

Перекрестные ссылки m_CreatureSoundMap.

Используется в EasterEgg().

◆ Release()

void Release ( vector pos)
private
186 {
187 if ( GetGame().IsServer() )
188 {
189 m_CaptureState = eCaptureState.RELEASEFX;
190 m_CreatureHash = 0;
191 SetSynchDirty();
192
193 GetGame().CreateObject( m_CreatureType, pos, false, true );
194 m_CreatureType = "";
195
196 DecreaseHealth( "", "", GetMaxHealth() * 0.4 );
197 SetQuantity( GetQuantityMin(), false );
199
200 if ( !IsAlive() )
201 {
202 if ( m_ParCapture )
203 m_ParCapture.Delete();
204 Delete();
205 }
206 }
207 }
override int GetQuantityMin()
Definition ItemBase.c:8113

Перекрестные ссылки CAPTURE_VELOCITY, GetGame(), GetQuantityMin(), m_CaptureState, m_CreatureHash, m_CreatureType, m_ParCapture, SetQuantity() и SetVelocity().

Используется в ContactEvent().

◆ ResizeParticle()

void ResizeParticle ( DayZCreatureAI capAnimal)
private
229 {
230 //Determine particle scale depending on captured animal scale
232 capAnimal.GetWorldBounds( mins, maxs );
234
235 //Multiply to rescale down as fed values can be really large
237 }
const float PARTICLE_SCALE_MULT
Definition EasterEgg.c:25
Definition EnConvert.c:106
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.

Перекрестные ссылки vector::DistanceSq(), m_ParScale и PARTICLE_SCALE_MULT.

Используется в Capture().

◆ ~EasterEgg()

void ~EasterEgg ( )
protected
53 {
54 if ( m_ParCapture )
56 }

Перекрестные ссылки m_ParCapture и Particle::Stop().

Переменные

◆ CAPTURE_VELOCITY

const vector CAPTURE_VELOCITY = { 0, 0, 0 }
private
20{ 0, 0, 0 };

Используется в Capture() и Release().

◆ m_CaptureSound

EffectSound m_CaptureSound
protected

Используется в PlaySFX().

◆ m_CaptureSoundHash

int m_CaptureSoundHash
protected

Используется в Capture(), OnStoreLoad(), OnStoreSave() и PlaySFX().

◆ m_CaptureState

◆ m_CreatureHash

int m_CreatureHash = 0
private

Используется в Capture(), ContactEvent() и Release().

◆ m_CreatureSound

EffectSound m_CreatureSound
protected

Используется в PlaySFX().

◆ m_CreatureSoundMap

ref map<int, string> m_CreatureSoundMap
protected

Используется в PlaySFX() и RegisterSoundSetMap().

◆ m_CreatureType

string m_CreatureType
private

◆ m_DangerSound

bool m_DangerSound = false
protected

Используется в Capture(), OnStoreLoad(), OnStoreSave() и PlaySFX().

◆ m_ParCapture

Particle m_ParCapture
protected

Используется в Capture(), OnInventoryEnter(), PlayVFX(), Release() и ~EasterEgg().

◆ m_ParScale

float m_ParScale = 1
private

Используется в OnStoreLoad(), OnStoreSave(), PlayVFX() и ResizeParticle().

◆ m_ReleaseSoundHash

int m_ReleaseSoundHash
protected

Используется в Capture(), OnStoreLoad(), OnStoreSave() и PlaySFX().

◆ m_StoredCreature

enum eCaptureState m_StoredCreature = null

Используется в Capture().

◆ PARTICLE_SCALE_MULT

const float PARTICLE_SCALE_MULT = 0.1
private

Используется в ResizeParticle().