dayzplayer.c 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396
  1. /** @file
  2. this file is interface DayZPlayer classes
  3. */
  4. // *************************************************************************************
  5. // ! DayZPlayerCameraResult - camera result -
  6. // *************************************************************************************
  7. class DayZPlayerCameraResult
  8. {
  9. vector m_CameraTM[4]; //!< transformation matrix - pos + orient of the camera
  10. float m_fFovMultiplier; //!< fov multiplier - 1.0 default - used for modifying fov -
  11. float m_fFovAbsolute; //!< fov absolute value override - -1.0 default, if set - overrides absolute fov setting
  12. float m_fNearPlane; //!< nearplane distance
  13. float m_fPositionModelSpace; //!< 0.0 position is in heading space, 1.0 position is in model space
  14. float m_fDistance; //!< camera distance (external cameras only)
  15. float m_fUseHeading; //!< 0..1 (0 uses direct dir returned, 1 uses heading from player)
  16. float m_fPredictCollisionRadius; //!< sphere radius used for collision prediction
  17. int m_iDirectBone; //!< -1 no bone, >= 0 - bone index camera is bound to, m_CameraTM is offset to the bone
  18. int m_iDirectBoneMode; //! 0 not used, 1 - pos, 2 - rot, 3 - pos+rot applied as a parent to m_CameraTM, 4 as 3 but cam aligned with Y
  19. float m_fInsideCamera; //!< 0..1 (0 normal lod, 1 inside lod), >0.7 -> inside
  20. bool m_bUpdateWhenBlendOut; //!< true - camera is updated when blending to new camera (Ironsights == false)
  21. float m_fShootFromCamera; //!< 1(default) - uses shoot from camera (+aiming sway), 0 pure weapon shoot (ironsights == 0)
  22. float m_fIgnoreParentRoll; //!< 1 - resets base transforms roll
  23. float m_fIgnoreParentPitch; //!< 1 - resets base transforms pitch
  24. float m_fIgnoreParentYaw; //!< 1 - resets base transforms yaw
  25. bool m_bUpdateEveryFrame; //!< Whether the camera updates the next frame or blends with next character update
  26. vector m_OwnerTM[4]; //!< override automatically calculated owner transform during rendering (default - false)
  27. bool m_bOwnerTMOverride; //!< The world space transform of the owner to the camera
  28. IEntity m_CollisionIgnoreEntity; //!< ignore entity in 3rd person camera collision solver
  29. //! cannot be instanced from script (always created from C++)
  30. private void DayZPlayerCameraResult()
  31. {
  32. }
  33. //! cannot be instanced from script (always created from C++)
  34. private void ~DayZPlayerCameraResult()
  35. {
  36. }
  37. }
  38. // *************************************************************************************
  39. // ! DayZPlayerCamera - main dayz player camera implement
  40. // *************************************************************************************
  41. class DayZPlayerCamera
  42. {
  43. void DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
  44. {
  45. m_pPlayer = pPlayer;
  46. m_pInput = pInput;
  47. }
  48. //! this overrides freelook for cameras
  49. bool CanFreeLook()
  50. {
  51. return true;
  52. }
  53. //! virtual callback - called when camera is created
  54. void OnActivate(DayZPlayerCamera pPrevCamera, DayZPlayerCameraResult pPrevCameraResult)
  55. {
  56. }
  57. //! virtual callback - called each frame
  58. void OnUpdate(float pDt, out DayZPlayerCameraResult pOutResult)
  59. {
  60. }
  61. //! helper to blend between cameras
  62. //! ret[0] - up down angle
  63. //! ret[1] - left right angle
  64. //! ret[2] - roll angle
  65. vector GetBaseAngles()
  66. {
  67. return "0 0 0";
  68. }
  69. vector GetAdditiveAngles()
  70. {
  71. return "0 0 0";
  72. }
  73. string GetCameraName()
  74. {
  75. return "DayZPlayerCamera";
  76. }
  77. float GetCurrentYaw()
  78. {
  79. return -1;
  80. }
  81. float GetCurrentPitch()
  82. {
  83. return -1;
  84. }
  85. float GetCurrentRoll()
  86. {
  87. return -1;
  88. }
  89. vector GetCurrentOrientation()
  90. {
  91. return Vector(GetCurrentYaw(), GetCurrentPitch(), GetCurrentRoll());
  92. }
  93. bool IsCamera3rdRaised()
  94. {
  95. return false;
  96. }
  97. void SpawnDiagCameraShake()
  98. {
  99. SpawnCameraShakeProper(1, 1, 15, 4);
  100. }
  101. void SpawnCameraShake(float strength = 1, float radius = 2, float smoothness = 5, float radius_decay_speed = 6)
  102. {
  103. SpawnCameraShakeProper(strength, radius, smoothness, radius_decay_speed);//done this way in order to avoid duplicating default params which could cause issues under certain circumstances
  104. }
  105. void SpawnCameraShakeProper(float strength, float radius, float smoothness, float radius_decay_speed);
  106. //! data
  107. protected DayZPlayer m_pPlayer; //!< player camera is attached to
  108. protected HumanInputController m_pInput; //!< human input
  109. //! m_fCamPosOffsetZ info, used to adjust near plane in DayZPlayerCameraIronsights now
  110. void SendRecoilOffsetZ(float offset) {};
  111. }
  112. // *************************************************************************************
  113. // ! DayZPlayerTypeStepSoundLookupTable - virtual
  114. // *************************************************************************************
  115. class DayZPlayerTypeStepSoundLookupTable
  116. {
  117. SoundObjectBuilder GetSoundBuilder(int eventId, int pMovement, int pSurfaceHash, AnimBootsType pBoots)
  118. {
  119. return null;
  120. }
  121. }
  122. // *************************************************************************************
  123. // ! DayZPlayerTypeVoiceSoundLookupTable - virtual
  124. // *************************************************************************************
  125. class DayZPlayerTypeVoiceSoundLookupTable
  126. {
  127. SoundObjectBuilder GetSoundBuilder(int eventId, int parameterHash)
  128. {
  129. return null;
  130. }
  131. NoiseParams GetNoiseParams(int eventId);
  132. }
  133. // *************************************************************************************
  134. // ! DayZPlayerTypeAttachmentSoundLookupTable - virtual
  135. // *************************************************************************************
  136. class DayZPlayerTypeAttachmentSoundLookupTable
  137. {
  138. SoundObjectBuilder GetSoundBuilder(int eventId, string slotName, int attachmentHash)
  139. {
  140. return null;
  141. }
  142. }
  143. class DayZPlayerTypeAnimTable
  144. {
  145. AnimSoundEvent GetSoundEvent(int event_id)
  146. {
  147. return null;
  148. }
  149. }
  150. // *************************************************************************************
  151. // ! VegetationSound
  152. // *************************************************************************************
  153. class VegetationSound
  154. {
  155. private ref SoundObjectBuilder m_SoundObjectBuilder;
  156. private ref TIntArray m_AnimEventIds;
  157. void VegetationSound(SoundObjectBuilder soundObjectBuilder, TIntArray animEventIds)
  158. {
  159. m_SoundObjectBuilder = soundObjectBuilder;
  160. m_AnimEventIds = animEventIds;
  161. }
  162. SoundObjectBuilder GetSoundObjectBuilder()
  163. {
  164. return m_SoundObjectBuilder;
  165. }
  166. TIntArray GetAnimEventIds()
  167. {
  168. return m_AnimEventIds;
  169. }
  170. }
  171. // *************************************************************************************
  172. // ! DayZPlayerType - DayZPlayer configuration
  173. // *************************************************************************************
  174. //! class that configures static data for DayZPlayer
  175. //! on each mission start DayZPlayerTypeCreate(DayZPlayerType pType) is called - can call methods
  176. class DayZPlayerType
  177. {
  178. //!----------------------------------------------------
  179. // item in hands config
  180. //!
  181. proto native void SetDefaultItemInHandsProfile(string pAnimInstanceName, HumanItemBehaviorCfg pBehaviorCfg);
  182. //! reset profiles
  183. proto native void ResetItemInHandsProfiles();
  184. //! adds setup profile for items of class pItemClass
  185. //! when item is in hands - pAnimInstanceName is used for animation sourcing
  186. //! pCanRaise is whether weapon / item can be raised
  187. //! pRHandIK == false -> rhand ik is always turned off
  188. //! pLHandIK == false -> lhand ik is always turned off
  189. //! VKOSTIK: DO NOT FORGET !!! HumanItemBehaviorCfg.m_iPerItemCameraUD - per item camera user data - enables you setup different cameras for different items in hands
  190. //!
  191. proto native int AddItemInHandsProfile(string pItemClass, string pAnimInstanceName, HumanItemBehaviorCfg pBehaviorCfg);
  192. //!
  193. proto native int AddItemInHandsProfileIK(string pItemClass, string pAnimInstanceName, HumanItemBehaviorCfg pBehaviorCfg, string pIkPoseAnim, string pWeaponStates = "");
  194. //! add bone remap for item class
  195. //! pBoneRemap has always 2x N members
  196. //! bone in item's P3D first, bone in Character skeleton second
  197. //! array<string> remap = { "bolt", "Weapon_Bolt", "magazine", "Weapon_Magazine", "trigger", "Weapon_Trigger" };
  198. //! AddItemBoneRemap("class", remap);
  199. proto native int AddItemBoneRemap(string pItemClass, array<string> pBoneRemap);
  200. //! debug / hack - loads all animation instances
  201. proto native void DebugPreloadAnimationInstances();
  202. //!----------------------------------------------------
  203. // camera creators
  204. //! resets camera creators
  205. proto native void ResetCameraCreators();
  206. //! registers camera creator - camera type => camera type (must be descendant of DayZPlayerCamera)
  207. proto native void RegisterCameraCreator(int pCameraID, typename pCameraType);
  208. //! registers camera on change function - static function
  209. proto native void RegisterCameraOnChangeFnStatic(typename pClass, string pFnName);
  210. //! registers camera on change function -
  211. proto native void RegisterCameraOnChangeFn(Class pInstance, string pFnName);
  212. //!----------------------------------------------------
  213. // global options
  214. //! sets look limits for a player
  215. proto native void SetLookLimits(float pDown, float pUp, float pLeft, float pRight);
  216. //! sets aim limits for a player
  217. proto native void SetAimLimits(float pDown, float pUp, float pLeft, float pRight);
  218. //! sets vertical minimum aim limit for a player
  219. proto native void SetVerticalMinimumAimLimit(float value);
  220. //! sets aim limits for a player
  221. proto native void SetCameraShootParams(float pRayDistance, float pRayRadius, float pMaxAngleCos);
  222. //!----------------------------------------------------
  223. // bone indices
  224. proto native int GetHeadBoneIdx();
  225. //!----------------------------------------------------
  226. // event handling
  227. //! calls DayZPlayer.OnStepEvent();
  228. proto native void RegisterStepEvent(string pEventType, float pFilterTimeout);
  229. //! calls DayZPlayer.OnSoundEvent();
  230. proto native void RegisterSoundEvent(string pEventType, float pFilterTimeout);
  231. //! calls DayZPlayer.OnParticleEvent();
  232. proto native void RegisterParticleEvent(string pEventType, float pFilterTimeout);
  233. void RegisterStepSoundLookupTable(DayZPlayerTypeStepSoundLookupTable pSSLUT)
  234. {
  235. m_pStepSoundLookupTable = pSSLUT;
  236. }
  237. DayZPlayerTypeStepSoundLookupTable GetStepSoundLookupTable()
  238. {
  239. return m_pStepSoundLookupTable;
  240. }
  241. void RegisterAttachmentSoundLookupTable(DayZPlayerTypeAttachmentSoundLookupTable pASLUT)
  242. {
  243. m_pAttachmentSoundLookupTable = pASLUT;
  244. }
  245. DayZPlayerTypeAttachmentSoundLookupTable GetAttachmentSoundLookupTable()
  246. {
  247. return m_pAttachmentSoundLookupTable;
  248. }
  249. void RegisterVoiceSoundLookupTable(DayZPlayerTypeVoiceSoundLookupTable pASLUT)
  250. {
  251. m_pVoiceSoundLookupTable = pASLUT;
  252. }
  253. DayZPlayerTypeVoiceSoundLookupTable GetVoiceSoundLookupTable()
  254. {
  255. return m_pVoiceSoundLookupTable;
  256. }
  257. void RegisterSoundTable(DayZPlayerTypeAnimTable pST)
  258. {
  259. m_pSoundTable = pST;
  260. }
  261. DayZPlayerTypeAnimTable GetSoundTable()
  262. {
  263. return m_pSoundTable;
  264. }
  265. /*
  266. void RegisterSoundVoiceTable(DayZPlayerTypeAnimTable pVST)
  267. {
  268. m_pSoundVoiceTable = pVST;
  269. }
  270. DayZPlayerTypeAnimTable GetSoundVoiceTable()
  271. {
  272. return m_pSoundVoiceTable;
  273. }
  274. */
  275. array<ref VegetationSound> GetVegetationSounds()
  276. {
  277. return m_pVegetationSounds;
  278. }
  279. NoiseParams GetNoiseParamsStand()
  280. {
  281. return m_pNoiseStepStand;
  282. }
  283. NoiseParams GetNoiseParamsCrouch()
  284. {
  285. return m_pNoiseStepCrouch;
  286. }
  287. NoiseParams GetNoiseParamsProne()
  288. {
  289. return m_pNoiseStepProne;
  290. }
  291. NoiseParams GetNoiseParamsLandLight()
  292. {
  293. return m_pNoiseLandLight;
  294. }
  295. NoiseParams GetNoiseParamsLandHeavy()
  296. {
  297. return m_pNoiseLandHeavy;
  298. }
  299. NoiseParams GetNoiseParamsWhisper()
  300. {
  301. return m_pNoiseWhisper;
  302. }
  303. NoiseParams GetNoiseParamsTalk()
  304. {
  305. return m_pNoiseTalk;
  306. }
  307. NoiseParams GetNoiseParamsShout()
  308. {
  309. return m_pNoiseShout;
  310. }
  311. void LoadSoundWeaponEvent()
  312. {
  313. string cfgPath = "CfgVehicles SurvivorBase AnimEvents SoundWeapon ";
  314. m_animSoundEventsAttack = new array<ref AnimSoundEvent>;
  315. int soundCount = GetGame().ConfigGetChildrenCount(cfgPath);
  316. for(int i = 0; i < soundCount; i++)
  317. {
  318. string soundName;
  319. GetGame().ConfigGetChildName(cfgPath, i, soundName);
  320. string soundPath = cfgPath + soundName + " ";
  321. AnimSoundEvent soundEvent = new AnimSoundEvent(soundPath);
  322. if(soundEvent.IsValid())
  323. m_animSoundEventsAttack.Insert(soundEvent);
  324. }
  325. }
  326. void LoadVegetationSounds()
  327. {
  328. m_pVegetationSounds = new array<ref VegetationSound>;
  329. string vegSoundsCfgPath = "CfgVehicles SurvivorBase VegetationSounds ";
  330. int vegSoundsCount = GetGame().ConfigGetChildrenCount(vegSoundsCfgPath);
  331. for (int v = 0; v < vegSoundsCount; ++v)
  332. {
  333. string vegSoundParamName;
  334. GetGame().ConfigGetChildName(vegSoundsCfgPath, v, vegSoundParamName);
  335. string soundSet = "";
  336. GetGame().ConfigGetText(vegSoundsCfgPath + vegSoundParamName + " soundSet", soundSet);
  337. TIntArray animEventIds = new TIntArray;
  338. GetGame().ConfigGetIntArray(vegSoundsCfgPath + vegSoundParamName + " animEventIds", animEventIds);
  339. SoundParams soundParams = new SoundParams(soundSet);
  340. if (soundParams.IsValid() && animEventIds.Count() > 0)
  341. {
  342. m_pVegetationSounds.Insert(new VegetationSound(new SoundObjectBuilder(soundParams), animEventIds));
  343. }
  344. }
  345. }
  346. AnimSoundEvent GetSoundWeaponEvent(int event_id)
  347. {
  348. foreach (AnimSoundEvent soundEvent : m_animSoundEventsAttack)
  349. {
  350. if (soundEvent.m_iID == event_id)
  351. return soundEvent;
  352. }
  353. return null;
  354. }
  355. //! register hit components for AI melee (used by attacking AI)
  356. void RegisterHitComponentsForAI()
  357. {
  358. m_HitComponentsForAI = new array<ref DayZAIHitComponent>;
  359. //! registers default hit compoent for entity
  360. m_DefaultHitComponent = "dmgZone_torso";
  361. //! registers default hit position for entity
  362. m_DefaultHitPositionComponent = "Pelvis";
  363. //! list of components suitable for melee finisher attacks (used in fight logic)
  364. m_SuitableFinisherHitComponents = new array<string>;
  365. m_SuitableFinisherHitComponents.Insert("Head");
  366. //! register hit components that are selected by probability
  367. //DayZAIHitComponentHelpers.RegisterHitComponent(m_HitComponentsForAI, "dmgZone_head", 5); // TMP comment out
  368. DayZAIHitComponentHelpers.RegisterHitComponent(m_HitComponentsForAI, "dmgZone_leftArm", 50);
  369. DayZAIHitComponentHelpers.RegisterHitComponent(m_HitComponentsForAI, "dmgZone_torso", 65);
  370. DayZAIHitComponentHelpers.RegisterHitComponent(m_HitComponentsForAI, "dmgZone_rightArm", 50);
  371. DayZAIHitComponentHelpers.RegisterHitComponent(m_HitComponentsForAI, "dmgZone_leftLeg", 40);
  372. DayZAIHitComponentHelpers.RegisterHitComponent(m_HitComponentsForAI, "dmgZone_rightLeg", 40);
  373. }
  374. string GetHitComponentForAI()
  375. {
  376. string hitComp;
  377. if (DayZAIHitComponentHelpers.SelectMostProbableHitComponent(m_HitComponentsForAI, hitComp))
  378. {
  379. return hitComp;
  380. }
  381. return GetDefaultHitComponent();
  382. }
  383. string GetDefaultHitComponent()
  384. {
  385. return m_DefaultHitComponent;
  386. }
  387. string GetDefaultHitPositionComponent()
  388. {
  389. return m_DefaultHitPositionComponent;
  390. }
  391. array<string> GetSuitableFinisherHitComponents()
  392. {
  393. return m_SuitableFinisherHitComponents;
  394. }
  395. private void DayZPlayerType()
  396. {
  397. string cfgPath = "CfgVehicles SurvivorBase ";
  398. m_pNoiseStepStand = new NoiseParams();
  399. m_pNoiseStepStand.LoadFromPath(cfgPath + "NoiseStepStand");
  400. m_pNoiseStepCrouch = new NoiseParams();
  401. m_pNoiseStepCrouch.LoadFromPath(cfgPath + "NoiseStepCrouch");
  402. m_pNoiseStepProne = new NoiseParams();
  403. m_pNoiseStepProne.LoadFromPath(cfgPath + "NoiseStepProne");
  404. m_pNoiseLandLight = new NoiseParams();
  405. m_pNoiseLandLight.LoadFromPath(cfgPath + "NoiseLandLight");
  406. m_pNoiseLandHeavy = new NoiseParams();
  407. m_pNoiseLandHeavy.LoadFromPath(cfgPath + "NoiseLandHeavy");
  408. m_pNoiseWhisper = new NoiseParams();
  409. m_pNoiseWhisper.LoadFromPath(cfgPath + "NoiseWhisper");
  410. m_pNoiseTalk = new NoiseParams();
  411. m_pNoiseTalk.LoadFromPath(cfgPath + "NoiseTalk");
  412. m_pNoiseShout = new NoiseParams();
  413. m_pNoiseShout.LoadFromPath(cfgPath + "NoiseShout");
  414. LoadSoundWeaponEvent();
  415. LoadVegetationSounds();
  416. }
  417. private void ~DayZPlayerType();
  418. //!----------------------------------------------------
  419. // global settings
  420. //! returns Human global settings for DayZPlayer
  421. proto native SHumanGlobalSettings GetGlobalSettingsW();
  422. //!----------------------------------------------------
  423. // command configs
  424. // returns command move setting for write - in init phase
  425. proto native SHumanCommandMoveSettings CommandMoveSettingsW();
  426. // returns command swim setting for write - in init phase
  427. proto native SHumanCommandSwimSettings CommandSwimSettingsW();
  428. // returns command swim setting for write - in init phase
  429. proto native SHumanCommandClimbSettings CommandClimbSettingsW();
  430. //!< this is used for getting appropriate sound effect to play step event on various surfaces && boots
  431. //!< it's downcasted to StepSoundLookupTable
  432. ref DayZPlayerTypeStepSoundLookupTable m_pStepSoundLookupTable;
  433. ref DayZPlayerTypeAttachmentSoundLookupTable m_pAttachmentSoundLookupTable;
  434. ref DayZPlayerTypeVoiceSoundLookupTable m_pVoiceSoundLookupTable;
  435. ref DayZPlayerTypeAnimTable m_pSoundTable;
  436. //ref DayZPlayerTypeAnimTable m_pSoundVoiceTable;
  437. ref NoiseParams m_pNoiseStepStand;
  438. ref NoiseParams m_pNoiseStepCrouch;
  439. ref NoiseParams m_pNoiseStepProne;
  440. ref NoiseParams m_pNoiseLandLight;
  441. ref NoiseParams m_pNoiseLandHeavy;
  442. // von noises
  443. ref NoiseParams m_pNoiseWhisper;
  444. ref NoiseParams m_pNoiseTalk;
  445. ref NoiseParams m_pNoiseShout;
  446. ref array<ref VegetationSound> m_pVegetationSounds;
  447. //! Melee hit components (AI targeting)
  448. protected ref array<ref DayZAIHitComponent> m_HitComponentsForAI;
  449. protected string m_DefaultHitComponent;
  450. protected string m_DefaultHitPositionComponent;
  451. protected ref array<string> m_SuitableFinisherHitComponents;
  452. ref array<ref AnimSoundEvent> m_animSoundEventsAttack;
  453. }
  454. // *************************************************************************************
  455. // ! DayZPlayerConstants - dayz player constants
  456. // *************************************************************************************
  457. //! defined in C++
  458. enum DayZPlayerConstants
  459. {
  460. //! ---------------------------------------------------------
  461. //! ---------------------- movement stances -----------------
  462. //! ---------------------------------------------------------
  463. DEBUG_MENU, //!< dayz player debug menu in enfusion
  464. DEBUG_TURNSLIDE, //!< over turn slides / clamps
  465. DEBUG_SHOWDEBUGPLUGIN, //!< menu for showing debug plugin
  466. DEBUG_SHOWINJURY, //!< menu for showing injuries
  467. DEBUG_SHOWEXHAUSTION, //!< menu for showing exhaustion
  468. DEBUG_ENABLEJUMP, //!< menu for showing exhaustion
  469. DEBUG_ENABLETALKING, //!< option for showing talk command
  470. //! ---------------------------------------------------------
  471. //! ---------------------- movement stances -----------------
  472. //! ---------------------------------------------------------
  473. STANCEIDX_ERECT,
  474. STANCEIDX_CROUCH,
  475. STANCEIDX_PRONE,
  476. STANCEIDX_RAISEDERECT,
  477. STANCEIDX_RAISEDCROUCH,
  478. STANCEIDX_RAISEDPRONE,
  479. /*
  480. STANCEIDX_ERECT + STANCEIDX_RAISED = STANCEIDX_RAISEDERECT
  481. STANCEIDX_RAISEDCROUCH - STANCEIDX_RAISED = STANCEIDX_CROUCH...
  482. */
  483. STANCEIDX_RAISED,
  484. //! stance masks
  485. STANCEMASK_ERECT,
  486. STANCEMASK_CROUCH,
  487. STANCEMASK_PRONE,
  488. STANCEMASK_RAISEDERECT,
  489. STANCEMASK_RAISEDCROUCH,
  490. STANCEMASK_RAISEDPRONE,
  491. STANCEMASK_ALL, // STANCEMASK_ERECT | STANCEMASK_CROUCH | STANCEMASK_PRONE | STANCEMASK_RAISEDERECT | STANCEMASK_RAISEDCROUCH | STANCEMASK_RAISEDPRONE
  492. STANCEMASK_NOTRAISED = STANCEMASK_ERECT | STANCEMASK_CROUCH | STANCEMASK_PRONE,
  493. STANCEMASK_RAISED = STANCEMASK_RAISEDERECT | STANCEMASK_RAISEDCROUCH | STANCEMASK_RAISEDPRONE,
  494. //! movements - masks
  495. MOVEMENT_IDLE, //! 0x1
  496. MOVEMENT_WALK, //! 0x2
  497. MOVEMENT_RUN, //! 0x4
  498. MOVEMENT_SPRINT, //! 0x8
  499. //! rotation modes
  500. ROTATION_DISABLE, //!
  501. ROTATION_ENABLE, //!
  502. //! movement idx
  503. MOVEMENTIDX_SLIDE = -2,
  504. MOVEMENTIDX_IDLE = 0,
  505. MOVEMENTIDX_WALK = 1,
  506. MOVEMENTIDX_RUN = 2,
  507. MOVEMENTIDX_SPRINT = 3,
  508. MOVEMENTIDX_CROUCH_RUN = 4,
  509. //! melee hit type
  510. MELEE_LIGHT = 0,
  511. MELEE_HEAVY = 1,
  512. //! vehicle classes
  513. VEHICLECLASS_CAR,
  514. VEHICLECLASS_HELI,
  515. VEHICLECLASS_BOAT,
  516. //! vehicle seats
  517. VEHICLESEAT_DRIVER,
  518. VEHICLESEAT_CODRIVER,
  519. VEHICLESEAT_PASSENGER_L,
  520. VEHICLESEAT_PASSENGER_R,
  521. //! death types
  522. DEATH_DEFAULT = -1, //! not defining in C++ as it is only used in script for undefined type
  523. DEATH_PULL_OUT_TRANSPORT, //! transport death -> death - special handling for pulling a dead player out of a vehicle
  524. DEATH_BODY, //! locomotion -> death - normal death animation while a player is conciscious
  525. DEATH_FAST, //! locomotion -> death - faster animation, for impulse driven deaths, i.e. hit by vehicle
  526. DEATH_WATER, //! swimming -> death
  527. DEATH_FALL, //! falling -> death
  528. DEATH_UNCON_ON_LAND, //! unconscious -> death - while not in water
  529. DEATH_UNCON_IN_WATER, //! unconscious -> death - while in water
  530. // - Type not used for "swimming to death" or "transport to death"
  531. //! ---------------------------------------------------------
  532. //! ---------------------- COMMAND IDs ----------------------
  533. //! ---------------------------------------------------------
  534. //! command ids - main movement commands
  535. COMMANDID_NONE, // type is int - no command - invalid state
  536. COMMANDID_MOVE, // type is int (overridden from C++) - normal movement (idle, walk, run, sprint, ... )
  537. COMMANDID_ACTION, // type is int (overridden from C++) - full body action
  538. COMMANDID_MELEE, // type is int (overridden from C++) - melee attacks
  539. COMMANDID_MELEE2, // type is int (overridden from C++) - melee attacks
  540. COMMANDID_FALL, // type is int (overridden from C++) - falling
  541. COMMANDID_DEATH, // type is int (overridden from C++) - dead
  542. COMMANDID_DAMAGE, // type is int (overridden from C++) - fullbody damage
  543. COMMANDID_LADDER, // type is int (overridden from C++) - ladder
  544. COMMANDID_UNCONSCIOUS, // type is int (overridden from C++) - unconscious
  545. COMMANDID_SWIM, // type is int (overridden from C++) - swimming
  546. COMMANDID_VEHICLE, // type is int (overridden from C++) - vehicle
  547. COMMANDID_CLIMB, // type is int (overridden from C++) - climb
  548. COMMANDID_SCRIPT, // type is int (overridden from C++) - all scripted commands
  549. //! modifier commands - additive behaviour
  550. COMMANDID_MOD_LOOKAT, // look at - always on
  551. COMMANDID_MOD_WEAPONS, // weapons - always on
  552. COMMANDID_MOD_ACTION, // action - additive action
  553. COMMANDID_MOD_DAMAGE, // damage - additive damage
  554. //! ---------------------------------------------------------
  555. //! ---------------------- ACTIONS --------------------------
  556. //! ---------------------------------------------------------
  557. //! internal action commands used in HumanCommandActionCallback.InternalCommand()
  558. CMD_ACTIONINT_INTERRUPT = -2, //!< totally interrupt action (no animation, just blend)
  559. CMD_ACTIONINT_FINISH = -1, //!< secondary ending (finishing action, eg running out of water while drinking, not all actions have this)
  560. CMD_ACTIONINT_END = 0, //!< end action (stopping action, without finish, all actions have this)
  561. CMD_ACTIONINT_ACTION = 1, //!< one time secondary action within an action
  562. CMD_ACTIONINT_ACTIONLOOP = 2, //!< loop secondary action within an action
  563. //! animations constants
  564. //! note: (erc - standing, cro - crouching, pne - prone) anim pose it can start from
  565. //! note: (end, end2, action, loop2) internal command which can be send in loop state
  566. //! looping
  567. //! --------------------------
  568. //! modifier (differential animation)
  569. CMD_ACTIONMOD_DRINK = 0, // erc,cro [end, end2]
  570. CMD_ACTIONMOD_EAT = 1, // erc,cro [end, end2]
  571. CMD_ACTIONMOD_EMPTY_VESSEL = 2, // erc,cro [end]
  572. CMD_ACTIONMOD_CATCHRAIN = 3, // erc,cro [end]
  573. CMD_ACTIONMOD_VIEWCOMPASS = 7, // erc,cro [end]
  574. CMD_ACTIONMOD_ITEM_TUNE = 9, // erc,cro [end]
  575. CMD_ACTIONMOD_GIVEL = 10, // erc,cro [end]
  576. CMD_ACTIONMOD_GIVER = 11, // erc,cro [end]
  577. CMD_ACTIONMOD_SHAVE = 12, // erc,cro [end]
  578. CMD_ACTIONMOD_FILLMAG = 13, // erc,cro [end]
  579. CMD_ACTIONMOD_EMPTYMAG = 14, // erc,cro [end]
  580. CMD_ACTIONMOD_OPENITEM = 15, // erc,cro [end]
  581. CMD_ACTIONMOD_TAKETEMPSELF = 18, // erc,cro [end]
  582. CMD_ACTIONMOD_VIEWMAP = 19, // erc,cro [end]
  583. CMD_ACTIONMOD_RAISEITEM = 20, // erc,cro [end]
  584. CMD_ACTIONMOD_SEARCHINVENTORY = 21, // erc,cro [end]
  585. CMD_ACTIONMOD_CRAFTING = 22, // erc,cro [end]
  586. CMD_ACTIONMOD_RESTRAINEDSTRUGGLE = 23, // erc,cro [end, end2]
  587. CMD_ACTIONMOD_COVERHEAD_SELF = 24, // erc,cro [end, end2]
  588. CMD_ACTIONMOD_COVERHEAD_TARGET = 25, // erc,cro [end, end2]
  589. CMD_ACTIONMOD_SET_ALARM = 250,
  590. CMD_ACTIONMOD_SET_KITCHENTIMER = 252,
  591. CMD_ACTIONMOD_RESET_KITCHENTIMER = 253,
  592. CMD_ACTIONMOD_BLOODTEST = 254, // erc,cro [end]
  593. CMD_ACTIONMOD_BLOODTESTOTHER = 255, // erc,cro [end]
  594. // onetime
  595. CMD_ACTIONMOD_PICKUP_HANDS = 500, // erc,cro
  596. CMD_ACTIONMOD_PICKUP_INVENTORY = 501, // erc,cro
  597. CMD_ACTIONMOD_LICKBATTERY = 502, // erc,cro
  598. CMD_ACTIONMOD_LIGHTFLARE = 503, // erc,cro
  599. CMD_ACTIONMOD_LITCHEMLIGHT = 504, // erc,cro
  600. CMD_ACTIONMOD_UNPINGRENAGE = 505, // erc,cro
  601. CMD_ACTIONMOD_OPENDOORFW = 506, // erc,cro
  602. CMD_ACTIONMOD_OPENLID = 507, // erc,cro
  603. CMD_ACTIONMOD_CLOSELID = 508, // erc,cro
  604. CMD_ACTIONMOD_ITEM_ON = 509, // erc,cro
  605. CMD_ACTIONMOD_ITEM_OFF = 510, // erc,cro
  606. CMD_ACTIONMOD_BATONEXTEND = 511, // erc,cro
  607. CMD_ACTIONMOD_BATONRETRACT = 512, // erc,cro
  608. CMD_ACTIONMOD_UNLOCKHANDCUFFTARGET = 513, // erc,cro
  609. CMD_ACTIONMOD_FISHINGRODEXTEND = 514, // erc,cro
  610. CMD_ACTIONMOD_FISHINGRODRETRACT = 515, // erc,cro
  611. CMD_ACTIONMOD_CLEANHANDSBOTTLE = 516, // erc,cro
  612. CMD_ACTIONMOD_OPENITEM_ONCE = 517, // erc,cro
  613. CMD_ACTIONMOD_ATTACHSCOPE = 518, // erc,cro
  614. CMD_ACTIONMOD_ATTACHBARREL = 519, // erc,cro
  615. CMD_ACTIONMOD_EMPTYSEEDSPACK = 520, // erc,cro
  616. CMD_ACTIONMOD_INTERACTONCE = 521, // erc,cro
  617. CMD_ACTIONMOD_ATTACHITEM = 522, // erc,cro
  618. CMD_ACTIONMOD_CLOSEITEM_ONCE = 523, // erc,cro,pne
  619. CMD_ACTIONMOD_FOLDITEM_ONCE = 524, // erc,cro
  620. CMD_ACTIONMOD_UNFOLDITEM_ONCE = 525, // erc,cro
  621. CMD_ACTIONMOD_PRESS_TRIGGER = 526, // erc,cro
  622. CMD_ACTIONMOD_STOP_ALARM = 251,
  623. CMD_ACTIONMOD_EAT_PILL = 527, // erc,cro
  624. CMD_ACTIONMOD_EAT_TABLET = 528, // erc,cro
  625. CMD_ACTIONMOD_HEATPACK = 529, // erc,cro
  626. CMD_ACTIONMOD_DROPITEM_HANDS = 900, // erc, cro
  627. CMD_ACTIONMOD_DROPITEM_INVENTORY = 901, // erc, cro
  628. //! --------------------------
  629. //! fb (full body)
  630. CMD_ACTIONFB_DRINK = 0, // pne [end, end2]
  631. CMD_ACTIONFB_EAT = 1, // pne [end, end2]
  632. CMD_ACTIONFB_CATCHRAIN = 3, // pne [end]
  633. CMD_ACTIONFB_ITEM_TUNE = 9, // pne [end]
  634. CMD_ACTIONFB_GIVEL = 10, // pne [end]
  635. CMD_ACTIONFB_GIVER = 11, // pne [end]
  636. CMD_ACTIONFB_FILLMAG = 13, // pne [end]
  637. CMD_ACTIONFB_EMPTYMAG = 14, // pne [end]
  638. CMD_ACTIONFB_DRINKPOND = 50, // cro [end]
  639. CMD_ACTIONFB_DRINKWELL = 51, // cro [end]
  640. CMD_ACTIONFB_FILLBOTTLEWELL = 52, // cro [end]
  641. CMD_ACTIONFB_FIREESTINGUISHER = 53, // erc [end]
  642. CMD_ACTIONFB_WRING = 54, // cro [end]
  643. CMD_ACTIONFB_FISHING = 56, // cro [action (check fish), end(catch fish), end2(not catching anything ]
  644. CMD_ACTIONFB_CPR = 57, // cro [end]
  645. CMD_ACTIONFB_BANDAGE = 58, // cro [end]
  646. CMD_ACTIONFB_CRAFTING = 59, // cro [end]
  647. CMD_ACTIONFB_INTERACT = 60, // erc,cro [end]
  648. CMD_ACTIONFB_FORCEFEED = 62, // erc,cro [end]
  649. CMD_ACTIONFB_BANDAGETARGET = 63, // erc,cro [end]
  650. CMD_ACTIONFB_SPRAYPLANT = 64, // cro [end]
  651. CMD_ACTIONFB_STARTFIRE = 65, // cro [end]
  652. CMD_ACTIONFB_ANIMALSKINNING = 66, // cro [end]
  653. CMD_ACTIONFB_WASHHANDSWELL = 67, // cro [end]
  654. CMD_ACTIONFB_WASHHANDSPOND = 68, // cro [end]
  655. CMD_ACTIONFB_SALINEBLOODBAGTARGET = 69, // erc,cro [end]
  656. CMD_ACTIONFB_SALINEBLOODBAG = 70, // erc,cro [end]
  657. CMD_ACTIONFB_STITCHUPSELF = 71, // erc,cro [end]
  658. CMD_ACTIONFB_VOMIT = 72, // cro [end]
  659. CMD_ACTIONFB_UNRESTRAINTARGET = 73, // erc,cro [end (finish cutting), end2 (cancel cutting)]
  660. CMD_ACTIONFB_RESTRAINTARGET = 74, // erc,cro [end (finish tying up), end2 (cancel tying up)]
  661. CMD_ACTIONFB_CHECKPULSE = 76, // cro [end]
  662. CMD_ACTIONFB_CLEANWOUNDSTARGET = 78, // erc, cro [end]
  663. CMD_ACTIONFB_COLLECTBLOODSELF = 81, // erc, cro [end]
  664. CMD_ACTIONFB_EMPTY_VESSEL = 82, // erc, cro [end]
  665. CMD_ACTIONFB_OPENITEM = 83, // pne [end]
  666. CMD_ACTIONFB_HACKBUSH = 85, // erc [end, end2]
  667. CMD_ACTIONFB_HACKTREE = 86, // erc [end, end2]
  668. CMD_ACTIONFB_TAKETEMPSELF = 87, // pne [end]
  669. CMD_ACTIONFB_DIG = 88, // erc [end, end2]
  670. CMD_ACTIONFB_DIGUPCACHE = 89, // erc [end, end2]
  671. CMD_ACTIONFB_DIGMANIPULATE = 90, // erc [end, end2]
  672. CMD_ACTIONFB_DEPLOY_HEAVY = 95, // erc [end, end2]
  673. CMD_ACTIONFB_DEPLOY_2HD = 96, // cro [end, end2]
  674. CMD_ACTIONFB_DEPLOY_1HD = 97, // cro [end, end2]
  675. CMD_ACTIONFB_BLOWFIREPLACE = 98, // cro [end]
  676. CMD_ACTIONFB_VIEWMAP = 99, // pne [end]
  677. CMD_ACTIONFB_VIEWCOMPASS = 100, // pne [end]
  678. CMD_ACTIONFB_FILLBOTTLEPOND = 101, // erc, cro [end]
  679. CMD_ACTIONFB_PLACING_HEAVY = 102, // erc [end, end2]
  680. CMD_ACTIONFB_PLACING_2HD = 103, // cro [end, end2]
  681. CMD_ACTIONFB_PLACING_1HD = 104, // cro [end, end2]
  682. CMD_ACTIONFB_CUTBARK = 105, // erc,cro [end, end2]
  683. CMD_ACTIONFB_VIEWNOTE = 106, // erc,cro,pne [end]
  684. CMD_ACTIONFB_SEARCHINVENTORY = 107, // pne [end]
  685. CMD_GESTUREFB_LOOKOPTICS = 108, // erc,cro,pne [end]
  686. CMD_ACTIONFB_MINEROCK = 109, // erc [end, end2]
  687. CMD_ACTIONFB_RAISEITEM = 110, // pne [end]
  688. CMD_ACTIONFB_RESTRAINEDSTRUGGLE = 111, // ,pne [end, end2]
  689. CMD_ACTIONFB_RESTRAINSELF = 112, // erc,cro [end]
  690. CMD_ACTIONFB_ASSEMBLE = 113, // erc,cro [end, end2]
  691. CMD_ACTIONFB_DISASSEMBLE = 114, // erc,cro [end, end2]
  692. CMD_ACTIONFB_FLAME_REPAIR = 115, // erc, cro
  693. CMD_ACTIONFB_TURN_VALVE = 116, // erc
  694. CMD_ACTIONFB_SET_ALARM = 250, // erc,cro ??not sure
  695. CMD_ACTIONFB_SHOVEL_DIG = 117, // cro [end, end2]
  696. CMD_ACTIONFB_VEHICLE_PUSH = 118, // erc
  697. CMD_ACTIONFB_PATCHING_TIRE = 119, // cro [end]
  698. CMD_ACTIONFB_PATCHING_DUCTTAPE = 120, // cro [end]
  699. CMD_ACTIONFB_PATCHING_SEWING = 121, // cro [end]
  700. CMD_ACTIONFB_PATCHING_LEATHER_SEWING_KIT = 122, // cro [end]
  701. CMD_ACTIONFB_SPLITTING_FIREWOOD = 123, // cro [end]
  702. CMD_ACTIONFB_BREAKING_STICK = 124, // cro [end]
  703. CMD_ACTIONFB_CLEANING_WEAPON = 125, // cro [end]
  704. CMD_ACTIONFB_EATING_SNOW = 126, // cro [end]
  705. CMD_ACTIONFB_FILLING_CONTAINER_SNOW = 127, // cro [end]
  706. CMD_ACTIONFB_DIGGIN_WORMS = 128, // erc,cro [end]
  707. // onetime
  708. CMD_ACTIONFB_PICKUP_HANDS = 500, // pne
  709. CMD_ACTIONFB_PICKUP_INVENTORY = 501, // pne
  710. CMD_ACTIONFB_LICKBATTERY = 502, // pne
  711. CMD_ACTIONFB_LIGHTFLARE = 503, // pne
  712. CMD_ACTIONFB_LITCHEMLIGHT = 504, // pne
  713. CMD_ACTIONFB_UNPINGRENAGE = 505, // pne
  714. CMD_ACTIONFB_ITEM_ON = 506, // pne
  715. CMD_ACTIONFB_ITEM_OFF = 507, // pne
  716. CMD_ACTIONFB_HANDCUFFTARGET = 508, // erc,cro
  717. CMD_ACTIONFB_MORPHINE = 509, // cro
  718. CMD_ACTIONFB_INJECTION = 510, // cro
  719. CMD_ACTIONFB_INJECTIONTARGET = 511, // erc,cro
  720. CMD_ACTIONFB_DRINKSIP = 512, // cro
  721. CMD_ACTIONFB_CLEANHANDSBOTTLE = 513, // pne
  722. CMD_ACTIONFB_OPENITEM_ONCE = 514, // pne
  723. CMD_ACTIONFB_POKE = 515, // cro
  724. CMD_ACTIONFB_ATTACHSCOPE = 516, // pne
  725. CMD_ACTIONFB_ATTACHBARREL = 517, // pne
  726. CMD_ACTIONFB_RESTRAIN = 518, // erc,cro,pne
  727. CMD_ACTIONFB_PICKUP_HEAVY = 519, // erc
  728. CMD_ACTIONFB_PRESS_TRIGGER = 526, // pne
  729. CMD_ACTIONFB_RAISE_FLAG = 600, // erc?
  730. CMD_ACTIONFB_LOWER_FLAG = 601, // erc?
  731. CMD_ACTIONFB_STOP_ALARM = 251,
  732. CMD_ACTIONFB_EAT_PILL = 527, // pne
  733. CMD_ACTIONFB_EAT_TABLET = 528, // pne
  734. CMD_ACTIONFB_HEATPACK = 529, // pne
  735. CMD_ACTIONFB_DROPITEM_HANDS = 900, // pne, pne back
  736. //! ---------------------------------------------------------
  737. //! ---------------------- TRAILER --------------------------
  738. //! ---------------------------------------------------------
  739. CMD_TRAILER_MASK = 3006,
  740. CMD_TRAILER_MASK_02 = 3007,
  741. CMD_TRAILER_MASK_CHAINS = 3008,
  742. CMD_TRAILER_MASK_DALLAS = 3009,
  743. CMD_TRAILER_MASK_HOXTON = 3010,
  744. CMD_TRAILER_MASK_WOLF = 3011,
  745. //! ---------------------------------------------------------
  746. //! ---------------------- VEHICLES -------------------------
  747. //! ---------------------------------------------------------
  748. // looping actions
  749. CMD_ACTIONMOD_STARTENGINE = 300, // [end]
  750. CMD_ACTIONMOD_TOOTHORN = 301, // [end]
  751. // onetime actions
  752. CMD_ACTIONMOD_DRIVER_DOOR_OPEN = 400,
  753. CMD_ACTIONMOD_DRIVER_DOOR_CLOSE = 401,
  754. CMD_ACTIONMOD_CODRIVER_DOOROPEN = 402,
  755. CMD_ACTIONMOD_CODRIVER_DOORCLOSE = 403,
  756. CMD_ACTIONMOD_STOPENGINE = 404,
  757. CMD_ACTIONMOD_SHIFTGEAR = 405,
  758. CMD_ACTIONMOD_HEADLIGHT = 406,
  759. //! ---------------------------------------------------------
  760. //! ---------------------- GESTURES -------------------------
  761. //! ---------------------------------------------------------
  762. //! modifier (differential animation)
  763. CMD_GESTUREMOD_GREETING = 1000, // erc,cro [end]
  764. CMD_GESTUREMOD_POINT = 1001, // erc,cro [end]
  765. CMD_GESTUREMOD_THUMB = 1002, // erc,cro [end, CMD_ACTIONINT_ACTION to switch to THUMB DOWN]
  766. CMD_GESTUREMOD_THUMBDOWN = 1003, // erc,cro [end, CMD_ACTIONINT_ACTION to switch to THUMB UP]
  767. CMD_GESTUREMOD_SILENCE = 1004, // erc,cro [end]
  768. CMD_GESTUREMOD_TAUNT = 1005, // erc,cro [end]
  769. CMD_GESTUREMOD_TIMEOUT = 1006, // erc,cro [end]
  770. CMD_GESTUREMOD_HEART = 1007, // erc,cro [end]
  771. CMD_GESTUREMOD_FACEPALM = 1008, // erc,cro [end]
  772. CMD_GESTUREMOD_WATCHING = 1009, // erc,cro [end]
  773. CMD_GESTUREMOD_HOLD = 1010, // erc,cro [end]
  774. CMD_GESTUREMOD_LISTENING = 1011, // erc,cro [end]
  775. CMD_GESTUREMOD_POINTSELF = 1012, // erc,cro [end]
  776. CMD_GESTUREMOD_LOOKATME = 1013, // erc,cro [end]
  777. CMD_GESTUREMOD_OKAY = 1014, // erc,cro [end]
  778. CMD_GESTUREMOD_RPS = 10000, // erc [SPECIAL, SEE BELOW]
  779. CMD_ACTIONINT_RPS_ROCK = 10, // RPS Internal Gesture
  780. CMD_ACTIONINT_RPS_PAPER = 11, // RPS Internal Gesture
  781. CMD_ACTIONINT_RPS_SCISSORS = 12, // RPS Internal Gesture
  782. // onetime
  783. CMD_GESTUREMOD_THROAT = 1100, // erc,cro
  784. CMD_GESTUREMOD_CLAP = 1101, // erc,cro
  785. CMD_GESTUREMOD_DABBING = 1102, // erc,cro
  786. CMD_GESTUREMOD_MOVE = 1103, // erc,cro
  787. CMD_GESTUREMOD_DOWN = 1104, // erc,cro
  788. CMD_GESTUREMOD_COME = 1105, // erc,cro
  789. CMD_GESTUREMOD_TAUNTKISS = 1106, // erc,cro
  790. CMD_GESTUREMOD_TAUNTELBOW = 1107, // erc,cro
  791. CMD_GESTUREMOD_TAUNTTHINK = 1108, // erc,cro
  792. CMD_GESTUREMOD_NODHEAD = 1109, // erc,cro
  793. CMD_GESTUREMOD_SHAKEHEAD = 1110, // erc,cro
  794. CMD_GESTUREMOD_SHRUG = 1111, // erc,cro
  795. CMD_GESTUREMOD_SURRENDER = 1112, // erc
  796. CMD_GESTUREMOD_SURRENDERIN = 1112, // erc
  797. CMD_GESTUREMOD_SURRENDEROUT = 1113, // erc
  798. //! --------------------------
  799. //! fb (full body)
  800. CMD_GESTUREFB_GREETING = 1000, // pne [end]
  801. CMD_GESTUREFB_POINT = 1001, // pne [end]
  802. CMD_GESTUREFB_THUMB = 1002, // pne [end, CMD_ACTIONINT_ACTION to switch to THUMB DOWN]
  803. CMD_GESTUREFB_THUMBDOWN = 1003, // pne [end, CMD_ACTIONINT_ACTION to switch to THUMB UP]
  804. CMD_GESTUREFB_SILENCE = 1004, // pne [end]
  805. CMD_GESTUREFB_TAUNT = 1005, // pne [end]
  806. CMD_GESTUREFB_TIMEOUT = 1006, // pne [end]
  807. CMD_GESTUREFB_HEART = 1007, // pne [end]
  808. CMD_GESTUREFB_WATCHING = 1009, // pne [end]
  809. CMD_GESTUREFB_HOLD = 1010, // pne [end]
  810. CMD_GESTUREFB_LISTENING = 1011, // pne [end]
  811. CMD_GESTUREFB_POINTSELF = 1012, // pne [end]
  812. CMD_GESTUREFB_LOOKATME = 1013, // pne [end]
  813. CMD_GESTUREFB_OKAY = 1014, // pne [end]
  814. CMD_GESTUREFB_SALUTE = 1050, // erc [end]
  815. CMD_GESTUREFB_CAMPFIRE = 1051, // cro [end]
  816. CMD_GESTUREFB_LYINGDOWN = 1052, // cro [end]
  817. CMD_GESTUREFB_SOS = 1053, // erc [end]
  818. CMD_GESTUREFB_SITA = 1054, // cro [end]
  819. CMD_GESTUREFB_SITB = 1055, // cro [end]
  820. CMD_GESTUREFB_DABBING = 1056, // erc, cro [end]
  821. CMD_GESTUREFB_KNEEL = 1057, // cro [end]
  822. // onetime
  823. CMD_GESTUREFB_THROAT = 1100, // pne
  824. CMD_GESTUREFB_MOVE = 1103, // pne
  825. CMD_GESTUREFB_DOWN = 1104, // pne
  826. CMD_GESTUREFB_COME = 1105, // pne
  827. CMD_GESTUREFB_TAUNTKISS = 1106, // pne
  828. CMD_GESTUREFB_TAUNTTHINK = 1108, // pne
  829. CMD_GESTUREFB_DANCE = 1109, // erc
  830. CMD_GESTUREFB_NODHEAD = 1110, // pne
  831. CMD_GESTUREFB_SHAKEHEAD = 1111, // pne
  832. CMD_GESTUREFB_SHRUG = 1112, // pne
  833. CMD_GESTUREFB_SURRENDER = 1113, // cro,pne
  834. CMD_GESTUREFB_SURRENDERIN = 1113, // cro,pne
  835. CMD_GESTUREFB_SURRENDEROUT = 1114, // cro,pne
  836. //! ---------------------------------------------------------
  837. //! ---------------------- TRAILER --------------------------
  838. //! ---------------------------------------------------------
  839. CMD_TRAILER_WAKE_UP = 3000,
  840. CMD_TRAILER_DEAD_BODY = 3001,
  841. CMD_TRAILER_WALKIE_TALKIE = 3002,
  842. CMD_TRAILER_WOUNDED = 3003,
  843. CMD_TRAILER_WALK_AWAY = 3004,
  844. CMD_TRAILER_DEAD = 3005,
  845. //! ---------------------------------------------------------
  846. //! ---------------------- SUICIDE --------------------------
  847. //! ---------------------------------------------------------
  848. //! fb (full body)
  849. CMD_SUICIDEFB_1HD = 2000, // cro [end (cancel), end2 (commit)]
  850. CMD_SUICIDEFB_FIREAXE = 2001, // erc [end (cancel), end2 (commit)]
  851. CMD_SUICIDEFB_PITCHFORK = 2002, // erc [end (cancel), end2 (commit)]
  852. CMD_SUICIDEFB_PISTOL = 2003, // cro [end (cancel), end2 (commit)]
  853. CMD_SUICIDEFB_RIFLE = 2004, // cro [end (cancel), end2 (commit)]
  854. CMD_SUICIDEFB_SWORD = 2005, // erc [end (cancel), end2 (commit)]
  855. CMD_SUICIDEFB_UNARMED = 2006, // cro [end (cancel), end2 (commit)]
  856. CMD_SUICIDEFB_WOODAXE = 2007, // erc [end (cancel), end2 (commit)]
  857. CMD_SUICIDEFB_SPEAR = 2008, // erc [end (cancel), end2 (commit)]
  858. CMD_SUICIDEFB_SICKLE = 2009, // cro [end (cancel), end2 (commit)]
  859. CMD_SUICIDEFB_HOE = 2010, // erc [end (cancel), end2 (commit)]
  860. // 32767 is totaly MAXIMAL index !!!!!
  861. };
  862. //! defined in C++
  863. enum DayZPlayerInstanceType
  864. {
  865. INSTANCETYPE_SERVER, //! server instance
  866. INSTANCETYPE_CLIENT, //! client instance && controlled
  867. INSTANCETYPE_REMOTE, //! client instance && other player
  868. INSTANCETYPE_AI_SERVER, //! temporary!
  869. INSTANCETYPE_AI_REMOTE, //! temporary!
  870. INSTANCETYPE_AI_SINGLEPLAYER, //! temporary!
  871. }
  872. // *************************************************************************************
  873. // ! DayZPlayer - mainly for logic and camera
  874. // *************************************************************************************
  875. class SDayZPlayerHeadingModel
  876. {
  877. int m_iCamMode; //[in] - DayZPlayerConstants.CAMERAMODE_...
  878. int m_iCurrentCommandID; //[in] - Current Main Command ID
  879. float m_fOrientationAngle; //[in/out] - horizontal model orientation (where you face) - in rad
  880. float m_fHeadingAngle; //[in/out] - horizontal aim angle (where you aim) - in rad
  881. //! cannot be created from script
  882. private void SDayZPlayerHeadingModel() {}
  883. private void ~SDayZPlayerHeadingModel() {}
  884. }
  885. // *************************************************************************************
  886. // ! DayZPlayer - mainly for logic and camera
  887. // *************************************************************************************
  888. class SDayZPlayerAimingModel
  889. {
  890. int m_iCamMode; //[in] - DayZPlayerConstants.CAMERAMODE_... HEAD,EXTERNAL,WEAPON...
  891. int m_iCurrentCommandID; //[in] - Current Main Command ID
  892. float m_fCurrentAimX; //[in] - horizontal aim angle - in degrees
  893. float m_fCurrentAimY; //[in] - vertical aim angle - in degrees
  894. float m_fAimXCamOffset; //[out] - camera (angle) offset modifier
  895. float m_fAimYCamOffset; //[out] - camera (angle) offset modifier
  896. float m_fAimXHandsOffset; //[out] - hands offset modifier
  897. float m_fAimYHandsOffset; //[out] - hands offset modifier
  898. float m_fAimXMouseShift; //[out] - shift like mouse does
  899. float m_fAimYMouseShift; //[out] - shift like mouse does
  900. float m_fCamPosOffsetX; //[out] - camera (position) offset modifier
  901. float m_fCamPosOffsetY; //[out] - camera (position) offset modifier
  902. float m_fCamPosOffsetZ; //[out] - camera (position) offset modifier
  903. //! cannot be created from script
  904. private void SDayZPlayerAimingModel() {}
  905. private void ~SDayZPlayerAimingModel() {}
  906. }
  907. #ifdef FEATURE_NETWORK_RECONCILIATION
  908. class DayZPlayerOwnerState : AnimPhysOwnerState
  909. {
  910. proto native void SetHeading(float value);
  911. proto native float GetHeading();
  912. proto native void SetHeadingVelocity(float value);
  913. proto native float GetHeadingVelocity();
  914. proto native void SetHeadingVelocityAlign(float value);
  915. proto native float GetHeadingVelocityAlign();
  916. proto native void SetHeadingTargetAlignVelocity(vector value);
  917. proto native void GetHeadingTargetAlignVelocity(out vector value);
  918. };
  919. class DayZPlayerMove : AnimPhysMove
  920. {
  921. proto native void SetHeading(float value);
  922. proto native float GetHeading();
  923. //! Appropriately calls 'SetParent' and 'SetParentTransform' with the correct data
  924. proto native void UpdateParent(DayZPlayer player);
  925. //! For use within 'DayZPlayer.ReplayAdditiveMove' on the 'other' move to signal if the base move had its parent changed
  926. proto native bool WasParentUpdated();
  927. };
  928. #endif
  929. // *************************************************************************************
  930. // ! DayZPlayer - mainly for logic and camera
  931. // *************************************************************************************
  932. class DayZPlayer extends Human
  933. {
  934. const int SIMPLE_SELECTION_MELEE_RIFLE = 0;
  935. const int SIMPLE_SELECTION_MELEE_MELEE = 1;
  936. const int SIMPLE_SELECTION_SHOULDER_RIFLE = 2;
  937. const int SIMPLE_SELECTION_SHOULDER_MELEE = 3;
  938. //! invokers
  939. protected ref ScriptInvoker m_OnDeathStart;
  940. //! returns appropriate DayZPlayerType
  941. proto native DayZPlayerType GetDayZPlayerType();
  942. proto native DayZPlayerInstanceType GetInstanceType();
  943. override string GetDebugName()
  944. {
  945. string res = super.GetDebugName();
  946. res += ":" + typename.EnumToString(DayZPlayerInstanceType, GetInstanceType());
  947. return res;
  948. }
  949. //! ---------------- heading model -------------------------
  950. //! updated each tick
  951. //! this can limit / extend player's heading (orientation) behaviour in game
  952. bool HeadingModel(float pDt, SDayZPlayerHeadingModel pModel);
  953. //! ---------------- aiming model -------------------------
  954. //! updated each tick - this takes care about aiming
  955. bool AimingModel(float pDt, SDayZPlayerAimingModel pModel);
  956. //! ---------------- command handling -------------------------
  957. //! updated each tick
  958. //! handles: starting new commands, canceling, interruption
  959. //! pDt - delta time
  960. //! pCurrentCommandID - actually running command's ID
  961. //! pCurrentCommandFinished - is current command finished
  962. void CommandHandler(float pDt, int pCurrentCommandID, bool pCurrentCommandFinished);
  963. //! ---------------- camera handling -------------------------
  964. //! virtual
  965. //! returns registered camera type
  966. //! pCameraMode - DayZPlayerConstants.CAMERAMODE_ ...
  967. int CameraHandler(int pCameraMode);
  968. //! ---------------- camera additional functions -------------------------
  969. //! gets current camera
  970. proto native DayZPlayerCamera GetCurrentCamera();
  971. //! gets transform of current player camera
  972. proto native void GetCurrentCameraTransform(out vector position, out vector direction, out vector rotation);
  973. //! gets current camera
  974. proto native int GetCurrentPerItemCameraUD();
  975. proto native bool IsCameraBlending();
  976. //! ---------------- animation graph functions -------------------------
  977. //! functions usable only from CommandHandler
  978. proto native void AnimCallCommand(int pCommand, int pParamInt, float pParamFloat);
  979. proto native void AnimSetFloat(int pVar, float pFlt);
  980. proto native void AnimSetInt(int pVar, int pInt);
  981. proto native void AnimSetBool(int pVar, bool pBool);
  982. //! ---------------- deterministic random numbers ------------------------
  983. /**
  984. \brief Random number in range of <0,0xffffffff> - !!! use this only during deterministic simulation (CommandHandler)
  985. \return int value in range of <0,0xffffffff>
  986. */
  987. proto native int Random();
  988. /**
  989. \brief Random number in range of <0,pRange-1> - !!! use this only during deterministic simulation (CommandHandler)
  990. @param pRange upper bounds of random number
  991. \return int value in range of <0,pRange-1>
  992. */
  993. proto native float RandomRange(int pRange);
  994. /**
  995. \brief Random number in range of <0,1> - !!! use this only during deterministic simulation (CommandHandler)
  996. \return float value in range of <0,1>
  997. */
  998. proto native float Random01();
  999. //! DEPRICATED(use GetEyeZoomLevel()) returns true if player is using EyeZoom, otherwise false
  1000. bool IsEyeZoom();
  1001. //! returns eye zoom level, uses ECameraZoomType values
  1002. int GetEyeZoomLevel();
  1003. //! return true if shots are fired from camere, otherwise false
  1004. bool IsShootingFromCamera();
  1005. //! return true if player is trying to hold breah, otherwise false
  1006. bool IsHoldingBreath();
  1007. //! return true if player is currently performing FB gesture, otherwise false
  1008. bool IsPerformingFBGesture();
  1009. //! return true if player is currently in 3pp, otherwise false
  1010. bool IsInThirdPerson();
  1011. //! processes melee hit
  1012. proto native MeleeCombatData GetMeleeCombatData();
  1013. //! processes melee hit (uses component index)
  1014. proto native void ProcessMeleeHit(InventoryItem pMeleeWeapon, int pMeleeModeIndex, Object pTarget, int pComponentIndex, vector pHitWorldPos);
  1015. //! processes melee hit (uses component name)
  1016. proto native void ProcessMeleeHitName(InventoryItem pMeleeWeapon, int pMeleeModeIndex, Object pTarget, string pComponentName, vector pHitWorldPos);
  1017. //! get reason for kickoff if available (server only)
  1018. proto native EClientKicked GetKickOffReason();
  1019. //! ---------------- release controls -------------------------
  1020. proto native void ReleaseNetworkControls();
  1021. //! ---------------- sync stuff -------------------------
  1022. proto native void SendSyncJuncture(int pJunctureID, ParamsWriteContext ctx);
  1023. proto native void StoreInputForRemotes(ParamsWriteContext ctx);
  1024. //! ---------------- sync shadow -------------------------
  1025. //! test if entity is DayZPlayer
  1026. //static proto native bool IsEntityDayZPlayer(IEntity pEntity);
  1027. //!
  1028. proto native bool DebugSyncShadowSetup(DayZPlayer pPlayer);
  1029. //! sets look limits for a player
  1030. proto native void SetLookLimits(float pDown, float pUp, float pLeft, float pRight);
  1031. //! returns look limits for a player
  1032. proto void GetLookLimits(out float pDown, out float pUp, out float pLeft, out float pRight);
  1033. //! sets aim limits for a player
  1034. proto native void SetAimLimits(float pDown, float pUp, float pLeft, float pRight);
  1035. //! returns aim limits for a player
  1036. proto void GetAimLimits(out float pDown, out float pUp, out float pLeft, out float pRight);
  1037. //! sets aim lower limit for a player
  1038. proto native void SetVerticalMinimumAimLimit(float value);
  1039. void SetCurrentWaterLevel(float pWaterLevel);
  1040. float GetCurrentWaterLevel();
  1041. //! ---------------- camera additiona functions -------------------------
  1042. //! returns true if player is currently in one of the stances specified by stance mask
  1043. //! IsPlayerInStance(STANCEMASK_ERECT | STANCEMASK_CROUCH) returns true if player is standing or crouching and not raised (aimed)
  1044. //! IsPlayerInStance(STANCEMASK_PRONE | STANCEIDX_RAISEDPRONE) returns true if player is in or in prone (both raised or nonraised)
  1045. //! IsPlayerInStance(STANCEMASK_ALL) returns true always
  1046. //! IsPlayerInStance(STANCEMASK_RAISEDERECT | STANCEMASK_RAISEDCROUCH | STANCEMASK_RAISEDPRONE) returns true if player has raised hands
  1047. // PSOVIS - move to native
  1048. bool IsPlayerInStance(int pStanceMask) // STANCEMASK_ERECT | STANCEMASK_CROUCH
  1049. {
  1050. HumanMovementState state = new HumanMovementState;
  1051. GetMovementState(state);
  1052. bool ret = ((1 << state.m_iStanceIdx) & pStanceMask) != 0;
  1053. return ret;
  1054. }
  1055. void OnInputForRemote (ParamsReadContext ctx) { }
  1056. void OnInputFromServer (ParamsReadContext ctx) { }
  1057. //! ---------------- speaking anim -------------------------
  1058. //! Check if player is using VoN to speak and return max amplitude from current samples
  1059. proto native float IsPlayerSpeaking();
  1060. void UpdateDummyPlayerProxyVisibility(EntityAI shoulder, EntityAI melee)
  1061. {
  1062. /*EntityAI shoulder_item = FindAttachmentBySlotName("Shoulder");
  1063. EntityAI melee_item = FindAttachmentBySlotName("Melee");*/
  1064. bool boo;
  1065. if ( melee )
  1066. {
  1067. boo = melee.IsWeapon();
  1068. SetSimpleHiddenSelectionState(SIMPLE_SELECTION_MELEE_RIFLE,boo);
  1069. SetSimpleHiddenSelectionState(SIMPLE_SELECTION_MELEE_MELEE,!boo);
  1070. }
  1071. if ( shoulder )
  1072. {
  1073. boo = shoulder.IsWeapon();
  1074. SetSimpleHiddenSelectionState(SIMPLE_SELECTION_SHOULDER_RIFLE,boo);
  1075. SetSimpleHiddenSelectionState(SIMPLE_SELECTION_SHOULDER_MELEE,!boo);
  1076. }
  1077. }
  1078. //! ---------------- Forces player to stand up when swapping to heavy item -------------------------
  1079. void ForceStandUpForHeavyItems(notnull EntityAI item)
  1080. {
  1081. InventoryLocation il = new InventoryLocation;
  1082. if ( item.IsHeavyBehaviour() && IsPlayerInStance(DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_CROUCH))
  1083. {
  1084. HumanCommandMove cm = GetCommand_Move();
  1085. if (cm)
  1086. {
  1087. cm.ForceStance(DayZPlayerConstants.STANCEIDX_ERECT);
  1088. }
  1089. }
  1090. }
  1091. void ForceStandUpForHeavyItemsSwap(notnull EntityAI item1, notnull EntityAI item2)
  1092. {
  1093. ForceStandUpForHeavyItems(item1);
  1094. ForceStandUpForHeavyItems(item2);
  1095. }
  1096. void OnThrowingModeChange(bool change_to_enabled){}
  1097. ScriptInvoker GetOnDeathStart()
  1098. {
  1099. if (!m_OnDeathStart)
  1100. m_OnDeathStart = new ScriptInvoker();
  1101. return m_OnDeathStart;
  1102. }
  1103. override void OnCommandDeathStart()
  1104. {
  1105. if (m_OnDeathStart)
  1106. m_OnDeathStart.Invoke(this);
  1107. }
  1108. }