Guest User

B&A code

a guest
Jul 22nd, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.70 KB | None | 0 0
  1. Assets =
  2. {
  3.     Asset("ATLAS", "images/newslots.xml"),
  4. }
  5.  
  6. function backpackpostinit(inst)
  7.     inst.components.equippable.equipslot = GLOBAL.EQUIPSLOTS.BACK
  8. end
  9.  
  10. function amuletpostinit(inst)
  11.     inst.components.equippable.equipslot = GLOBAL.EQUIPSLOTS.NECK
  12. end
  13.  
  14. function inventorypostinit(component,inst)
  15.     inst.components.inventory.numequipslots = 5
  16. end
  17.  
  18. AddPrefabPostInit("amulet", amuletpostinit)
  19. AddPrefabPostInit("blueamulet", amuletpostinit)
  20. AddPrefabPostInit("purpleamulet", amuletpostinit)
  21. AddPrefabPostInit("orangeamulet", amuletpostinit)
  22. AddPrefabPostInit("greenamulet", amuletpostinit)
  23. AddPrefabPostInit("yellowamulet", amuletpostinit)
  24. AddComponentPostInit("inventory", inventorypostinit)
  25. AddPrefabPostInit("backpack", backpackpostinit)
  26. AddPrefabPostInit("krampus_sack", backpackpostinit)
  27. AddPrefabPostInit("piggyback", backpackpostinit)
  28. AddPrefabPostInit("icepack", backpackpostinit)
  29.  
  30. table.insert(GLOBAL.EQUIPSLOTS, "BACK")
  31. GLOBAL.EQUIPSLOTS.BACK = "back"
  32. table.insert(GLOBAL.EQUIPSLOTS, "NECK")
  33. GLOBAL.EQUIPSLOTS.NECK = "neck"
  34.  
  35. AddClassPostConstruct("screens/playerhud", function(self)
  36.     local oldfn = self.SetMainCharacter
  37.     function self:SetMainCharacter(maincharacter)
  38.         oldfn(self, maincharacter)
  39.         self.controls.inv:AddEquipSlot(GLOBAL.EQUIPSLOTS.BACK, "images/newslots.xml", "back.tex")
  40.         self.controls.inv:AddEquipSlot(GLOBAL.EQUIPSLOTS.NECK, "images/newslots.xml", "neck.tex")
  41.         self.controls.inv.bg:SetScale(1.25,1,1.25)
  42.     local bp = maincharacter.components.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.BACK)
  43.     if bp and bp.components.container then
  44.         bp.components.container:Close()
  45.         bp.components.container:Open(maincharacter)
  46.         end
  47.     end
  48. end)
Advertisement
Add Comment
Please, Sign In to add comment