Occupations: Add schedule check function, allow enqueuing of schedule check.
Add simple test farmer occupation (WIP).
This commit is contained in:
82
random_data/occupations_data.lua
Normal file
82
random_data/occupations_data.lua
Normal file
@ -0,0 +1,82 @@
|
||||
-- Occupations definitions
|
||||
|
||||
-- Register default occupation
|
||||
npc.occupations.register_occupation("default_basic", npc.occupations.basic_def)
|
||||
|
||||
-- Test farmer
|
||||
npc.occupations.register_occupation("test_farmer", {
|
||||
dialogues = {},
|
||||
textures = {},
|
||||
initial_inventory = {},
|
||||
workplace = {
|
||||
search_nodes = {"cottages:gate_open","cottages:gate_closed"},
|
||||
search_type = "orthogonal",
|
||||
surrounding_nodes =
|
||||
{
|
||||
bottom = {
|
||||
nodes = {"farming:soil", "farming:wet_soil", "default:dirt", "default:dirt_with_grass"},
|
||||
criteria = "any"
|
||||
}
|
||||
sides = {
|
||||
nodes = {"doors:wooden_fence"}
|
||||
criteria = "exact"
|
||||
}
|
||||
}
|
||||
}
|
||||
schedule_entries = {
|
||||
[7] = {
|
||||
[1] =
|
||||
{
|
||||
task = npc.actions.cmd.WALK_TO_POS,
|
||||
args = {
|
||||
end_pos = npc.places.PLACE_TYPE.OTHER.HOME_OUTSIDE,
|
||||
walkable = {}
|
||||
}
|
||||
},
|
||||
[2] =
|
||||
{
|
||||
check = true,
|
||||
range = 2,
|
||||
random_execution_times = true
|
||||
min_count = 10,
|
||||
max_count = 12,
|
||||
nodes = {"farming:cotton_3"},
|
||||
actions =
|
||||
{
|
||||
-- Actions for grown cotton - harvest and replant
|
||||
["farming:cotton_3"] =
|
||||
{
|
||||
[1] =
|
||||
{
|
||||
action = npc.actions.cmd.WALK_STEP,
|
||||
},
|
||||
[2] =
|
||||
{
|
||||
action = npc.actions.cmd.DIG,
|
||||
},
|
||||
[3] =
|
||||
{
|
||||
action = npc.actions.cmd.PLACE,
|
||||
args =
|
||||
{
|
||||
node = "farming:cotton_1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
none_actions =
|
||||
{
|
||||
-- Walk a single step in a random direction
|
||||
[1] = {
|
||||
action = npc.actions.cmd.WALK_STEP,
|
||||
args =
|
||||
{
|
||||
dir = "random"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
Reference in New Issue
Block a user