mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 10:21:45 -04:00
fixing motion sensor again
stuff changed again between 1.7.10 to 1.10 closes #2692
This commit is contained in:
parent
1633375355
commit
f9cd34580a
@ -102,15 +102,15 @@ class MotionSensor(val host: EnvironmentHost) extends prefab.ManagedEnvironment
|
|||||||
// is pseudo-infrared driven (it only works for *living* entities, after
|
// is pseudo-infrared driven (it only works for *living* entities, after
|
||||||
// all), so I think it makes more sense for it to work in the dark, too.
|
// all), so I think it makes more sense for it to work in the dark, too.
|
||||||
/* entity.getBrightness(0) > 0.2 && */ {
|
/* entity.getBrightness(0) > 0.2 && */ {
|
||||||
var origin = new Vec3d(x, y, z)
|
val origin = new Vec3d(x, y, z)
|
||||||
val target = new Vec3d(entity.posX, entity.posY, entity.posZ)
|
val target = new Vec3d(entity.posX, entity.posY, entity.posZ)
|
||||||
val path = origin.subtract(target).normalize()
|
val path = target.subtract(origin).normalize()
|
||||||
origin = origin.addVector(
|
val moved_origin = origin.addVector(
|
||||||
path.xCoord * 0.75,
|
path.xCoord * 0.75,
|
||||||
path.yCoord * 0.75,
|
path.yCoord * 0.75,
|
||||||
path.zCoord * 0.75
|
path.zCoord * 0.75
|
||||||
)
|
)
|
||||||
world.rayTraceBlocks(origin, target) == null
|
world.rayTraceBlocks(moved_origin, target) == null
|
||||||
}
|
}
|
||||||
|
|
||||||
private def sendSignal(entity: EntityLivingBase) {
|
private def sendSignal(entity: EntityLivingBase) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user