Author Topic: Workaround for bugged GetX()  (Read 7811 times)

Qon

  • Full Member
  • ***
  • Posts: 112
    • View Profile
Workaround for bugged GetX()
« on: October 17, 2013, 09:52:06 pm »
The GetX() functions aren't updated instantly when the qomputer moves in BV 1.21. This is a quick and easy workaround.
Qall move(direction), getX(), getY(), getZ() everywhere in your qode where you would otherwise have used Move(direction), GetX(), GetY(), GetZ().
They work exactly the same except that they aren't bugged q:
I haven't tested what happens if you give faulty values to Move() so you shouldn't either xD
Add this to your qode:
Qall
Code: [Select]
initP() as first line in Voxel_Step()!
Code: [Select]
p <- null
function vaddir(a, dir){
return vadd(a, [(dir==1?1:0)-(dir==3?1:0), (dir==4?1:0)-(dir==5?1:0), (dir==0?1:0)-(dir==2?1:0)])
}
function vadd(a, b) {
return [a[0]+b[0], a[1]+b[1], a[2]+b[2]]
}
function initP() {
if(p==null)
p = [GetX(), GetY(), GetZ()]
}
function refreshP(dir) {
p = vaddir(p, dir)
}
function move(d){
if(Move(d)){
refreshP(d)
return true
}
return false
}
function getX(){
return p[0]
}
function getY(){
return p[1]
}
function getZ(){
return p[2]
}
And don't put your qomputer on a qonveyor belt, then it will get out of sync :)