DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
DustEffectCeilingHandler.c
См. документацию.
2{
3 protected static int RANGE_MIN_DEFAULT = 4;
4 protected static int RANGE_MAX_DEFAULT = 8;
5 protected static float FLOOR_THICKNESS_DEFAULT = 0.4;
6
7 protected EntityAI m_Owner;
8 protected int m_StepCounter;
9 protected int m_NextEffectStepIdx;
10
12 {
13 m_Owner = owner;
14 m_StepCounter = 0;
15 }
16
17 protected void CalculateNextEffect(string surfaceType, int particleID)
18 {
19 int rangeMin = RANGE_MIN_DEFAULT;
20 int rangeMax = RANGE_MAX_DEFAULT;
21 DustEffectManager.AdjustCeilingDustEffectFrequency(surfaceType, particleID, rangeMin, rangeMax);
22 m_NextEffectStepIdx = Math.RandomIntInclusive(rangeMin,rangeMax);
23 }
24
25 void OnStepUpdate(SurfaceInfo surfaceInfo, string boneName = "")
26 {
27 int ceilingParticleID = surfaceInfo.GetCeilingDustParticleId();
28 if (ceilingParticleID <= 0)
29 return;
30
32
34 {
35 vector pos = GetBonePosition(boneName);
36 AdjustBySurfaceThickness(pos, surfaceInfo);
37 CreateEffects(ceilingParticleID, pos);
38 m_StepCounter = 0;
39 CalculateNextEffect(surfaceInfo.GetSurfaceType(), ceilingParticleID);
40 }
41 }
42
43 protected vector GetBonePosition(string boneName)
44 {
45 DayZCreature creature;
47
48 vector ownerPos = m_Owner.GetPosition();
49 if (boneName == "")
50 return ownerPos;
51
52 int boneIdx = -1;
53 if (Class.CastTo(creature, m_Owner))
54 boneIdx = creature.GetBoneIndexByName(boneName);
55 if (Class.CastTo(player, m_Owner))
56 boneIdx = player.GetBoneIndexByName(boneName);
57
58 if (boneIdx == -1)
59 return ownerPos;
60
61 vector bonePos = m_Owner.GetBonePositionWS(boneIdx);
62 bonePos[1] = ownerPos[1]; //equalize Y to allow for consistent height adjustment later
63 return bonePos;
64 }
65
66 protected void AdjustBySurfaceThickness(inout vector pos, SurfaceInfo surfaceInfo)
67 {
68 float thicc = surfaceInfo.GetThickness(); //returns '-1' if not defined, for reasons
69 if (thicc < 0)
71 pos[1] = pos[1] - thicc;
72 }
73
74 protected void CreateEffects(int ceilingParticleID, vector position);
75}
76
77class DustEffectCeilingHandlerLocal : DustEffectCeilingHandlerBase
78{
79 override protected void CreateEffects(int ceilingParticleID, vector position)
80 {
82 {
84 effect.SetParticle(ceilingParticleID);
85 effect.SetAutodestroy(true);
87 }
88 }
89}
90
93{
94 //! Request from server, effecter handles the rest
95 override protected void CreateEffects(int ceilingParticleID, vector position)
96 {
97 //'spam' variant of effecters solution
98 SEffectManager.CreateParticleServer(position, new ParticleEffecterParameters("CeilingDustEffecter", 2.0, ceilingParticleID));
99 }
100}
101
102///////////////////////////////
103//effecter
104
105class CeilingDustEffecter : ParticleEffecter
106{
107 override protected typename GetEffectTypename()
108 {
109 return DustEffectManager.GetCeilingEffectType(m_ParticleEffectIDSync).ToType();
110 }
111}
112
114//effect class
115
117{
119 {
121 }
122
127
132
133 override void Start()
134 {
136 return;
137
138 super.Start();
139 }
140
141 protected string GetAdjustedSoundSet(vector effectPos)
142 {
143 vector playerPos = g_Game.GetPlayer().GetPosition();
144 bool upperVariant = effectPos[1] < playerPos[1];
145
146 if (upperVariant)
149 }
150
152 //methods to override in children classes
153
154 protected string GetLowerSoundsetVariant()
155 {
156 return "";
157 }
158
159 protected string GetUpperSoundsetVariant()
160 {
161 return "";
162 }
163}
164
165class CeilingDustEffectWood : CeilingDustEffectBase
166{
167 override protected string GetLowerSoundsetVariant()
169 return "CeilingDustEffect_SoundSet";
170 }
171
172 override protected string GetUpperSoundsetVariant()
174 return "CeilingDustEffectTop_SoundSet";
175 }
176}
DayZGame g_Game
Определения DayZGame.c:4074
void PlayCeilingDustSound()
Определения DustEffectCeilingHandler.c:178
vector position
Определения DustKickupEffects.c:20
ref ScriptInvoker Event_OnEffectStarted
Event used when the actual effect started playing.
Определения Effect.c:24
vector m_Position
Cached world position.
Определения Effect.c:43
void EffectParticleGeneral()
Определения EffectManager.c:871
void ~CeilingDustEffectBase()
Определения DustEffectCeilingHandler.c:123
void CeilingDustEffectBase()
Определения DustEffectCeilingHandler.c:118
string GetAdjustedSoundSet(vector effectPos)
Определения DustEffectCeilingHandler.c:141
override void Start()
Определения DustEffectCeilingHandler.c:133
string GetUpperSoundsetVariant()
Определения DustEffectCeilingHandler.c:159
string GetLowerSoundsetVariant()
Определения DustEffectCeilingHandler.c:154
void PlayCeilingDustSound()
Определения DustEffectCeilingHandler.c:128
Super root of all classes in Enforce script.
Определения EnScript.c:11
Определения DayZAnimal.c:192
Определения ManBase.c:2
static float FLOOR_THICKNESS_DEFAULT
Определения DustEffectCeilingHandler.c:5
void AdjustBySurfaceThickness(inout vector pos, SurfaceInfo surfaceInfo)
Определения DustEffectCeilingHandler.c:66
void CreateEffects(int ceilingParticleID, vector position)
void DustEffectCeilingHandlerBase(EntityAI owner)
Определения DustEffectCeilingHandler.c:11
void OnStepUpdate(SurfaceInfo surfaceInfo, string boneName="")
Определения DustEffectCeilingHandler.c:25
void CalculateNextEffect(string surfaceType, int particleID)
Определения DustEffectCeilingHandler.c:17
static int RANGE_MIN_DEFAULT
Определения DustEffectCeilingHandler.c:3
vector GetBonePosition(string boneName)
Определения DustEffectCeilingHandler.c:43
static int RANGE_MAX_DEFAULT
Определения DustEffectCeilingHandler.c:4
void CreateEffects(int ceilingParticleID, vector position)
Request from server, effecter handles the rest.
Определения DustEffectCeilingHandler.c:95
Generic synced solution.
Определения DustEffectCeilingHandler.c:93
int IsCeilingDustEffectEnabled()
Определения DustEffectsManager.c:731
static string GetCeilingEffectType(int particleID)
Returns effect type paired to the particleID.
Определения DustEffectsManager.c:720
static DustEffectManager GetDustEffectManager()
Определения DustEffectsManager.c:6
static void AdjustCeilingDustEffectFrequency(string surfaceType, int particleID, inout int min, inout int max)
optional adjustment of frequency by particleID
Определения DustEffectsManager.c:706
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:607
Определения EnMath.c:7
GetEffectTypename()
Определения EffectManager.c:857
static int PlayInWorld(notnull Effect eff, vector pos)
Play an Effect.
Определения EffectManager.c:47
static int CreateParticleServer(vector pos, EffecterParameters parameters)
returns unique effecter ID
Определения EffectManager.c:586
static EffectSound PlaySound(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Определения EffectManager.c:178
Manager class for managing Effect (EffectParticle, EffectSound)
Определения EffectManager.c:6
proto float GetThickness()
proto string GetSurfaceType()
proto int GetCeilingDustParticleId()
Определения SurfaceInfo.c:9
Определения EnConvert.c:119
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения EnMath.c:54
proto native ToType()
Returns internal type representation. Can be used in runtime, or cached in variables and used for fas...