DayZ 1.24
Loading...
Searching...
No Matches
EnEntity.c
Go to the documentation of this file.
1typedef int[] BaseContainer;
2typedef int[] IEntitySource;
3typedef int[] WidgetSource;
4
6{
7 proto native owned string GetClassName();
8 proto native owned string GetName();
9 proto native int VarIndex(string varName);
10 proto native bool IsVariableSet(int varIndex);
11 proto bool IsType(int varIndex, typename type);
12 proto bool Get(int varIndex, out void val);
13};
14
16{
17 proto native IEntitySource GetChildren();
18 proto native IEntitySource GetSibling();
19 proto native IEntitySource GetParent();
20};
21
23{
24 proto native WidgetSource GetChildren();
25 proto native WidgetSource GetSibling();
26 proto native WidgetSource GetParent();
27};
28
41
44{
47
55
62
69
75
81
82 //Only with MeshObject
83 //ANIMEND - End of AF_ONCE animation, extra = slot number 0...11
84 //ANIMBLEND - Animation blended from previous one, extra = slot number 0...11
85
86
87 //SOUNDEND - playing of SFL_ONCE sound has ended
88 // extra = pointer to a sound handle
89
90 //USER
91
102
107
109 ALL
111
159
164{
165 //DO NOT INSERT ANYTHING BELOW - order of event methods matters!
170 event protected void EOnTouch(IEntity other, int extra)
171 {
172 }
173 event protected void EOnInit(IEntity other, int extra)
174 {
175 }
176 event protected void EOnExtra(IEntity other, int extra)
177 {
178 }
179 event protected void EOnNotVisible(IEntity other, int extra)
180 {
181 }
182 event protected void EOnFrame(IEntity other, float timeSlice)
183 {
184 }
185 event protected int EOnVisible(IEntity other, int extra)
186 {
187 }
188 event protected void EOnPostFrame(IEntity other, int extra)
189 {
190 }
191 event protected void EOnWorldProcess(IEntity other, int extra)
192 {
193 }
194 event protected void EOnAnimEvent(IEntity other, AnimEvent extra)
195 {
196 }
197 event protected void EOnSoundEvent(IEntity other, SoundEvent extra)
198 {
199 }
200 event protected void EOnSimulate(IEntity other, float dt)
201 {
202 }
203 event protected void EOnPostSimulate(IEntity other, float timeSlice)
204 {
205 }
206 event protected void EOnJointBreak(IEntity other, int extra)
207 {
208 }
209 event protected void EOnPhysicsMove(IEntity other, int extra)
210 {
211 }
212 event protected void EOnContact(IEntity other, Contact extra)
213 {
214 }
215 protected void EOnUser0(IEntity other, int extra)
216 {
217 }
218 protected void EOnUser1(IEntity other, int extra)
219 {
220 }
221 event protected void EOnEnter(IEntity other, int extra)
222 {
223 }
224 event protected void EOnLeave(IEntity other, int extra)
225 {
226 }
227 protected void EOnUser4(IEntity other, int extra)
228 {
229 }
230 protected void EOnDummy020(IEntity other, int extra)
231 {
232 }
233 protected void EOnDummy021(IEntity other, int extra)
234 {
235 }
236 protected void EOnDummy022(IEntity other, int extra)
237 {
238 }
239 protected void EOnDummy023(IEntity other, int extra)
240 {
241 }
242 protected void EOnDummy024(IEntity other, int extra)
243 {
244 }
245 protected void EOnDummy025(IEntity other, int extra)
246 {
247 }
248 protected void EOnDummy026(IEntity other, int extra)
249 {
250 }
251 protected void EOnDummy027(IEntity other, int extra)
252 {
253 }
254 protected void EOnDummy028(IEntity other, int extra)
255 {
256 }
257 protected void EOnDummy029(IEntity other, int extra)
258 {
259 }
260 protected void EOnDummy030(IEntity other, int extra)
261 {
262 }
263 protected void EOnDummy031(IEntity other, int extra)
264 {
265 }
267 //DO NOT INSERT ANYTHING ABOVE - order of event methods matters!
268
273
287 proto external void GetTransform(out vector mat[]);
288
302 proto external void GetRenderTransform(out vector mat[]);
303
317 proto external void GetLocalTransform(out vector mat[]);
318
336 proto native external vector GetTransformAxis(int axis);
337
355 proto native external void SetTransform(vector mat[4]);
356
367 proto native external vector GetOrigin();
368
379 proto external vector GetLocalPosition();
380
391 proto native external vector GetYawPitchRoll();
392
396 proto native external vector GetAngles();
397
408 proto native external vector GetLocalYawPitchRoll();
409
413 proto native external vector GetLocalAngles();
414
426 proto native external void SetYawPitchRoll(vector angles);
427
431 proto native external void SetAngles(vector angles);
432
444 proto native external void SetOrigin(vector orig);
445
446 proto native external float GetScale();
447 proto native external void SetScale(float scale);
459 proto native external vector VectorToParent(vector vec);
460
472 proto native external vector CoordToParent(vector coord);
473
485 proto native external vector VectorToLocal(vector vec);
486
498 proto native external vector CoordToLocal(vector coord);
499
501
502
506
517 proto native int GetID();
518
530 proto native void SetID(int id);
531
532 proto native void SetName(string name);
533 proto native external owned string GetName();
535
536
541
550 proto native external bool AddChild(notnull IEntity child, int pivot, bool positionOnly = false);
551
559 proto native external bool RemoveChild(notnull IEntity child, bool keepTransform = false);
560
562 proto native bool IsHierarchyPositionOnly();
563
565 proto native int GetHierarchyPivot();
566
568 proto native IEntity GetParent();
570 proto native IEntity GetChildren();
572 proto native IEntity GetSibling();
574
592 proto external void GetBounds(out vector mins, out vector maxs);
593
611 proto external void GetWorldBounds(out vector mins, out vector maxs);
612
627 proto native external EntityFlags GetFlags();
628
640 proto native external bool IsFlagSet(EntityFlags flags);
641
655 proto native external EntityFlags SetFlags(EntityFlags flags, bool recursively);
656
670 proto native external EntityFlags ClearFlags(EntityFlags flags, bool recursively);
671
672
683 proto native external EntityEvent GetEventMask();
684
698 proto native external EntityEvent SetEventMask(EntityEvent e);
699
715 proto native external EntityEvent ClearEventMask(EntityEvent e);
716
718 proto external volatile void SendEvent(notnull IEntity actor, EntityEvent e, void extra);
719
721
726
734 proto native external void SetObject(vobject object, string options);
735
739 proto native vobject GetVObject();
740
742 proto native external int Animate(float speed, int loop);
744 proto native external int AnimateEx(float speed, int loop, out vector lin, out vector ang);
745
747 proto native external int SetCameraMask(int mask);
749
753 proto native external void FilterNextTrace();
754
763 proto native external int Update();
764
765#ifdef COMPONENT_SYSTEM
767 protected void IEntity(IEntitySource src, IEntity parent);
768#endif
769};
770
771#ifdef ENF_DONE
772 // Set fixed LOD. -1 for non-fixed LOD
773 proto native void SetFixedLOD(IEntity ent, int lod);
774 //Sets the texture that can be referenced from material as $renderview
775 //and connects it with camera cam_index. Size iz recommended size of
776 //rendertarget (0 is default)
777 proto native void SetRenderView(IEntity ent, int cam_index, int width, int height);
778 proto void GetRenderView(IEntity ent, out int cam_index, out int width, out int height);
779#endif
780
781
788{
789 string m_Key;
790 string m_Value;
791 string m_Desc;
792
793 void ParamEnum(string key, string value, string desc = "")
794 {
795 m_Key = key;
796 m_Value = value;
797 m_Desc = desc;
798 }
799}
800
801class ParamEnumArray: array<ref ParamEnum>
802{
803 static ParamEnumArray FromEnum(typename e)
805 ParamEnumArray params = new ParamEnumArray();
806 int cnt = e.GetVariableCount();
807 int val;
809 for (int i = 0; i < cnt; i++)
810 {
811 if (e.GetVariableType(i) == int && e.GetVariableValue(NULL, i, val))
812 params.Insert(new ParamEnum(e.GetVariableName(i), val.ToString()));
813 }
814
815 return params;
816 }
817}
818
819// -------------------------------------------------------------------------
821{
823 string m_UiWidget;
825 string m_Desc;
826 ref ParamEnumArray m_Enums;
827
828 void Attribute(string defvalue, string uiwidget, string desc = "", string rangescale = "", ParamEnumArray enums = NULL)
829 {
830 m_DefValue = defvalue;
831 m_UiWidget = uiwidget;
832 m_RangeScale = rangescale;
833 m_Desc = desc;
834 m_Enums = enums;
835 }
836}
837
838class EditorAttribute
839{
840 string m_Style;
841 string m_Category;
845 string m_Color;
846 string m_Color2;
850
851 void EditorAttribute(string style, string category, string description, vector sizeMin, vector sizeMax, string color, string color2 = "0 0 0 0", bool visible = true, bool insertable = true, bool dynamicBox = false)
852 {
853 m_Style = style;
854 m_Category = category;
855 m_Description = description;
856 m_SizeMin = sizeMin;
857 m_SizeMax = sizeMax;
858 m_Color = color;
859 m_Color2 = color2;
860 m_Visible = visible;
861 m_Insertable = insertable;
862 m_DynamicBox = dynamicBox;
863 }
864}
866
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
int[] BaseContainer
Definition EnEntity.c:1
int[] IEntitySource
Definition EnEntity.c:2
int[] WidgetSource
Definition EnEntity.c:3
TODO doc.
Definition EnScript.c:118
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto native IEntitySource GetSibling()
proto native WidgetSource GetSibling()
void EOnWorldProcess(IEntity other, int extra)
EntityEvent.WORLDPROCESS.
Definition EnEntity.c:191
proto bool Get(int varIndex, out void val)
proto native WidgetSource GetChildren()
void EOnDummy022(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:236
void EOnExtra(IEntity other, int extra)
EntityEvent.EXTRA.
Definition EnEntity.c:176
void ParamEnum(string key, string value, string desc="")
Definition EnEntity.c:808
proto native vobject GetVObject()
Returns visual object set to this Entity. No reference is added.
void EOnDummy031(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:263
class Attribute m_Style
can be "box", "sphere", "cylinder", "pyramid", "diamond" or custom style name
proto native external int AnimateEx(float speed, int loop, out vector lin, out vector ang)
Updates animation (either xob, or particle, whatever)
string m_UiWidget
can be "editbox", "combobox", "spinbox", "slider", "font", "fileeditbox", "colorPicker",...
Definition EnEntity.c:823
proto native external void SetAngles(vector angles)
Same as SetYawPitchRoll, but sets rotation around X, Y and Z axis.
proto native external void SetTransform(vector mat[4])
Sets entity transformation.
string m_RangeScale
defined as "MIN_VALUE MAX_VALUE STEP" eg. "1 100 0.5"
Definition EnEntity.c:824
proto native void SetID(int id)
Set unique entity ID.
void EOnDummy026(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:248
void EOnUser4(IEntity other, int extra)
EntityEvent.EV_USER+4.
Definition EnEntity.c:227
void Attribute(string defvalue, string uiwidget, string desc="", string rangescale="", ParamEnumArray enums=NULL)
Definition EnEntity.c:828
void EOnSimulate(IEntity other, float dt)
EntityEvent.SIMULATE.
Definition EnEntity.c:200
proto native owned string GetClassName()
void EOnDummy023(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:239
proto native external EntityFlags SetFlags(EntityFlags flags, bool recursively)
Sets Entity flags. It's OR operation, not rewrite. Returns previous flags.
void ParamEnum(string key, string value, string desc="")
Definition EnEntity.c:793
proto native external vector VectorToLocal(vector vec)
Transforms world space vector to local space.
ref ParamEnumArray m_Enums
Only ints and floats are currently supported. Array can be defined this way: { ParamEnum("Choice 1",...
Definition EnEntity.c:826
proto native external void SetYawPitchRoll(vector angles)
Sets angles for entity (Yaw, Pitch, Roll)
proto native external void SetOrigin(vector orig)
Sets origin for entity.
proto native WidgetSource GetParent()
string m_Category
folder structure eg. StaticEntities/Walls
Definition EnEntity.c:841
proto native external vector GetTransformAxis(int axis)
Returns one row of Entity transformation matrix.
int EOnVisible(IEntity other, int extra)
EntityEvent.VISIBLE.
Definition EnEntity.c:185
bool m_Insertable
Definition EnEntity.c:848
void EOnUser1(IEntity other, int extra)
EntityEvent.EV_USER+1.
Definition EnEntity.c:218
proto external void GetBounds(out vector mins, out vector maxs)
Returns local bounding box of model on Entity.
proto native external int Animate(float speed, int loop)
Updates animation (either xob, or particle, whatever)
proto native external vector GetLocalYawPitchRoll()
Returns local orientation when it's in hierarchy (Yaw, Pitch, Roll)
proto native int GetHierarchyPivot()
Returns the hierarchy component pivot.
void EOnUser0(IEntity other, int extra)
EntityEvent.EV_USER+0.
Definition EnEntity.c:215
void EOnContact(IEntity other, Contact extra)
EntityEvent.CONTACT.
Definition EnEntity.c:212
void EOnFrame(IEntity other, float timeSlice)
EntityEvent.FRAME.
Definition EnEntity.c:182
proto native external EntityEvent ClearEventMask(EntityEvent e)
Clears event mask.
proto native external vector GetAngles()
Same as GetYawPitchRoll, but returns rotation vector around X, Y and Z axis.
proto native external int SetCameraMask(int mask)
Sets visibility mask for cameras, where Entity will be rendered.
proto native IEntitySource GetChildren()
proto native external EntityEvent SetEventMask(EntityEvent e)
Sets event mask.
proto external volatile void SendEvent(notnull IEntity actor, EntityEvent e, void extra)
Dynamic event invokation. Parameters are the same as in IEntity::EOnXXXX() methods.
bool m_Visible
Definition EnEntity.c:847
proto native external owned string GetName()
proto native external vector GetYawPitchRoll()
Returns orientation of Entity in world space (Yaw, Pitch, Roll)
void EOnDummy024(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:242
proto native int GetID()
Return unique entity ID.
void EOnSoundEvent(IEntity other, SoundEvent extra)
EntityEvent.SOUNDEVENT.
Definition EnEntity.c:197
void EOnTouch(IEntity other, int extra)
EntityEvent.TOUCH.
Definition EnEntity.c:170
string m_Color2
Definition EnEntity.c:846
proto native external vector GetOrigin()
Returns origin of Entity.
void EOnDummy025(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:245
proto native external bool AddChild(notnull IEntity child, int pivot, bool positionOnly=false)
Adds child entity to this entity.
proto native external int Update()
proto external vector GetLocalPosition()
Returns local position of Entity.
proto native external vector CoordToLocal(vector coord)
Transforms world space position to local space.
proto native IEntity GetSibling()
Returns pointer to next child Entity on the same hierarchy.
void EOnAnimEvent(IEntity other, AnimEvent extra)
EntityEvent.ANIMEVENT.
Definition EnEntity.c:194
proto native bool IsHierarchyPositionOnly()
Returns if the hierarchy component was created with positionOnly.
proto external void GetWorldBounds(out vector mins, out vector maxs)
Returns quantized world-bound-box of Entity.
string m_Description
class purpose description
Definition EnEntity.c:842
proto external void GetTransform(out vector mat[])
Returns transformation of Entity. It returns only so much vectors as array is big.
proto native external float GetScale()
proto native external bool IsFlagSet(EntityFlags flags)
Test if one or more of specified flags are set.
ParamEnum Managed FromEnum(typename e)
Definition EnEntity.c:803
string m_Desc
Definition EnEntity.c:791
proto native external vector GetLocalAngles()
Same as GetLocalYawPitchRoll, but returns rotation vector around X, Y and Z axis.
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44
string m_Key
Definition EnEntity.c:789
proto bool IsType(int varIndex, typename type)
proto native IEntity GetParent()
Returns pointer to parent Entity in hierarchy.
void EOnDummy030(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:260
proto native void SetName(string name)
void EOnDummy028(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:254
proto native external vector CoordToParent(vector coord)
Transforms local position to world space.
proto native IEntity GetChildren()
Returns pointer to first child Entity in hierarchy.
proto native external void SetObject(vobject object, string options)
void EOnPostSimulate(IEntity other, float timeSlice)
EntityEvent.POSTSIMULATE.
Definition EnEntity.c:203
void EOnPostFrame(IEntity other, int extra)
EntityEvent.POSTFRAME.
Definition EnEntity.c:188
proto native owned string GetName()
proto native IEntitySource GetParent()
proto native external void FilterNextTrace()
When called, the Entity is excluded from consequent TraceMove/TraceLine.
string m_Color
Definition EnEntity.c:845
proto native external void SetScale(float scale)
void EOnEnter(IEntity other, int extra)
EntityEvent.ENTER.
Definition EnEntity.c:221
bool m_DynamicBox
Definition EnEntity.c:849
EntityFlags
Entity flags.
Definition EnEntity.c:114
void EOnLeave(IEntity other, int extra)
EntityEvent.LEAVE.
Definition EnEntity.c:224
proto native external bool RemoveChild(notnull IEntity child, bool keepTransform=false)
Removes child entity from hierarchy.
string m_Value
Definition EnEntity.c:790
proto native bool IsVariableSet(int varIndex)
string m_Desc
Definition EnEntity.c:825
void EOnInit(IEntity other, int extra)
EntityEvent.INIT.
Definition EnEntity.c:173
proto native external EntityFlags GetFlags()
Returns Entity flags.
void EOnJointBreak(IEntity other, int extra)
EntityEvent.JOINTBREAK.
Definition EnEntity.c:206
void EOnDummy020(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:230
proto external void GetRenderTransform(out vector mat[])
Returns render transformation of Entity. Must pass in vector array size of 4.
proto native external EntityFlags ClearFlags(EntityFlags flags, bool recursively)
Clear Entity flags. Returns cleared flags.
string m_DefValue
Definition EnEntity.c:822
void EOnDummy027(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:251
void EOnDummy029(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:257
void EOnPhysicsMove(IEntity other, int extra)
EntityEvent.PHYSICSMOVE.
Definition EnEntity.c:209
proto native external EntityEvent GetEventMask()
Returns current event mask.
vector m_SizeMax
max vector of a bounding box
Definition EnEntity.c:844
void EOnNotVisible(IEntity other, int extra)
EntityEvent.NOTVISIBLE.
Definition EnEntity.c:179
proto external void GetLocalTransform(out vector mat[])
Returns local transformation of Entity. It returns only so much vectors as array is big.
void EditorAttribute(string style, string category, string description, vector sizeMin, vector sizeMax, string color, string color2="0 0 0 0", bool visible=true, bool insertable=true, bool dynamicBox=false)
Definition EnEntity.c:851
proto native external vector VectorToParent(vector vec)
Transforms local vector to world space.
void EOnDummy021(IEntity other, int extra)
Placeholder.
Definition EnEntity.c:233
vector m_SizeMin
min vector of a bounding box
Definition EnEntity.c:843
proto native int VarIndex(string varName)
@ PHYSICSMOVE
Definition EnEntity.c:95
@ INIT
Definition EnEntity.c:80
@ FRAME
Definition EnEntity.c:68
@ PHYSICSSTEADY
Definition EnEntity.c:100
@ POSTSIMULATE
Definition EnEntity.c:94
@ NOTVISIBLE
Definition EnEntity.c:61
@ TOUCH
entity was touched by other entity
Definition EnEntity.c:46
@ CONTACT
Definition EnEntity.c:96
@ SOUNDEVENT
Definition EnEntity.c:99
@ ENTER
Object entered Trigger.
Definition EnEntity.c:104
@ ANIMEVENT
Definition EnEntity.c:98
@ SIMULATE
Definition EnEntity.c:93
@ JOINTBREAK
Definition EnEntity.c:92
@ ALL
Mask of all events.
Definition EnEntity.c:109
@ POSTFRAME
Definition EnEntity.c:74
@ LEAVE
Object left Trigger.
Definition EnEntity.c:106
@ USER
Definition EnEntity.c:101
@ EXTRA
Definition EnEntity.c:97
@ USER6
Definition EnEntity.c:157
@ TRIGGER
Is not collidable, but invokes touch events.
Definition EnEntity.c:123
@ SOLID
Is collidable by various trace methods.
Definition EnEntity.c:122
@ ACTIVE
Definition EnEntity.c:141
@ WATER
Used by tracing methods. Traceable only with flag TraceFlags.WATER.
Definition EnEntity.c:135
@ USER4
Definition EnEntity.c:155
@ USER5
Definition EnEntity.c:156
@ USER1
Flags for custom usage and filterings.
Definition EnEntity.c:152
@ TRANSLUCENT
Definition EnEntity.c:132
@ USER2
Definition EnEntity.c:153
@ TOUCHTRIGGERS
Interacts with triggers.
Definition EnEntity.c:124
@ FEATURE
Scene rendering hint for dominant objects that are not culled by standard way.
Definition EnEntity.c:127
@ VISIBLE
Definition EnEntity.c:54
@ USER3
Definition EnEntity.c:154
@ STATIC
Static objects are included in the query.
Definition EnEntity.c:149
@ SYNCHRONIZATION_DIRTY
Entity wants to synchronize (network)
Definition EnEntity.c:125