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. if((count _namThisJumpData) !=0) then
  25. {
  26. _namIsOverCounter=_C;
  27. _namIsCool=(time-_namLastJumpTime)>=_namJumpCooldownTime;
  28. comment "if ur cooled then reset counter";
  29. if(_B)then
  30. {
  31. _namJumpCounter=0;
  32. _namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
  33. };
  34. if(!_C || {!_A && {_B}}) then
  35. {
  36. _namResult=true;
  37. }
  38. else
  39. {
  40. hint parseText format["Can not boost. <t color='#40e0d0'>Cooldown done in</t> <t color='#FF0000'>%1</t>",(_namJumpCooldownTime-(time-_namLastJumpTime))];
  41. if(_B || {(_namJumpCooldownTime-(time-_namLastJumpTime))<0}) then
  42. {
  43. _namJumpCounter=0;
  44. _namUnit setVariable ["jumpArray", [_namIsJumping,_namLastJumpTime,_namJumpCounter,_namJumpCooldownTime,_namMaxJump],true];
  45. };
  46. };
  47. _namResult
  48. };