JackJohnsn Posted October 10, 2019 Share Posted October 10, 2019 (edited) So, I was messing around with some modding commands, and I encountered this weird scenario. When the player is trying to deploy something ( let's say, they have 20 stone walls - prefab wall_stone_item - and they are trying to deploy them ), they will click a stack, and then right click to deploy. That means, a stack of for example 20 is selected. Now, if you drop the player's inventory while this is happening, only 1 instance of that particular item will be dropped. Here's some code to reproduce: local global_ActionDeploy = _G.ACTIONS.DEPLOY.fn _G.ACTIONS.DEPLOY.fn = function(act) act.doer.components.inventory:DropEverything() return global_ActionDeploy(act) end Try putting this into a mod, select a stack of walls and deploy one. Only one wall item will be dropped. But, if you distribute that stack in your inventory ( let's say, you put 1 wall item in each inventory slot ) and then select "one" and deploy, the command will drop all the items. It seems to be some to do with the selection of the items. So, is this expected behavior? Because due to the method's name ( DropEverything() ) I was expecting it to drop all of the inventory. Edited October 10, 2019 by JackJohnsn Link to comment Share on other sites More sharing options...
Serpens Posted October 10, 2019 Share Posted October 10, 2019 Maybe it has to do with the "items on mouse" ? try dropping everything while you have an item on mouse. And if it does not has to do with it, search more within the deploy/drop code and see if there is a problem with stacks/missing code for stacks. Link to comment Share on other sites More sharing options...
JackJohnsn Posted October 10, 2019 Author Share Posted October 10, 2019 Ya that's actually what I mentioned. If a stack is selected by mouse, only one of it will be dropped. Link to comment Share on other sites More sharing options...
Serpens Posted October 11, 2019 Share Posted October 11, 2019 (edited) It is a bug, you can file a bug report for it. Every single line in inventory.lua that currently looks like this:self:DropItem(self.activeitem) should be instead:self:DropItem(self.activeitem,true) to also drop stacks. edit: after these changes the whole stack that is on the mouse is dropped. But of course it might be possible, that someone only want to drop one item from the stack. In this case my above code is not the final solution and the devs should find out why the rest of the active item is disappearing. Edited October 11, 2019 by Serpens 1 Link to comment 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