7 RplId m_ParentID = RplId.Invalid();
10 RplId m_TargetRplID = RplId.Invalid();
15 vector m_vTransform[4];
23 static void Encode(SSnapSerializerBase snapshot, ScriptCtx hint, ScriptBitSerializer packet)
25 snapshot.Serialize(packet, 84);
29 static bool Decode(ScriptBitSerializer packet, ScriptCtx hint, SSnapSerializerBase snapshot)
31 return snapshot.Serialize(packet, 84);
35 static bool SnapCompare(SSnapSerializerBase lhs, SSnapSerializerBase rhs, ScriptCtx hint)
37 return lhs.CompareSnapshots(rhs, 84);
43 return snapshot.Compare(prop.m_vTransform, 48)
44 && snapshot.Compare(prop.m_ParentID, 4)
45 && snapshot.Compare(prop.m_bParentChanged, 4)
46 && snapshot.Compare(prop.m_VerticalMode, 4)
47 && snapshot.Compare(prop.m_bIsUnderwater, 4)
48 && snapshot.Compare(prop.m_TargetRplID, 4)
49 && snapshot.Compare(prop.m_TargetStaticID, 8)
50 && snapshot.Compare(prop.m_TargetInteraction, 4)
51 && snapshot.Compare(prop.m_PlacingFlags, 4);
57 snapshot.SerializeBytes(prop.m_vTransform, 48);
58 snapshot.SerializeBytes(prop.m_ParentID, 4);
59 snapshot.SerializeBytes(prop.m_bParentChanged, 4);
60 snapshot.SerializeBytes(prop.m_VerticalMode, 4);
61 snapshot.SerializeBytes(prop.m_bIsUnderwater, 4);
62 snapshot.SerializeBytes(prop.m_TargetRplID, 4);
63 snapshot.SerializeBytes(prop.m_TargetStaticID, 8);
64 snapshot.SerializeBytes(prop.m_TargetInteraction, 4);
65 snapshot.SerializeBytes(prop.m_PlacingFlags, 4);
73 snapshot.SerializeBytes(prop.m_vTransform, 48);
74 snapshot.SerializeBytes(prop.m_ParentID, 4);
75 snapshot.SerializeBytes(prop.m_bParentChanged, 4);
76 snapshot.SerializeBytes(prop.m_VerticalMode, 4);
77 snapshot.SerializeBytes(prop.m_bIsUnderwater, 4);
78 snapshot.SerializeBytes(prop.m_TargetRplID, 4);
79 snapshot.SerializeBytes(prop.m_TargetStaticID, 8);
80 snapshot.SerializeBytes(prop.m_TargetInteraction, 4);
81 snapshot.SerializeBytes(prop.m_PlacingFlags, 4);
89 void GetWorldTransform(out vector outTransform[4])
91 if (m_Offset == vector.Zero)
95 Math3D.MatrixCopy(m_vTransform, outTransform);
100 vector coefMatrix[4] = {m_vTransform[0], m_vTransform[1], m_vTransform[2], vector.Zero};
101 vector offsetMatrix[4] = { vector.Zero, vector.Zero, vector.Zero, m_Offset};
102 Math3D.MatrixMultiply4(coefMatrix, offsetMatrix, offsetMatrix);
103 outTransform = {m_vTransform[0], m_vTransform[1], m_vTransform[2], m_vTransform[3] + offsetMatrix[3]};
113 if (!m_Parent && m_ParentID.IsValid())
115 Print(
string.Format(
"Cannot deserialize entity, parent with RplId = %1 not found!", m_ParentID), LogLevel.ERROR);
124 if (!
m_Target && m_TargetRplID.IsValid())
126 Print(
string.Format(
"Cannot deserialize entity, target neither with RplId = %1 nor with EntityID = %2 found!", m_TargetRplID, m_TargetStaticID), LogLevel.ERROR);
138 if (target && target.GetOwner())
140 m_TargetRplID = Replication.FindId(target);
141 if (!m_TargetRplID.IsValid())
142 m_TargetStaticID = target.GetOwner().GetID();
157 RplId parentID = Replication.INVALID_ID,
159 bool isUnderwater =
false,
165 Math3D.MatrixCopy(transform,
params.m_vTransform);
166 params.m_ParentID = parentID;
167 params.m_VerticalMode = verticalMode;
168 params.m_bIsUnderwater = isUnderwater;
169 params.m_TargetInteraction = targetInteraction;
186 SCR_NotificationsComponent.SendLocal(
ENotification.EDITOR_TRANSFORMING_INCORRECT_TARGET);
192 previewManager.GetPreviewTransform(
params.m_vTransform);
193 params.m_VerticalMode = previewManager.GetVerticalModeReal();
194 params.m_bIsUnderwater = previewManager.IsUnderwater();
195 params.m_TargetInteraction = previewManager.GetTargetInteraction();
196 params.SetTarget(previewManager.GetTarget());
197 params.m_ParentID = Replication.FindId(parent);
198 params.m_bParentChanged = parentChanged;