All pastes #344041 Raw Edit

Miscellany

public lua v1 · immutable
·published 2007-02-07 14:06 UTC
rendered paste body
function move ()local randrepeatrand = randInt ( 1, options.b ) --Note 1until (moving[rand] ~= 1) --Note 2	local object = objects[ rand ] --Note 3	local move = randInt ( 0, 5 ) --Note 4	local x,y,z	local x2,y2,z2 = getElementPosition ( object )	local free = {}	copyTable(matrix,free) --Note 5	getFree(free) --Note 6	x = x2 / -4 --Note 7	y = y2 / -4	z = z2 / 3	if (move == 0) and (x ~= 1) and (free[x-1][y][z] == 0) then --Note 8		moving[rand] = 1 --Note 9		local s = 4000 - xy_speed * z --Note 10		setTimer ("done", s, 1, rand, x, y, z) --Note 11		x = x - 1 --Note 12		matrix[x][y][z] = 1 --Note 13		moveObject ( object, s, x2 + 4, y2, z2, 0, 0, 0 ) --Note 14	elseif (move == 1) and (x ~= options.x) and (free[x+1][y][z] == 0) then		moving[rand] = 1		local s = 4000 - xy_speed * z		setTimer ("done", s, 1, rand, x, y, z)		x = x + 1		matrix[x][y][z] = 1		moveObject ( object, s, x2 - 4, y2, z2, 0, 0, 0 )	elseif (move == 2) and (y ~= 1) and (free[x][y-1][z] == 0) then		moving[rand] = 1		local s = 4000 - xy_speed * z		setTimer ("done", s, 1, rand, x, y, z)		y = y - 1		matrix[x][y][z] = 1		moveObject ( object, s, x2, y2 + 4, z2, 0, 0, 0 )	elseif (move == 3) and (y ~= options.y) and (free[x][y+1][z] == 0) then		moving[rand] = 1		local s = 4000 - xy_speed * z		setTimer ("done", s, 1, rand, x, y, z)		y = y + 1		matrix[x][y][z] = 1		moveObject ( object, s, x2, y2 - 4, z2, 0, 0, 0 )	elseif (move == 4) and (z ~= 1) and (free[x][y][z-1] == 0) then		moving[rand] = 1		local s = 3000 - z_speed * z		setTimer ("done", s, 1, rand, x, y, z)		z = z - 1		matrix[x][y][z] = 1		moveObject ( object, s, x2, y2, z2 - 3, 0, 0, 0 )	elseif (move == 5) and (z ~= options.z) and (free[x][y][z+1] == 0) then		moving[rand] = 1		local s = 3000 - z_speed * z		setTimer ("done", s, 1, rand, x, y, z)		z = z + 1		matrix[x][y][z] = 1		moveObject ( object, s, x2, y2, z2 + 3, 0, 0, 0 )	endend