Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
ScriptModel.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameLib/Scripted", description: "Script model", dynamicBox: true)]
2class ScriptModelClass: GenericEntityClass
3{
4
5};
6
7class ScriptModel: GenericEntity
8{
9 [Attribute("", UIWidgets.ResourceNamePicker, "Model", "xob")]
10 ResourceName Model;
11 [Attribute("1", UIWidgets.ComboBox, "Physics", "", { ParamEnum("None", "2"), ParamEnum("Static", "1"), ParamEnum("Dynamic", "0") } )]
12 int Type;
13
14 void ScriptModel(IEntitySource src, IEntity parent)
15 {
16 if (Model== "")
17 return;
18
19 SetFlags(EntityFlags.ACTIVE | EntityFlags.TRACEABLE | EntityFlags.VISIBLE, false);
20
21 Resource resource = Resource.Load(Model);
22 VObject vobj = resource.GetResource().ToVObject();
23 SetObject(vobj, "");
24
25 if (Type == 1)
26 {
27 Physics.CreateStatic(this, 0xffffffff); // todo - defines for layer mask
28 }
29 else if (Type == 0)
30 {
31 if(!Physics.CreateDynamic(this, 1.0, 0xffffffff))
32 {
33 //create implicit box
34 vector mins, maxs;
35 GetBounds(mins, maxs);
36 vector center = (mins + maxs) * 0.5;
37 vector size = maxs - mins;
38
39 ref PhysicsGeomDef geoms[] = {PhysicsGeomDef("", PhysicsGeom.CreateBox(size), "material/default", 0xffffffff)};
40 Physics.CreateDynamicEx(this, center, 1, geoms);
41 }
42 if(GetPhysics())
43 {
44 GetPhysics().SetMass(1.0);
45 GetPhysics().SetActive(ActiveState.ACTIVE);
46 }
47 }
48 }
49
50 void ~ScriptModel()
51 {
52 if(GetPhysics())
53 GetPhysics().Destroy();
54 }
55};
int size
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
proto external Physics GetPhysics()
proto external void GetBounds(out vector mins, out vector maxs)
proto external EntityFlags SetFlags(EntityFlags flags, bool recursively=false)
Object holding reference to resource. In destructor release the resource.
Definition Resource.c:25
Visual object.
Definition VObject.c:14
SCR_FieldOfViewSettings Attribute
EntityFlags
Various entity flags.
Definition EntityFlags.c:14
ActiveState
Definition ActiveState.c:16