peteR_pg

hotbar activation fixed - Simple Sling

Sep 3rd, 2023
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. require "ISUI/ISPanelJoypad"
  2.  
  3. local old_activateSlot = ISHotbar.activateSlot
  4. function ISHotbar:activateSlot(slotIndex)
  5. old_activateSlot(self, slotIndex)
  6. local item = self.attachedItems[slotIndex]
  7. if not item then return end
  8. if item:getAttachedSlot() ~= slotIndex then
  9. error "item:getAttachedSlot() ~= slotIndex"
  10. end
  11.  
  12. ------ G.E.A.R. CLOTHING EQUIP -----------------\\
  13. if item:getCategory() == "Clothing" then
  14. if item:isEquipped() then
  15. ISTimedActionQueue.add(ISUnequipAction:new(self.chr, item, 50))
  16. else
  17. ISTimedActionQueue.add(ISWearClothing:new(self.chr, item, 50))
  18. end
  19. return
  20. end
  21. -----------------------------------------------//
  22.  
  23. ------ G.E.A.R. EAT FOOD -----------------------\\
  24. if item:IsFood() and item:getHungerChange() < 0 then
  25. if self.chr:getMoodles():getMoodleLevel(MoodleType.FoodEaten) < 3 or self.chr:getNutrition():getCalories() < 1000 then
  26. ISTimedActionQueue.add(ISEatFoodAction:new(self.chr, item, 0.25));
  27. return
  28. end
  29. end
  30. ------------------------------------------------//
  31.  
  32.  
  33. if item:canBeActivated() then
  34. item:setActivated(not item:isActivated())
  35. return
  36. end
  37. self:equipItem(item)
  38. end
  39.  
Advertisement
Add Comment
Please, Sign In to add comment