Poll

What you like better?

Dreams
Memes

Author Topic: Farming - Ready to work again, what do I do now?  (Read 39103 times)

I've done the first scripting on this mod since I last hosted it.
It's not much, but I got basic pipe finding code done:
Code: [Select]
function fxDtsBrick::findNextPipe(%brick,%side)
{
%position = %brick.position;
%mask = $TypeMasks::FxBrickObjectType;
if(%brick.dataBlock.isStraightPipe)
{
%size = %brick.dataBlock.brickSizeX/2;
if(%brick.angleID == 0 || %brick.angleID == 2)
{
initContainerBoxSearch(%position,%size+0.5 SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
{
if(%side == 0 && getWord(%searchObj.position,0) < getWord(%brick.position,0))
return %searchObj;
else if(%side == 1 && getWord(%searchObj.position,0) > getWord(%brick.position,0))
return %searchObj;
}
}
else
{
initContainerBoxSearch(%position,"0.4" SPC %size+0.5 SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
{
if(%side == 0 && getWord(%searchObj.position,1) < getWord(%brick.position,1))
return %searchObj;
else if(%side == 1 && getWord(%searchObj.position,1) > getWord(%brick.position,1))
return %searchObj;
}
}
}
else if(%brick.dataBlock $= "brickPipeCrossData")
{
initContainerBoxSearch(%position,"1 1 0.4",%mask);
while(%searchObj = containerSearchNext())
{
if(%side == 0 && getWord(%searchObj.position,1) < getWord(%brick.position,1))
return %searchObj;
if(%side == 1 && getWord(%searchObj.position,1) > getWord(%brick.position,1))
return %searchObj;
if(%side == 2 && getWord(%searchObj.position,0) > getWord(%brick.position,0))
return %searchObj;
if(%side == 3 && getWord(%searchObj.position,0) < getWord(%brick.position,0))
return %searchObj;
}
}
else if(%brick.dataBlock $= "brickPipeTData")
{
if(%brick.angleID == 0)
{
if(%side == 0)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) > getWord(%brick.position,1))
return %searchObj;
}
else if(%side == 1)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) > getWord(%brick.position,0))
return %searchObj;
}
else if(%side == 2)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) < getWord(%brick.position,1))
return %searchObj;
}
}
else if(%brick.angleID == 1)
{
if(%side == 0)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) < getWord(%brick.position,1))
return %searchObj;
}
else if(%side == 1)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) > getWord(%brick.position,0))
return %searchObj;
}
else if(%side == 2)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) < getWord(%brick.position,0))
return %searchObj;
}
}
else if(%brick.angleID == 2)
{
if(%side == 0)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) < getWord(%brick.position,1))
return %searchObj;
}
else if(%side == 1)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) < getWord(%brick.position,0))
return %searchObj;
}
else if(%side == 2)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) > getWord(%brick.position,1))
return %searchObj;
}
}
else if(%brick.angleID == 3)
{
if(%side == 0)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) > getWord(%brick.position,1))
return %searchObj;
}
else if(%side == 1)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) < getWord(%brick.position,0))
return %searchObj;
}
else if(%side == 2)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) > getWord(%brick.position,0))
return %searchObj;
}
}
}
else if(%brick.dataBlock $= "brickPipeTurnData")
{
if(%brick.angleID == 0)
{
if(%side == 0)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) > getWord(%brick.position,1))
return %searchObj;
}
else if(%side == 1)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) > getWord(%brick.position,0))
return %searchObj;
}
}
if(%brick.angleID == 1)
{
if(%side == 0)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) < getWord(%brick.position,1))
return %searchObj;
}
else if(%side == 1)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) > getWord(%brick.position,0))
return %searchObj;
}
}
else if(%brick.angleID == 2)
{
if(%side == 0)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) < getWord(%brick.position,1))
return %searchObj;
}
else if(%side == 1)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) < getWord(%brick.position,0))
return %searchObj;
}
}
else if(%brick.angleID == 3)
{
if(%side == 0)
{
initContainerBoxSearch(%position,"0.4" SPC "1" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,1) > getWord(%brick.position,1))
return %searchObj;
}
else if(%side == 1)
{
initContainerBoxSearch(%position,"1" SPC "0.4" SPC "0.4",%mask);
while(%searchObj = containerSearchNext())
if(getWord(%searchObj.position,0) < getWord(%brick.position,0))
return %searchObj;
}
}
}
}

function findPump(%brick)
{
%numPipesSearched = 0;
%numPipesDiscovered = 1;
%pipesDiscovered[0] = %brick;

while(true)
{
%pipeToSearch = -1;
%index = -1;
for(%a=0;%a<%numPipesDiscovered;%a++)
{
if(isObject(%pipesDiscovered[%a]))
{
%pipeToSearch = %pipesDiscovered[%a];
%index = %a;
break;
}
}
if(!isObject(%pipeToSearch))
break;
else
{
%pipesDiscovered[%index] = -1;

%blankSearchedSlot = -1;
for(%q = 0; %q<%numPipesSearched;%q++)
{
if(!isObject(%pipesSearched[%q]))
{
%blankSearchedSlot = %q;
break;
}
}
if(%blankSearchedSlot != -1)
%pipesSearched[%blankSearchedSlot] = %pipeToSearch;
else
{
%pipesSearched[%numPipesSearched] = %pipeToSearch;
%numPipesSearched++;
}

for(%v = 0; %v<4; %v++)
{
%newBrick = %pipeToSearch.findNextPipe(%v);
if(isObject(%newBrick))
{
if(%newBrick != %pipeToSearch && %newBrick.getClassName() $= "fxDTSBrick")
{
%found = false;
for(%la = 0; %la<%numPipesSearched;%la++)
{
if(%pipesSearched[%la] == %newBrick)
{
%found = true;
break;
}
}
if(!%found)
{
for(%lb = 0; %lb<%numPipesDiscovered;%lb++)
{
if(%pipesDiscovered[%lb] == %newBrick)
{
%found = true;
break;
}
}
if(!%found)
{
%newBrick.setColorFx(2);

%blankDiscoveredSlot = -1;
for(%p=0;%p<%numPipesDiscovered;%p++)
{
if(!isObject(%pipesDiscovered[%p]))
{
%blankDiscoveredSlot = %p;
break;
}
}
if(%blankDiscoveredSlot != -1)
%pipesDiscovered[%blankDiscoveredSlot] = %newBrick;
else
{
%pipesDiscovered[%numPipesDiscovered] = %newBrick;
%numPipesDiscovered++;
}
}
}
}
}
}
}
}
}

function doPipeSystemReschedule(%brick,%client)
{
if(isObject(%brick.foundPump))
{
cancel(%brick.foundPump.calcSch);
%brick.foundPump.calcSch = schedule(1000,0,doPipeLogic,%brick.foundPump,%client);
}
else
{
cancel(%brick.pumpFindsch);
%brick.pumpFindSch = schedule(1000,0,findPump,%brick,%client);
}
}

package pipePackage
{
function fxDtsBrick::onDoorOpen(%brick,%client)
{
Parent::onDoorOpen(%brick,%client);
doPipeSystemReschedule(%brick.getDownBrick(0),%client);
}
};
activatepackage(pipePackage);

i think pipe bricks actually make builds look good, not the build itself


Nice! But, are those flower bricks actually plant bricks? Because i love the way they look!

Also, maybe for looks, add plant bricks that cant be harvested, but the crops never die. It'll allow people to have huge farms for decoration, without having to spam dirt bricks with plants that'll slow down the server.

 Nevermind, I could just use the plant bricks.
« Last Edit: June 22, 2016, 04:15:48 AM by Killbot Alpha »

We need something similar to the logic mod, where you can make switches and wires for activating and interacting with things. That would be a very neat end-game concept to give players something to tinker with as well as an useful mid-game mechanic.

genetically modified seeds ??

Pipes are a great mechanic.

My hours at work have been a bit erratic lately and I've been left with only a few free hours after work and sleep. So progress has been going quite slowly. That said, I more or less completed the pipe system and will host a free build with it as early as tomorrow.

Pipes wori, freebuild is up with the pipes there for testing.

Next up is getting storage to work.

Then I'll need to play around with all the growth times and prices to update for rpg mode.

After which, this weekend, I'll host a test server for y'all to try.

aw hell yes, i remember this. i look forward to trying it when i get home from vacation

EDIT: Okay nevermind.
« Last Edit: June 24, 2016, 01:20:24 AM by Killbot Alpha »

Metric forget-ton of ideas:
  - Cooking: First thing to come to thought, would be
  - Animals: I believe someone already mentioned this, but it would be good for midgame such as hens, and then endgame for cattle.
  - Spice gardens To show manliness, cry in for 20 minutes, and for special cooking recipes mentioned earlier.
  - More crops, such as: Apples, Oranges, Bananas, Rice, Tea, Coffee, Raspberries, Lemons, Cotton, Barley, etc. (Note the non-edible cotton, and Tea/ Coffee)
  - A physical place to sell crops, such as a a shipping building, instead of the crops magically turning into cash.
  - Wild crops that would not harvest for fruit, but would be the first way to get seeds.
  - Options to toggle if people can enter your farm, but if they aren't allowed to, you'd have to buy and place a no trespassing sign.
  -Loans & Loansharks
this isnt a rpg. its farming.

Metric forget-ton of ideas:
  - Cooking: First thing to come to thought, would be possible and already under consideration
  - Animals: I believe someone already mentioned this, but it would be good for midgame such as hens, and then endgame for cattle. not possible since bots lag a lot more than bricks
  - Spice gardens To show manliness, cry in for 20 minutes, and for special cooking recipes mentioned earlier.
  - More crops, such as: Apples, Oranges, Bananas, Rice, Tea, Coffee, Raspberries, Lemons, Cotton, Barley, etc. (Note the non-edible cotton, and Tea/ Coffee)
        more crops is always an option, but they take time to refine and make.
  - A physical place to sell crops, such as a a shipping building, instead of the crops magically turning into cash.
        this is a pretty good idea
  - Wild crops that would not harvest for fruit, but would be the first way to get seeds.
        this isn't a wildnerness survival farming rpg server
  - Options to toggle if people can enter your farm, but if they aren't allowed to, you'd have to buy and place a no trespassing sign.
        not even sure how you'd enforce this. what's the problem with letting people run around your build?
  -Loans & Loansharks
        you probably will never run out of money and since its really easy to make money if you have a ton its probably against the idea of long-term gameplay to add this

 Bump
  Just wondering, how exactly is the map going to be? (Unless it is a grid) Will it be have the train system? Because that was helpful, and it was actually pretty fun to take the train across the map.

Bump
  Just wondering, how exactly is the map going to be? (Unless it is a grid) Will it be have the train system? Because that was helpful, and it was actually pretty fun to take the train across the map.
I mean I was thinking a grid. But I did love that train.

Anyway, I just wanted to tell you guys the 'roads' take 17600 bricks before anyone even gets a lot. I may want to have custom plate bricks made that are the exact dimensions of the roads, in order to save about 15000 bricks.

I mean I was thinking a grid. But I did love that train.

Anyway, I just wanted to tell you guys the 'roads' take 17600 bricks before anyone even gets a lot. I may want to have custom plate bricks made that are the exact dimensions of the roads, in order to save about 15000 bricks.
making cuboid bricks requires no knowledge of modeling; break open any filler-brick pack to see how to make one. its trivial, really.