Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_RotationEditorAttribute.c
Go to the documentation of this file.
3 {
4  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
5  {
6  //disable
7  return null;
8 
10  if (!editableEntity)
11  return null;
12 
13  if (!IsValidEntityType(editableEntity.GetEntityType()))
14  return null;
15 
16  //~Todo: Make sure chilren positions are set correctly
17  if (editableEntity.GetChildrenCount() > 0)
18  return null;
19 
20  vector mat[4];
21  editableEntity.GetTransform(mat);
22  vector angles = Math3D.MatrixToAngles(mat);
23 
24  return SCR_BaseEditorAttributeVar.CreateFloat(angles[0] + 180);
25  }
26 
27  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
28  {
29  if (!var)
30  return;
31 
32  SCR_EditableEntityComponent editableEntity = SCR_EditableEntityComponent.Cast(item);
33  if (!editableEntity)
34  return;
35 
36  vector mat[4];
37  editableEntity.GetTransform(mat);
38  vector angles = Math3D.MatrixToAngles(mat);
39  angles[0] = var.GetFloat() - 180;
40  Math3D.AnglesToMatrix(angles, mat);
41  editableEntity.SetTransform(mat, true);
42 
43  //Print("UPDATE CHILDREN!");
44  }
45 
46  override int GetEntries(notnull array<ref SCR_BaseEditorAttributeEntry> outEntries)
47  {
48  outEntries.Insert(new SCR_BaseEditorAttributeDefaultFloatValue(180));
49  return super.GetEntries(outEntries);
50  }
51 };
SCR_ValidTypeBaseValueListEditorAttribute
Definition: SCR_ValidTypeBaseValueListEditorAttribute.c:2
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
SCR_BaseEditorAttributeDefaultFloatValue
void SCR_BaseEditorAttributeDefaultFloatValue(float floatValue)
Definition: SCR_BaseEditorAttribute.c:856
SCR_RotationEditorAttribute
Definition: SCR_RotationEditorAttribute.c:2
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468