description
Berry Basket
A high-output berry producer you can place anywhere. No building, zones, or cost requirements.
Why I Created This Mod
This is the first game mod I've ever written. I combined ideas from @junkets's Berry Farm, @Batyushki's Aladdin's Lamp and @RainsinMuff1n's Fantasy Decorations, to make a unique building:
- Berry Basket produces a large but reasonable number of berries, rather than an infinite count. Shows more realistic numbers in toolbar.
- No building is required. The basket can be placed anywhere.
- When clicked, the basket shows production stats directly, without clicking the building parts list.
- A new Berry Picker job is created with two worker spots for the basket. Berry Pickers and Foragers tend to the basket.
- Transporters pick up and carry berries to the granary from the same basket.
Changing The Basket Graphic
The Berry Basket 3D model PREFAB_BASKET_BERRIES_PART
comes from Fantasy Decorations. You can change it to another prefab in that mod (or any other prefab), by modifying the value PREFAB_BASKET_BERRIES_PART
both places that it appears in berryBasket.lua (see both code boxes below):
-- BUILDING PART Berries
berryBasket:register({
DataType = "BUILDING_PART",
Id = "BUILDING_PART_BERRIES",
Name = "BUILDING_PART_BERRIES_NAME",
AssetBuildingFunction = "BUILDING_FUNCTION_BERRY_PRODUCER",
ConstructorData = {
DataType = "BUILDING_CONSTRUCTOR_DEFAULT",
CoreObjectPrefab = "PREFAB_BASKET_BERRIES_PART"
}
}}
Changing The Berry Production Behavior
You can change the rate of berry production and picking by modifying the values in this section of berryBasket.lua:
-- RESOURCE CONTAINER Berries
berryBasket:registerPrefabComponent("PREFAB_BASKET_BERRIES_PART", {
DataType = "COMP_RESOURCE_CONTAINER",
ResourceData = "BERRIES",
IsReplenishable = true,
ReplenishDurationInDays = 7,
ReplenishQuantity = 10,
ResourceValue = 5.0, -- How many to pick each time?
AvailableQuantity = 50, -- Maximum storage.
Radius = .55, -- Villager stands this far away to pick.
IsDestroyWhenEmpty = false
})
Eliminating Dependencies
You can remove the Fantasy Decorations dependency entirely by specifying any of the built-in prefabs, like PREFAB_RESOURCE_BERRIES
which will draw a standard berry bush instead of the basket. This change needs to made in both of the sections shown above (both places that PREFAB_BASKET_BERRIES_PART
appears.
Credits & Acknowledgements
Thank you to @junkets, @Batyushki, and @RainsinMuff1n for your inspiration and examples. Starting from someone else's working code is a huge advantage and I recommend that approach for any new mod developers.
Future Directions
I'd like to create a monument version of this mod with a few more parts, like a table or crate to put the basket on. It also needs nodes to better place the workers around it. Finally, I plan to make other versions with different resources to help you keep your village stocked!
Thanks for checking it out... I welcome and enjoy your feedback!
-- GarranPlum
0 Comments for Berry Basket