jumpDecider.sqf 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //Params["personToApply"];
  2. _namUnit=_this select 0;
  3. _namThisJumpData=_namUnit getVariable["jumpArray",[false,0,0,5,2]];
  4. _namResult=false;
  5. comment "data from jump array";
  6. comment "is Jumping-0
  7. last jump time-1
  8. jump counter-2
  9. cooldown-3
  10. max consecutive jumps-4
  11. !C or (!A and B)";
  12. _namIsJumping=_namThisJumpData select 0;
  13. _namLastJumpTime=_namThisJumpData select 1;
  14. _namJumpCounter=_namThisJumpData select 2;
  15. _namJumpCooldownTime=_namThisJumpData select 3;
  16. _namMaxJump=_namThisJumpData select 4;
  17. comment "A-is jumping B-is cooled C-is over counter /// karnugh map variables";
  18. _namTimeSinceLastJump=time-_namLastJumpTime;
  19. _A=_namIsJumping;
  20. comment "true if cooled";
  21. _B=(_namTimeSinceLastJump)>_namJumpCooldownTime;
  22. comment "true if u just 'double jumped'";
  23. _C=_namJumpCounter>=_namMaxJump;
  24. [west, "HQ"] sideChat format["jumpdata %1 %2",_namThisJumpData,time];
  25. if((count _namThisJumpData) !=0) then
  26. {
  27. _namIsOverCounter=_C;
  28. _namIsCool=(time-_namLastJumpTime)>=_namJumpCooldownTime;
  29. comment "if ur cooled then reset counter";
  30. if(_B)then
  31. {
  32. _namJumpCounter=0;
  33. _namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
  34. };
  35. if(!_C || {!_A && {_B}}) then
  36. {
  37. _namResult=true;
  38. }
  39. else
  40. {
  41. hint parseText format["Can not boost. <t color='#40e0d0'>Cooldown done in</t> <t color='#FF0000'>%1</t>",(_namJumpCooldownTime-(time-_namLastJumpTime))];
  42. if(_B || {(_namJumpCooldownTime-(time-_namLastJumpTime))<0}) then
  43. {
  44. _namJumpCounter=0;
  45. _namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
  46. };
  47. };
  48. _namResult
  49. };