diff --git a/lwcomponents/docs/api.txt b/lwcomponents/docs/api.txt new file mode 100644 index 0000000..252e947 --- /dev/null +++ b/lwcomponents/docs/api.txt @@ -0,0 +1,51 @@ + + +lwcomponents.version () + Returns this mod version as a string. eg. "0.1.5". + + + +lwcomponents.register_spawner (itemname, spawn_func) + + itemname: + Registered string name of the spawner item + + spawn_func: + The function to call to spawn the mob of the form - + + spawn_func (spawn_pos, itemstack, owner, spawner_pos, spawner_dir, force) + + spawn_pos: + The position the entity should be spawned at. + + itemstack: + The spawner ItemStack, of the name itemname. + + owner: + As string of the player's name that will own the spawned entity, + if applicable. This may be "" for no owner. + + spawner_pos: + The position of the block calling this function. + + spawner_dir: + A single unit vector of the direction the spawner block is facing. + eg. { x = -1, y = 0, z = 0 } + + force: + Recommended force (for velocity) of spawned entity. + Can use vector.multiply (spawner_dir, force). + + This function should return the ObjectRef of the spawned entity or + nil. If this function returns nil for ObjectRef a second boolean + value should be returned for whether to cancel the action. + + eg. If too many mobs: + return nil, true + + eg. If only chance of spawn and out of luck: + return nil, false + + The register function return true on success, or false on failure + (parameter type check failed or the spawn item has already been + registered). diff --git a/lwcomponents/docs/breaker.txt b/lwcomponents/docs/breaker.txt new file mode 100644 index 0000000..3d9f161 --- /dev/null +++ b/lwcomponents/docs/breaker.txt @@ -0,0 +1,56 @@ +Breaker +------- +* This block is only available if digilines and/or mesecons are loaded. + +Breakers dig the node up to 5 nodes directly in front of them and drop +the item at the back of them, or into a pipeworks tube if one is placed +behind it. The node is only dug if the breaker has a tool that can dig it +or if it can be dug by hand, and there are no nodes before of it. ie. +cannot dig 2nd node if 1st node has something in it. The tool is worn if +used. Also acts as a digilines conductor. If the hopper mod is loaded, +will take tools from the top and sides. Pipeworks tubes can push items +into and pull items from the inventory. + +Only the owner can dig or access the form of the locked version. To break +nodes in a protected area, the locked version must be used and the owner +must be able to dig in the area. + +UI + +Channel - digilines channel of breaker. +Top 1 slot inventory - tool to use. +Bottom 32 slot inventory - player's inventory. + +Mesecons + Digs the node in front (always the 1st node position) when power is + turned on, if it can. + +Digilines messages + +"break n" + Digs the node at n nodes in front when power is turned on, if it can. + n should be a number between 1 and 5. If omitted 1 is assumed. + +"eject side" + Drop the tool in the tool slot at the given side. Valid sides are "left", + "right", "back", "front". If side is omitted or invalid "front" is used. + +When a breaker digs a node or wears out the tool a digilines message is +sent with the breaker's channel. The message is a table with the following +keys: +{ + action = "", + name = "", + range = +} + +action + Will be "break" or "tool". + +name + For "break" action the registered node name of what was dug. + For "tool" action the registered tool name of the tool that wore out. + +range + For "break" action the nodes forward that was dug. + For "tool" action always nil. diff --git a/lwcomponents/docs/camera.txt b/lwcomponents/docs/camera.txt new file mode 100644 index 0000000..ad8bc2b --- /dev/null +++ b/lwcomponents/docs/camera.txt @@ -0,0 +1,41 @@ +Camera +------ +* This block is only available if digilines is loaded. + +Cameras take an image in the direction they are facing. The colors in the +image represent what is being viewed. Nodes are gray, entities are blue and +players are green. The closer they are to the camera the brighter the color. +The viewing distance of the camera is 1 to 16 nodes. Also acts as a +digilines conductor. + +Only the owner can dig or access the form of the locked version. + +UI + +Channel - digilines channel of camera. +Distance - the viewing distance forward from the camera (1 to 16). +Resolution - the image resolution (for both width and height, 1 to 128). + +Digilines messages + +"scan" + Sends a digilines message with the camera's channel and a table of the + image as the message (see below). + +"distance n" + Sets the viewing distance of the camera. Will be clipped between 1 and + 16. + +"resolution n" + Sets the image resolution of the camera. + +The image is an indexed table of indexed tables. Each inner table is one +line of the image ordered top to bottom. There are resolution number of +lines. Each line has a string value for each pixel of that line left to +right. The string is a hex color string eg. "00FF00". There are resolution +number of pixels per line. + +The image format is compatible with digistuff's digiscreens and lwcomputers' +digiscreens and digipanels. It is best to set the resolution of the camera +to the resolution of the display, then the image from the camera can be sent +straight to the display device. diff --git a/lwcomponents/docs/cannon.txt b/lwcomponents/docs/cannon.txt new file mode 100644 index 0000000..beb8b53 --- /dev/null +++ b/lwcomponents/docs/cannon.txt @@ -0,0 +1,104 @@ +Cannon +------ +This item is available without digilines or mesecons as it can be used +manually. + +Contains a single inventory slot and shoots an item on command. +If the hopper mod is loaded, will take items from the top and sides, and +release them from the bottom. Pipeworks tubes can push items into and pull +items from the inventory. + +Cannon rotation range: +side to side - +/-60 degrees (- = left, + = right) +down to up: -20 to 70 degrees (- = down, + = up) + +To spawn entities from cannons include the lwcomponents_spawners mod. + +Only the owner can dig or access the form of the locked version. + +UI + +Channel - digilines channel of cannon. +Hide - hides the form so the cannon can be used manually, double right click + any other face besides the rear to bring up the form. +Controller - digistuff game controller digilines channel. +Sensitive - if checked game controller movements have a x3 sensitivity. +Top 1 slot inventory - storage of items to shoot. +Bottom 32 slot inventory - player's inventory. + +Manual control +Place some items in the single slot, and click the Hide button. On the +rear panel their are 4 gray buttons. Right clicking them turns the barrel +in that direction 10 degrees. aux + right click turns 1 degree. Clicking +the red button fires an item. To bring up the form again double right click +any other face besides the rear. + +Digistuff game controller +Connect a game controller to the cannon with digilines cable. Enter the +game controller's channel in the Controller field of the cannon's form +(click Set). Your turning movements turn the cannon's barrel in the +direction the cannon is facing. If Sensitive is checked the movements +have an increased sensitivity (x3) to try and keep the target in your view, +otherwise x1. Punching shoots an item. The game controller updates every +0.2 seconds, so a quick punch may not register. A locked cannon can only +be controlled by it's owner with a game controller. + +Mesecons + Shoots an item when power is turned on. + +Digilines messages + +"pitch " + Sets the pitch of the barrel. n should be between -20 to 70, and will + be clipped to this range. + eg. "pitch 22" + +"rotation " + Sets the rotation of the barrel. n should be between -60 to 60, and will + be clipped to this range. + eg. "rotation 45" + +table - aim position +{ + action = "aim", + aim = { x, y, z } +} + x is the horizontal left (negative) to right. 0 is straight ahead. + y is the vertical down (negative) to up. 0 is straight ahead. + z is the depth. Must be > 0 or ignored. 1 is the position directly in + front of the cannon. + * The cannon barrel's height is 0.65 above the cannon's placed position. + When aiming for height, if the cannon's base height is taken as -0.5, + and consider height from there. This allows for the barrel height + and a little drop in the projectile at close range. + +"fire" + Shoots an item. + +* Note: turning the barrel is animated and takes 0.1 seconds per 10 + degrees of movement. A fire command while moving is ignored. + + +Three shells are provided for cannons. + +Shell +This shell has a 70% chance of destroying a node within a radius of 2 from +the impact, a 5% chance a flammable node will be set on fire within a +radius of 2 (if fire is installed), and damages players and entities within +a radius of 4 with a maximum of 20 damage points. + + +Soft Shell +This shell has a 50% chance of destroying only soft (buildable_to) nodes, +such as grass, within a radius of 2 from the impact, a 5% chance a flammable +node will be set on fire within a radius of 2 (if fire is installed), and +damages players and entities within a radius of 4 with a maximum of 20 +damage points. + + +Fire Shell +* This item is only available if fire is installed. +This shell does not destroying nodes, has a 70% chance of setting a node +on fire, whether its flammable or not within a radius of 2, and damages +players and entities within a radius of 4 with a maximum of 20 damage +points. diff --git a/lwcomponents/docs/collector.txt b/lwcomponents/docs/collector.txt new file mode 100644 index 0000000..9b87932 --- /dev/null +++ b/lwcomponents/docs/collector.txt @@ -0,0 +1,34 @@ +Collector +--------- +* This block is only available if digilines is loaded. + +Picks up dropped items in adjacent block, with optional filtering. Also +acts as a digilines conductor. If the hopper mod is loaded, will take items +from the top and sides, and release them from the bottom. Pipeworks tubes +can push items into and pull items from the inventory. + +Only the owner can dig or access the form of the locked version. + +UI + +Channel - digilines channel of collector. +Left 16 slot inventory - storage of picked up items. +Right 8 slot inventory - Filter list. Place what items should be picked + up in this list. Leave empty to pick up all. +Bottom 32 slot inventory - player's inventory. + +Digilines messages + +"start" + Start the collector. + +"stop" + Stop the collector. + +When items are picked up a digilines message is sent with the collector's +channel. The message is a table with the following keys: +{ + action = "collect", + name = "", -- name of picked up items. + count = -- number of the item picked up. +} diff --git a/lwcomponents/docs/conduit.txt b/lwcomponents/docs/conduit.txt new file mode 100644 index 0000000..2fb6af8 --- /dev/null +++ b/lwcomponents/docs/conduit.txt @@ -0,0 +1,109 @@ +Conduit +------- + +Conduits are connected in a circuit, and can move items from their +inventory to another conduit in the same circuit. + +When a conduit node is placed it has a simple form that asks for a channel. +This channel is both the digilines' channel and the target id of this +conduit within the circuit. A conduit does not have to be given a channel. +Most of them are just used to connect other conduits together. + +Transfer of items takes 0.1 seconds per conduit node moved, and will work +in unloaded blocks. + +Filtering of items can be done by placing an item into a filter slot and +setting a target for that item. If an item is not filtered it is sent to +the main target. Filtering can also be implemented through digilines. + +Conduits also act as a digilines conductor. If the hopper mod is loaded, +the conduit will take items from the top and sides, and release them from +the bottom. Be aware that hoppers from the hopper mod have some deficits +that can cause some nodes from this mod to not function correctly in +multi-player environments. The hoppers from this mod are more compatible. +Pipeworks tubes can push items into and pull items from the inventory. + +Note that if a sending conduit is moved (as with a piston) while in the +process of sending items, when the conduit is moved back into a circuit +a duplicate of the last sent item/s can be resent. + + +Only the owner can dig or access the form of the locked version. + +UI + +Channel - digilines channel/target id of conduit. +Target - target id/channel of conduit this conduit will transfer to. +Automatic - if checked transfers next item every second without command. +Top center 16 slot inventory - storage of items. +Bottom 32 slot inventory - player's inventory. +Filter - 8 vertical slot inventory on the right, each with their accompanying + target field. + +Mesecons + Transfers the next item when power is turned on to the target conduit. + +Digilines messages +"target " + Set the target of the conduit. id should be the channel of another + conduit on the same circiut. This takes a moment to take effect, so + delay any transfers. + +"targets" + Conduit will send a digilines message with its own channel in the form: + { + action = "targets", + targets = { ... } -- list of string channels of all other conduits + -- with a channel on the same circuit. + } + +"transfer" + Simple transfer. Transfers the next item in the inventory to the target + conduit (same as mesecons power). + +table message +{ + action = "transfer", + target = "", + slot = , + item = "" +} + + If target is not given, the conduit determines the target from it's + own settings. + + slot should be a number between 1 to 16. If the slot is empty nothing + is transferred. + + item should be the registered item name. If the conduit's inventory + does not contain any nothing is transferred. + + Only slot or item should be given. If both are given slot is used. If + neither are given the next item in the inventory is transferred. + +"inventory" + Sends a digilines message with it's own channel in the following form: + { + action = "inventory", + inventory = { + + } + } + The inventory key is an indexed list of items in the conduit in slot + order. Each item entry is a table with the following keys: + { + name -- string, the name of the item, as : + description -- string, description of the item, same as in UI + count -- number, the total number of this item in storage + custom -- true if a custom item (has metadata), false if not + pallet_index -- string if the item has a pallet index, otherwise nil + } + The description is derived from the short description, if none + then the description, and if none then the item's name, as + :. + +Note: When sending transfer messages the simple item name, as :, +will work for most items, but not for custom items. With custom items, or +to play it safe, use the table form of the transfer message and use the +index for the item from an inventory message as the slot for the transfer +message. diff --git a/lwcomponents/docs/crafter.txt b/lwcomponents/docs/crafter.txt new file mode 100644 index 0000000..81459da --- /dev/null +++ b/lwcomponents/docs/crafter.txt @@ -0,0 +1,166 @@ +Crafter +------- + +Crafters can craft items by recipe or desired output item. Crafted items +are placed in the Output inventory, along with any replacement items (for +example if a bucket of milk is used in the craft the bucket is placed in +the Output inventory as well). Source items for the craft must be in the +Input inventory. If the crafter is adjoined to a storage unit the crafter +will also use source items from it as well. + +Only the owner can dig or access the form of the locked version. + +Unowned crafters can only access unowned units. Owned crafters can access +units of the same owner or unowned units. + +UI +Input inventory - top left, source items for crafting. +Player inventory - lower left. +Channel - digilines channel of crafter, press enter or click Set to set. +Crafting grid - center top, enter a recipe to craft. +Automatic - if checked a craft of the recipe is performed every second (if possible). +Preview - this is a preview of the item crafted from the recipe. +Craft - perform 1 craft from the recipe (if possible). +Output inventory - center bottom, where crafted and replacement items are placed. +Search - top right. +Craftable list - right, list of all items that are possible to craft from + the input items. clicking an item crafts it (if possible). + +The form does not update while open. A craft from source items no longer +available will not craft. If an attempt is made to craft by item when the +source materials have run out, the form does update. + +Terms can be entered into the search field, and when enter is pressed or +the Search button is pressed, only items whose name or description contains +these terms are shown in the list. That is if they match any of the space +separated terms. + +When items are placed into the crafting grid a copy is used and the item +returns to where it was taken from. When items are removed from the crafting +grid they are disposed of. + +The preview displays the craft preformed by the recipe. Items cannot be +pulled from here. + +The automatic crafting is only operable when the crafter is in an active +block. Mesecons and digilines operations operate in unloaded blocks. + +When crafting by item, if more than one recipe is satisfied by the input +items, the crafting grid is replaced with the available crafts for that +item. Clicking the < and > buttons walks through the recipes. Clicking +Craft performs one craft with the displayed recipe. Clicking Close displays +the crafting grid. If only one recipe is satisfied by the input items one +craft is immediately performed without displaying the recipe. + +Hoppers placed to the top or sides of a crafter will feed items into the +input. Hoppers placed below a crafter will take items from the output. + +Pipeworks tubes can push items into the input, and pull items from the +output. + +Mesecons + Perform 1 craft from the recipe when power is turned on (if possible). + +Digilines messages +"craft [qty]" + Craft from the recipe if possible. qty is optional, if given must be an + integer between 1 to 10. If not given defaults to 1. A return message + is sent with it's own channel in the following format: + { + action = "crafted", + qty = number, -- craft qty requested + crafted = number -- crafts successfully performed + } + + +"craftitem itemname [qty]" + Craft the given item if possible. itemname must be a valid item name + (eg. "default:wood"). qty is optional, if given must be an integer + between 1 to 10. If not given defaults to 1. A return message is sent + with it's own channel in the following format: + { + action = "crafted", + itemname = string, -- the name of the item requested to craft + qty = number, -- craft qty requested + crafted = number -- crafts successfully performed + } + +"can_craft [itemname]" + Test whether a single craft can be performed for the item. itemname is + optional, if given will test craft by item. If not given will test if + the recipe in the crafting grid can be performed. A return message is + sent with it's own channel in the following format: + { + action = "can_craft", + itemname = string, -- the name of the item requested, nil for recipe + result = boolean -- true if craft can be performed, false if not + } + +"automatic state" + Sets the automatic running state of the crafter. state must be true or + false. + +"craftable" + Sends a digilines message with it's own channel of the possible craftable + items in the following form: + { + action = "craftable", + items = { + + } + } + The items key is an indexed list of items. Each item entry is + a table with the following keys: + { + name -- string, the name of the item, as : + description -- string, short description of item + } + +"inventory" + Sends a digilines message with it's own channel of the source items, + including any attached storage, in the following form: + { + action = "inventory", + inventory = { + + } + } + The inventory key is an indexed list of items. Each item entry is + a table with the following keys: + { + name -- string, the name of the item, as : + description -- string, short description of item + count -- number, the total number of this item in storage + } + + +Set recipe grid: +{ + action = "recipe", + items = { ... } +} + items must be a string list of item names as :. The grid is + filled left to right, top to bottom. Up to the first 9 items are used. + +* When crafting by item the output may not be as expected. For the digilines + "craftitem" message, the first found recipe for the craft which is + satisfied by the available items is used. So if you have saplings and + wood in the input and try to craft sticks, if the first recipe found + uses the saplings 1 stick will be output, if wood then 4 sticks. + Also, sometimes the same recipe is registered for more than 1 item. + In this case, what item will actually be crafted is ambiguous. + +* The file 'crafting_mods.lua' in the mod folder contains a list of + crafting modifications. Modify this file as necessary. The field name + is the item being crafted. Each item in the add list is added to the + output inventory. Each item in the remove list is removed from the + replacements or source storage. + +* Gaining the list of craftable items is an exponential process, based + on the number of unique source items and the total number of items + available. As a guide, 320 source items and 795 total items that resulted + 623 craftable items took approx. 200ms (1st gen i5 processor). The + list is obtained in a granular function to minimise server burden, but + may take a moment to update. This list is only gained: when the form is + opened; when the Search button is clicked; and when the digilines + "craftable" message is sent. diff --git a/lwcomponents/docs/deployer.txt b/lwcomponents/docs/deployer.txt new file mode 100644 index 0000000..e865ace --- /dev/null +++ b/lwcomponents/docs/deployer.txt @@ -0,0 +1,61 @@ +Deployer +-------- +* This block is only available if digilines and/or mesecons are loaded. + +Deployers place the node up to 5 nodes directly in front of them. The +node is only placed if there are no nodes before of it which are not +replaceable. ie. cannot place 2nd node if 1st node has something in it. +Also acts as a digilines conductor. If the hopper mod is loaded, will +take items from the top and sides, and release them from the bottom. +Pipeworks tubes can push items into and pull items from the inventory. + +Only the owner can dig or access the form of the locked version. To place +nodes in a protected area the 'Use player when placing' setting must be +enabled, the deployer must be the locked version and the owner must be able +to place in the area. + +UI + +Channel - digilines channel of breaker. +Top 16 slot inventory - storage of items to place. +Bottom 32 slot inventory - player's inventory. + +Mesecons + Places the node in front (always the 1st node position) when power is + turned on, if it can. + +Digilines messages + +"deploy " + Places the node at n nodes in front when power is turned on, if it can. + n should be a number between 1 and 5. If omitted 1 is assumed. + + If slot is a number, places an item from that slot. No placement if + slot is empty. + eg. "deploy 7" + + If itemname is given, places the item of the name given. No placement + if deployer does not contain the item. + eg. "deploy default:stone" + + If n is given with no slot/itemname use "nil". + eg. "deploy nil 3" + +When a deployer places a node a digilines message is sent with the +deployer's channel. The message is a table with the following +keys: +{ + action = "deploy", + name = "", + slot = , + range = +} + +action + Will be "deploy". + +name + The registered node name of what was placed. + +range + The nodes forward that was placed. diff --git a/lwcomponents/docs/destroyer.txt b/lwcomponents/docs/destroyer.txt new file mode 100644 index 0000000..5805b92 --- /dev/null +++ b/lwcomponents/docs/destroyer.txt @@ -0,0 +1,11 @@ +Destroyer +--------- + +Destroyers dispose of items placed in their single slot inventory (basically +a trash). Items can be push into destroyers with tubes from pipeworks or +hoppers attached to the top or sides, so they are suitable for automation. +Items cannot be pulled out of destroyers. + +Note that destroyers act when an item is placed in their inventory, as with +storage indexers it is best to use the hopper from this mod to feed them +in multi-player games. diff --git a/lwcomponents/docs/detector.txt b/lwcomponents/docs/detector.txt new file mode 100644 index 0000000..a2064c0 --- /dev/null +++ b/lwcomponents/docs/detector.txt @@ -0,0 +1,112 @@ +Detector +-------- +* This block is only available if digilines and/or mesecons are loaded. + +Detects items or entities within a given radius. Also acts as a +digilines conductor. + +Only the owner can dig or access the form of the locked version. + +UI + +Channel - digilines channel of detector. +Radius - block distance from detector to detect. +Entities - if checked detects entities. +Players - if checked detects players. +Drops - if checked detects drops. +Nodes - if checked detects nodes. + +mode: + All - detects to radius in all directions, including diagonal. + Forward - detects to radius directly in front of the detector (one block high). + Up - detects to radius directly above the detector (one block wide). + Down - detects to radius directly below the detector (one block wide). + +Mesecons + Mesecons power is turned on when something is detected, and turned off + when nothing is detected. + +Digilines messages + +"start" + Start the detector. + +"stop" + Stop the detector. + +"radius " + Set radius of the detector. should be a number from 1 to 5, and is + trimmed to this range. + +"entities " + Set detection of entities on or off. + +"players " + Set detection of players on or off. + +"drops " + Set detection of drops on or off. + +"nodes " + Set detection of nodes on or off. + +"mode all" +"mode forward" +"mode up" +"mode down" + Set the detector's mode. + +When items or entities are detected a digilines message is sent with the +detector's channel. A message is sent for each found item/entity. The +message is a table with the following keys: + +{ + action = "detect", + detected = table +} + +The detected field is a list of detected items. Each entry is of the form: +{ + type = "", -- will be "entity", "player", "drop" or "node" + name = "", + label = "