Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BasePrefabSpawner.c
Go to the documentation of this file.
2{
3 [Attribute("", UIWidgets.ResourcePickerThumbnail, desc: "Prefab to be spawned", params: "et")]
5
7 {
9 Activate();
10 }
11
12 protected override void EOnInit(IEntity owner)
13 {
14 }
15
16 protected override void EOnFrame(IEntity owner, float timeSlice)
17 {
18 if (!Replication.IsServer())
19 return;
20
21 if (CanSpawn())
22 Spawn();
23 }
24
25 protected bool CanSpawn()
26 {
27 return false;
28 }
29
30 protected bool Spawn()
31 {
32 BaseWorld myWorld = GetGame().GetWorld();
33 if (!myWorld || m_rnPrefab.IsEmpty())
34 return false;
35
36 Resource res = Resource.Load(m_rnPrefab);
38
39 vector mat[4];
41 params.Transform = mat;
42 IEntity newEnt = GetGame().SpawnEntityPrefab(res, myWorld, params);
43 if (!newEnt)
44 return false;
45
46 newEnt.SetFlags(EntityFlags.VISIBLE, true);
47
48 OnSpawn(newEnt);
49
50 return true;
51 }
52
53 protected void OnSpawn(IEntity newEnt)
54 {
55 }
56};
57
58class SCR_BasePrefabSpawnerClass : GenericEntityClass
59{
60};
ArmaReforgerScripted GetGame()
Definition game.c:1398
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external void Activate()
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external EntityEvent SetEventMask(EntityEvent e)
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
Main replication API.
Definition Replication.c:14
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
void OnSpawn(IEntity newEnt)
override void EOnInit(IEntity owner)
override void EOnFrame(IEntity owner, float timeSlice)
void SCR_BasePrefabSpawner(IEntitySource src, IEntity parent)
void EntitySpawnParams()
Definition gameLib.c:130
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.
Definition EntityEvent.c:14
EntityFlags
Various entity flags.
Definition EntityFlags.c:14