This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
craftygeek's profile picture

Light sensor

Started by craftygeek, 19 January 2013 - 05:48 PM
craftygeek #1
Posted 19 January 2013 - 06:48 PM
With the addition of the vanilla daylight sensor for 1.5, I think a CC light sensor would be warranted. Maybe just restricted to a day/night sensor, but I would personally enjoy being able to have a turtle used for excavation be able to detect when to place torches. The OP-ness of this autodetection would, I think, be easily balanced by the fact that a turtle 'casts a shadow'/affects the light level/is not a transparent block, thereby necessitating a (nonstandard) bit of voodoo to account for that fact.

I envision a forced top-mounting light sensor (the sensor is crafted with a nether quartz material, and it could easily be said that top-mounting must be the case because of fragility of a quartz component, or something - you have to place it upright in the vanilla world, anyway, rather than on a side or bottom of a block), so even the expedient of just flying a layer above torch placement level would not work. Maybe this top-mount forcing could be a config, rather than hard-coded?

If that's not enough balancing for the sensor, maybe limit its uses before breakage, or make it, after n uses, need to do some version of a lightSensor.refuel() call with Nether Quartz as the selected fuel? Maybe even, rather than returning an error/null from reads after the refuel threshold, instead return random readings between 0 and 15? Or make it, below a certain threshold on the way to repair necessity, begin to have a legitimate uncertainty, spitting values further and further afield of the true reading (e.g., when it's at 50% 'durability'/quartz fuel of the sensor, a reading where the true light level is 10 could return a value from 9-11, whereas at 40% it could return a random value from 8-12, etc)?


Yes, I wouldn't be surprised if OpenCCSensors implements something akin to this; but, I think with the addition of light sensing into vanilla, it is an opportune time to add light sensing to CC-vanilla.
Dlcruz129 #2
Posted 19 January 2013 - 07:29 PM
os.time() returns the world time.
theoriginalbit #3
Posted 19 January 2013 - 07:37 PM
os.time() returns the world time.
I think OP is meaning more like when its mining underground, instead of using
if distMoved % 12 then placeTorch() end
having something like
if sensor.getLightLevel() == 12 then placeTorch() end
Dlcruz129 #4
Posted 19 January 2013 - 07:41 PM
And also, I believe the vanilla sensor outputs signal strength based on light level, does it not? The developers have confirmed that measuring signal strength will be added. Simply place a sensor and check the signal strength coming off of it.
theoriginalbit #5
Posted 19 January 2013 - 07:47 PM
And also, I believe the vanilla sensor outputs signal strength based on light level, does it not? The developers have confirmed that measuring signal strength will be added. Simply place a sensor and check the signal strength coming off of it.
On a turtle that is moving and mining? o.O
I can understand why this suggestion has been done, however I think the method I listed above is just as effective at placing torches… if you place a torch every 12 a mob wont spawn, so having it place every 12 would stop that… the only other use for a light sensor in CC would be useless since we do have os.time()
BigSHinyToys #6
Posted 19 January 2013 - 08:19 PM
And also, I believe the vanilla sensor outputs signal strength based on light level, does it not? The developers have confirmed that measuring signal strength will be added. Simply place a sensor and check the signal strength coming off of it.
On a turtle that is moving and mining? o.O
I can understand why this suggestion has been done, however I think the method I listed above is just as effective at placing torches… if you place a torch every 12 a mob wont spawn, so having it place every 12 would stop that… the only other use for a light sensor in CC would be useless since we do have os.time()
while true do
if os.time() == day and turtle.lightlevel() ~= bright then
dig.up()
end
goDown()
move forward()
end


yes there is no reason you would need it. This topic firmly falls in the WAIT till it happens category.
Luanub #7
Posted 19 January 2013 - 09:04 PM
There's also when it rains, its nice to have your lighting turn on when it starts to storm. Right now I use a RP2 light sensor for my automatic lights just for that reason. Would be nice if there was a way to do it with just CC.
Dlcruz129 #8
Posted 20 January 2013 - 04:11 AM
There's also when it rains, its nice to have your lighting turn on when it starts to storm. Right now I use a RP2 light sensor for my automatic lights just for that reason. Would be nice if there was a way to do it with just CC.

OpenCCSensors does that.
Luanub #9
Posted 20 January 2013 - 01:39 PM
Yeah but I don't typically use the peripheral mods, the peripheral cables that Xfel made is the only one I use. I'm not going to add another peripheral for it when I can just stick with the sensor for RP2 and call it good. It's much easier to use as well.
Zoinky #10
Posted 22 January 2013 - 08:16 PM
Well, once the ability of measuring redstone signals gets added in we could just use a vanilla solar panel.

Example:

if redstone.getStrength("right") < 7 then
redstone.setOutput("left", true)
else
redstone.setOutput("left", false)
end
sleep(5)

immibis #11
Posted 22 January 2013 - 10:15 PM
Well, once the ability of measuring redstone signals gets added in we could just use a vanilla solar panel.

Example:

if redstone.getStrength("right") < 7 then
redstone.setOutput("left", true)
else
redstone.setOutput("left", false)
end
sleep(5)

Those only detect sunlight.
Zoinky #12
Posted 22 January 2013 - 11:13 PM
Well, once the ability of measuring redstone signals gets added in we could just use a vanilla solar panel.

Example:

if redstone.getStrength("right") < 7 then
redstone.setOutput("left", true)
else
redstone.setOutput("left", false)
end
sleep(5)

Those only detect sunlight.

My post was directed a Luanub. But it's my fault for not quoting. Sorry :(/>