Download Here:
http://forums.facepunchstudios.com/s...d.php?t=425101
Update: Version 1.3:
-Mostly Fixed: Pumps
-Fixed: Supply Connectors saving to Adv. Duplicator
Update: Version 1.1:
-Added: Client-Side Beams
-Added: Cutoff Valve
-Added: Pumps
Client-Side Beams
Thanks to Tad2020's Beam Library you can now link resources without costly ropes lagging your server!
Cutoff Valve
This device can temporarly stop the flow of resources, effectively splitting resource networks. For example, you could shut off power to portions of your ship's systems, or prevent your resources from being siphoned out of Supply Conectors.
Pumps
Supply Connectors can now spawn with Pumps installed with a configurable transfer rate. This will allow you to create refill stations which dispense resources at a controlled rate.
Description:
This is mainly a tool for developing Scripted Entities which operate on resources. For example, you could create a Bread Machine that consumes Flour, Water, Yeast and Energy to produce units of Bread, which could either be stored in a container or consumed by the player if user-addon provides for it.
An example of what this can do is found in the Life Support Mod, where the 3 main resources of Air, Energy and Coolant are generated, stored, distributed and consumed for the purpose of survival in hostile environments.
The best part is that it's extremely easy to use. For example:
our Bread Machine's Init() function could have the following lines included:
Code:
RD_AddResource(self.Entity, "flour", 0)
RD_AddResource(self.Entity, "water", 0)
RD_AddResource(self.Entity, "yeast", 0)
RD_AddResource(self.Entity, "energy", 0)
Then in the Bread Machine's Think() function it could say:
Code:
local flour = RD_GetResourceAmount(self, "flour")
local water = RD_GetResourceAmount(self, "water")
local yeast = RD_GetResourceAmount(self, "yeast")
local energy = RD_GetResourceAmount(self, "energy")
if (flour >= 4) and (water >= 2) and (yeast >= 1) and (energy >= 25) then
RD_ConsumeResource(self, "flour", 4)
RD_ConsumeResource(self, "water", 2)
RD_ConsumeResource(self, "yeast", 1)
RD_ConsumeResource(self, "energy", 25)
... MAKE BREAD ....
end
Here are the utility function definitions:
Code:
RD_AddResource(ent, res, capacity)
--Adds a named resource with the specified storage capacity to the ent
RD_ConsumeResource(ent, res, amount)
--Consumes a named resource from the entity
RD_SupplyResource(ent, res, amount)
--Replenishes a named resource on the entity by a specified amount
RD_GetResourceAmount(ent, res)
--Returns the amount of a named resource accessable to the entity
RD_GetUnitCapacity(ent, res)
--Returns the maximum storage capacity of a specified entity, disregarding the network size(for named resource only)
RD_GetNetworkCapacity(ent, res)
--Returns the maximum storage capacity of an entire network accessable to the entity(for named resource only)
Using the included Link Tool you can hook devices up and create networks of shared resources. Also included is a retractable Supply Connector for temporary connections such as fueling stations or modular forts.
I have included some test entities in the base pack, the "Bucket o' Crud", the "Tub o' Crud and Junk", and the "Barrel o' Stuff and Junk." These are accessable in the SEnts Spawn Menu, and serve no other purpose than perhaps as templates for you to study.

Please note that Life Support 1.6 will conflict with this mod. Life Support 1.7 was built with Resource Distribution as a foundation, and will thus be compatible. When Garrysmod.org returns from the abyss, I'll be updating that and SpaceBuild.
Enjoy, and Happy Modding!
Addons using Resource Distribution:
Life Support: Petrol Systems
GCombat Damage System
Energy Generation 1.0
Life Support/SpaceBuild - EMP Coil
Powered Omni-Laser
Hydrogen Systems! Life Support Version 2!
Life Support Systems
Life Support System Cheats
Razer Weapon
Plasma Weapon
Tiberium!
Space Shield
Res. Distrib. Plug
Cloaking Button