-
Notifications
You must be signed in to change notification settings - Fork 8
Home
I'll try to extend this wiki and provide an easy walkthrough/tutorial in the future. For now, you can find some basic guidelines here.
There are currently two ways you can use this mod:
1. Create resource production and consumer entities.
2. Make your custom storage component compatible with other storage/logistic systems.
That one is easy: Just add a MarketSubscriberComponent to your entity. There you have the possibility to specify what resources are needed to produce the specified productscan be left empty if there are none). You also have to set an entityRefs to the entities where the MarketLogisticSystem should look for storage components, one to draw potential consumption resources from and one to store potential products. You'll also need to specify the time interval (should be in seconds) on which the production and consumption events are sent. Currently you'll also need to register your entity to the MarketSubscriberComponent to the MarketUpdaterSystem by sending a SubscriberRegistrationEvent (uses default constructor).
The only thing you really have to do is to implement the StorageComponentHandler for the storage-component you use in your mod. When the handler is ready, you'll need to register it in the StorageHandlerLibrary by calling storageHandlerLibrary.registerHandler(StorageComponentHandler handler)
.
Then you are already done :). Keep in mind that the handler most likely has to translate the resource representation within the economy module (String type, int amount) into your own, which will most likely be an actual item. I'll try to set up the a standard handler for the core stuff as a good example. For now you can use the very simple InfiniteStorageHandler for the InfiniteStorageComponent as a rough guide.
Using the logistic capabilities of this module is pretty straightforward: You'll find the current available actions in the events folder. Just send them from the entity of your choice the system should to the rest!
Current actions include:
Store resource in a target.
Draw resource from a target.
Create resource.
Destroy resource.
Conditioned production of resources and store them in a target: The condition here is currently only that the specified consumption resources are available in the respective entity and that the target has enough storage capacity.
I have plans to include a condition interface, which will allow to check target/origin entities for extra conditions that you can specify.