Difference between revisions of "OpenCCSensors"

From ComputerCraft Wiki
Jump to: navigation, search
(Please explicitly set "|Output-link=OpenCCSensors" when using the Crafting grid template, to prevent dead links for OCS sensorcards from being generated. (The CG template attempts to link to a page for the item.))
Line 26: Line 26:
 
  |A3=Stone |B3=Stone      |C3=Stone
 
  |A3=Stone |B3=Stone      |C3=Stone
 
  |Output=Sensor Peripheral
 
  |Output=Sensor Peripheral
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
<table style="width: 100%; border-spacing: 0px;">
 
<table style="width: 100%; border-spacing: 0px;">
Line 53: Line 54:
 
  |A1=glass_pane |B1=Redstone          |C1=Monitor
 
  |A1=glass_pane |B1=Redstone          |C1=Monitor
 
  |Output=Gauge Peripheral
 
  |Output=Gauge Peripheral
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
  
Line 77: Line 79:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=Inventory Sensor Card
 
  |Output=Inventory Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 99: Line 102:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=Industrial Craft 2 Sensor Card
 
  |Output=Industrial Craft 2 Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 110: Line 114:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=Buildcraft Sensor Card
 
  |Output=Buildcraft Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 123: Line 128:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=Liquid Sensor Card
 
  |Output=Liquid Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 134: Line 140:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=World Sensor Card
 
  |Output=World Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 145: Line 152:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=Dropped Item Sensor Card
 
  |Output=Dropped Item Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 156: Line 164:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=Sign Sensor Card
 
  |Output=Sign Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 167: Line 176:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=Thaumcraft Sensor Card
 
  |Output=Thaumcraft Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 179: Line 189:
 
  |A3=paper |B3=paper      |C3=paper
 
  |A3=paper |B3=paper      |C3=paper
 
  |Output=Minecart Sensor Card
 
  |Output=Minecart Sensor Card
 +
|Output-link=OpenCCSensors
 
  }}
 
  }}
 
</td></tr>
 
</td></tr>
Line 228: Line 239:
 
  end
 
  end
 
}}
 
}}
 +
 +
[[Category:User_Created_Peripherals]][[Category:Unofficial_APIs]]

Revision as of 14:44, 26 January 2013

This page needs some serious TLC, stat!
Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: I no dun with this, but 'tis a start! AfterLifeLochie 03:34, 25 December 2012 (MSK))

OpenCCSensors is a new, open-source, up to date replacement for CcSensors (outdated), allowing monitoring and gathering information from the Minecraft environment - including players, entities, proximity, world info, IndustrialCraft 2, BuildCraft 2, liquids, inventories - and more!


OpenCCSensors comes with its own API, and automatically installs a new program for you at /ocs/programs/sensorview. sensorview is a handy program for very quickly looking at the information gathered from your sensors.


http://www.youtube.com/watch?v=i8Bv7uKkIOM&feature=youtu.be

Grid disk.png   OpenCCSensors Peripherals

NameDescription
Sensor Peripheral

The Sensor Peripheral needs to be placed next to a computer and it has a single slot to insert a Sensor Card


Obsidian

Redstone

Stone

Obsidian

Obsidian

Stone

Obsidian

Redstone

Stone

Sensor Peripheral




os.loadAPI("ocs/apis/sensor") Load the sensor API
mySensor = sensor.wrap(side) Returns the wrapped sensor on the side specified.
mySensor.getTargets() Returns a a table of all the targets for mySensor, where the keys are used as a numerical index, and the values are each a table of basic details.
mySensor.getTargetDetails(key) Returns a table of full details for that particular target from the sensor mySensor - where the the "key" is the key returned from getTargets()
Gauge Peripheral

The Gauge Peripheral can be placed onto the side of certain machines to get instant readings from them. Right now this only supports Batboxes, MFE's, MFSU, Mass fabricators and Nuclear reactors. We hope to expand this in the future as well as offer an API to re-program the gauge from a computer.


glass_pane


Redstone


Monitor


Gauge Peripheral





Grid disk.png   OpenCCSensors Sensor Cards

NameDescription
Inventory Sensor Card The Inventory Sensor Card is capable of reading inventories of any chests or machines around the sensor. It gives full information about what item is in each slot.


Redstone

Redstone

paper

wooden_plank

Redstone

paper

Redstone

Redstone

paper

Inventory Sensor Card



Proximity Sensor Card The Proximity Sensor Card is capable of detecting players and entities within it's range.


Redstone

Redstone

paper

pressure_plate

Redstone

paper

Redstone

Redstone

paper

Proximity Sensor Card



Industrial Craft 2 Sensor Card The IndustrialCraft Sensor Card is capable of interfacing and reading IC2 machine values (eg, EU in storage, etc).


Redstone

Redstone

paper

copper_cable

Redstone

paper

Redstone

Redstone

paper

Industrial Craft 2 Sensor Card



BuildCraft Sensor Card


Redstone

Redstone

paper

lever

Redstone

paper

Redstone

Redstone

paper

Buildcraft Sensor Card



Tank Sensor Card The Tank sensor card is far more powerful than it first seems. This card not only reads actual tanks, but reads internal tanks within a variety of different machines, such as:

Railcraft: Iron Tanks, Buildcraft: Tanks, Thermal Expansion: Aqueous Accumulator, Thermal Expansion: Igneous Extruder, Thermal Expansion: Glacial Precipitator, Thermal Expansion: Liquid Transposer, Thermal Expansion: Magma Crucible, Thermal Expansion: Magmatic Engine, Thermal Expansion: Steam Engine, Industrial Craft: Geothermal Generator, Thaumcraft: Crucible, Buildcraft: Tank, Buildcraft: Combustion Engine, Buildcraft: Pump, Buildcraft: Refinery, Forestry: Biogas Engine, Forestry: Fermenter, Forestry: Still, Forestry: Bottler, Forestry: Raintank, Forestry: Bio Generator, Forestry: Carpenter, Forestry: Moistener, Forestry: Squeezer, Forestry: Thermonic Fabricator, Extra Bees: Analyser, Extra Bees: Purifier, Extra Bees: Synthesizer, Extra Bees: Genepool, Extra Bees: Splicer, Railcraft: Hobbyist's Steam Engine, Railcraft: Commercial Steam Engine, Railcraft: Industrial Steam Engine, GregTech: Quantum Tank, GregTech: Thermal Generator


Redstone

Redstone

paper

Bucket

Redstone

paper

Redstone

Redstone

paper

Liquid Sensor Card



World Sensor Card The World Sensor Card is able to tell the time, weather, and more about the world.


Redstone

Redstone

paper

ender_pearl

Redstone

paper

Redstone

Redstone

paper

World Sensor Card



Dropped Item Sensor Card The Dropped Item Sensor Card is able to locate and identify dropped items.


Redstone

Redstone

paper

slime_ball

Redstone

paper

Redstone

Redstone

paper

Dropped Item Sensor Card



Sign Sensor Card The Sign Sensor Card is capable of reading signs within it's range.


Redstone

Redstone

paper

sign

Redstone

paper

Redstone

Redstone

paper

Sign Sensor Card



Thaumcraft Sensor Card The Thaumcraft Card can read XP levels from a "brain in a jar" and read aspect levels from crucibles and jars


Redstone

Redstone

paper

Goggles of Revealing

Redstone

paper

Redstone

Redstone

paper

Thaumcraft Sensor Card



Minecart Sensor Card The Minecart Sensor Card can detect minecarts in the area and give basic information about them


Redstone

Redstone

paper

Minecart

Redstone

paper

Redstone

Redstone

paper

Minecart Sensor Card



Usage Examples

Grid paper.png  Example
List all available targets on a Proximity Sensor on the left of the Computer.
Code
os.loadAPI("ocs/apis/sensor")
local prox = sensor.wrap("left")
print(textutils.serialize(prox.getTargets()))
Output A huge blob of text with all nearby available targets to the sensor, and some basic details.



Grid paper.png  Example
Turn on a Redstone lamp when a player is within a certain distance from it. The sensor is placed to the left of the computer and the lamp is placed on top of the computer.
Code
os.loadAPI("ocs/apis/sensor")
 
-- the location of the redstone lamp relative to the sensor
local offset = {
  X = 1,
  Y = 1,
  Z = 0
}
 
-- how close a player has to be to activate the lamp
local radius = 5

 -- find the distance from the player position to the offset
function distance(pos)
  local xd = pos.X - offset.X
  local yd = pos.Y - offset.Y
  local zd = pos.Z - offset.Z
  return math.sqrt(xd*xd + yd*yd + zd*zd)
end

 
local proximity = sensor.wrap("left")
while true do
  local signal = false
  local targets = proximity.getTargets()
  for k, v in pairs(targets) do
        if distance(v.Position) < radius then
          signal = true   
        end
  end
  rs.setOutput("top", signal)
end