Project Zomboid

Project Zomboid

JB Max Capacity Override
61 Comments
jbdiablo  [author] 26 Jun @ 8:09am 
@Briar Feet require=\StarlitLibrary is correct for B42
Briar Feet 25 Jun @ 6:41pm 
@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  [author] 16 Jun @ 4:18pm 
@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
Promises 16 Jun @ 3:30pm 
im using it on b41
Vengent 16 Jun @ 3:15pm 
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  [author] 16 Jun @ 2:37pm 
@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 Jun @ 7:51pm 
same problem as person below
Promises 14 Jun @ 7:25pm 
i have starlit library but in the mod menu it wont let me enable this because it says i dont have the library
jbdiablo  [author] 9 Jun @ 10:36am 
@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 Jun @ 6:06pm 
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 May @ 7:32pm 
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  [author] 27 May @ 3:54pm 
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 May @ 1:29pm 
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  [author] 27 May @ 8:44am 
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 May @ 8:12pm 
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  [author] 26 May @ 3:31pm 
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 May @ 2:42pm 
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  [author] 1 May @ 2:21pm 
@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 @ 5:18pm 
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 @ 7:00pm 
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  [author] 22 Apr @ 3:53pm 
Does ISInventoryTransferAction exist in 41? Also, in 41 it's as easy as using setCapacity() on the container.
Flexible Games 22 Apr @ 1:59pm 
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 @ 1:34pm 
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  [author] 11 Apr @ 8:05pm 
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  [author] 11 Apr @ 9:45am 
@landerv123 -- you're on build 42? You're not using a modpacked StarLit Library?
landerv123 11 Apr @ 4:33am 
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 @ 9:27am 
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  [author] 7 Apr @ 10:44am 
@Skimble Shanks - my bad, I don't think I ever noticed that. Thanks!
Skimble Shanks 7 Apr @ 9:47am 
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  [author] 6 Apr @ 8:15pm 
@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 @ 8:00pm 
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
jbdiablo  [author] 6 Apr @ 5:57pm 
Updated:
1) Added a check "if containerType exists" before calling Nepenthe's fix to cut down on errors in the logs
2) Re-did the transferTime function to be more friendly
3) Vehicle Mechanics UI now shows the correct "trunk" capacity
4) Vehicle damage affects trunk capacity
5) Changed hard-coded message to the RD text "You can't do that!" so there will be no translation files today, satan
6) Got rid of check "if container type exists" in addContainer because really, it did nothing important
Flexible Games 6 Apr @ 1:49pm 
tried to move this thread into a discussion post
jbdiablo  [author] 6 Apr @ 12:53pm 
@Flexible Games - player inventory type is none. I mean, maybe it can be done with checking type = none and parent = player, but I haven't investigated if any of that is handled in Lua or not.

Really, I'm just telling lua to use my functions instead of the java functions. The limitation is that lua has to call the function. If java calls it, it will use the java function.
Flexible Games 6 Apr @ 12:41pm 
You are a LUA wizard, I could have never figured out how to do this. All the patch class stuff and crazy LUAfoo.
One last mountain to climb, can this be used for the player inventory? If so, what do I use for the passed in type? If that can happen, then I don't need the java override for this either.
jbdiablo  [author] 6 Apr @ 12:28pm 
@Flexible Games - yay! The code wasn't centered around using vanilla objects but obviously you can. The code doesn't care as long as the game calls hasRoomFor(object) in Lua and it can get a "type" back from the object.

local containerType = self:getType()
local overrideData = JB_MaxCapacityOverride.CONTAINERS_TO_OVERRIDE[containerType]
jbdiablo  [author] 6 Apr @ 12:24pm 
@Flexible Games - for containers, generally the "container =" in that file is going to be the type.
Flexible Games 6 Apr @ 12:21pm 
I got it working! \o/
I created a discussion post on the other mod with the script edit
Wow that took awhile to track down. I could not figure out where you got the string "militarycrate" until I did a search on on the entire media directory files, not just media/scripts
This games files are just... so god awful.
Flexible Games 6 Apr @ 10:40am 
So I might have found it, were you taking the name from the newtiledefinitions.tiles.txt
container = ...
list?
Flexible Games 6 Apr @ 10:27am 
Okay, so if I were to add a little script to call addContainer on lockers and things, where would I find a list of exactly what to pass as the type variable. I can't find how you know what that name should be.
Please forgive my ignorance, I'm not a LUA dev normally and the PZ back-end is... confusing at best.
jbdiablo  [author] 6 Apr @ 9:39am 
@Flexible Games -- The container types are just "crate" , "locker" etc
Flexible Games 5 Apr @ 11:15pm 
I'd love to know how you got it to work with crates, poedgirls mod is specifically "carryable containers" i.e. backpacks and such.
Flexible Games 5 Apr @ 11:04pm 
How??!! Can you let me know?
I just streamed with this for 10 hours and none of my containers like crates had the change. I checked poedgirls mod and getItems() is called, but crates are not items, they're entities.

The one other capacity mod I'm using is the one that edits the characters capacity.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3408066578
Can this mod api work for the player as well?
jbdiablo  [author] 5 Apr @ 9:10am 
@Flexible Games - I just checked and it works fine with fridge, freezer, lockers, crates.
jbdiablo  [author] 5 Apr @ 9:04am 
@Flexible Games - What other mod's are you using? I know it works with crates, military crates, counters, etc. I'll investigate fridge and lockers but I don't see why they wouldn't work. I know how @poedgirl's mod works and those are all containers so the mod should pick up on them and add them.
Flexible Games 4 Apr @ 11:36pm 
After some investigating it seems this mod doesn't or can't modify things like crates, fridges, lockers, etc?
Would it be possible to add that functionality or ability?
Flexible Games 4 Apr @ 11:04pm 
All of the containers in my base reset their capacities and are no longer awesome. Been using that addon mod for this one that sets all capacities to 10k. Nothing in the log regarding JB other than loading the two mods
jbdiablo  [author] 3 Apr @ 8:58pm 
@poedgirl - I would have assumed it was for multiplayer but it looks like that's all going to be handled by the server. It would be nice if they opened the capacities up on SP / client-side
jbdiablo  [author] 3 Apr @ 8:55pm 
Updated:
- Changed the formula for transfer time. but I'm not happy with it, so it will be improved.
- Implemented Nepenthe's speed fix from "Remove Bag Slowdown" with permission.

I'm not sure if an equipped weight is going to happen and I'm not sure if a speed fix for "heavy load" is going to happen. I haven't found a way in to the java classes/functions that I need to do those.
poedgirl 3 Apr @ 6:59pm 
I do want to say thanks for all your work on this, I'll never understand why this limit exists to begin with, considering it's only modders that will have to deal with it.