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 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 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 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.