Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
object.c
Go to the documentation of this file.
8
9class ObjectSnapCallback
10{
14
17
19
22
26 void OnSetup()
27 {
28 }
29
32 void OnDebug(vector p0, vector p1, bool hasHit, bool found)
33 {
34 }
35
41 {
42 return false;
43 }
44
49 bool OnQuery(Object other)
50 {
51 return true;
52 }
53
58 bool OnCollide(Object other)
59 {
60 return true;
61 }
62};
63
64class Object extends IEntity
65{
66 private void ~Object();
67 private void Object();
68
69 bool CanBeSkinned()
70 {
71 return false;
72 }
73
82 void Delete()
83 {
84 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(g_Game.ObjectDelete, this);
85 }
86
87 proto native void AddProxyPhysics(string proxySelectionName);
88
89 proto native void RemoveProxyPhysics(string proxySelectionName);
90
92 void OnEnterTrigger(ScriptedEntity trigger) {}
93
95 void OnLeaveTrigger(ScriptedEntity trigger) {}
96
98 proto native bool GetLODS(notnull out array<LOD> lods);
99
101 proto native owned string GetLODName(LOD lod);
102
103 proto native vector GetBoundingCenter();
104
106 LOD GetLODByName( string name )
107 {
108 array<LOD> lods = new array<LOD>;
109 GetLODS( lods );
110
111 for ( int i = 0; i < lods.Count(); ++i )
112 {
113 string lod_name = GetLODName( lods.Get( i ) );
114 lod_name.ToLower();
115 name.ToLower();
116 if ( lod_name == name )
117 {
118 return lods.Get( i );
119 }
120 }
121
122 return NULL;
123 }
124
126 TStringArray GetHiddenSelections()
127 {
128 return HiddenSelectionsData.GetHiddenSelectionsConfig(GetType());
129 }
130
132 TStringArray GetHiddenSelectionsTextures()
133 {
134 return HiddenSelectionsData.GetHiddenSelectionsTexturesConfig(GetType());
135 }
136
138 TStringArray GetHiddenSelectionsMaterials()
139 {
140 return HiddenSelectionsData.GetHiddenSelectionsMaterialsConfig(GetType());
141 }
142
144 void Explode(int damageType, string ammoType = "")
145 {
146 if (ammoType == "")
147 ammoType = ConfigGetString("ammoType");
148
149 if (ammoType == "")
150 ammoType = "Dummy_Heavy";
151
152 if ( g_Game.IsServer() )
153 {
154 SynchExplosion();
155 DamageSystem.ExplosionDamage(EntityAI.Cast(this), null, ammoType, GetPosition(), damageType);
156 }
157 }
158
159 void SynchExplosion()
160 {
161 if ( g_Game.IsDedicatedServer() ) // Multiplayer server
162 {
163 Param1<EntityAI> p = new Param1<EntityAI>(null);
164 g_Game.RPCSingleParam( this, ERPCs.RPC_EXPLODE_EVENT, p, true);
165 }
166 else if ( !g_Game.IsMultiplayer() ) // Singleplayer
167 {
168 OnExplodeClient();
169 }
170 }
171
173 void OnExplodeClient()
174 {
175 string ammoType = ConfigGetString("ammoType");
176
177 if (ammoType == "")
178 ammoType = "Dummy_Heavy";
179
180 vector pos = GetPosition();
181
182 // Handle spawn of particle if one is configured in config
183 AmmoEffects.PlayAmmoParticle(ammoType, pos);
184
185 // Handle spawn of Effect if one is configured in config
186 AmmoEffects.PlayAmmoEffect(ammoType, pos);
187 }
188
189 void OnExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType) { }
190
192 proto native owned string GetActionComponentName(int componentIndex, string geometry = "");
193
195 proto native owned vector GetActionComponentPosition(int componentIndex, string geometry = "");
196
198 proto native owned int GetActionComponentNameList(int componentIndex, TStringArray nameList, string geometry = "");
199
201 proto native bool IsActionComponentPartOfSelection(int componentIndex, string selectionName, string geometry = "");
202
204 proto void GetActionComponentsForSelectionName(int level, string selectionName, TIntArray componentIndices);
205
207 proto vector GetActionComponentCenter(int level, int componentIndex);
208
210 proto vector GetActionComponentCenterOOB(int level, int componentIndex);
211
213 proto void GetActionComponentMinMax(int level, int componentIndex, out vector min, out vector max);
214
216 proto native bool ToDelete();
217
221 proto native bool IsPendingDeletion();
222
224 proto native int GetGeometryLevel();
225 proto native int GetFireGeometryLevel();
226 proto native int GetViewGeometryLevel();
227 proto native int GetMemoryLevel();
228
229#ifdef DEVELOPER
231 proto bool ToBonePivot(out int pivot, int level, int bone);
232 proto bool FromBonePivot(int pivot, out int level, out int bone);
233#endif
234
236 proto int GetBonePivot(int level, int component);
237
239 proto native void GetBonePivotsForAnimationSource(int level, string animationSource, out TIntArray pivots);
240
242 proto native vector GetBonePositionLS(int pivot);
243 proto native vector GetBonePositionMS(int pivot);
244 proto native vector GetBonePositionWS(int pivot);
245
247 proto native void GetBoneRotationLS(int pivot, out float quaternion[4]);
248 proto native void GetBoneRotationMS(int pivot, out float quaternion[4]);
249 proto native void GetBoneRotationWS(int pivot, out float quaternion[4]);
250
252 proto native void GetBoneTransformLS(int pivot, out vector transform[4]);
253 proto native void GetBoneTransformMS(int pivot, out vector transform[4]);
254 proto native void GetBoneTransformWS(int pivot, out vector transform[4]);
255
262 proto native void GetTightlyPackedCorners(ETransformationAxis axis, out vector corners[4]);
263
264#ifdef DIAG_DEVELOPER
265 void DebugDrawTightlyPackedCorners(ETransformationAxis axis, int color)
266 {
267#ifndef SERVER
268 vector points[2];
269 vector corners[4];
270
271 GetTightlyPackedCorners(axis, corners);
272
273 points[0] = corners[0];
274 points[1] = corners[1];
275 Shape.CreateLines(color, ShapeFlags.TRANSP | ShapeFlags.ONCE | ShapeFlags.NOOUTLINE | ShapeFlags.NOZBUFFER, points, 2);
276
277 points[0] = corners[1];
278 points[1] = corners[3];
279 Shape.CreateLines(color, ShapeFlags.TRANSP | ShapeFlags.ONCE | ShapeFlags.NOOUTLINE | ShapeFlags.NOZBUFFER, points, 2);
280
281 points[0] = corners[3];
282 points[1] = corners[2];
283 Shape.CreateLines(color, ShapeFlags.TRANSP | ShapeFlags.ONCE | ShapeFlags.NOOUTLINE | ShapeFlags.NOZBUFFER, points, 2);
284
285 points[0] = corners[2];
286 points[1] = corners[0];
287 Shape.CreateLines(color, ShapeFlags.TRANSP | ShapeFlags.ONCE | ShapeFlags.NOOUTLINE | ShapeFlags.NOZBUFFER, points, 2);
288#endif
289 }
290#endif
291
293 proto native vector GetPosition();
294
297 proto native vector GetWorldPosition();
298
300 proto native void SetPosition(vector vPos);
301
305 proto native void PlaceOnSurface();
306
311 proto native vector GetOrientation();
312
317 proto native void SetOrientation(vector vOrientation);
318
320 proto native vector GetDirection();
321
327 proto native void SetDirection(vector vPos);
328
330 proto native vector GetDirectionUp();
331
333 proto native vector GetDirectionAside();
334
336 proto native vector GetLocalPos(vector vPos);
338 proto native vector GetGlobalPos(vector vPos);
339
341 proto native vector GetSpeed();
342
344 proto native vector GetModelSpeed();
345
347 proto native bool CanAffectPathgraph();
348
350 proto native void SetAffectPathgraph(bool fromConfig, bool affect);
351
352
364 proto float ClippingInfo(out vector minMax[2]);
365
376 proto native bool GetCollisionBox(out vector minMax[2]);
377
382 proto native float GetCollisionRadius();
383
385 proto native float GetDamage();
386
387
388 proto native void GetSelectionList(out TStringArray selectionList);
389
391 float GetSurfaceNoise()
392 {
393 vector position = GetPosition();
394 return g_Game.SurfaceGetNoiseMultiplier(NULL, position, -1);
395 }
396
398 string GetSurfaceType()
399 {
400 string surface_type;
401 int liquid_type;
402
403 g_Game.SurfaceUnderObject(this, surface_type,liquid_type);
404// Print(surface_type);
405// Print(liquid_type);
406
407 return surface_type;
408 }
409
411 bool HasSelection( string selection )
412 {
413 TStringArray selections = new TStringArray;
414 GetSelectionList( selections );
415
416 for ( int i = 0; i < selections.Count(); ++i )
417 {
418 if ( selections.Get( i ) == selection )
419 {
420 return true;
421 }
422 }
423
424 return false;
425 }
426
428 bool HasAnimation( string anim_name )
429 {
430 string cfg_path_vehicles = "CfgVehicles " + GetType() + " ";
431 if ( g_Game.ConfigIsExisting (cfg_path_vehicles) && g_Game.ConfigIsExisting (cfg_path_vehicles + "AnimationSources " + anim_name) )
432 {
433 return true;
434 }
435
436 string cfg_path_weapons = "CfgWeapons " + GetType() + " ";
437 if ( g_Game.ConfigIsExisting (cfg_path_weapons) && g_Game.ConfigIsExisting (cfg_path_weapons + "AnimationSources " + anim_name) )
438 {
439 return true;
440 }
441
442 string cfg_path_magazines = "CfgMagazines " + GetType() + " ";
443 if ( g_Game.ConfigIsExisting (cfg_path_magazines) && g_Game.ConfigIsExisting (cfg_path_magazines + "AnimationSources " + anim_name) )
444 {
445 return true;
446 }
447
448 return false;
449 }
450
452 /*bool HasEnergyManager()
453 {
454 return false;
455 }*/
456
457 proto native int GetMemoryPointIndex(string memoryPointName);
458 proto native vector GetMemoryPointPos(string memoryPointName);
459 proto native vector GetMemoryPointPosByIndex(int pointIndex);
460 proto native bool MemoryPointExists(string memoryPoint);
461
462 proto native void CreateDynamicPhysics(int interactionLayers);
463 proto native void EnableDynamicCCD(bool state);
464 proto native void SetDynamicPhysicsLifeTime(float lifeTime);
465
467 void OnTreeCutDown(EntityAI cutting_entity);
468
470 proto native EntityType GetEntityType();
471
473 string GetType()
474 {
475 string ret;
476 g_Game.ObjectGetType(this, ret);
477
478 return ret;
479 }
480
482 string GetDisplayName()
483 {
484 string tmp;
485 if (NameOverride(tmp))
486 {
487 tmp = Widget.TranslateString(tmp);
488 }
489 else
490 {
491 g_Game.ObjectGetDisplayName(this, tmp);
492 }
493 return tmp;
494 }
495
496 //Used to specify this object will always display it's own name when attached to another object
497 bool DisplayNameRuinAttach()
498 {
499 return false;
500 }
501
503 string GetModelName()
504 {
505 return g_Game.GetModelName(GetType());
506 }
507
509 proto native owned string GetShapeName();
510
511 int Release()
512 {
513 return g_Game.ObjectRelease(this);
514 }
515
517 bool IsKindOf(string type)
518 {
519 return g_Game.ObjectIsKindOf(this, type);
520 }
521
522 // Check alive state
523 bool IsAlive()
524 {
525 return !IsDamageDestroyed();
526 }
527
529 bool IsMan()
530 {
531 return false;
532 }
533
535 bool IsDayZCreature()
536 {
537 return false;
538 }
539
541 bool IsEntityAI()
542 {
543 return false;
544 }
545
547 bool IsStaticTransmitter()
548 {
549 return false;
550 }
551
553 bool IsTransmitter()
554 {
555 return false;
556 }
557
559 bool IsItemBase()
560 {
561 return false;
562 }
563
564 //Returns true for protector cases and similar items. Usually can be nested in other cargo while full, unlike clothing..
565 bool IsContainer()
566 {
567 return false;
568 }
569
571 bool IsMagazine()
572 {
573 return false;
574 }
575
577 bool IsAmmoPile()
578 {
579 return false;
580 }
581
583 bool IsInventoryItem()
584 {
585 return false;
586 }
587
589 bool IsClothing()
590 {
591 return false;
592 }
593
595 bool IsFireplace()
596 {
597 return false;
598 }
599
601 bool IsTree()
602 {
603 return false;
604 }
605
607 bool IsRock()
608 {
609 return false;
610 }
611
613 bool IsWoodBase()
614 {
615 return false;
616 }
617
619 bool IsBush()
620 {
621 return false;
622 }
623
624 bool IsCuttable()
625 {
626 return false;
627 }
628
630 bool IsPeltBase()
631 {
632 return false;
633 }
634
636 bool IsWeapon()
637 {
638 return false;
639 }
640
642 bool IsMeleeWeapon()
643 {
644 return false;
645 }
646
648 bool IsBuilding()
649 {
650 return false;
651 }
652
653 EWaterSourceObjectType GetWaterSourceObjectType()
654 {
655 return EWaterSourceObjectType.NONE;
656 }
657
658 int GetLiquidSourceType()
659 {
660 return LIQUID_NONE;
661 }
662
665 bool IsWell()
666 {
667 return false;
668 }
670 bool ShootsExplosiveAmmo()//placed on Object so that we can optimize early checks in DayZGame without casting
671 {
672 return false;
673 }
674
676 bool IsFuelStation()
677 {
678 return false;
679 }
680
682 bool IsTransport()
683 {
684 return false;
685 }
686
688 bool IsElectricAppliance()
689 {
690 return false;
691 }
692
694 bool CanUseConstruction()
695 {
696 return false;
697 }
698
701 {
702 return false;
703 }
704
706 bool CanUseHandConstruction()
707 {
708 return false;
709 }
710
711 bool IsBeingBackstabbed()
712 {
713 return false;
714 }
715
716 void SetBeingBackstabbed(int backstabType){}
717
719 bool IsFood()
720 {
721 return ( IsFruit() || IsMeat() || IsCorpse() || IsMushroom() );
722 }
723
724 bool IsFruit()
725 {
726 return false;
727 }
728
729 bool IsMeat()
730 {
731 return false;
732 }
733
734 bool IsCorpse()
735 {
736 return false;
737 }
738
739 bool IsMushroom()
740 {
741 return false;
742 }
743
745 bool IsHealthVisible()
746 {
747 return true;
748 }
749
751 bool ShowZonesHealth()
752 {
753 return false;
754 }
755
756 bool IsParticle()
757 {
758 return false;
759 }
760
761 bool IsItemTent()
762 {
763 return false;
764 }
765
766 bool IsScriptedLight()
767 {
768 return false;
769 }
770
771 bool IsHologram()
772 {
773 return false;
774 }
775
776 bool HasProxyParts()
777 {
778 return false;
779 }
780
781 bool CanObstruct()
782 {
783 return IsPlainObject() && !IsScenery();
784 }
785
786 bool CanProxyObstruct()
787 {
788 return HasProxyParts() || CanUseConstruction();
789 }
790
792 bool CanProxyObstructSelf()
793 {
794 return false;
795 }
796
797 bool CanBeIgnoredByDroppedItem()
798 {
799 return IsBush() || IsTree() || IsMan() || IsDayZCreature() || IsItemBase();
800 }
801
802 bool CanBeAutoDeleted()
803 {
804 return true;
805 }
806
809 {
810 return false;
811 }
812
815 proto void GetNetworkID( out int lowBits, out int highBits );
816
817 string GetNetworkIDString()
818 {
819 int low, high;
820 GetNetworkID( low, high );
821 return high.ToString() + low.ToString();
822 }
823
824 override string GetDebugName()
825 {
826 return GetDebugNameNative();
827 }
828
829 static string GetDebugName(Object o)
830 {
831 if (o)
832 return o.GetDebugName();
833 return "null";
834 }
835
837 proto string GetDebugNameNative();
838
840 void RPC(int rpc_type, array<ref Param> params, bool guaranteed, PlayerIdentity recipient = NULL)
841 {
842 g_Game.RPC(this, rpc_type, params, guaranteed, recipient);
843 }
844
846 void RPCSingleParam(int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient = NULL)
847 {
848 g_Game.RPCSingleParam(this, rpc_type, param, guaranteed, recipient);
849 }
850
856 void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx);
857
858 proto vector GetSelectionPositionOld(string name);
859 proto vector GetSelectionPositionLS(string name);
860 proto vector GetSelectionPositionMS(string name);
861 proto vector GetSelectionPositionWS(string name);
862
867 proto vector GetSelectionBasePositionLS(string name);
868
869 proto vector ModelToWorld(vector modelPos);
870 proto vector WorldToModel(vector worldPos);
871
872 // config class API
873
874 proto string ConfigGetString(string entryName);
881 proto string ConfigGetStringRaw(string entryName);
882 proto int ConfigGetInt(string entryName);
883 bool ConfigGetBool(string entryName)
884 {
885 return (ConfigGetInt(entryName) == 1);
886 }
887
888 proto float ConfigGetFloat(string entryName);
889 proto vector ConfigGetVector(string entryName);
890 //proto ParamEntry ConfigGetEntry(string entryName);
891
897 proto native void ConfigGetTextArray(string entryName, out TStringArray values);
898
905 proto native void ConfigGetTextArrayRaw(string entryName, out TStringArray values);
906
912 proto native void ConfigGetFloatArray(string entryName, out TFloatArray values);
913
919 proto native void ConfigGetIntArray(string entryName, out TIntArray values);
920
925 proto native bool ConfigIsExisting(string entryName);
926
928 bool KindOf( string tag )
929 {
930 string item_name = this.GetType();
931 TStringArray item_tag_array = new TStringArray;
932 ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
933
934 int array_size = item_tag_array.Count();
935 for (int i = 0; i < array_size; i++)
936 {
937 if ( item_tag_array.Get(i) == tag )
938 {
939 return true;
940 }
941 }
942 return false;
943 }
944
945 bool IsAnyInherited( array<typename> typenames )
946 {
947 int nTypenames = typenames.Count();
948 for( int i = 0; i < nTypenames; ++i )
949 {
950 if (IsInherited(typenames.Get(i)))
951 {
952 return true;
953 }
954 }
955 return false;
956 }
957
961 proto native bool IsPlainObject();
962
966 proto native bool IsScenery();
967
968 // Damage system
972 proto native bool HasDamageSystem();
973
977 proto native bool IsDamageDestroyed();
978
983 proto native void SetDestructTime(float time);
984
990 proto native float GetHealth(string zoneName, string healthType);
991
997 proto native float GetHealth01(string zoneName, string healthType);
998
1004 proto native float GetMaxHealth(string zoneName, string healthType);
1005
1011 proto native void SetHealth(string zoneName, string healthType, float value);
1012
1016 proto native void SetFullHealth();
1017
1023 proto native void AddHealth(string zoneName, string healthType, float value);
1024
1030 proto native void DecreaseHealth(string zoneName, string healthType, float value);
1031
1038 proto native bool GetAdditionalHealthTypes(string zoneName, TStringArray outHealthTypes);
1039
1045 void DecreaseHealth(string zoneName, string healthType, float value, bool auto_delete)
1046 {
1047 DecreaseHealth(zoneName, healthType, value);
1048
1049 if (auto_delete)
1050 {
1051 float result_health = GetHealth(zoneName, healthType);
1052 if (result_health <= 0)
1053 g_Game.GetCallQueue(CALL_CATEGORY_SYSTEM).Call(g_Game.ObjectDelete, this);
1054 }
1055 }
1056
1058 float GetHealth()
1059 {
1060 return GetHealth("", "");
1061 }
1063 float GetHealth01()
1064 {
1065 return GetHealth01("", "");
1066 }
1068 float GetMaxHealth()
1069 {
1070 return GetMaxHealth("", "");
1071 }
1073 void SetHealth(float health)
1074 {
1075 SetHealth("", "", health);
1076 }
1078 void SetGlobalHealth(float health)
1079 {
1080 SetHealth("", "", health);
1081 }
1083 void SetHealthLevel(int healthLevel, string zone = "")
1084 {
1085 SetHealth01(zone,"", GetHealthLevelValue(healthLevel, zone));
1086 }
1088 void AddHealthLevel(int healthLevelDelta, string zone = "")
1089 {
1090 int maxHealthLevel = GetNumberOfHealthLevels(zone) - 1;
1091 int newHealthLevel = Math.Clamp(GetHealthLevel(zone) + healthLevelDelta,0,maxHealthLevel);
1092 SetHealthLevel(newHealthLevel,zone);
1093 }
1094
1096 void SetHealth01(string zoneName, string healthType, float coef)
1097 {
1098 SetHealth(zoneName,healthType,(GetMaxHealth(zoneName,healthType)*coef));
1099 }
1101 void SetHealthMax(string zoneName = "", string healthType = "")
1102 {
1103 SetHealth(zoneName,healthType,GetMaxHealth(zoneName,healthType));
1104 }
1106 void AddHealth( float add_health)
1107 {
1108 AddHealth("", "", add_health);
1109 }
1111 void DecreaseHealth(float dec_health, bool auto_delete = true)
1112 {
1113 DecreaseHealth("", "", dec_health, auto_delete);
1114 }
1116 void DecreaseHealthCoef(float dec_health_coef, bool auto_delete = true)
1117 {
1118 float current_health = GetHealth();
1119 float final_health_coef = GetHealth01() - dec_health_coef;
1120 float final_health = GetMaxHealth() * final_health_coef;
1121 DecreaseHealth("", "", current_health - final_health);
1122 }
1123
1134 proto native void ProcessDirectDamage(int damageType, EntityAI source, string componentName, string ammoName, vector modelPos, float damageCoef = 1.0, int flags = 0);
1135
1140 bool EEOnDamageCalculated(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
1141 {
1142 return true;
1143 }
1144
1149 proto native void GetDamageZones(out TStringArray dmgZones);
1150
1155 proto native vector GetDamageZonePos(string zoneName);
1160 proto native owned string GetDamageZoneNameByComponentIndex(int componentIndex);
1161
1167 proto native int GetHealthLevel(string zone = "");
1168
1174 proto native int GetNumberOfHealthLevels(string zone = "");
1175
1181 proto native float GetHealthLevelValue(int healthLevel, string zone = "");
1182
1183
1187 proto native bool GetAllowDamage();
1192 proto native void SetAllowDamage(bool val);
1193
1197 proto native bool GetCanBeDestroyed();
1198
1203 proto native void SetCanBeDestroyed(bool val);
1204
1215 bool IsRuined()
1216 {
1217 return IsDamageDestroyed();
1218 }
1219
1221 void OnSimulationEnabled() {}
1222
1224 void OnSimulationDisabled() {}
1225
1226 void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
1227 {
1228 }
1229
1231 SoundOnVehicle PlaySound(string sound_name, float range, bool create_local = true)
1232 {
1233 return g_Game.CreateSoundOnObject(this, sound_name, range, false, create_local);
1234 }
1235
1237 SoundOnVehicle PlaySoundLoop(string sound_name, float range, bool create_local = true)
1238 {
1239 return g_Game.CreateSoundOnObject(this, sound_name, range, true, create_local);
1240 }
1241
1243 bool PlaySoundSet( out EffectSound sound, string sound_set, float fade_in, float fade_out, bool loop = false )
1244 {
1245 if ( g_Game && !g_Game.IsDedicatedServer() )
1246 {
1247 if ( sound )
1248 {
1249 if ( loop )
1250 {
1251 return true;
1252 }
1253 else
1254 {
1255 StopSoundSet( sound ); //auto stop for non-looped sounds
1256 }
1257 }
1258
1259 sound = SEffectManager.PlaySoundOnObject( sound_set, this, fade_in, fade_out, loop );
1260 sound.SetAutodestroy( true );
1261
1262 return true;
1263 }
1264
1265 return false;
1266 }
1267
1269 bool PlaySoundSetLoop( out EffectSound sound, string sound_set, float fade_in, float fade_out )
1270 {
1271 return PlaySoundSet( sound, sound_set, fade_in, fade_out, true );
1272 }
1273
1275 bool PlaySoundSetAtMemoryPointLoopedSafe(out EffectSound sound, string soundSet, string memoryPoint,float play_fade_in = 0, float stop_fade_out = 0)
1276 {
1277 if (sound && sound.IsPlaying())
1278 {
1279 sound.SoundStop();
1280 }
1281 return PlaySoundSetAtMemoryPointLooped(sound, soundSet, memoryPoint, play_fade_in, stop_fade_out);
1282 }
1283
1284 bool PlaySoundSetAtMemoryPointLooped(out EffectSound sound, string soundSet, string memoryPoint, float play_fade_in = 0, float stop_fade_out = 0)
1285 {
1286 return PlaySoundSetAtMemoryPoint(sound, soundSet, memoryPoint, true, play_fade_in, stop_fade_out);
1287 }
1288
1289
1290 bool PlaySoundSetAtMemoryPoint(out EffectSound sound, string soundSet, string memoryPoint, bool looped = false, float play_fade_in = 0, float stop_fade_out = 0)
1291 {
1292 vector pos;
1293
1294 if (MemoryPointExists(memoryPoint))
1295 {
1296 pos = GetMemoryPointPos(memoryPoint);
1297 pos = ModelToWorld(pos);
1298 }
1299 else
1300 {
1301 ErrorEx(string.Format("Memory point %1 not found when playing soundset %2 at memory point location", memoryPoint, soundSet));
1302 return false;
1303 }
1304
1305 sound = SEffectManager.PlaySoundEnviroment(soundSet, pos, play_fade_in, stop_fade_out, looped);
1306 return true;
1307 }
1308
1310 bool StopSoundSet( out EffectSound sound )
1311 {
1312 if ( sound && g_Game && ( !g_Game.IsDedicatedServer() ) )
1313 {
1314 sound.SoundStop();
1315 sound = null;
1316
1317 return true;
1318 }
1319
1320 return false;
1321 }
1322
1323 void PostAreaDamageActions();
1324 void PreAreaDamageActions();
1325
1326 void SpawnDamageDealtEffect();
1327 void OnReceivedHit(ImpactEffectsData hitData);
1328
1330 void OnPlayerRecievedHit();
1331
1332 bool HasNetworkID()
1333 {
1334 int lo = 0;
1335 int hi = 0;
1336 GetNetworkID(lo, hi);
1337 return lo | hi;
1338 }
1339
1340 bool NameOverride(out string output)
1341 {
1342 return false;
1343 }
1344
1345 bool DescriptionOverride(out string output)
1346 {
1347 return false;
1348 }
1349
1350 EntityAI ProcessMeleeItemDamage(int mode = 0) {}
1351
1352 bool CanBeRepairedToPristine()
1353 {
1354 return false;
1355 }
1356
1357 vector GetCenter()
1358 {
1359 if ( MemoryPointExists("ce_center") )
1360 {
1361 //Print("CE_CENTER found");
1362 return ModelToWorld( GetMemoryPointPos("ce_center") );
1363 }
1364 else
1365 {
1366 //Print("CE_CENTER DOING A BAMBOOZLE => not found");
1367 return GetPosition() + Vector(0, 0.2, 0);
1368 }
1369 }
1370
1371 #ifdef DEVELOPER
1372 void SetDebugItem();
1373 #endif
1374
1375 void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
1376 {
1377 int pivot = GetBonePivot(GetFireGeometryLevel(), componentIndex);
1378 vector parentTransMat[4];
1379 vector arrowTransMat[4];
1380
1381 if (pivot == -1)
1382 {
1383 GetTransform(parentTransMat);
1384 }
1385 else
1386 {
1387 GetBoneTransformWS(pivot, parentTransMat);
1388 }
1389
1390 float scale = GetScale();
1391 scale = 1 / (scale * scale);
1392
1393 arrow.GetTransform(arrowTransMat);
1394 Math3D.MatrixInvMultiply4(parentTransMat, arrowTransMat, arrowTransMat);
1395
1396 // orthogonalize matrix - parent might be skewed
1397 Math3D.MatrixOrthogonalize4(arrowTransMat);
1398
1399 arrowTransMat[3] = arrowTransMat[3] * scale;
1400
1401 arrow.SetTransform(arrowTransMat);
1402
1403 AddChild(arrow, pivot);
1404 }
1405
1406 bool CanBeActionTarget()
1407 {
1408 return !IsHologram();
1409 }
1410
1412 {
1413 return false;
1414 }
1415
1416 void OnSpawnByObjectSpawner(ITEM_SpawnerObject item);
1417
1418 bool Gizmo_IsSupported()
1419 {
1420 return !g_Game.IsMultiplayer();
1421 }
1422
1423 void Gizmo_SetWorldTransform(vector transform[4], bool finalize)
1424 {
1425 SetPosition(transform[3]);
1426 SetDirection(transform[2]);
1427
1428 SetTransform(transform);
1429
1430 // TODO: RPC or something when finalize == true to send the new transform to the server, don't forget to make 'Gizmo_IsSupported' return true
1431 }
1432
1433 void Gizmo_GetWorldTransform(vector transform[4])
1434 {
1435 GetTransform(transform);
1436 }
1437
1438 bool Gizmo_IsAllowedTransformMode(GizmoTransformMode mode)
1439 {
1440 return true;
1441 }
1442
1443 bool Gizmo_IsAllowedSpaceMode(GizmoSpaceMode mode)
1444 {
1445 return true;
1446 }
1447
1448 //Debug
1449 //----------------------------------------------
1450 /*void DbgAddPxyPhy(string slot)
1451 {
1452 Print("AddProxyPhysics slot: " + slot);
1453 AddProxyPhysics(slot);
1454 }*/
1455};
class LogManager EntityAI
eBleedingSourceType GetType()
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
override bool ShootsExplosiveAmmo()
vector GetOrientation()
override bool CanObstruct()
override bool CanUseConstruction()
override bool ShowZonesHealth()
override bool CanUseConstructionBuild()
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
override bool DisableVicinityIcon()
Definition dayzanimal.c:75
override bool HasFixedActionTargetCursorPosition()
Definition dayzanimal.c:120
override void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
Definition dayzanimal.c:80
override bool CanBeSkinned()
Definition dayzanimal.c:60
override bool IsDayZCreature()
Definition dayzanimal.c:55
DayZGame g_Game
Definition dayzgame.c:3942
override string GetDebugName()
override void OnExplosionEffects(Object source, Object directHit, int componentIndex, string surface, vector pos, vector surfNormal, float energyFactor, float explosionFactor, bool isWater, string ammoType)
override bool IsCorpse()
override bool IsMeat()
override bool IsFruit()
override bool IsMushroom()
bool IsParticle()
Check whether the Effect is EffectParticle without casting.
Definition effect.c:138
ERPCs
Definition erpcs.c:2
ETransformationAxis
EWaterSourceObjectType
override bool IsFireplace()
Serializer ParamsReadContext
Definition gameplay.c:15
class LOD Object
GizmoTransformMode
Definition gizmoapi.c:2
GizmoSpaceMode
Definition gizmoapi.c:11
enum ShapeType ErrorEx
proto native void SetPosition(vector position)
Set the world position of the Effect.
Definition effect.c:463
proto native void SetDirection(vector direction)
bool IsPendingDeletion()
Get whether the Effect is queued up for being cleaned up.
Definition effect.c:260
ShapeFlags
Definition endebug.c:126
class DiagMenu Shape
don't call destructor directly. Use Destroy() instead
array< float > TFloatArray
Definition enscript.c:713
array< string > TStringArray
Definition enscript.c:712
array< int > TIntArray
Definition enscript.c:714
const int LIQUID_NONE
Definition constants.c:532
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
proto native vector GetSpeed()
vector GetPosition()
Get the world position of the Effect.
Definition effect.c:473
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
void PlaySound()
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override bool IsItemBase()
Definition itembase.c:7684
override bool KindOf(string tag)
Definition itembase.c:7690
void OnDebug(vector p0, vector p1, bool hasHit, bool found)
Debug callback for rendering on the screen.
Definition object.c:32
bool OnCollide(Object other)
Ray cast line test from owner to a tested position.
Definition object.c:58
vector m_DirectionFunc
The size of the boundig box, centered.
Definition object.c:18
enum ProcessDirectDamageFlags m_Owner
bool OnFirstContact(Object other)
Called for first layer contacts to determine if this object should be snapped around or default rv ra...
Definition object.c:40
bool OnQuery(Object other)
Initial query around the owner position to see if an object should be processed in contact testing.
Definition object.c:49
vector m_Offset
The direction of the owner in world space.
Definition object.c:15
ProcessDirectDamageFlags
Definition object.c:2
@ NO_ATTACHMENT_TRANSFER
Do not transfer damage to attachments.
Definition object.c:4
@ ALL_TRANSFER
Definition object.c:3
@ NO_GLOBAL_TRANSFER
Do not transfer damage to global.
Definition object.c:5
@ NO_TRANSFER
NO_ATTACHMENT_TRANSFER | NO_GLOBAL_TRANSFER.
Definition object.c:6
vector m_OwnerDirection
The position of the owner in world space.
Definition object.c:13
vector m_Transform[4]
If 'OnDebug' is to be called.
Definition object.c:21
bool m_DebugEnabled
How much should the direction be favoured.
Definition object.c:20
vector m_OwnerPosition
The owner performing the snap callback.
Definition object.c:12
vector m_Extents
The true center of the bounding box of the object to be dropped in model space.
Definition object.c:16
void OnSetup()
The transformation currently being debugged.
Definition object.c:26
proto string GetDebugNameNative()
Gets the debug name for the ParticleManager.
override void OnRPC(ParamsReadContext ctx)
override void Explode(int damageType, string ammoType="")
override bool IsCuttable()
Definition woodbase.c:46
override bool IsWoodBase()
Definition woodbase.c:41
override bool CanBeActionTarget()
Definition woodbase.c:256