Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_IdentityManagerComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/GameMode/Components", description: "Character Identity Manager")]
5
7{
9
10 [Attribute("#AR-CharacterIdentity_DateFormating", desc: "Date formatting %1 = day %2 = month %3 = year %4 = age", uiwidget: UIWidgets.LocaleEditBox, category: "Settings")]
12
13 [Attribute("#AR-Date_Format_MonthFull", desc: "Date formatting %1 = day %2 = month %3 = year", uiwidget: UIWidgets.LocaleEditBox, category: "Settings")]
15
16 [Attribute("{6075C04F05460FB4}Configs/Identities/BloodTypes.conf", desc: "Holds an array of all possible bloodtypes with randomization weight. Keep combined randomization weight at 100 for ease of use", params: "conf class=SCR_BloodTypeHolderConfig", category: "Data")]
18
19 [Attribute(desc: "Holds Identity groups for each type. Create one entry for each type. ONLY ONE HOLDER PER INDENTIY TYPE!", params: "conf class=SCR_IdentityBioTypeHolderConfig", category: "Data")]
20 protected ref array<ResourceName> m_aIdentityBioTypeHoldersConfigs;
21
22 [Attribute((SCR_EIdentityItemGenerationType.ON_POSSESSION + SCR_EIdentityItemGenerationType.ON_DEATH + SCR_EIdentityItemGenerationType.ON_UNCONSCIOUS).ToString(), desc: "Wether or not the Identity Item is spawned for players and for AI and when it happens. Note that the identity item will only be added once to a character this includes if it is added from an arsenal. Possessing also happens when GM takes control of an character.", uiwidget: UIWidgets.Flags, enums: ParamEnumArray.FromEnum(SCR_EIdentityItemGenerationType), category: "Settings")]
24
25 [Attribute("1", desc: "If true the identity item will be added to a special slot. (m_eIdentityItemGenerationType on Possession flags needs to be set to enable the slot). The identity item cannot be removed unless the player dies.", category: "Settings")]
27
28 [Attribute("0", desc: "If true valuable intel will be generated on identity documentation which can be exchanged at arsenals (Will only generate the intel when taken it from arsenal if m_bAddIdentityItemToInventories is false)", category: "Settings")]
30
31 [Attribute("1", desc: "If true will show player name instead of Bio name on the identity item of players", category: "Settings")]
33
34 [Attribute(desc: "Hints for the extended identity system", category: "Data")]
36
37 //~ Dev only \/
38 [Attribute("-1", desc: "Workbench only. Seed overwrite forces all generated Identities to use the same given seed for debugging purposes. Set to any value greater than -1 to enable overwrite", category: "Debug")]
40 [Attribute("-1", desc: "Workbench only. Forced all assigned bio's to use this value as bio group index for debugging purposes. Set to any value that is greater than -1 to enable overwrite", category: "Debug")]
42 [Attribute("-1", desc: "Workbench only. Forced all assigned bio's to use this value as bio index for debugging purposes. Set to any value that is greater than -1 to enable overwrite", category: "Debug")]
44 //~ Dev only /\
45
46 protected const string HAND_IN_VALUABLE_INTEL_SOUNDEVENT = "SOUND_DEPOSITINTEL";
47
48 protected ref array<ref SCR_IdentityBioTypeHolderConfig> m_aIdentityBioTypeHolders = {};
49
51
52 //~ Ref
55
56 //~ Together the bio groups indexes and Bio indexes will be one int. This makes sure it will never be greater then int.MAX (Which is extreamly unlikly it ever happens)
57 static const int MAX_IDENTITY_GROUPS = 9999; //~ Used to combine bio group indexes and bio indexes. (Bio group * (MAX_BIO_GROUPS +1)
58 static const int MAX_IDENTITY_ENTRIES = 99999; //~ Used to combine bio group indexes and bio indexes.
59
60 //======================================== INSTANCE ========================================\\
61 //------------------------------------------------------------------------------------------------
66
67 //======================================== BIO ========================================\\
68 //------------------------------------------------------------------------------------------------
70 {
72 {
73 if (bioTypeHolder && bioTypeHolder.m_eIdentityType == identityType)
74 return bioTypeHolder;
75 }
76
77 return null;
78 }
79
80 //------------------------------------------------------------------------------------------------
85 int GetBioGroupIndexFromID(SCR_EIdentityType identityType, string bioGroupID)
86 {
87 if (bioGroupID.IsEmpty())
88 return -1;
89
90 SCR_IdentityBioTypeHolderConfig foundBioTypeHolder = GetIdentityBioHolder(identityType);
91
92 if (!foundBioTypeHolder || foundBioTypeHolder.m_aIdentityBioGroups.IsEmpty())
93 return -1;
94
95 foreach (int i, SCR_IdentityBioGroupConfig config : foundBioTypeHolder.m_aIdentityBioGroups)
96 {
97 if (config.GetBioGroupID() == bioGroupID)
98 return i;
99 }
100
101 PrintFormat("'SCR_CharacterIdentityManagerComponent' bio group '%1' could not be found in 'm_aIdentityBioGroups' for type '%2'", bioGroupID, typename.EnumToString(SCR_EIdentityType, identityType), level: LogLevel.WARNING);
102 return -1;
103 }
104
105 //------------------------------------------------------------------------------------------------
112 SCR_IdentityBio GetBioFromIndexes(IEntity entity, SCR_EIdentityType identityType, int bioGroupIndex, int bioIndex)
113 {
114 if (bioGroupIndex < 0)
115 return null;
116
117 SCR_IdentityBioTypeHolderConfig foundBioTypeHolder = GetIdentityBioHolder(identityType);
118 if (!foundBioTypeHolder)
119 return null;
120
121 if (bioGroupIndex >= foundBioTypeHolder.m_aIdentityBioGroups.Count())
122 return null;
123
124 return foundBioTypeHolder.m_aIdentityBioGroups[bioGroupIndex].GetIdentityBio(entity, bioIndex);
125
126 }
127
128 //------------------------------------------------------------------------------------------------
133 int CombineBioIndexes(int bioGroupIndex, int bioIndex)
134 {
135 return (bioGroupIndex * (MAX_IDENTITY_GROUPS + 1)) + bioIndex;
136 }
137
138 //------------------------------------------------------------------------------------------------
143 void GetBioIndexesFromCombined(int combinedIndexes, out int bioGroupIndex, out int bioIndex)
144 {
145 bioGroupIndex = combinedIndexes / (MAX_IDENTITY_GROUPS + 1);
146 bioIndex = combinedIndexes - (bioGroupIndex * (MAX_IDENTITY_GROUPS + 1));
147 }
148
149 //------------------------------------------------------------------------------------------------
155 int GetValidBioGroups(IEntity entity, SCR_EIdentityType identityType, int factionIndex, notnull array<ref SCR_IdentityBioGroupConfig> validBioGroups) //~ Todo: Add gender check here!
156 {
157 validBioGroups.Clear();
158
159 SCR_IdentityBioTypeHolderConfig foundBioTypeHolder = GetIdentityBioHolder(identityType);
160 if (!foundBioTypeHolder)
161 return 0;
162
163 //~ Get extended Identity
165 SCR_ExtendedCharacterIdentityComponent extendedCharIdentity = SCR_ExtendedCharacterIdentityComponent.Cast(extendedIdentity);
166
167 //~ If character is a player first check if there are any identities unique for the player UID
168 if (extendedCharIdentity && extendedCharIdentity.GetPlayerID() > 0)
169 {
170 //~ Check if the player ID is in any of the unique identity groups for that uniques player UID
171 foreach (SCR_IdentityBioGroupConfig bioGroup: foundBioTypeHolder.m_aIdentityBioGroups)
172 {
173 if (!SCR_UniquePlayerIdentityBioGroupConfig.Cast(bioGroup))
174 continue;
175
176 if (!bioGroup.IsEnabled() || !bioGroup.IsValidForRandomization(entity, extendedIdentity) || !bioGroup.IsValidFaction(factionIndex))
177 continue;
178
179 //~ Add to valid group
180 validBioGroups.Insert(bioGroup);
181 }
182
183 //~ Unique IDs were valid
184 if (!validBioGroups.IsEmpty())
185 return validBioGroups.Count();
186 }
187
188 //~ Get any valid identity
189 foreach (SCR_IdentityBioGroupConfig bioGroup: foundBioTypeHolder.m_aIdentityBioGroups)
190 {
191 if (!bioGroup.IsEnabled() || !bioGroup.IsValidForRandomization(entity, extendedIdentity) || !bioGroup.IsValidFaction(factionIndex))
192 continue;
193
194 //~ Add to valid group
195 validBioGroups.Insert(bioGroup);
196 }
197
198 return validBioGroups.Count();
199 }
200
201 //------------------------------------------------------------------------------------------------
211 SCR_IdentityBio AssignRandomAvailableBio(RandomGenerator randomizer, IEntity entity, SCR_EIdentityType identityType, int factionIndex, out int bioGroupIndex, out int bioIndex, bool useRandomWeighted = true) //Also add gender check
212 {
213 if (!randomizer)
214 return null;
215
216 array<ref SCR_IdentityBioGroupConfig> validBioGroups = {};
217 int count = GetValidBioGroups(entity, identityType, factionIndex, validBioGroups);
218
219 if (validBioGroups.IsEmpty())
220 return null;
221
222 int randomValidBioIndex = -1;
223
224 //~ Get weighted randomized
225 if (useRandomWeighted)
226 {
227 int totalWeight = 0;
228
229 //~ Get all weights
230 foreach (SCR_IdentityBioGroupConfig bioGroup: validBioGroups)
231 {
232 totalWeight+= bioGroup.GetWeight();
233 }
234
235 //~ Randomize with total weights
236 int randomWeight = randomizer.RandIntInclusive(0, totalWeight);
237 int checkedWeight = 0;
238
239 //~ Find entry within random Weights
240 for(int i = 0; i < count; i++)
241 {
242 //~ Last in list no need calculate
243 if (i == count -1)
244 {
245 randomValidBioIndex = i;
246 break;
247 }
248
249 checkedWeight += validBioGroups[i].GetWeight();
250 if (randomWeight <= checkedWeight)
251 {
252 randomValidBioIndex = i;
253 break;
254 }
255 }
256 }
257 //~ Get random
258 else
259 {
260 randomValidBioIndex = randomizer.RandInt(0, count);
261 }
262
263 bioGroupIndex = GetBioGroupIndexFromID(identityType, validBioGroups[randomValidBioIndex].GetBioGroupID());
264
265 SCR_IdentityBioTypeHolderConfig foundBioTypeHolder = GetIdentityBioHolder(identityType);
266 if (!foundBioTypeHolder)
267 return null;
268
269 SCR_IdentityBio bio;
270 foundBioTypeHolder.m_aIdentityBioGroups[bioGroupIndex].AssignRandomAvailableBio(randomizer, entity, bioIndex, bio);
271
272 return bio;
273 }
274
275 //------------------------------------------------------------------------------------------------
283 SCR_IdentityBio AssignBioManually(IEntity entity, SCR_EIdentityType identityType, int bioGroupIndex, int bioIndex)
284 {
285 SCR_IdentityBioTypeHolderConfig foundBioTypeHolder = GetIdentityBioHolder(identityType);
286 if (!foundBioTypeHolder)
287 return null;
288
289 if (bioGroupIndex < 0 || bioGroupIndex >= foundBioTypeHolder.m_aIdentityBioGroups.Count())
290 return null;
291
292 return foundBioTypeHolder.m_aIdentityBioGroups[bioGroupIndex].OnCharacterBioAssigned(entity, bioIndex);
293 }
294
295 //======================================== BIRTH DATE ========================================\\
296 //------------------------------------------------------------------------------------------------
305 bool GetCreationdayString(SCR_ExtendedIdentityComponent identityComponent, out string format, out string day, out string month, out string year, out string age)
306 {
307 if (!m_TimeAndWeatherManager || !identityComponent)
308 return false;
309
310 SCR_ExtendedIdentity extendedIdentity = identityComponent.GetExtendedIdentity();
311 if (!extendedIdentity)
312 return false;
313
314 format = m_sBirthDateFormat;
315 day = extendedIdentity.GetDayOfCreation().ToString();
316 month = SCR_DateTimeHelper.GetAbbreviatedMonthString(extendedIdentity.GetMonthOfCreation());
317 year = GetYearOfCreation(identityComponent).ToString();
318 age = extendedIdentity.GetAge().ToString();
319
320 return !(day.IsEmpty() && month.IsEmpty() && year.IsEmpty() && age.IsEmpty());
321 }
322
323 //------------------------------------------------------------------------------------------------
328 {
329 if (!m_TimeAndWeatherManager || !identityComponent)
330 return false;
331
332 SCR_ExtendedIdentity extendedIdentity = identityComponent.GetExtendedIdentity();
333 if (!extendedIdentity)
334 return -1;
335
336 return m_TimeAndWeatherManager.GetDay() == extendedIdentity.GetDayOfCreation() && m_TimeAndWeatherManager.GetMonth() == extendedIdentity.GetMonthOfCreation();
337 }
338
339 //------------------------------------------------------------------------------------------------
344 {
345 if (!m_TimeAndWeatherManager || !identityComponent)
346 return -1;
347
348 SCR_ExtendedIdentity extendedIdentity = identityComponent.GetExtendedIdentity();
349 if (!extendedIdentity)
350 return -1;
351
352 return m_TimeAndWeatherManager.GetYear() - extendedIdentity.GetAge();
353 }
354
355 //======================================== DEATH DATE ========================================\\
356 //------------------------------------------------------------------------------------------------
357 override void OnControllableDestroyed(notnull SCR_InstigatorContextData instigatorContextData)
358 {
359 //~ Server only and only for characters
360 if (!GetGameMode().IsMaster() || instigatorContextData.HasAnyVictimKillerRelation(SCR_ECharacterDeathStatusRelations.NOT_A_CHARACTER))
361 return;
362
363 //~ Spawn Identity Item for AI
365 SpawnIdentityItemInInventory_S(ChimeraCharacter.Cast(instigatorContextData.GetVictimEntity()));
366
367 SCR_ExtendedCharacterIdentityComponent extendedIdentity = SCR_ExtendedCharacterIdentityComponent.Cast(instigatorContextData.GetVictimEntity().FindComponent(SCR_ExtendedCharacterIdentityComponent));
368 if (!extendedIdentity)
369 return;
370
371 extendedIdentity.OnCharacterDeath();
372 }
373
374 //------------------------------------------------------------------------------------------------
383 bool GetDeathDateAndTimeString(SCR_ExtendedCharacterIdentityComponent identityComponent, out string formatDate, out string dayString, out string monthString, out string yearString, out string time)
384 {
385 if (!identityComponent)
386 return false;
387
388 SCR_ExtendedCharacterIdentity charExtendedIdentity = SCR_ExtendedCharacterIdentity.Cast(identityComponent.GetExtendedIdentity());
389 if (!charExtendedIdentity)
390 return false;
391
392 int day, month, year, hour, minute;
393
394 //~ Character death date not set
395 if (!charExtendedIdentity.GetDeathDateAndTime(day, month, year, hour, minute))
396 return false;
397
398 formatDate = m_sDateDeathFormat;
399
400 dayString = day.ToString();
401 monthString = SCR_DateTimeHelper.GetAbbreviatedMonthString(month);
402 yearString = year.ToString();
403
405 return true;
406 }
407
408 //======================================== BLOOD TYPE ========================================\\
409 //------------------------------------------------------------------------------------------------
414 int GetRandomBloodTypeIndex(RandomGenerator randomizer = null, bool useWeightedRandom = true)
415 {
417 return -1;
418
419 array<SCR_CharacterIdentityBloodType> bloodTypes = {};
420 int count = m_BloodTypeHolder.GetBloodTypes(bloodTypes);
421
422 if (!useWeightedRandom)
423 {
424 if (count == 0)
425 return -1;
426
427 if (randomizer)
428 {
429 return randomizer.RandInt(0, count);
430 }
431 else
432 {
433 return Math.RandomInt(0, count);
434 }
435 }
436
437 int totalWeight = 0;
438
439 //~ Get all weights
440 foreach (SCR_CharacterIdentityBloodType bloodtype: bloodTypes)
441 {
442 totalWeight += bloodtype.GetWeight();
443 }
444
445 //~ Randomize with total weights
446 int randomWeight;
447
448 if (randomizer)
449 randomWeight = randomizer.RandIntInclusive(0, totalWeight);
450 else
451 randomWeight = Math.RandomIntInclusive(0, totalWeight);
452
453 int checkedWeight = 0;
454
455 //~ Find entry within random Weights
456 foreach (int i, SCR_CharacterIdentityBloodType bloodtype : bloodTypes)
457 {
458 //~ Last in list no need calculate
459 if (i == count -1)
460 return i;
461
462 checkedWeight += bloodtype.GetWeight();
463 if (randomWeight <= checkedWeight)
464 return i;
465 }
466
467 return -1;
468 }
469
470 //------------------------------------------------------------------------------------------------
475 {
477 return null;
478
479 return m_BloodTypeHolder.GetBloodTypeUIInfo(bloodType);
480 }
481
482 //======================================== PLAYER SPAWN ========================================\\
483 //------------------------------------------------------------------------------------------------
484 //~ Sets the character Identity to player as the entity itself does not know yet if the character is a player or not
485 override bool PreparePlayerEntity_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
486 {
488 if (extendedIdentity)
489 extendedIdentity.SetPlayerID(requestComponent.GetPlayerId());
490
491 return super.PreparePlayerEntity_S(requestComponent, handlerComponent, data, entity);
492 }
493
494 //======================================== ON UNCONSCIOUS ========================================\\
495 //------------------------------------------------------------------------------------------------
496 //~ Called when a character with an SCR_ExtendedCharacterIdentityComponent falls unconscious
502
503 //======================================== IDENTITY ITEM ========================================\\
504 //------------------------------------------------------------------------------------------------
505 protected void SpawnIdentityItemInInventory_S(ChimeraCharacter character, bool checkIfHadSpawnedIdentityItem = true)
506 {
507 if (!character)
508 return;
509
510 //~ Did the character already had a identity item?
511 if (checkIfHadSpawnedIdentityItem)
512 {
514 if (extendedIdentity && extendedIdentity.WasIdentityItemAddedOnce_S())
515 return;
516 }
517
518 //~ Get inventory manager
520 if (!inventoryManager)
521 return;
522
523 //~ Get catalog
524 SCR_EntityCatalogManagerComponent catalogManager = SCR_EntityCatalogManagerComponent.GetInstance();
525 if (!catalogManager)
526 return;
527
528 //~ Get Identity item
529 ResourceName identityItemPrefab = catalogManager.GetIdentityItemForCharacter(character);
530 if (identityItemPrefab.IsEmpty())
531 return;
532
533 //~ Get the identity item be added to the inventory
534 if (!inventoryManager.CanInsertResource(identityItemPrefab))
535 return;
536
537 //~ Spawn the identity item
539 character.GetTransform(params.Transform);
540
541 IEntity identityItem = GetGame().SpawnEntityPrefab(Resource.Load(identityItemPrefab), null, params);
542 if (!identityItem)
543 return;
544
545 //~ Try adding the item to jacket if the slot is not enabled
547 {
549 if (characterStorage)
550 {
551 IEntity jacket = characterStorage.GetClothFromArea(LoadoutJacketArea);
552 if (jacket && inventoryManager.TryInsertItemInStorage(identityItem, BaseInventoryStorageComponent.Cast(jacket.FindComponent(BaseInventoryStorageComponent))))
553 return;
554 }
555 }
556
557 //~ Insert the identity item anywhere in the character's inventory
558 if (!inventoryManager.TryInsertItem(identityItem))
559 delete identityItem;
560 }
561
562 //------------------------------------------------------------------------------------------------
569
570 //------------------------------------------------------------------------------------------------
576
577 //------------------------------------------------------------------------------------------------
583
584 //------------------------------------------------------------------------------------------------
590
591 //------------------------------------------------------------------------------------------------
594 {
596
597 return identityManager && identityManager.IsGenerateValuableIntelEnabled();
598 }
599
600 //------------------------------------------------------------------------------------------------
601 //~ When entity becomes possessed it will add an identity item
602 protected void OnCharacterPossessed(IEntity entity)
603 {
605 return;
606
608 }
609
610 //------------------------------------------------------------------------------------------------
611 override void OnPlayerConnected(int playerId)
612 {
613 if (!GetGameMode().IsMaster())
614 return;
615
616 SCR_PlayerController playerController = SCR_PlayerController.Cast(GetGame().GetPlayerManager().GetPlayerController(playerId));
617 if (!playerController)
618 return;
619
620 playerController.m_OnPossessed.Insert(OnCharacterPossessed);
621 }
622
623 //------------------------------------------------------------------------------------------------
624 override void OnPlayerDisconnected(int playerId, KickCauseCode cause, int timeout)
625 {
626 if (!GetGameMode().IsMaster())
627 return;
628
629 SCR_PlayerController playerController = SCR_PlayerController.Cast(GetGame().GetPlayerManager().GetPlayerController(playerId));
630 if (!playerController)
631 return;
632
633 playerController.m_OnPossessed.Remove(OnCharacterPossessed);
634 }
635
636 //------------------------------------------------------------------------------------------------
639 void OnValuableIntelHandIn_S(notnull PlayerController playerController)
640 {
641 //~ No audio to play
643 return;
644
645 int playerID = playerController.GetPlayerId();
646
648 Rpc(OnValuableIntelHandIn_RPL, playerID);
649 }
650
651 //------------------------------------------------------------------------------------------------
652 [RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
653 protected void OnValuableIntelHandIn_RPL(int playerID)
654 {
655 if (playerID != SCR_PlayerController.GetLocalPlayerId())
656 return;
657
659 }
660
661 //======================================== HINTS ========================================\\
662 //------------------------------------------------------------------------------------------------
664 void ShowHint(EHint hintType)
665 {
668 return;
669
671 SCR_HintManagerComponent hintManager = SCR_HintManagerComponent.GetInstance();
672 if (!hintManager)
673 return;
674
675 SCR_HintUIInfo hint = m_ExtendedIdentityHints.GetHintByType(hintType);
676 if (!hint)
677 return;
678
680 hintManager.Show(hint);
681 }
682
683 //======================================== INIT/DESTROY ========================================\\
684 //------------------------------------------------------------------------------------------------
685 override void EOnInit(IEntity owner)
686 {
687 ChimeraWorld world = ChimeraWorld.CastFrom(GetGameMode().GetWorld());
688 if (world)
689 m_TimeAndWeatherManager = world.GetTimeAndWeatherManager();
690
692 Print("'SCR_CharacterIdentityManagerComponent' could not find 'TimeAndWeatherManagerEntity' which it needs to function!", LogLevel.ERROR);
693
694 m_FactionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
695 if (!m_FactionManager)
696 {
697 Print("'SCR_CharacterIdentityManagerComponent' could not find 'SCR_FactionManager' which it needs to function!", LogLevel.ERROR);
698 return;
699 }
700 }
701
702 //------------------------------------------------------------------------------------------------
703 override void OnPostInit(IEntity owner)
704 {
706 return;
707
708 if (m_sInstance)
709 {
710 Print("Multiple instances of SCR_IdentityManagerComponent detected! Only one is allowed!", LogLevel.WARNING);
711 return;
712 }
713
714 m_sInstance = this;
715
716 SetEventMask(owner, EntityEvent.INIT);
717
719
720 //~ Load the configs
722
724 {
725 loadedConfig = SCR_IdentityBioTypeHolderConfig.Cast(SCR_BaseContainerTools.CreateInstanceFromPrefab(config, true));
726 if (!loadedConfig)
727 {
728 Print("'SCR_IdentityManagerComponent' failed to load one of the Identity Configs!", LogLevel.ERROR);
729 continue;
730 }
731
732 m_aIdentityBioTypeHolders.Insert(loadedConfig);
733 }
734
735 //~ Safty checks
737 {
739 {
740 if ( holder.m_eIdentityType == SCR_EIdentityType.NONE)
741 {
742 Print(string.Format("'SCR_IdentityManagerComponent' Bio group holder has '%1' entity type! This should not happen!", typename.EnumToString(SCR_EIdentityType, holder.m_eIdentityType)), LogLevel.ERROR);
743 continue;
744 }
745
746 if (holderCheck != holder && holderCheck.m_eIdentityType == holder.m_eIdentityType)
747 {
748 Print(string.Format("'SCR_IdentityManagerComponent' one or more bio group holder of the same Identity type: '%1' in array. Each Identity Type can only have one holder!", typename.EnumToString(SCR_EIdentityType, holder.m_eIdentityType)), LogLevel.ERROR);
749 break;
750 }
751 }
752
753 foreach(SCR_IdentityBioGroupConfig identityBioGroup: holder.m_aIdentityBioGroups)
754 {
755 foreach(SCR_IdentityBioGroupConfig identityBioGroupCheck: holder.m_aIdentityBioGroups)
756 {
757 if (identityBioGroup.GetBioGroupID() == string.Empty)
758 {
759 Print(string.Format("'SCR_IdentityManagerComponent' Identity group in type '%1' has empty ID string!", typename.EnumToString(SCR_EIdentityType, holder.m_eIdentityType)), LogLevel.WARNING);
760 continue;
761 }
762
763 if (identityBioGroupCheck != identityBioGroup && identityBioGroup.GetBioGroupID() == identityBioGroupCheck.GetBioGroupID())
764 {
765 Print(string.Format("'SCR_IdentityManagerComponent' Identity group in type '%1' has duplicate or empty ID: '%2' in array. Each Identity group needs to have an unique ID!", typename.EnumToString(SCR_EIdentityType, holder.m_eIdentityType), identityBioGroupCheck.GetBioGroupID()), LogLevel.ERROR);
766 break;
767 }
768 }
769 }
770 }
771
772 super.OnPostInit(owner);
773 }
774};
775
EHint
Definition EHint.c:11
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseGameMode GetGameMode()
void SCR_BaseGameModeComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
EDamageType type
SCR_EBloodType
SCR_EIdentityType
Get all prefabs that have the spawner data
void SCR_FactionManager(IEntitySource src, IEntity parent)
SCR_EIdentityItemGenerationType
When will the identity item be generated on the character.
@ ON_DEATH
When an character dies an identity item will be added to his/her inventory. If no Identity item was e...
@ ON_UNCONSCIOUS
When an character falls unconscious an identity item will be added to his/her inventory....
@ ON_POSSESSION
When an character is possessed by a player (On player spawned or GM possessing) and it has never had ...
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
Definition Math.c:13
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
void OnCharacterDeath()
Called by SCR_CharacterIdentityManagerComponent when character dies (Server Only).
void SetPlayerID(int playerId)
Set this character player ID. Handled in the preparing of this character by the SCR_IdentityManagerCo...
bool GetDeathDateAndTime(out int deathDay, out int deathMonth, out int deathYear, out int deathHour, out int deathMinute)
static string GetTimeFormattingHoursMinutes(int hours, int minutes, ETimeFormatParam hideEmpty=0, ETimeFormatParam hideLeadingZeroes=0)
static bool IsEditMode()
Definition Functions.c:1566
bool IsValidForRandomization(IEntity entity, SCR_ExtendedIdentityComponent extendedIdentity)
bool IsValidFaction(string factionKey)
bool IsCreationDay(SCR_ExtendedIdentityComponent identityComponent)
bool GetCreationdayString(SCR_ExtendedIdentityComponent identityComponent, out string format, out string day, out string month, out string year, out string age)
void OnCharacterBecomeUnconscious(IEntity character)
SCR_UIInfo GetBloodTypeUIInfo(SCR_EBloodType bloodType)
static SCR_IdentityManagerComponent GetInstance()
override void OnPostInit(IEntity owner)
SCR_IdentityBio GetBioFromIndexes(IEntity entity, SCR_EIdentityType identityType, int bioGroupIndex, int bioIndex)
int GetValidBioGroups(IEntity entity, SCR_EIdentityType identityType, int factionIndex, notnull array< ref SCR_IdentityBioGroupConfig > validBioGroups)
ref SCR_GeneralHintStorage m_ExtendedIdentityHints
ref array< ref SCR_IdentityBioTypeHolderConfig > m_aIdentityBioTypeHolders
static SCR_IdentityManagerComponent m_sInstance
override void OnPlayerDisconnected(int playerId, KickCauseCode cause, int timeout)
int GetBioGroupIndexFromID(SCR_EIdentityType identityType, string bioGroupID)
void ShowHint(EHint hintType)
Show Extended Identity specific hints.
override void OnPlayerConnected(int playerId)
void OnValuableIntelHandIn_S(notnull PlayerController playerController)
SCR_IdentityBio AssignRandomAvailableBio(RandomGenerator randomizer, IEntity entity, SCR_EIdentityType identityType, int factionIndex, out int bioGroupIndex, out int bioIndex, bool useRandomWeighted=true)
ref array< ResourceName > m_aIdentityBioTypeHoldersConfigs
override void OnControllableDestroyed(notnull SCR_InstigatorContextData instigatorContextData)
override bool PreparePlayerEntity_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
SCR_EIdentityItemGenerationType m_eIdentityItemGenerationType
int GetRandomBloodTypeIndex(RandomGenerator randomizer=null, bool useWeightedRandom=true)
ref SCR_BloodTypeHolderConfig m_BloodTypeHolder
int CombineBioIndexes(int bioGroupIndex, int bioIndex)
void SpawnIdentityItemInInventory_S(ChimeraCharacter character, bool checkIfHadSpawnedIdentityItem=true)
int GetYearOfCreation(SCR_ExtendedIdentityComponent identityComponent)
void GetBioIndexesFromCombined(int combinedIndexes, out int bioGroupIndex, out int bioIndex)
SCR_IdentityBio AssignBioManually(IEntity entity, SCR_EIdentityType identityType, int bioGroupIndex, int bioIndex)
SCR_IdentityBioTypeHolderConfig GetIdentityBioHolder(SCR_EIdentityType identityType)
TimeAndWeatherManagerEntity m_TimeAndWeatherManager
bool HasIdentityItemGenerationType(SCR_EIdentityItemGenerationType type)
bool GetDeathDateAndTimeString(SCR_ExtendedCharacterIdentityComponent identityComponent, out string formatDate, out string dayString, out string monthString, out string yearString, out string time)
ref OnPossessedInvoker m_OnPossessed
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
void EntitySpawnParams()
Definition gameLib.c:130
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
proto void PrintFormat(string fmt, 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, LogLevel level=LogLevel.NORMAL)
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14
proto external PlayerController GetPlayerController()
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
Definition EnNetwork.c:95
RplRcver
Definition RplRcver.c:59
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
Definition RplChannel.c:14