Add workplaces support.
Places: Workplaces are now usable nodes. Plotmarkers around a building can be scanned and their information stored into current plotmarker. Slightly optimize plotmarker search. Occupations: Add test "priest" occupation definition. Fix lots of bugs in initialization code. Spawner: Add ability to determine occupation name out of surrounding workplaces. Assign occupation to spawned NPC using simple algorithm. Others: Reduce log noise a bit. Fix some warnings.
This commit is contained in:
@ -1,24 +1,28 @@
|
||||
-- Occupations definitions
|
||||
|
||||
-- Register default occupation
|
||||
npc.occupations.register_occupation("default_basic", npc.occupations.basic_def)
|
||||
npc.occupations.register_occupation(npc.occupations.basic_name, npc.occupations.basic_def)
|
||||
|
||||
-- Test priest
|
||||
npc.occupations.register_occupation("test_priest", {
|
||||
dialogues = {
|
||||
{
|
||||
text = "How are you today my child?",
|
||||
tags = "male"
|
||||
type = "given",
|
||||
data = {
|
||||
{
|
||||
text = "How are you today my child?",
|
||||
tags = {"male"}
|
||||
}
|
||||
}
|
||||
},
|
||||
textures = {
|
||||
"npc_male_priest.png"
|
||||
},
|
||||
initial_inventory = {
|
||||
"farming:bread 1"
|
||||
{name="farming:bread", count=1}
|
||||
},
|
||||
initial_trader_status = npc.trade.NONE,
|
||||
building_types = {
|
||||
"home"
|
||||
"hut", "house", "farm_tiny", "lumberjack"
|
||||
},
|
||||
surrounding_building_types = {
|
||||
"church"
|
||||
@ -28,63 +32,63 @@ npc.occupations.register_occupation("test_priest", {
|
||||
|
||||
-- Test farmer
|
||||
npc.occupations.register_occupation("test_farmer", {
|
||||
dialogues = {},
|
||||
textures = {},
|
||||
initial_inventory = {},
|
||||
schedule_entries = {
|
||||
[7] = {
|
||||
[1] =
|
||||
dialogues = {},
|
||||
textures = {},
|
||||
initial_inventory = {},
|
||||
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 =
|
||||
{
|
||||
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"] =
|
||||
{
|
||||
-- Actions for grown cotton - harvest and replant
|
||||
["farming:cotton_3"] =
|
||||
[1] =
|
||||
{
|
||||
[1] =
|
||||
action = npc.actions.cmd.WALK_STEP,
|
||||
},
|
||||
[2] =
|
||||
{
|
||||
action = npc.actions.cmd.DIG,
|
||||
},
|
||||
[3] =
|
||||
{
|
||||
action = npc.actions.cmd.PLACE,
|
||||
args =
|
||||
{
|
||||
action = npc.actions.cmd.WALK_STEP,
|
||||
},
|
||||
[2] =
|
||||
{
|
||||
action = npc.actions.cmd.DIG,
|
||||
},
|
||||
[3] =
|
||||
{
|
||||
action = npc.actions.cmd.PLACE,
|
||||
args =
|
||||
{
|
||||
node = "farming:cotton_1"
|
||||
}
|
||||
node = "farming:cotton_1"
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
none_actions =
|
||||
{
|
||||
-- Walk a single step in a random direction
|
||||
[1] = {
|
||||
action = npc.actions.cmd.WALK_STEP,
|
||||
args =
|
||||
{
|
||||
dir = "random"
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
},
|
||||
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