Advertisement
KimonK

Untitled

Oct 2nd, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. wOS.ForcePowers:RegisterNewPower({
  2. name = "Meditate",
  3. icon = "M",
  4. image = "wos/forceicons/meditate.png",
  5. description = "Relax yourself and channel your energy",
  6. think = function( self )
  7. if self.MeditateCooldown and self.MeditateCooldown >= CurTime() then return end
  8. if ( self.Owner:KeyDown( IN_ATTACK2 ) ) and !self:GetEnabled() and self.Owner:OnGround() then
  9. self._ForceMeditating = true
  10. else
  11. self._ForceMeditating = false
  12. end
  13. if self._ForceMeditating then
  14. self:SetMeditateMode( 1 )
  15. if not self._NextMeditateHeal then self._NextMeditateHeal = 0 end
  16. if self._NextMeditateHeal < CurTime() then
  17. self.Owner:SetHealth( math.min( self.Owner:Health() + ( self.Owner:GetMaxHealth()*0.25 ), self.Owner:GetMaxHealth() ) )
  18. if #self.DevestatorList > 0 then
  19. self:SetDevEnergy( self:GetDevEnergy() + self.DevCharge )
  20. end
  21. local tbl = wOS.ALCS.Config.Skills.ExperienceTable[ self.Owner:GetUserGroup() ]
  22. if not tbl then
  23. tbl = wOS.ALCS.Config.Skills.ExperienceTable[ "Default" ].Meditation
  24. else
  25. tbl = wOS.ALCS.Config.Skills.ExperienceTable[ self.Owner:GetUserGroup() ].Meditation
  26. end
  27. self.Owner:AddSkillXP( tbl )
  28. self._NextMeditateHeal = CurTime() + 1
  29. end
  30. self.Owner:SetLocalVelocity(Vector(0, 0, 0))
  31. self.Owner:SetMoveType(MOVETYPE_NONE)
  32. else
  33. self:SetMeditateMode( 0 )
  34. if self:GetMoveType() != MOVETYPE_WALK and self.Owner:GetNW2Float( "wOS.DevestatorTime", 0 ) < CurTime() then
  35. self.Owner:SetMoveType(MOVETYPE_WALK)
  36. end
  37. end
  38. if self.Owner:KeyReleased( IN_ATTACK2 ) then
  39. self.MeditateCooldown = CurTime() + 2
  40. end
  41. end
  42. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement