Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
ScriptModel.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameLib/Scripted", description: "Script model", dynamicBox: true)]
2 class ScriptModelClass: GenericEntityClass
3 {
4 
5 };
6 
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 };
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
ScriptModelClass
Definition: ScriptModel.c:2
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
Attribute
typedef Attribute
Post-process effect of scripted camera.
ScriptModel
Definition: ScriptModel.c:7
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180