Cyde042 Posted October 18, 2016 Share Posted October 18, 2016 I need to add an invisible equip slot, preferably off screen. I took a look at extra equip slots and this part works: Spoiler AddGlobalClassPostConstruct("widgets/inventorybar", "Inv", function() local Inv_Refresh_base = Inv.Refresh or function() return "" end local Inv_Rebuild_base = Inv.Rebuild or function() return "" end function Inv:LoadExtraSlots(self) --self.bg:SetScale(1.35,1,1.25) --self.bgcover:SetScale(1.35,1,1.25) if self.addextraslots == nil then self.addextraslots = 0 self:AddEquipSlot(GLOBAL.EQUIPSLOTS.EXTRA) --[[ if self.inspectcontrol then local W = 68 --68 local SEP = 12 --12 local INTERSEP = 28 --28 local inventory = self.owner.replica.inventory local num_slots = inventory:GetNumSlots() local num_equip = #self.equipslotinfo local num_buttons = self.controller_build and 0 or 1 local num_slotintersep = math.ceil(num_slots / 5) local num_equipintersep = num_buttons > 0 and 1 or 0 local total_w = (num_slots + num_equip + num_buttons) * W + (num_slots + num_equip + num_buttons - num_slotintersep - num_equipintersep - 1) * SEP + (num_slotintersep + num_equipintersep) * INTERSEP self.inspectcontrol.icon:SetPosition(-4, 6) -- -4 6 --self.inspectcontrol:SetPosition((total_w - W) * .5 + 3, -6, 0) end ]] end end function Inv:Refresh() Inv_Refresh_base(self) Inv:LoadExtraSlots(self) end function Inv:Rebuild() Inv_Rebuild_base(self) Inv:LoadExtraSlots(self) end end) The commented part doesn't seem to do anything when it's only 1 slot. So this does add the slot, without a background, which is exactly what I want except it also centers all the hotbar according to the number of item slots, so it goes out of bounds of the hotbar background. I could simply make it wider, but that would cause compatibility issues with other mods that change the hotbar. So, could anyone tell me how do I go about making the newly added slot not affect the overall positioning? Link to comment https://forums.kleientertainment.com/forums/topic/70950-any-way-to-make-hot-bar-not-move-upon-adding-a-new-equip-slot/ Share on other sites More sharing options...
Mobbstar Posted October 18, 2016 Share Posted October 18, 2016 You can't use self:AddEquipSlot() if you want it to not affect the other slot tiles. By the way, doesn't calling AddEquipSlot() tell the game to perform a Rebuild() next tick? If so, calling AddEquipSlot() after every Rebuild() impacts performance at all times. Link to comment https://forums.kleientertainment.com/forums/topic/70950-any-way-to-make-hot-bar-not-move-upon-adding-a-new-equip-slot/#findComment-826509 Share on other sites More sharing options...
Cyde042 Posted October 18, 2016 Author Share Posted October 18, 2016 4 hours ago, Mobbstar said: You can't use self:AddEquipSlot() if you want it to not affect the other slot tiles. By the way, doesn't calling AddEquipSlot() tell the game to perform a Rebuild() next tick? If so, calling AddEquipSlot() after every Rebuild() impacts performance at all times. Ehhh, I just copy-pasted from equip-slots mods, but forget it I found a workaround. I tried earlier making it act like the beard does, but making another component wasn't enough, I had to make the temperature component take into consideration the new 'beard' component too. And it's working as intended. Thanks anyways. Link to comment https://forums.kleientertainment.com/forums/topic/70950-any-way-to-make-hot-bar-not-move-upon-adding-a-new-equip-slot/#findComment-826647 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now