Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AdditionalDeployablePart.c
Go to the documentation of this file.
2{
3 [Attribute(uiwidget: UIWidgets.ResourcePickerThumbnail, desc: "Prefab which is going to be required in order to deploy the main entity", params: "et")]
5
6 [Attribute(defvalue: "1", desc: "How many instances of this prefab should be spawned", params: "1 inf")]
7 protected int m_iNumberOfPrefabs;
8
9 //------------------------------------------------------------------------------------------------
12 {
13 return m_sPrefab;
14 }
15
16 //------------------------------------------------------------------------------------------------
21 bool SpawnPrefabs(int authorPlayerId, IEntity user, notnull EntitySpawnParams params)
22 {
23 Resource resource = Resource.Load(m_sPrefab);
24 if (!resource.IsValid())
25 {
26 Print("[SCR_AdditionalDeployablePart.SpawnPrefabs] => Failed to load the resource from m_sPrefab = " + m_sPrefab, LogLevel.ERROR);
27 return false;
28 }
29
30 vector spawnedMat[4];
31 IEntity spawnedEntity;
32 InventoryItemComponent spawnedIIC;
33 int numberOfSuccesfullySpawnedEnts;
34 for(int i; i < m_iNumberOfPrefabs; i++)
35 {
36 spawnedEntity = GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), params);
37 if (!spawnedEntity)
38 continue;
39
40 numberOfSuccesfullySpawnedEnts++;
41 PostPrefabSpawn(spawnedEntity);
42 SCR_MultiPartDeployableItemComponent.SetAuthor(spawnedEntity, authorPlayerId);
43
44 spawnedIIC = InventoryItemComponent.Cast(spawnedEntity.FindComponent(InventoryItemComponent));
45 if (spawnedIIC)
46 spawnedIIC.PlaceOnGround(user);
47 }
48
49 return numberOfSuccesfullySpawnedEnts == m_iNumberOfPrefabs;
50 }
51
52 //------------------------------------------------------------------------------------------------
55 void PostPrefabSpawn(notnull IEntity spawnedEntity);
56}
ArmaReforgerScripted GetGame()
Definition game.c:1398
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
void PostPrefabSpawn(notnull IEntity spawnedEntity)
bool SpawnPrefabs(int authorPlayerId, IEntity user, notnull EntitySpawnParams params)
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
SCR_FieldOfViewSettings Attribute