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

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

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

enum  eBloodyHandsTypes { CLEAN = 0 , SALMONELA , JUST_BLOOD , LAST_INDEX }
 

Функции

static PluginLifespan GetInstance ()
 
void PluginLifespan ()
 
void LoadFromCfg ()
 
void SynchLifespanVisual (PlayerBase player, int beard_state_visible, bool bloody_hands_visible, bool blood_type_visible, int blood_type)
 
void ChangeFakePlaytime (PlayerBase player, int change)
 
void UpdateLifespan (PlayerBase player, bool force_update=false)
 
void UpdateLifespanLevel (PlayerBase player, float player_beard, bool force_update=false)
 
LifespanLevel GetLifespanLevel (string player_class, float age=0)
 
void SetPlayerLifespanLevel (PlayerBase player, LifespanLevel level)
 
void SynchBeardVisual (PlayerBase player, int state)
 
void UpdateBloodyHandsVisibilityEx (PlayerBase player, eBloodyHandsTypes type)
 
void UpdateBloodyHandsVisibility (PlayerBase player, bool show)
 
void SynchBloodyHandsVisual (PlayerBase player, bool has_bloody_hands)
 
void SetBloodyHandsEx (PlayerBase player, eBloodyHandsTypes type)
 
void SetBloodyHands (PlayerBase player, bool show)
 
void SetHandsMaterial (PlayerBase player, int material_type)
 
bool CanMakeHandsBloody (PlayerBase player)
 
void UpdateBloodTypeVisibility (PlayerBase player, bool show)
 
void UpdateBloodType (PlayerBase player, int blood_type)
 
void SynchShowBloodTypeVisual (PlayerBase player, bool show)
 
void SynchShowBloodType (PlayerBase player, int blood_type)
 
string GetCurrentHeadTexture (PlayerBase player)
 
string GetCurrentHeadMaterial (PlayerBase player)
 

Переменные

enum eBloodyHandsTypes BEARD_NONE = 0
 
enum eBloodyHandsTypes BEARD_MEDIUM = 1
 
enum eBloodyHandsTypes BEARD_LARGE = 2
 
enum eBloodyHandsTypes BEARD_EXTRA = 3
 
enum eBloodyHandsTypes COUNT = 4
 
enum eBloodyHandsTypes LIFESPAN_MIN = 0
 
static const int LIFESPAN_MAX = 240
 
int m_FakePlaytime
 
ref map< PlayerBase, ref LifespanLevelm_PlayerCurrentLevel
 
ref map< string, ref array< ref LifespanLevel > > m_LifespanLevels
 
ref map< string, ref BloodyHandsm_BloodyHands
 
ref map< PlayerBase, intm_BloodType
 

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

◆ eBloodyHandsTypes

Элементы перечислений
CLEAN 
SALMONELA 
JUST_BLOOD 
LAST_INDEX 
9{
10 CLEAN = 0,//clean needs to be 0
13 //--- ONLY LAST_INDEX BELLOW !!!
15}
@ JUST_BLOOD
Definition PluginLifespan.c:12
@ CLEAN
Definition PluginLifespan.c:10
@ LAST_INDEX
Definition PluginLifespan.c:14
@ SALMONELA
Definition PluginLifespan.c:11

Функции

◆ CanMakeHandsBloody()

bool CanMakeHandsBloody ( PlayerBase player)
protected
486 {
487 return !player.FindAttachmentBySlotName( "Gloves" ) );
488 }
Definition EntityAI.c:95

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

◆ ChangeFakePlaytime()

void ChangeFakePlaytime ( PlayerBase player,
int change )
protected
208 {
209 if ( !GetGame().IsMultiplayer() )
210 {
212 UpdateLifespan( player, true );
213 }
214 }
void UpdateLifespan(PlayerBase player, bool force_update=false)
Definition PluginLifespan.c:220
int m_FakePlaytime
Definition PluginLifespan.c:30
proto native CGame GetGame()

Перекрестные ссылки GetGame(), m_FakePlaytime и UpdateLifespan().

◆ GetCurrentHeadMaterial()

string GetCurrentHeadMaterial ( PlayerBase player)
protected
534 {
535 if ( m_PlayerCurrentLevel.Contains(player) )
536 {
538 return current_level.GetMaterialName();
539 }
540 return "";
541 }
ref map< PlayerBase, ref LifespanLevel > m_PlayerCurrentLevel
Definition PluginLifespan.c:32
Definition LifespanLevel.c:2

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

◆ GetCurrentHeadTexture()

string GetCurrentHeadTexture ( PlayerBase player)
protected
524 {
525 if ( m_PlayerCurrentLevel.Contains(player) )
526 {
528 return current_level.GetTextureName();
529 }
530 return "";
531 }

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

◆ GetInstance()

static PluginLifespan GetInstance ( )
staticprotected
41 {
43 }
void PluginLifespan()
Definition PluginLifespan.c:45
PluginBase GetPlugin(typename plugin_type)
Definition PluginManager.c:316

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

◆ GetLifespanLevel()

LifespanLevel GetLifespanLevel ( string player_class,
float age = 0 )
protected
272 {
274
275 if ( lifespan_levels != NULL )
276 {
277 for ( int i = lifespan_levels.Count() - 1; i >= 0; i-- )
278 {
280
281 if ( age >= level.GetThreshold() )
282 {
283 return level;
284 }
285 }
286 }
287
288 return NULL;
289 }
ref map< string, ref array< ref LifespanLevel > > m_LifespanLevels
Definition PluginLifespan.c:33

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

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

◆ LoadFromCfg()

void LoadFromCfg ( )
protected
57 {
60
62
63 //cfg_name = 'CfgVehicles'
64 // config_name = 'CfgVehicles'
65 //cfg_class_count = 2348
66 // config_count = 2348
67 //cfg_class_name = 'SurvivorMale_Base'
68 // survivor_name = 'SurvivorMale_Base'
69 //cfg_class_fullname = 'CfgVehicles SurvivorMale_Base'
70 // survivor_path = 'CfgVehicles SurvivorMale_Base'
71 //cfg_class_member_count = 10
72 // survivor_lifespan_count = 10
73 //cfg_class_member_name = 'Lifespan'
74 // survivor_lifespan_name = 'Lifespan'
75 //cfg_class_member_fullname = 'CfgVehicles SurvivorMale_Base Lifespan';
76 // survivor_lifespan_path = 'CfgVehicles SurvivorMale_Base Lifespan';
77 //cfg_class_member_member_count = 1
78 // survivor_lifespan_beard_count = 1
79 //cfg_class_member_member_name = 'Beard'
80 // survivor_lifespan_beard_name = 'Beard'
81 //cfg_class_member_member_fullname = 'CfgVehicles SurvivorMale_Base Lifespan Beard'
82 // survivor_lifespan_beard_path = 'CfgVehicles SurvivorMale_Base Lifespan Beard'
83 //cfg_class_member_member_variable_name = 'mat'
84 // survivor_lifespan_beard_material_name = 'mat'
85 //cfg_class_member_member_variable_fullname = 'CfgVehicles SurvivorMale_Base Lifespan Beard mat'
86 // survivor_lifespan_beard_material_path = 'CfgVehicles SurvivorMale_Base Lifespan Beard mat'
87
88 string config_name = "CfgVehicles";
89 int config_count = GetGame().ConfigGetChildrenCount( config_name );
90
91 int i, j, k, l, m;
92
93 //Print( "config_count: " + config_count );
94 for ( i = 0; i < config_count; i++ )
95 {
96 string survivor_name = "";
97 GetGame().ConfigGetChildName( config_name, i, survivor_name );
98
99 if ( survivor_name != "" && survivor_name != "access" )
100 {
101 if ( GetGame().IsKindOf(survivor_name, "SurvivorMale_Base") || GetGame().IsKindOf(survivor_name, "SurvivorFemale_Base") )
102 {
103 string survivor_path = config_name + " " + survivor_name;
104 int survivor_lifespan_count = GetGame().ConfigGetChildrenCount( survivor_path );
105
106 //Print( "survivor_path: " + survivor_path );
107 for ( j = 0; j < survivor_lifespan_count; j++ )
108 {
109 string survivor_lifespan_name = "";
110 GetGame().ConfigGetChildName( survivor_path, j, survivor_lifespan_name );
111
113
114 if ( survivor_lifespan_name == "Lifespan" )
115 {
116 int survivor_lifespan_beard_count = GetGame().ConfigGetChildrenCount( survivor_lifespan_path );
117
118 for ( k = 0; k < survivor_lifespan_beard_count; k++ )
119 {
122
124
125 if ( survivor_lifespan_beard_name == "Beard" )
126 {
129
131 {
135
137 {
139
141
142 int level_count = materials.Count() / 2;
143 for ( m = 0; m < level_count; m++ )
144 {
145 int tex = m*2;
146 int mat = ((m*2)+1);
147 if ( mat < materials.Count() )
148 {
149 float threshold = (((float)m / (float)(level_count - 1)) * (float)LIFESPAN_LENGTH) + (float)LIFESPAN_MIN;
151 //Print("material a textura a threshold: " + materials.Get(tex) + " " + materials.Get(mat) + " " + threshold );
152 }
153 }
154
155 if ( lifespan_levels.Count() > 0 )
156 {
158 }
159 }
160 }
161 }
162 }
163 }
164 else if ( survivor_lifespan_name == "BloodyHands" )
165 {
167 string path_normal = survivor_lifespan_path + " mat_normal";
168 string path_bloody = survivor_lifespan_path + " mat_blood";
169 GetGame().ConfigGetText(path_normal, normal_material);
170 GetGame().ConfigGetText(path_bloody, bloody_material);
172 }
173 }
174 }
175 }
176 }
177
178 /*for ( int cl = 0; cl < m_LifespanLevels.Count(); cl++ )
179 {
180 string class_name = m_LifespanLevels.GetKey( cl );
181 array<ref LifespanLevel> levels = m_LifespanLevels.GetElement( cl );
182
183 Print( class_name );
184
185 for ( int ll = 0; ll < levels.Count(); ll++)
186 {
187 Print( "lvl: " + levels.Get( ll ).GetLevel() );
188 Print( "treshold: " + levels.Get( ll ).GetThreshold() );
189 Print( "texture: " + levels.Get( ll ).GetTextureName() );
190 Print( "material: " + levels.Get( ll ).GetMaterialName() );
191 }
192 }*/
193 }
static const int LIFESPAN_MAX
Definition PluginLifespan.c:29
enum eBloodyHandsTypes LIFESPAN_MIN
ref map< string, ref BloodyHands > m_BloodyHands
Definition PluginLifespan.c:34
Definition BloodyHands.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition IsBoxCollidingGeometryProxyClasses.c:28
Definition EnConvert.c:97
array< string > TStringArray
Definition EnScript.c:685

Перекрестные ссылки GetGame(), LIFESPAN_MAX, LIFESPAN_MIN, m_BloodyHands и m_LifespanLevels.

◆ PluginLifespan()

◆ SetBloodyHands()

void SetBloodyHands ( PlayerBase player,
bool show )
protected
450 {
451 player.SetBloodyHands( show );
452
453 if ( show )
454 {
456 }
457 else
458 {
460 }
461 }
void SetHandsMaterial(PlayerBase player, int material_type)
Definition PluginLifespan.c:463
const int MATERIAL_TYPE_BLOODY
Definition BloodyHands.c:6
const int MATERIAL_TYPE_NORMAL
Definition BloodyHands.c:5

Перекрестные ссылки BloodyHands::MATERIAL_TYPE_BLOODY, BloodyHands::MATERIAL_TYPE_NORMAL и SetHandsMaterial().

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

◆ SetBloodyHandsEx()

void SetBloodyHandsEx ( PlayerBase player,
eBloodyHandsTypes type )
protected
435 {
436 player.SetBloodyHandsEx( type );
437
438 if ( type )
439 {
441 }
442 else
443 {
445 }
446
447 }

Перекрестные ссылки BloodyHands::MATERIAL_TYPE_BLOODY, BloodyHands::MATERIAL_TYPE_NORMAL и SetHandsMaterial().

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

◆ SetHandsMaterial()

void SetHandsMaterial ( PlayerBase player,
int material_type )
protected
464 {
465 string player_class = player.GetPlayerClass();
466 int slot_id;
468
469 if ( m_BloodyHands.Contains(player_class))
470 {
472 eai = player.GetInventory().FindPlaceholderForSlot( slot_id );
473
474 if (eai)
475 {
476 eai.SetObjectMaterial( 0, m_BloodyHands.Get(player_class).GetMaterial(material_type) );
477 }
478 }
479 else
480 {
481 //Print("Error! Player class <" + player_class + "> does not contain valid configuration for bloody hands!");
482 }
483 }
Definition Building.c:6
provides access to slot configuration
Definition InventorySlots.c:6
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id

Перекрестные ссылки InventorySlots::GetSlotIdFromString() и m_BloodyHands.

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

◆ SetPlayerLifespanLevel()

void SetPlayerLifespanLevel ( PlayerBase player,
LifespanLevel level )
protected
292 {
293 if (player.m_CorpseState != 0)
294 return;
296 EntityAI players_head = player.GetInventory().FindPlaceholderForSlot( slot_id );
297
298 if ( players_head )
299 {
300 switch (level.GetLevel())
301 {
302 case LifeSpanState.BEARD_NONE:
303 {
304 players_head.SetObjectTexture( 0, "");
305 players_head.SetObjectMaterial( 0, "");
306
307 player.SetFaceTexture( level.GetTextureName() );
308 player.SetFaceMaterial( level.GetMaterialName() );
309
310 player.SetLifeSpanStateVisible(LifeSpanState.BEARD_NONE);
311 //Print("LifeSpanState.BEARD_NONE");
312 break;
313 }
314 case LifeSpanState.BEARD_MEDIUM:
315 {
316 players_head.SetObjectTexture( 0, "");
317 players_head.SetObjectMaterial( 0, "");
318
319 player.SetFaceTexture( level.GetTextureName() );
320 player.SetFaceMaterial( level.GetMaterialName() );
321
322 player.SetLifeSpanStateVisible(LifeSpanState.BEARD_MEDIUM);
323 //Print("LifeSpanState.BEARD_MEDIUM");
324 break;
325 }
326
327 case LifeSpanState.BEARD_LARGE:
328 {
329 players_head.SetObjectTexture( 0, "");
330 players_head.SetObjectMaterial( 0, "");
331
332 player.SetFaceTexture( level.GetTextureName() );
333 player.SetFaceMaterial( level.GetMaterialName() );
334
335 player.SetLifeSpanStateVisible(LifeSpanState.BEARD_LARGE);
336 //Print("LifeSpanState.BEARD_LARGE");
337 break;
338 }
339
340 case LifeSpanState.BEARD_EXTRA:
341 {
342 players_head.SetObjectTexture( 0, level.GetTextureName() );
343 players_head.SetObjectMaterial( 0, level.GetMaterialName() );
344
347
348 player.SetFaceTexture( prev_level.GetTextureName() );
349 player.SetFaceMaterial( prev_level.GetMaterialName() );
350
351 player.SetLifeSpanStateVisible(LifeSpanState.BEARD_EXTRA);
352 //Print("LifeSpanState.BEARD_EXTRA");
353 break;
354 }
355
356 default:
357 {
358 Print("Lifespan state missing");
359 break;
360 }
361 }
362 }
363 }
proto void Print(void var)
Prints content of variable to console/log.

Перекрестные ссылки InventorySlots::GetSlotIdFromString(), m_LifespanLevels и Print().

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

◆ SynchBeardVisual()

void SynchBeardVisual ( PlayerBase player,
int state )
protected
366 {
367 float player_beard;
368
369 switch (state)
370 {
371 case LifeSpanState.BEARD_NONE:
372 {
373 // first out of 4 states
375 break;
376 }
377 case LifeSpanState.BEARD_MEDIUM:
378 {
379 // second out of 4 states
381 break;
382 }
383
384 case LifeSpanState.BEARD_LARGE:
385 {
386 // third out of 4 states
388 break;
389 }
390
391 case LifeSpanState.BEARD_EXTRA:
392 {
393 // fourth out of 4 states
395 break;
396 }
397
398 default:
399 {
400 Print("Lifespan state missing");
401 break;
402 }
403 }
404
406 }
void UpdateLifespanLevel(PlayerBase player, float player_beard, bool force_update=false)
Definition PluginLifespan.c:236

Перекрестные ссылки LIFESPAN_MAX, LIFESPAN_MIN, Print() и UpdateLifespanLevel().

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

◆ SynchBloodyHandsVisual()

void SynchBloodyHandsVisual ( PlayerBase player,
bool has_bloody_hands )
protected
429 {
431 }
void UpdateBloodyHandsVisibility(PlayerBase player, bool show)
Definition PluginLifespan.c:420

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

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

◆ SynchLifespanVisual()

void SynchLifespanVisual ( PlayerBase player,
int beard_state_visible,
bool bloody_hands_visible,
bool blood_type_visible,
int blood_type )
protected
200 {
205 }
void SynchShowBloodTypeVisual(PlayerBase player, bool show)
Definition PluginLifespan.c:509
void SynchBloodyHandsVisual(PlayerBase player, bool has_bloody_hands)
Definition PluginLifespan.c:428
void SynchBeardVisual(PlayerBase player, int state)
Definition PluginLifespan.c:365
void SynchShowBloodType(PlayerBase player, int blood_type)
Definition PluginLifespan.c:514

Перекрестные ссылки SynchBeardVisual(), SynchBloodyHandsVisual(), SynchShowBloodType() и SynchShowBloodTypeVisual().

◆ SynchShowBloodType()

void SynchShowBloodType ( PlayerBase player,
int blood_type )
protected
515 {
517 }
void UpdateBloodType(PlayerBase player, int blood_type)
Definition PluginLifespan.c:504

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

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

◆ SynchShowBloodTypeVisual()

void SynchShowBloodTypeVisual ( PlayerBase player,
bool show )
protected
510 {
512 }
void UpdateBloodTypeVisibility(PlayerBase player, bool show)
Definition PluginLifespan.c:494

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

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

◆ UpdateBloodType()

void UpdateBloodType ( PlayerBase player,
int blood_type )
protected
505 {
506 player.SetBloodType( blood_type );
507 }

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

◆ UpdateBloodTypeVisibility()

void UpdateBloodTypeVisibility ( PlayerBase player,
bool show )
protected
495 {
496 player.SetBloodTypeVisible( show );
497
498 if ( player.m_Hud )
499 {
500 player.m_Hud.UpdateBloodName();
501 }
502 }

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

◆ UpdateBloodyHandsVisibility()

void UpdateBloodyHandsVisibility ( PlayerBase player,
bool show )
protected
421 {
422 if ( CanMakeHandsBloody( player ) )
423 {
424 SetBloodyHands( player, show );
425 }
426 }
void SetBloodyHands(PlayerBase player, bool show)
Definition PluginLifespan.c:449
bool CanMakeHandsBloody(PlayerBase player)
Definition PluginLifespan.c:485

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

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

◆ UpdateBloodyHandsVisibilityEx()

void UpdateBloodyHandsVisibilityEx ( PlayerBase player,
eBloodyHandsTypes type )
protected
413 {
414 if ( CanMakeHandsBloody( player ) )
415 {
416 SetBloodyHandsEx( player, type );
417 }
418 }
void SetBloodyHandsEx(PlayerBase player, eBloodyHandsTypes type)
Definition PluginLifespan.c:434

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

◆ UpdateLifespan()

void UpdateLifespan ( PlayerBase player,
bool force_update = false )
protected
221 {
222 if (player != null)
223 {
225
226 if (GetGame().IsMultiplayer() && GetGame().IsServer())
228
229 float playerBeard = playerPlaytime - player.GetLastShavedSeconds();
230 playerBeard = playerBeard / 60.0;
231
233 }
234 }
Definition AnalyticsManagerServer.c:2
const string STAT_PLAYTIME
Definition AnalyticsManagerServer.c:4

Перекрестные ссылки GetGame(), m_FakePlaytime, AnalyticsManagerServer::STAT_PLAYTIME и UpdateLifespanLevel().

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

◆ UpdateLifespanLevel()

void UpdateLifespanLevel ( PlayerBase player,
float player_beard,
bool force_update = false )
protected
237 {
238 if ( !player.IsAlive() )
239 return;
240
241 if ( m_PlayerCurrentLevel.Contains(player) )
242 {
244
245 if ( player_beard > current_level.GetThreshold() || force_update )
246 {
248
249 if ( next_level != NULL )
250 {
253 }
254 }
255 }
256 else
257 {
258 if ( m_LifespanLevels.Contains( player.GetPlayerClass() ) )
259 {
261
262 if ( level != NULL )
263 {
266 }
267 }
268 }
269 }
void SetPlayerLifespanLevel(PlayerBase player, LifespanLevel level)
Definition PluginLifespan.c:291
LifespanLevel GetLifespanLevel(string player_class, float age=0)
Definition PluginLifespan.c:271

Перекрестные ссылки GetLifespanLevel(), m_LifespanLevels, m_PlayerCurrentLevel и SetPlayerLifespanLevel().

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

Переменные

◆ BEARD_EXTRA

enum eBloodyHandsTypes BEARD_EXTRA = 3

◆ BEARD_LARGE

enum eBloodyHandsTypes BEARD_LARGE = 2

◆ BEARD_MEDIUM

enum eBloodyHandsTypes BEARD_MEDIUM = 1

◆ BEARD_NONE

enum eBloodyHandsTypes BEARD_NONE = 0

◆ COUNT

◆ LIFESPAN_MAX

const int LIFESPAN_MAX = 240
staticprotected

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

◆ LIFESPAN_MIN

enum eBloodyHandsTypes LIFESPAN_MIN = 0

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

◆ m_BloodType

◆ m_BloodyHands

ref map<string, ref BloodyHands> m_BloodyHands
protected

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

◆ m_FakePlaytime

int m_FakePlaytime
protected

Используется в ChangeFakePlaytime(), PluginLifespan() и UpdateLifespan().

◆ m_LifespanLevels

ref map<string, ref array< ref LifespanLevel> > m_LifespanLevels
protected

◆ m_PlayerCurrentLevel