46
Gallery / Re: Pictures of my work area
« on: October 14, 2013, 05:16:08 pm »
My attempt at a Stainless Steel factory. It is very slow since it has to wait for them to cool of.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
2223444
2223444
22X3X44
111 555
00X7X66
0007666
0007666
// Build Stair
MineNearOre <- 6; // 0=Do not mine near ores, 1=Mine all near none Black Rock, 2=Only Mine usefull near ores. +4=Follow
MaxMineFollow <- 16; // How far to follow ore
RefillOre <- 2; // 0=Do not refill after mining ore, 1=Only refill on floor (does not work well with follow), 2=Refill all
Rares <- {[26]="Au",[44]="X",[60]="C",[74]="Fe",[109]="Diamond",[111]="U",[112]="Cu",[122]="Ti",[150]="Pb",[197]="Al"};
VoxelOrder <- [ 1, 3, 2, 5, 6, 4, 8 ,9, 7, 10, 10, 10, 10 ]; // The order that Black Rock Voxels should be used (The order they appear in on the central blue plains
PathNo <- 4; // What variant to Build
// Path:
// first value=Level change from one execution of the path
// the rest:
// 0,1,2,3,4,5 mine voxel in that direction (See Blackvoxel manual for what different directions the numbers represent.)
// +8 also move in that direction
// +16 Place voxel in that direction if there is not already a solid voxel there. Usefull for making stairs in empty space.
Path <- {
// Dig 3 Wide 4 High Down (7x7)
[0] = [ 2,
9, 12, 12, 8, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 18,
9, 12, 12, 8, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
9, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
9, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
11, 11 ],
// Dig 3 Wide 6 High, Down (7x7)
[1] = [ 2,
9, 12, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 18,
9, 12, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
9, 12, 12, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
9, 12, 12, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
11, 11 ],
// Dig 3 Wide Up
[2] = [ 2,
12, 9, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 18,
12, 9, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
9, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
9, 12, 12, 12, 8, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21,
11, 11 ],
// Build 3 wide stairs Up with railings. For use in empty space (7x7)
[3] = [ 2,
10, 17, 8, 12, 9, 21, 18, 8, 21, 8, 21, 16
12, 9, 21, 16, 10, 21, 9, 21, 8, 21, 16, 9, 21, 16, 17, 10, 21, 17, 10, 21, 17, 11, 21 , 11, 21 ],
// Dig 4 wide 10 high Down. (11x11)
[4] = [ 4,
9, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 10, 21, 18,
9, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 10, 21, 18,
9, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 10, 21, 18,
9, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 10, 21,
9, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 10, 21,
9, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 10, 21,
9, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 12, 10, 12, 8, 8, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 10, 13, 8, 13, 21, 10, 21, 10, 21, 10, 21,
11, 11, 11 ]
};
Time <- 0;
Step <- 0; // Current step in the path
Direction <- 0; // Current rotation adjustment
MinePath <- []; // Dynamic path created while following ore.
/*
Levels
-1 Black Rock Blue
-65 Black Rock Green
-129 Black Rock Orange
-193 Black Rock Cyan
-257 Black Rock Yellow
-321 Black Rock Red
-385 Black Rock Purple
-449 Black Rock Grey
-513 Black Rock Pink
-577 Black Rock White
-621 Nothing
-631 Water+Black Rock White
-636 Black Rock White
*/
function Voxel_Step()
{
local i,j,v,done;
// Init
if (Time == 0) {
Time = GetGameTime();
// Calculate start direction based on Level.
i = GetY();
if (i<0) i = -i;
Direction = (i/Path[PathNo][0])%4;
}
if ( (GetGameTime() - Time) > 1 )
{
Time = GetGameTime();
} else {
return;
}
done = 0;
do {
// Check for end of path
if (Step >= Path[PathNo].len())
{
Step = 1;
Direction = (Direction+1)%4; // Next execution of path will be rotated one step clockwise.
}
i = Path[PathNo][Step];
// Get direction part of path
j = (i%8);
if (j<4) // Don't rotate up/down
{
// Modify move/dig value with direction
j = (j+Direction)%4;
}
v = Look(j);
if ((i & 16)==16) { // Bit 8 set = Place Voxel
if (GetVoxelProp(v,0)) { // If it is not a solid, place one.
v = GetBlackRockForLevel(j);
if (v>0)
PlaceVoxel(j,v);
}
} else {
if (MinePath.len()==0) {
if (!GetVoxelProp(v,0)) // If it is a solid, mine it.
PickVoxel(j);
}
if (MineNearOre > 0) {
if (MineFollow())
return; // We have moved, so need a new Step before we can do anymore
}
}
if ((i & 8)==8) { // Bit 3 set = Move also
if (!Move(j)) {
log_err("Could not move! "+j);
}
done = 1;
}
Step++;
} while (done==0)
}
function MineFollow()
{
local i,j,v;
local reverse=[2, 3, 0, 1, 5, 4];
i = 0;
j = MinePath.len();
if (j>0) {
if ((MinePath[j-1] & 8) == 8) {
i = MinePath.pop() & 7;
v = GetBlackRockForLevel(i);
if (v>0)
PlaceVoxel(i,v);
}
}
while (i < 6) {
v = Look(i);
if ( ((MineNearOre & 1) && (!GetVoxelProp(v,0))) || // All none Black Rock Solids
((MineNearOre & 2) && (v in Rares)) ) { // Rare Ores
if (PickVoxel(i)) {
if (MineNearOre & 4) { // Follow
if (MinePath.len() < MaxMineFollow) {
MinePath.push(i);
Move(i);
return true; // We have moved, so need a new Step before we can do anymore
}
}
}
}
i++;
}
if (MinePath.len()>0) {
i = MinePath.pop();
Move(reverse[i]);
if ((RefillOre == 1 && i == 5) || RefillOre == 2)
MinePath.push(i+8); // Push direction + 8 to indicate that we need to refill the voxel
return true; // We have moved, so need a new Step before we can do anymore
}
return false;
}
// Returns the VoxelType of Black Rock Voxel that is most approriate for the level in the robots inventory. 0 if none present.
function GetBlackRockForLevel(dir)
{
local adds=[0,0,0,0,1,-1];
local a,level;
level = GetY() + adds[dir];
if (level<0) level = -level -1;
level = level / 64
if (level>=VoxelOrder.len()) level = VoxelOrder.len()-1;
for (a=level; a>=0; a--) {
if(GetQuantity(VoxelOrder[a])>0) {
return VoxelOrder[a];
}
}
for (a=level; a<VoxelOrder.len(); a++) {
if(GetQuantity(VoxelOrder[a])>0) {
return VoxelOrder[a];
}
}
return 0;
}
function log_info(msg)
{
Display( "Robot at " + GetX() + "," + GetY() + "," + GetZ() + " Info: " + msg, 1000, 4, 500);
}
function log_err(msg)
{
Display( "ROBOT AT " + GetX() + "," + GetY() + "," + GetZ() + " Err: " + msg, 1000, 4, 1000);
Time = Time + 1500;
}