Project Zomboid

Project Zomboid

JB Max Capacity Override
80 kommentarer
neobenmike 15. aug. kl. 22:56 
No worries, already got it working, thanks
jbdiablo  [ophavsmand] 15. aug. kl. 20:33 
@neobenmike - which version of 42 are you running?
neobenmike 15. aug. kl. 18:11 
Can't enable mod due to requirement typo: \StarlitLibrary instead of just StarlitLibrary
jbdiablo  [ophavsmand] 31. juli kl. 10:58 
Re-uploaded the mod data enhancement. See description on how to use it and the limitations.

Thank you Eizen for the inspiration and testing!
jbdiablo  [ophavsmand] 30. juli kl. 7:57 
no worries, go ahead and hit me up on discord @jimbeamdiablo
Eizen 30. juli kl. 4:16 
@jbdiablo thank you for all the help. I managed to solve my issue except when equipping the backpack the capacity reverts back. Can I message you in discord? Btw I saw the thread in the discord link that you gave me. I'm really sorry for the clutter that I made in your comment section
jbdiablo  [ophavsmand] 29. juli kl. 17:05 
I broke it. Reverting until I can figure it out
jbdiablo  [ophavsmand] 29. juli kl. 14:56 
Added a mod data capacity override for single containers. To use:

yourContainer:getModData()["JB_MaxCapacityOverride"] = { capacity = 75 }

It still checks if your container type is in the lookup table first. Let me know if there are any issues with it. Cheers!
jbdiablo  [ophavsmand] 29. juli kl. 12:13 
@Eizen - I don't know what you're cooking but I tested and mod data was persistent on the item. I'll mess around with my code in a bit to check for mod data when patching capacities.
jbdiablo  [ophavsmand] 29. juli kl. 11:34 
I was trying to find a work around to preserve mod data, because that's messed up.
Eizen 29. juli kl. 11:23 
Damn, alright. I'm currently working on a solution that I theorized
jbdiablo  [ophavsmand] 29. juli kl. 10:46 
or not - "if your backpack has context menu wear options, it will nuke all the mod data on switch"
jbdiablo  [ophavsmand] 29. juli kl. 9:58 
@Eizen - I think the consensus is that mod data would be the way to go
jbdiablo  [ophavsmand] 29. juli kl. 9:52 
@Eizen - I asked about this in the PZ mod_development discord and the answer was "Tell them to come here and ask about it" :)

https://discord.gg/theindiestone
Eizen 29. juli kl. 9:22 
Yes, I've tried that but the type reverts back to original when you relog :(
jbdiablo  [ophavsmand] 29. juli kl. 9:20 
@Eizen - oh yea, that's a wrench in the cog for sure. Can you setType to something unique when it's upgraded?
Eizen 29. juli kl. 9:15 
Hmmm this is tricky, I have a mod that adds a functionality to upgrade a bag and increase its capacity, using JB_MaxCapacityOverride.CONTAINERS_TO_OVERRIDE causes all bags to increase capacity. Maybe it's impossible for now. Anyways, thank you
jbdiablo  [ophavsmand] 29. juli kl. 9:00 
@Eizen - you should be able to change the value for the container in the lookup table, like:

JB_MaxCapacityOverride.CONTAINERS_TO_OVERRIDE["Bag_ShotgunDblSawnoffBag"].capacity = 100

it works in my head anyway, I haven't tried it.
Eizen 29. juli kl. 2:55 
After I called this JB_MaxCapacityOverride.addContainer("Bag_ShotgunDblSawnoffBag", 125, true) , is it not possible to programmatically change the capacity to 100? like this container:setCapacity(100)
jbdiablo  [ophavsmand] 26. juni kl. 8:09 
@Briar Feet require=\StarlitLibrary is correct for B42
Matikanetannhauser 25. juni kl. 18:41 
@jbdiablo the issue is about the mod requirements. On the mod.info it was written like this: require=\StarlitLibrary and the correct one should be like this: require=StarlitLibrary because that is the mod id of Starlit Library. Ty!
jbdiablo  [ophavsmand] 16. juni kl. 16:18 
@Vengent thanks for the info!

@Promises this is for 42. changing capacities in 41 was so easy and didn't need any of *waves hands* this
Subway Shark 16. juni kl. 15:30 
im using it on b41
Vengent 16. juni kl. 15:15 
I've got it working in 42.9 with crates and some other movable containers. I'm not seeing any error about starlit currently.
jbdiablo  [ophavsmand] 16. juni kl. 14:37 
@Promises @Luna - I'll do some digging tomorrow. I haven't even fired up PZ since 42.9 so something may have changed.
Luna ~ 14. juni kl. 19:51 
same problem as person below
Subway Shark 14. juni kl. 19:25 
i have starlit library but in the mod menu it wont let me enable this because it says i dont have the library
jbdiablo  [ophavsmand] 9. juni kl. 10:36 
@Vengent I believe "crate" is the type you need"

-- Only using (containerType, capacity, preventNesting)
local JB_MaxCapacityOverride = require("JB_MaxCapacityOverride")
JB_MaxCapacityOverride.addContainer("crate", 500, false)
Vengent 6. juni kl. 18:06 
Hey JB, any chance of adding some samples for using this with containers like crates? Found a good one for character bags, but nothing for container existing in the world.
Flexible Games 27. maj kl. 19:32 
I was hoping for some built-in flag or something that skips inventory as mass, but I should have known better with this game.
jbdiablo  [ophavsmand] 27. maj kl. 15:54 
If you want to dig around in the CarController java, there might be a work-around without too much fuss. Like changing the vehicle mass in the vehicle script, maybe.
Flexible Games 27. maj kl. 13:29 
I can confirm that a trailer with over ~1800 weight does not move. Got it set to 20k, put about 2400 in planks and logs into it, would not budge. I could back it up, funny enough, but going forward it was like it was anchored to the ground. Had to empty it down to about 1800 for it to work.
jbdiablo  [ophavsmand] 27. maj kl. 8:44 
I get it - some days I write succinct, neat code and other days I struggle with simple things.

"TruckBed" is vanilla. You could probably setType() if vehicle = W900 and then set capacity to what you want. That way you don't change every TruckBed. I don't see why the W900 mod would care what the container type is named, but I could be wrong.
Flexible Games 26. maj kl. 20:12 
I'm barely hanging on with all this LUA.
Was looking at the W900 truck mod to customize it. It uses "TruckBed" as well and I am afraid to mess too much with renaming things as all the data is tied up in knots together.

The other things I desperately want to do is make the W900's vehicle transport flatbed able to take more than one vehicle. Sort of like how you can load many chickens into an animal trailer. But again, more LUA that I have no idea how to do.
jbdiablo  [ophavsmand] 26. maj kl. 15:31 
This is what I used in testing and it didn't affect the vehicle handling:

JB_MaxCapacityOverride.addContainer("TruckBedOpen", 500, false)
JB_MaxCapacityOverride.addContainer("TruckBed", 500, false)

I believe I had it up to 10,000 at some point and it was fine. You could loop through vehicle parts and check if they are a container. I believe vanilla does this somewhere. Seats, glovebox, begins with "TruckBed" are all going to be containers, though. It should be seamless.

Also, if you give the player container a type, you can alter the capacity. The big issue I couldn't overcome without java modding is - the over loaded moodle won't go away.
Flexible Games 26. maj kl. 14:42 
I was poking around a bit to try and find the container types used for vehicle trunk and storage to see if I could increase those with this mod. No luck so far, but it did occur to me that if I have 10k weight of stuff in a trunk the car might not be able to move.
So now I think I might have to override something somewhere regarding vehicle weight calculations.
Sigh...
jbdiablo  [ophavsmand] 1. maj kl. 14:21 
@LUCAQUANTUM This mod is for Build 42. There isn't any reason to use this with 41 as the capacity limitations aren't present in that build.
QUANTUMSTAR 30. apr. kl. 17:18 
Hi, i'm on 41 build and just wanted to inform that I'm experiencing the same problem as landerv123. I have Starlit Library active, I didn't get it from a modpack, downloaded it off the workshop. Still this mod won't activate with an error msg saying \StarlitLibrary isn't installed.
Flexible Games 22. apr. kl. 19:00 
I'm talking about Build 42. Yes someone made a mod that enables multiplayer.
Been trying to get it to work, I can connect with mods, but a friend is having issues.
jbdiablo  [ophavsmand] 22. apr. kl. 15:53 
Does ISInventoryTransferAction exist in 41? Also, in 41 it's as easy as using setCapacity() on the container.
Flexible Games 22. apr. kl. 13:59 
So as a tentative test, I've wrapped any client-side code in a simple if isClient() then block
time will tell
Flexible Games 22. apr. kl. 13:34 
So I've been trying to get this to work with Multiplayer, yes, it does exist
but for some reason I'm getting a ton of LUA script errors like this:
function: JB_MaxCapacityOverride.lua -- file: JB_MaxCapacityOverride.lua line # 315 | MOD: JB Max Capacity Override
Callframe at: require
function: SetContainerSize -- file: infinitecontainers.lua line # 64 | MOD: Infinite Carryable Containers

[15:25:12] [INFO] [Zomboid/Error]: ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: attempted index: new of non-table: null at KahluaThread.tableget(KahluaThread.java:1667).

The line in question?
local OG_ISInventoryTransferAction_new = ISInventoryTransferAction.new

I'm trying to get this to work, but I may have to abandon it as the server seems obsessed with running client side scripts
jbdiablo  [ophavsmand] 11. apr. kl. 20:05 
Updated so there's no more loooooooog floats. Thanks Skimble Shanks! I didn't really get anything else done on it this week. Cheers!
jbdiablo  [ophavsmand] 11. apr. kl. 9:45 
@landerv123 -- you're on build 42? You're not using a modpacked StarLit Library?
landerv123 11. apr. kl. 4:33 
it says it needs '/starlitlibery' but i already have that mod active and it still doesnt want to let this mod eneable.
Skimble Shanks 8. apr. kl. 9:27 
thanks for your work!

and btw reading ur codes is fun LOL

i'm sorry i didn't submit a PR directly, i didn't notice you pasted github link at the bottom of description
jbdiablo  [ophavsmand] 7. apr. kl. 10:44 
@Skimble Shanks - my bad, I don't think I ever noticed that. Thanks!
Skimble Shanks 7. apr. kl. 9:47 
please allow me to suggest using `return math.ceil(effinCapacity * 1.3)` in line 173 instead, to avoid a loooooooog float like 150.7000000002 making UI ugly
jbdiablo  [ophavsmand] 6. apr. kl. 20:15 
@Flexible Games - lol yea, I got rid of the item type check before adding to the container table and added a script check before the DoParam since it would throw an error if the script didn't exist. No sense in clogging up the debug logs.
Flexible Games 6. apr. kl. 20:00 
I like how in the same patchnotes you have add "if containerType exists" AND got rid of "if container type exists" in the same function :D