DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
HescoBox.c
См. документацию.
1class HescoBox extends Inventory_Base
2{
3 static const int FOLDED = 0;
4 static const int UNFOLDED = 1;
5 static const int FILLED = 2;
6 static const int PERCENTUAL_DAMAGE = 1;
7
9
10 protected int m_State;
11
12 void HescoBox()
13 {
15
16 //synchronized variables
17 RegisterNetSyncVariableInt( "m_State", FOLDED, FILLED );
18 }
19
20 override bool HasProxyParts()
21 {
22 return true;
23 }
24
25 override bool CanPutIntoHands( EntityAI parent )
26 {
27 if( !super.CanPutIntoHands( parent ) )
28 {
29 return false;
30 }
31 return CanBeManipulated();
32 }
33
35 {
36 SetSynchDirty();
37 }
38
40 {
41 super.OnVariablesSynchronized();
42
43 //refresh visuals
45 }
46
48 {
49 }
50
52 {
53 return m_State;
54 }
55
56 void SetState( int state )
57 {
58 m_State = state;
59 }
60
62 {
63 string surface_type;
64 GetGame().SurfaceGetType( position[0], position[2], surface_type );
65
66 return GetGame().IsSurfaceDigable(surface_type);
67 }
68
70 {
71 if ( GetState() == FOLDED )
72 {
73 return true;
74 }
75 else
76 {
77 return false;
78 }
79 }
80
81 void Fold()
82 {
83 this.ShowSelection( "inventory" );
84 this.HideSelection( "placing" );
85 this.HideSelection( "filled" );
86
89
90 if ( GetGame().IsServer() )
91 {
92 SetAllowDamage(true);
94 float fold_damage = ( GetMaxHealth( "", "" ) / 100 ) * PERCENTUAL_DAMAGE;
95 DecreaseHealth( "", "", fold_damage );
96 }
97 }
98
99 void Unfold()
100 {
101 this.HideSelection( "inventory" );
102 this.ShowSelection( "placing" );
103 this.HideSelection( "filled" );
104
107
108 if ( GetGame().IsServer() )
109 {
110 SetAllowDamage(true);
111 Synchronize();
112 float unfold_damage = ( GetMaxHealth( "", "" ) / 100 ) * PERCENTUAL_DAMAGE;
113 DecreaseHealth( "", "", unfold_damage );
114 }
115 }
116
117 override void EEItemLocationChanged (notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
118 {
119 super.EEItemLocationChanged (oldLoc, newLoc);
120
121 //RefreshPhysics();
122 }
123
124 override void RefreshPhysics()
125 {
126 super.RefreshPhysics();
127
128 if ( this && !ToDelete() )
129 {
130 RemoveProxyPhysics( "inventory" );
131 RemoveProxyPhysics( "placing" );
132 RemoveProxyPhysics( "filled" );
133
134 int state = GetState();
135
136 switch (state)
137 {
138 case UNFOLDED:
139 //ShowSelection( "placing" );
140 AddProxyPhysics( "placing" );
141
142 return;
143
144 case FOLDED:
145 AddProxyPhysics( "inventory" );
146 return;
147
148 case FILLED:
149 AddProxyPhysics( "filled" );
150 return;
151 }
152 }
153 }
154
155 void Fill()
156 {
157 this.HideSelection( "inventory" );
158 this.HideSelection( "placing" );
159 this.ShowSelection( "filled" );
160
161 SetState( FILLED );
163
164 if ( GetGame().IsServer() )
165 {
166 Synchronize();
167 DecreaseHealth( "", "", 5 ); //TODO Daniel implement soft skill bonus via useraction
168 SetAllowDamage(false);
169 }
170 }
171
173 {
174 super.OnStoreSave(ctx);
175
176 // Save state
177 ctx.Write( m_State );
178 }
179
180 override bool OnStoreLoad(ParamsReadContext ctx, int version)
181 {
182 if ( !super.OnStoreLoad(ctx, version) )
183 return false;
184
185 // Load folded/unfolded state
186 int state = FOLDED;
187 if ( !ctx.Read(state) )
188 state = FOLDED;
189
190 switch (state)
191 {
192 case FOLDED:
193 {
194 Fold();
195 break;
196 }
197 case UNFOLDED:
198 {
199 Unfold();
200 break;
201 }
202 case FILLED:
203 {
204 Fill();
205 break;
206 }
207 }
208 return true;
209 }
210
211 //================================================================
212 // ADVANCED PLACEMENT
213 //================================================================
214
215 override void OnPlacementComplete( Man player, vector position = "0 0 0", vector orientation = "0 0 0" )
216 {
217 super.OnPlacementComplete( player, position, orientation );
218
219 if ( GetGame().IsServer() )
220 {
221 Unfold();
222 }
223 }
224
225 override bool IsDeployable()
226 {
227 return true;
228 }
229
230 override string GetDeploySoundset()
231 {
232 return "placeHescoBox_SoundSet";
233 }
234
235 override string GetLoopDeploySoundset()
236 {
237 return "hescobox_deploy_SoundSet";
238 }
239
240 override void SetActions()
241 {
242 super.SetActions();
243
247 }
248
250 protected ref EffectSound m_DeployLoopSound; //DEPRECATED in favor of m_DeployLoopSoundEx
251
254}
PlaceObjectActionReciveData ActionReciveData ActionDeployObject()
Определения ActionDeployObject.c:9
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
bool IsSurfaceDigable(string surface)
Checks if the surface is digable.
Определения Game.c:1156
proto float SurfaceGetType(float x, float z, out string type)
Returns: Y position the surface was found.
Wrapper class for managing sound through SEffectManager.
Определения EffectSound.c:5
Определения Building.c:6
override bool HasProxyParts()
Определения HescoBox.c:20
void Fill()
Определения HescoBox.c:155
void SetState(int state)
Определения HescoBox.c:56
bool CanBeFilledAtPosition(vector position)
Определения HescoBox.c:61
static const int PERCENTUAL_DAMAGE
Определения HescoBox.c:6
void PlayDeployLoopSound()
void Fold()
Определения HescoBox.c:81
bool CanBeManipulated()
Определения HescoBox.c:69
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения HescoBox.c:215
void StopDeployLoopSound()
DEPRECATED.
override bool IsDeployable()
Определения HescoBox.c:225
ref EffectSound m_DeployLoopSound
DEPRECATED.
Определения HescoBox.c:250
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения HescoBox.c:180
ref Timer m_Timer
Определения HescoBox.c:8
override bool CanPutIntoHands(EntityAI parent)
Определения HescoBox.c:25
void Unfold()
Определения HescoBox.c:99
void HescoBox()
Определения HescoBox.c:12
static const int UNFOLDED
Определения HescoBox.c:4
static const int FOLDED
Определения HescoBox.c:3
void Synchronize()
Определения HescoBox.c:34
override void RefreshPhysics()
Определения HescoBox.c:124
override void OnVariablesSynchronized()
Определения HescoBox.c:39
override void OnStoreSave(ParamsWriteContext ctx)
Определения HescoBox.c:172
override string GetDeploySoundset()
Определения HescoBox.c:230
void RefreshVisuals()
Определения HescoBox.c:47
int GetState()
Определения HescoBox.c:51
static const int FILLED
Определения HescoBox.c:5
override void SetActions()
Определения HescoBox.c:240
int m_State
Определения HescoBox.c:10
override string GetLoopDeploySoundset()
Определения HescoBox.c:235
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HescoBox.c:117
InventoryLocation.
Определения InventoryLocation.c:29
proto bool Write(void value_out)
proto bool Read(void value_in)
Определения DayZPlayerImplement.c:63
Определения EnConvert.c:106
Serializer ParamsReadContext
Определения gameplay.c:15
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16