Jump to content

Where are the craftable furniture objects defined?


false_chicken

Recommended Posts

Hello! I have added a few objects to the game and have successfully added them to the loot table but I was wondering where the craftable object definations (Furniture) are located? I am currently trying to make a simple override to make the "Lamp On Pillar" require no batteries as lighting is a serious problem for my local group of friends. Any suggestions? If anyone can point me in the right direction I would greatly appreciate it. Thanks!

Link to comment
Share on other sites

Should be in recipes.txt in ProjectZomboid\media\scripts

Unfortunately its not :(. That seems to only deal with the recipes to craft items in the players inventory not the furniture you can craft and place in the world. And I wouldn't be just looking for the recipe to create the object but rather where that object itself is defined (Similar to items.txt where items are defined but for furniture).

Link to comment
Share on other sites

If I understood you right, what you're looking for is in media/lua/client/BuildingObjects/ISUI/ISBuildMenu.lua, search for "pillar". There are no "neat" definitions for this stuff I'm afraid.

Not "neat" but with some LUA understanding not too difficult to follow. Thanks! Seems to be just what I was looking for. 

Link to comment
Share on other sites

If I understood you right, what you're looking for is in media/lua/client/BuildingObjects/ISUI/ISBuildMenu.lua, search for "pillar". There are no "neat" definitions for this stuff I'm afraid.

Sorry to bring this "solved" topic back up. Technically it looks like what I was looking for but I cannot seem to achieve my goal of a powerless lamp. Here is the code I was modifying:

 

ISBuildMenu.onPillarLamp = function(worldobjects, square, sprite, player)-- sprite, northSprite    local lamp = ISLightSource:new(sprite.sprite, sprite.northSprite, getSpecificPlayer(player));    lamp.offsetX = 5;    lamp.offsetY = 5;    lamp.modData["need:Base.Plank"] = "2";    lamp.modData["need:Base.Rope"] = "1";    lamp.modData["need:Base.Nails"] = "4";--    lamp.modData["need:Base.Torch"] = "1";    lamp:setEastSprite(sprite.eastSprite);    lamp:setSouthSprite(sprite.southSprite);    lamp.fuel = "Base.Battery";    lamp.baseItem = "Base.Torch";    lamp.radius = 10;    lamp.player = player    getCell():setDrag(lamp, player);end

I tried commenting out the lamp.fuel line and tried changing its value to an empty string (""). Both of those seem to disable interaction with the lamp. I no longer have a context menu when right clicking on it. When creating the mod I simply copied the folder structure from the PZ media folder to override the default ISBuildMenu.lua with my own with the only change being what I mentioned. I can confirm in the console that the override is happening and when I revert my changes it works fine. Any suggestions? Thanks a lot!

Link to comment
Share on other sites

Yep, looks like that can't be commented out. Hm.

Somewhere there's a check being made, judging by the stacktrace, that, having crossed those two values out, returns null. (This was done with cheat = true.)

Ah. Thats a shame. Well I suppose I will just have to wait until some future change that will allow the modification or figure out some other way. I also was looking into maybe instead of changing the fuel required I would change the rate at which it used the fuel to zero but I cannot find a reference to any sort of consumption rate.

Link to comment
Share on other sites

What if you changed the fuel to Base.Potato

Make it run on potatoes, and start a farm

 

Would be perfectly realistic

Yeah I could but I was really looking for an infinite light source. Not RP or realism friendly I know but its something that a large majority of my friends on my server want.

Link to comment
Share on other sites

Yep, looks like that can't be commented out. Hm.

Somewhere there's a check being made, judging by the stacktrace, that, having crossed those two values out, returns null. (This was done with cheat = true.)

Oh and thanks for actually going through the work and testing that EnigmaGrey. I didn't expect that. Above and beyond good sir.

Link to comment
Share on other sites

 

Yep, looks like that can't be commented out. Hm.

Somewhere there's a check being made, judging by the stacktrace, that, having crossed those two values out, returns null. (This was done with cheat = true.)

Oh and thanks for actually going through the work and testing that EnigmaGrey. I didn't expect that. Above and beyond good sir.

 

Eh, had my own results to work towards, too. Behold, the levitating compost bin:

zkr8H5C.png

I wonder if it'd be easier just to make a light source, as this does, rather than try to have a lamppost that doesn't require power?

         IsoWorld.instance.CurrentCell.getLamppostPositions().add(new IsoLightSource((int)owner.x, (int)owner.y, (int)owner.z, 0.8F * invAmb, 0.8F * invAmb, 0.6F * invAmb, 18, 6));
Link to comment
Share on other sites

 

 

Yep, looks like that can't be commented out. Hm.

Somewhere there's a check being made, judging by the stacktrace, that, having crossed those two values out, returns null. (This was done with cheat = true.)

Oh and thanks for actually going through the work and testing that EnigmaGrey. I didn't expect that. Above and beyond good sir.

 

Eh, had my own results to work towards, too. Behold, the levitating compost bin:

zkr8H5C.png

I wonder if it'd be easier just to make a light source, as this does, rather than try to have a lamppost that doesn't require power?

         IsoWorld.instance.CurrentCell.getLamppostPositions().add(new IsoLightSource((int)owner.x, (int)owner.y, (int)owner.z, 0.8F * invAmb, 0.8F * invAmb, 0.6F * invAmb, 18, 6));

That seems like a possible solution for me. I may need to read up on some more modding information. That looks like Java and I am not too bad at it but I do not have much context for that piece of code. I am also fuzzy on the connection between Java and Lua. I am not too sure how to go about calling that from Lua.

EDIT: Some examples from your code would probably be infinitely helpful. 

Link to comment
Share on other sites

Just a suggestion (for false_chicken)

 

How about remove "usedelta" from battery and torch items in items.txt? The lamp post would still use a battery and a flashlight, but they will never be exhausted (i think).

That is a good idea but I would prefer to have batteries and flashlights still function.

Link to comment
Share on other sites

  • 1 year later...

 

Just a suggestion (for false_chicken)

 

How about remove "usedelta" from battery and torch items in items.txt? The lamp post would still use a battery and a flashlight, but they will never be exhausted (i think).

That is a good idea but I would prefer to have batteries and flashlights still function.

 

make a new battery just for the lamp post :P

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...