Hey guys, I know this has been brought up before but I was hoping some oxide devs might be able to also look into it. The problem is the bug that come about a few months ago when force opening a players inventory that causes it to close straight away. I've spent many hours trying to find a alternative method with no success. Most plugins I've needed to use it on I have just come up with a different way to achieve the same results however one of the current plugins I'm working on there isn't really any other way. Im starting to think its not something we could fix but I was hoping if one of you awesome oxide devs could find what is actually causing it maybe we could come up with a solution or get FP to fix it.
Force opening player's inventory?
Discussion in 'Rust Development' started by k1lly0u, Jul 16, 2016.
-
I would like to assist, but actually i got no idea of the problem itself.
Do you got an example/plugin which would demonstrate the problem/issue/bug on a practical way? -
Bounty(don't think I changed it), InventoryViewer, or you just just spawn a box and force open it. It works occasionally but most of the time instantly closes which is a pain in the ass when you need to destroy said box once the user closes it
-
-
No, you can force the player to start looting any lootable entity. It used to work fine and a few months ago after a Rust update it started bugging out and would insta-close their inventory. I was using it for for a few plugins so it would spawn a box near the player and they would start looting it, then when they closed their inventory the box would disappear and its contents would be saved for what ever I was using it for. Some other things I wanted to use it I now just spawn the box and the user has to open it, or I switched to some kind of GUI, but I kind of need to for something I'm working on atm and all alternative methods won't yield the same result, be to clunky, or would be too much work for little gain
-
Did you force to open the loot by chatcommand?
-
Not directly, but yes the chat command eventually leads to the function to open the inventory
-
The call works, when its called by a button, which calls a console command to force the loot action.
It works not, when you force to open the loot from a chat command. because the client checks there, if the chat is open.
I did some research last days on "Backpacks", which has actually the same problem.
The button there works only, when the inv is already opened. The reason here is, to reach the button, you need to have to open the chat, to move the cursor. Once again, the opened chat is the problem for force-close.
But if the console command is bind to a key, then it works from anywhere with NOT opened inventory before, because the chat is not open
Main reason for such behavior is mutually this part in the "client-code":
Code:// ConVar.Inventory [ConsoleSystem.Client] public static void toggle() { if (PlayerInput.hasNoKeyInput) // <<<<<<<<<<<<< { return; } UIInventory.ToggleInventory(); }
Code:// PlayerInput public static bool hasNoKeyInput { get { return !LocalPlayer.isSleeping && (NeedsKeyboard.AnyActive() || HudMenuInput.AnyActive() || UIChat.isOpen || DeveloperTools.isOpen || MainMenuSystem.isOpen || BugReporter.isOpen); } }
-
Love your work, Perhaps @LaserHydra and @Mughisi will also find use in this
-
...
-
Well, even with a button the call don't work each time ... I get the exact same issue before, I solved it by setting up a little timer between the function who create the loot box and the function who open it ( found this somewhere on the forum but don't remember where exactly =/ ). Without it most of the time the inventory is closed directly.