Dayz Explorer 1.28.160049
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 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().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 ( GetGame().IsServer() )
153 {
154 SynchExplosion();
155 DamageSystem.ExplosionDamage(EntityAI.Cast(this), null, ammoType, GetPosition(), damageType);
156 }
157 }
158
159 void SynchExplosion()
160 {
161 if ( GetGame().IsDedicatedServer() ) // Multiplayer server
162 {
163 Param1<EntityAI> p = new Param1<EntityAI>(null);
164 GetGame().RPCSingleParam( this, ERPCs.RPC_EXPLODE_EVENT, p, true);
165 }
166 else if ( !GetGame().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 GetGame().SurfaceGetNoiseMultiplier(NULL, position, -1);
395 }
396
398 string GetSurfaceType()
399 {
400 string surface_type;
401 int liquid_type;
402
403 GetGame().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 ( GetGame().ConfigIsExisting (cfg_path_vehicles) && GetGame().ConfigIsExisting (cfg_path_vehicles + "AnimationSources " + anim_name) )
432 {
433 return true;
434 }
435
436 string cfg_path_weapons = "CfgWeapons " + GetType() + " ";
437 if ( GetGame().ConfigIsExisting (cfg_path_weapons) && GetGame().ConfigIsExisting (cfg_path_weapons + "AnimationSources " + anim_name) )
438 {
439 return true;
440 }
441
442 string cfg_path_magazines = "CfgMagazines " + GetType() + " ";
443 if ( GetGame().ConfigIsExisting (cfg_path_magazines) && GetGame().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 string GetType()
471 {
472 string ret;
473 GetGame().ObjectGetType(this, ret);
474
475 return ret;
476 }
477
479 string GetDisplayName()
480 {
481 string tmp;
482 if (NameOverride(tmp))
483 {
484 tmp = Widget.TranslateString(tmp);
485 }
486 else
487 {
488 GetGame().ObjectGetDisplayName(this, tmp);
489 }
490 return tmp;
491 }
492
493 //Used to specify this object will always display it's own name when attached to another object
494 bool DisplayNameRuinAttach()
495 {
496 return false;
497 }
498
500 string GetModelName()
501 {
502 return GetGame().GetModelName(GetType());
503 }
504
506 proto native owned string GetShapeName();
507
508 int Release()
509 {
510 return GetGame().ObjectRelease(this);
511 }
512
514 bool IsKindOf(string type)
515 {
516 return GetGame().ObjectIsKindOf(this, type);
517 }
518
519 // Check alive state
520 bool IsAlive()
521 {
522 return !IsDamageDestroyed();
523 }
524
526 bool IsMan()
527 {
528 return false;
529 }
530
532 bool IsDayZCreature()
533 {
534 return false;
535 }
536
538 bool IsEntityAI()
539 {
540 return false;
541 }
542
544 bool IsStaticTransmitter()
545 {
546 return false;
547 }
548
550 bool IsTransmitter()
551 {
552 return false;
553 }
554
556 bool IsItemBase()
557 {
558 return false;
559 }
560
561 //Returns true for protector cases and similar items. Usually can be nested in other cargo while full, unlike clothing..
562 bool IsContainer()
563 {
564 return false;
565 }
566
568 bool IsMagazine()
569 {
570 return false;
571 }
572
574 bool IsAmmoPile()
575 {
576 return false;
577 }
578
580 bool IsInventoryItem()
581 {
582 return false;
583 }
584
586 bool IsClothing()
587 {
588 return false;
589 }
590
592 bool IsFireplace()
593 {
594 return false;
595 }
596
598 bool IsTree()
599 {
600 return false;
601 }
602
604 bool IsRock()
605 {
606 return false;
607 }
608
610 bool IsWoodBase()
611 {
612 return false;
613 }
614
616 bool IsBush()
617 {
618 return false;
619 }
620
621 bool IsCuttable()
622 {
623 return false;
624 }
625
627 bool IsPeltBase()
628 {
629 return false;
630 }
631
633 bool IsWeapon()
634 {
635 return false;
636 }
637
639 bool IsMeleeWeapon()
640 {
641 return false;
642 }
643
645 bool IsBuilding()
646 {
647 return false;
648 }
649
650 EWaterSourceObjectType GetWaterSourceObjectType()
651 {
652 return EWaterSourceObjectType.NONE;
653 }
654
655 int GetLiquidSourceType()
656 {
657 return LIQUID_NONE;
658 }
659
662 bool IsWell()
663 {
664 return false;
665 }
667 bool ShootsExplosiveAmmo()//placed on Object so that we can optimize early checks in DayZGame without casting
668 {
669 return false;
670 }
671
673 bool IsFuelStation()
674 {
675 return false;
676 }
677
679 bool IsTransport()
680 {
681 return false;
682 }
683
685 bool IsElectricAppliance()
686 {
687 return false;
688 }
689
691 bool CanUseConstruction()
692 {
693 return false;
694 }
695
698 {
699 return false;
700 }
701
703 bool CanUseHandConstruction()
704 {
705 return false;
706 }
707
708 bool IsBeingBackstabbed()
709 {
710 return false;
711 }
712
713 void SetBeingBackstabbed(int backstabType){}
714
716 bool IsFood()
717 {
718 return ( IsFruit() || IsMeat() || IsCorpse() || IsMushroom() );
719 }
720
721 bool IsFruit()
722 {
723 return false;
724 }
725
726 bool IsMeat()
727 {
728 return false;
729 }
730
731 bool IsCorpse()
732 {
733 return false;
734 }
735
736 bool IsMushroom()
737 {
738 return false;
739 }
740
742 bool IsHealthVisible()
743 {
744 return true;
745 }
746
748 bool ShowZonesHealth()
749 {
750 return false;
751 }
752
753 bool IsParticle()
754 {
755 return false;
756 }
757
758 bool IsItemTent()
759 {
760 return false;
761 }
762
763 bool IsScriptedLight()
764 {
765 return false;
766 }
767
768 bool IsHologram()
769 {
770 return false;
771 }
772
773 bool HasProxyParts()
774 {
775 return false;
776 }
777
778 bool CanObstruct()
779 {
780 return IsPlainObject() && !IsScenery();
781 }
782
783 bool CanProxyObstruct()
784 {
785 return HasProxyParts() || CanUseConstruction();
786 }
787
789 bool CanProxyObstructSelf()
790 {
791 return false;
792 }
793
794 bool CanBeIgnoredByDroppedItem()
795 {
796 return IsBush() || IsTree() || IsMan() || IsDayZCreature() || IsItemBase();
797 }
798
799 bool CanBeAutoDeleted()
800 {
801 return true;
802 }
803
806 {
807 return false;
808 }
809
812 proto void GetNetworkID( out int lowBits, out int highBits );
813
814 string GetNetworkIDString()
815 {
816 int low, high;
817 GetNetworkID( low, high );
818 return high.ToString() + low.ToString();
819 }
820
821 override string GetDebugName()
822 {
823 return GetDebugNameNative();
824 }
825
826 static string GetDebugName(Object o)
827 {
828 if (o)
829 return o.GetDebugName();
830 return "null";
831 }
832
834 proto string GetDebugNameNative();
835
837 void RPC(int rpc_type, array<ref Param> params, bool guaranteed, PlayerIdentity recipient = NULL)
838 {
839 GetGame().RPC(this, rpc_type, params, guaranteed, recipient);
840 }
841
843 void RPCSingleParam(int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient = NULL)
844 {
845 GetGame().RPCSingleParam(this, rpc_type, param, guaranteed, recipient);
846 }
847
853 void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx);
854
855 proto vector GetSelectionPositionOld(string name);
856 proto vector GetSelectionPositionLS(string name);
857 proto vector GetSelectionPositionMS(string name);
858 proto vector GetSelectionPositionWS(string name);
859
864 proto vector GetSelectionBasePositionLS(string name);
865
866 proto vector ModelToWorld(vector modelPos);
867 proto vector WorldToModel(vector worldPos);
868
869 // config class API
870
871 proto string ConfigGetString(string entryName);
878 proto string ConfigGetStringRaw(string entryName);
879 proto int ConfigGetInt(string entryName);
880 bool ConfigGetBool(string entryName)
881 {
882 return (ConfigGetInt(entryName) == 1);
883 }
884
885 proto float ConfigGetFloat(string entryName);
886 proto vector ConfigGetVector(string entryName);
887 //proto ParamEntry ConfigGetEntry(string entryName);
888
894 proto native void ConfigGetTextArray(string entryName, out TStringArray values);
895
902 proto native void ConfigGetTextArrayRaw(string entryName, out TStringArray values);
903
909 proto native void ConfigGetFloatArray(string entryName, out TFloatArray values);
910
916 proto native void ConfigGetIntArray(string entryName, out TIntArray values);
917
922 proto native bool ConfigIsExisting(string entryName);
923
925 bool KindOf( string tag )
926 {
927 bool found = false;
928 string item_name = this.GetType();
929 TStringArray item_tag_array = new TStringArray;
930 ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
931
932 int array_size = item_tag_array.Count();
933 for (int i = 0; i < array_size; i++)
934 {
935 if ( item_tag_array.Get(i) == tag )
936 {
937 found = true;
938 break;
939 }
940 }
941 return found;
942 }
943
944 bool IsAnyInherited( array<typename> typenames )
945 {
946 bool ret;
947 for( int i = 0; i < typenames.Count(); i++ )
948 {
949 ret = ret || this.IsInherited( typenames.Get(i) );
950 }
951 return ret;
952 }
953
957 proto native bool IsPlainObject();
958
962 proto native bool IsScenery();
963
964 // Damage system
968 proto native bool HasDamageSystem();
969
973 proto native bool IsDamageDestroyed();
974
979 proto native void SetDestructTime(float time);
980
986 proto native float GetHealth(string zoneName, string healthType);
987
993 proto native float GetHealth01(string zoneName, string healthType);
994
1000 proto native float GetMaxHealth(string zoneName, string healthType);
1001
1007 proto native void SetHealth(string zoneName, string healthType, float value);
1008
1012 proto native void SetFullHealth();
1013
1019 proto native void AddHealth(string zoneName, string healthType, float value);
1020
1026 proto native void DecreaseHealth(string zoneName, string healthType, float value);
1027
1034 proto native bool GetAdditionalHealthTypes(string zoneName, TStringArray outHealthTypes);
1035
1041 void DecreaseHealth(string zoneName, string healthType, float value, bool auto_delete)
1042 {
1043 DecreaseHealth(zoneName, healthType, value);
1044
1045 if (auto_delete)
1046 {
1047 float result_health = GetHealth(zoneName, healthType);
1048 if (result_health <= 0)
1049 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Call(GetGame().ObjectDelete, this);
1050 }
1051 }
1052
1054 float GetHealth()
1055 {
1056 return GetHealth("", "");
1057 }
1059 float GetHealth01()
1060 {
1061 return GetHealth01("", "");
1062 }
1064 float GetMaxHealth()
1065 {
1066 return GetMaxHealth("", "");
1067 }
1069 void SetHealth(float health)
1070 {
1071 SetHealth("", "", health);
1072 }
1074 void SetGlobalHealth(float health)
1075 {
1076 SetHealth("", "", health);
1077 }
1079 void SetHealthLevel(int healthLevel, string zone = "")
1080 {
1081 SetHealth01(zone,"", GetHealthLevelValue(healthLevel, zone));
1082 }
1084 void AddHealthLevel(int healthLevelDelta, string zone = "")
1085 {
1086 int maxHealthLevel = GetNumberOfHealthLevels(zone) - 1;
1087 int newHealthLevel = Math.Clamp(GetHealthLevel(zone) + healthLevelDelta,0,maxHealthLevel);
1088 SetHealthLevel(newHealthLevel,zone);
1089 }
1090
1092 void SetHealth01(string zoneName, string healthType, float coef)
1093 {
1094 SetHealth(zoneName,healthType,(GetMaxHealth(zoneName,healthType)*coef));
1095 }
1097 void SetHealthMax(string zoneName = "", string healthType = "")
1098 {
1099 SetHealth(zoneName,healthType,GetMaxHealth(zoneName,healthType));
1100 }
1102 void AddHealth( float add_health)
1103 {
1104 AddHealth("", "", add_health);
1105 }
1107 void DecreaseHealth(float dec_health, bool auto_delete = true)
1108 {
1109 DecreaseHealth("", "", dec_health, auto_delete);
1110 }
1112 void DecreaseHealthCoef(float dec_health_coef, bool auto_delete = true)
1113 {
1114 float current_health = GetHealth();
1115 float final_health_coef = GetHealth01() - dec_health_coef;
1116 float final_health = GetMaxHealth() * final_health_coef;
1117 DecreaseHealth("", "", current_health - final_health);
1118 }
1119
1130 proto native void ProcessDirectDamage(int damageType, EntityAI source, string componentName, string ammoName, vector modelPos, float damageCoef = 1.0, int flags = 0);
1131
1136 bool EEOnDamageCalculated(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
1137 {
1138 return true;
1139 }
1140
1145 proto native void GetDamageZones(out TStringArray dmgZones);
1146
1151 proto native vector GetDamageZonePos(string zoneName);
1156 proto native owned string GetDamageZoneNameByComponentIndex(int componentIndex);
1157
1163 proto native int GetHealthLevel(string zone = "");
1164
1170 proto native int GetNumberOfHealthLevels(string zone = "");
1171
1177 proto native float GetHealthLevelValue(int healthLevel, string zone = "");
1178
1179
1183 proto native bool GetAllowDamage();
1188 proto native void SetAllowDamage(bool val);
1189
1193 proto native bool GetCanBeDestroyed();
1194
1199 proto native void SetCanBeDestroyed(bool val);
1200
1211 bool IsRuined()
1212 {
1213 return IsDamageDestroyed();
1214 }
1215
1217 void OnSimulationEnabled() {}
1218
1220 void OnSimulationDisabled() {}
1221
1222 void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
1223 {
1224 }
1225
1227 SoundOnVehicle PlaySound(string sound_name, float range, bool create_local = true)
1228 {
1229 return GetGame().CreateSoundOnObject(this, sound_name, range, false, create_local);
1230 }
1231
1233 SoundOnVehicle PlaySoundLoop(string sound_name, float range, bool create_local = true)
1234 {
1235 return GetGame().CreateSoundOnObject(this, sound_name, range, true, create_local);
1236 }
1237
1239 bool PlaySoundSet( out EffectSound sound, string sound_set, float fade_in, float fade_out, bool loop = false )
1240 {
1241 if ( GetGame() && !GetGame().IsDedicatedServer() )
1242 {
1243 if ( sound )
1244 {
1245 if ( loop )
1246 {
1247 return true;
1248 }
1249 else
1250 {
1251 StopSoundSet( sound ); //auto stop for non-looped sounds
1252 }
1253 }
1254
1255 sound = SEffectManager.PlaySoundOnObject( sound_set, this, fade_in, fade_out, loop );
1256 sound.SetAutodestroy( true );
1257
1258 return true;
1259 }
1260
1261 return false;
1262 }
1263
1265 bool PlaySoundSetLoop( out EffectSound sound, string sound_set, float fade_in, float fade_out )
1266 {
1267 return PlaySoundSet( sound, sound_set, fade_in, fade_out, true );
1268 }
1269
1271 bool PlaySoundSetAtMemoryPointLoopedSafe(out EffectSound sound, string soundSet, string memoryPoint,float play_fade_in = 0, float stop_fade_out = 0)
1272 {
1273 if (sound && sound.IsPlaying())
1274 {
1275 sound.SoundStop();
1276 }
1277 return PlaySoundSetAtMemoryPointLooped(sound, soundSet, memoryPoint, play_fade_in, stop_fade_out);
1278 }
1279
1280 bool PlaySoundSetAtMemoryPointLooped(out EffectSound sound, string soundSet, string memoryPoint, float play_fade_in = 0, float stop_fade_out = 0)
1281 {
1282 return PlaySoundSetAtMemoryPoint(sound, soundSet, memoryPoint, true, play_fade_in, stop_fade_out);
1283 }
1284
1285
1286 bool PlaySoundSetAtMemoryPoint(out EffectSound sound, string soundSet, string memoryPoint, bool looped = false, float play_fade_in = 0, float stop_fade_out = 0)
1287 {
1288 vector pos;
1289
1290 if (MemoryPointExists(memoryPoint))
1291 {
1292 pos = GetMemoryPointPos(memoryPoint);
1293 pos = ModelToWorld(pos);
1294 }
1295 else
1296 {
1297 ErrorEx(string.Format("Memory point %1 not found when playing soundset %2 at memory point location", memoryPoint, soundSet));
1298 return false;
1299 }
1300
1301 sound = SEffectManager.PlaySoundEnviroment(soundSet, pos, play_fade_in, stop_fade_out, looped);
1302 return true;
1303 }
1304
1306 bool StopSoundSet( out EffectSound sound )
1307 {
1308 if ( sound && GetGame() && ( !GetGame().IsDedicatedServer() ) )
1309 {
1310 sound.SoundStop();
1311 sound = null;
1312
1313 return true;
1314 }
1315
1316 return false;
1317 }
1318
1319 void PostAreaDamageActions();
1320 void PreAreaDamageActions();
1321
1322 void SpawnDamageDealtEffect();
1323 void OnReceivedHit(ImpactEffectsData hitData);
1324
1326 void OnPlayerRecievedHit();
1327
1328 bool HasNetworkID()
1329 {
1330 int lo = 0;
1331 int hi = 0;
1332 GetNetworkID(lo, hi);
1333 return lo | hi;
1334 }
1335
1336 bool NameOverride(out string output)
1337 {
1338 return false;
1339 }
1340
1341 bool DescriptionOverride(out string output)
1342 {
1343 return false;
1344 }
1345
1346 EntityAI ProcessMeleeItemDamage(int mode = 0) {}
1347
1348 bool CanBeRepairedToPristine()
1349 {
1350 return false;
1351 }
1352
1353 vector GetCenter()
1354 {
1355 if ( MemoryPointExists("ce_center") )
1356 {
1357 //Print("CE_CENTER found");
1358 return ModelToWorld( GetMemoryPointPos("ce_center") );
1359 }
1360 else
1361 {
1362 //Print("CE_CENTER DOING A BAMBOOZLE => not found");
1363 return GetPosition() + Vector(0, 0.2, 0);
1364 }
1365 }
1366
1367 #ifdef DEVELOPER
1368 void SetDebugItem();
1369 #endif
1370
1371 void AddArrow(Object arrow, int componentIndex, vector closeBonePosWS, vector closeBoneRotWS)
1372 {
1373 int pivot = GetBonePivot(GetFireGeometryLevel(), componentIndex);
1374 vector parentTransMat[4];
1375 vector arrowTransMat[4];
1376
1377 if (pivot == -1)
1378 {
1379 GetTransform(parentTransMat);
1380 }
1381 else
1382 {
1383 GetBoneTransformWS(pivot, parentTransMat);
1384 }
1385
1386 float scale = GetScale();
1387 scale = 1 / (scale * scale);
1388
1389 arrow.GetTransform(arrowTransMat);
1390 Math3D.MatrixInvMultiply4(parentTransMat, arrowTransMat, arrowTransMat);
1391
1392 // orthogonalize matrix - parent might be skewed
1393 Math3D.MatrixOrthogonalize4(arrowTransMat);
1394
1395 arrowTransMat[3] = arrowTransMat[3] * scale;
1396
1397 arrow.SetTransform(arrowTransMat);
1398
1399 AddChild(arrow, pivot);
1400 }
1401
1402 bool CanBeActionTarget()
1403 {
1404 return !IsHologram();
1405 }
1406
1408 {
1409 return false;
1410 }
1411
1412 void OnSpawnByObjectSpawner(ITEM_SpawnerObject item)
1413 {}
1414
1415 bool Gizmo_IsSupported()
1416 {
1417 return !GetGame().IsMultiplayer();
1418 }
1419
1420 void Gizmo_SetWorldTransform(vector transform[4], bool finalize)
1421 {
1422 SetPosition(transform[3]);
1423 SetDirection(transform[2]);
1424
1425 SetTransform(transform);
1426
1427 // TODO: RPC or something when finalize == true to send the new transform to the server, don't forget to make 'Gizmo_IsSupported' return true
1428 }
1429
1430 void Gizmo_GetWorldTransform(vector transform[4])
1431 {
1432 GetTransform(transform);
1433 }
1434
1435 //Debug
1436 //----------------------------------------------
1437 /*void DbgAddPxyPhy(string slot)
1438 {
1439 Print("AddProxyPhysics slot: " + slot);
1440 AddProxyPhysics(slot);
1441 }*/
1442};
eBleedingSourceType GetType()
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
override bool ShootsExplosiveAmmo()
vector GetOrientation()
override bool CanUseConstruction()
override bool ShowZonesHealth()
override bool CanUseConstructionBuild()
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Static data holder for certain ammo config values.
Definition ammoeffects.c:6
proto native bool IsMultiplayer()
bool ObjectIsKindOf(Object object, string cfg_parent_name)
Returns is object inherited from parent class name.
Definition game.c:1446
proto void SurfaceUnderObject(notnull Object object, out string type, out int liquidType)
proto native float SurfaceGetNoiseMultiplier(Object directHit, vector pos, int componentIndex)
Wrapper class for managing sound through SEffectManager.
Definition effectsound.c:5
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
LOD class.
Definition gameplay.c:204
Definition enmath.c:7
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
The class that will be instanced (moddable)
Definition gameplay.c:389
Manager class for managing Effect (EffectParticle, EffectSound)
static EffectSound PlaySoundEnviroment(string sound_set, vector position, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound, updating environment variables.
static EffectSound PlaySoundOnObject(string sound_set, Object parent_object, float play_fade_in=0, float stop_fade_out=0, bool loop=false)
Create and play an EffectSound.
Serialization general interface. Serializer API works with:
Definition serializer.c:56
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
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
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()
class LOD Object
proto native CGame GetGame()
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< string > TStringArray
Definition enscript.c:709
const int LIQUID_NONE
Definition constants.c:529
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
proto native vector GetSpeed()
class JsonUndergroundAreaTriggerData GetPosition
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
void PlaySound()
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
override bool IsItemBase()
Definition itembase.c:7606
override bool KindOf(string tag)
Definition itembase.c:7612
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