Default Farmer (WIP):

Improve schedule entries, schedule check.
Change to new building type format.
This commit is contained in:
Hector Franqui 2017-09-15 14:47:04 -04:00
parent 8cf1e932bc
commit b02a78de6d
1 changed files with 49 additions and 6 deletions

View File

@ -7,17 +7,37 @@
-- work on its crops during the morning, and sell some of them on the -- work on its crops during the morning, and sell some of them on the
-- afternoon. -- afternoon.
local farming_plants = {
cotton = {
"farming:cotton_1",
"farming:cotton_2",
"farming:cotton_3",
"farming:cotton_4",
"farming:cotton_5",
"farming:cotton_6",
"farming:cotton_7",
"farming:cotton_8"
}
}
local farmer_def = { local farmer_def = {
dialogues = {}, dialogues = {},
textures = {}, textures = {},
building_types = {
"farm_tiny", "farm_full"
},
surrounding_building_types = {
{type="field", origin_building_types={"hut", "house", "lumberjack"}}
},
walkable_nodes = farming_plants.cotton,
initial_inventory = {}, initial_inventory = {},
schedule_entries = { schedules_entries = {
[7] = { [7] = {
[1] = [1] =
{ {
task = npc.actions.cmd.WALK_TO_POS, task = npc.actions.cmd.WALK_TO_POS,
args = { args = {
end_pos = npc.places.PLACE_TYPE.OTHER.HOME_OUTSIDE, end_pos = npc.places.PLACE_TYPE.WORKPLACE.PRIMARY,
walkable = {} walkable = {}
} }
}, },
@ -29,26 +49,45 @@ local farmer_def = {
min_count = 10, min_count = 10,
max_count = 12, max_count = 12,
nodes = {"farming:cotton_3"}, nodes = {"farming:cotton_3"},
walkable_nodes = farming_plants.cotton,
actions = actions =
{ {
-- Actions for grown cotton - harvest and replant -- Actions for cotton - harvest and replant
["farming:cotton_3"] = ["farming:cotton_3"] =
{ {
[1] = [1] =
{ {
action = npc.actions.cmd.WALK_STEP, task = npc.actions.cmd.WALK_TO_POS,
args = {
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
walkable = farming_plants.cotton
}
}, },
[2] = [2] =
{ {
action = npc.actions.cmd.DIG, action = npc.actions.cmd.DIG,
args = {
bypass_protection = true
}
}, },
[3] = [3] =
{
action = npc.actions.cmd.STAND,
args = {}
},
[4] =
{ {
action = npc.actions.cmd.PLACE, action = npc.actions.cmd.PLACE,
args = args =
{ {
node = "farming:cotton_1" node = "farming:cotton_1",
bypass_protection = true
} }
},
[5] =
{
action = npc.actions.cmd.STAND,
args = {}
} }
} }
@ -60,9 +99,13 @@ local farmer_def = {
action = npc.actions.cmd.WALK_STEP, action = npc.actions.cmd.WALK_STEP,
args = args =
{ {
dir = "random" dir = "random_orthogonal"
} }
}, },
[2] = {
action = npc.actions.cmd.STAND,
args = {}
}
} }
} }
} }