Farmer: Add other schedule entries for commonplace tasks.
Priest: Fixed missing dialogue issue. Miner: Fixed indentation.
This commit is contained in:
parent
175d07476d
commit
cf77ab5299
@ -8,16 +8,22 @@
|
|||||||
-- afternoon.
|
-- afternoon.
|
||||||
|
|
||||||
local farming_plants = {
|
local farming_plants = {
|
||||||
cotton = {
|
"farming:cotton_1",
|
||||||
"farming:cotton_1",
|
"farming:cotton_2",
|
||||||
"farming:cotton_2",
|
"farming:cotton_3",
|
||||||
"farming:cotton_3",
|
"farming:cotton_4",
|
||||||
"farming:cotton_4",
|
"farming:cotton_5",
|
||||||
"farming:cotton_5",
|
"farming:cotton_6",
|
||||||
"farming:cotton_6",
|
"farming:cotton_7",
|
||||||
"farming:cotton_7",
|
"farming:cotton_8",
|
||||||
"farming:cotton_8"
|
"farming:wheat_1",
|
||||||
}
|
"farming:wheat_2",
|
||||||
|
"farming:wheat_3",
|
||||||
|
"farming:wheat_4",
|
||||||
|
"farming:wheat_5",
|
||||||
|
"farming:wheat_6",
|
||||||
|
"farming:wheat_7",
|
||||||
|
"farming:wheat_8"
|
||||||
}
|
}
|
||||||
|
|
||||||
local farmer_def = {
|
local farmer_def = {
|
||||||
@ -29,9 +35,28 @@ local farmer_def = {
|
|||||||
surrounding_building_types = {
|
surrounding_building_types = {
|
||||||
{type="field", origin_building_types={"hut", "house", "lumberjack"}}
|
{type="field", origin_building_types={"hut", "house", "lumberjack"}}
|
||||||
},
|
},
|
||||||
walkable_nodes = farming_plants.cotton,
|
walkable_nodes = farming_plants,
|
||||||
initial_inventory = {},
|
initial_inventory = {},
|
||||||
schedules_entries = {
|
schedules_entries = {
|
||||||
|
[6] = {
|
||||||
|
-- Get out of bed
|
||||||
|
[1] = {
|
||||||
|
task = npc.actions.cmd.USE_BED, args = {
|
||||||
|
pos = npc.places.PLACE_TYPE.BED.PRIMARY,
|
||||||
|
action = npc.actions.const.beds.GET_UP
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- Walk to home inside
|
||||||
|
[2] = {
|
||||||
|
task = npc.actions.cmd.WALK_TO_POS, args = {
|
||||||
|
end_pos = npc.places.PLACE_TYPE.OTHER.HOME_INSIDE,
|
||||||
|
walkable = {}
|
||||||
|
},
|
||||||
|
chance = 75
|
||||||
|
},
|
||||||
|
-- Allow mobs_redo wandering
|
||||||
|
[3] = {action = npc.actions.cmd.FREEZE, args = {freeze = false}}
|
||||||
|
},
|
||||||
[7] = {
|
[7] = {
|
||||||
[1] =
|
[1] =
|
||||||
{
|
{
|
||||||
@ -48,9 +73,9 @@ local farmer_def = {
|
|||||||
random_execution_times = true,
|
random_execution_times = true,
|
||||||
min_count = 20,
|
min_count = 20,
|
||||||
max_count = 25,
|
max_count = 25,
|
||||||
nodes = farming_plants.cotton,
|
nodes = farming_plants,
|
||||||
prefer_last_acted_upon_node = true,
|
prefer_last_acted_upon_node = true,
|
||||||
walkable_nodes = farming_plants.cotton,
|
walkable_nodes = farming_plants,
|
||||||
actions =
|
actions =
|
||||||
{
|
{
|
||||||
-- Actions for cotton - harvest and replant
|
-- Actions for cotton - harvest and replant
|
||||||
@ -61,7 +86,7 @@ local farmer_def = {
|
|||||||
task = npc.actions.cmd.WALK_TO_POS,
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
args = {
|
args = {
|
||||||
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
walkable = farming_plants.cotton
|
walkable = farming_plants
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] =
|
[2] =
|
||||||
@ -98,7 +123,7 @@ local farmer_def = {
|
|||||||
task = npc.actions.cmd.WALK_TO_POS,
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
args = {
|
args = {
|
||||||
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
walkable = farming_plants.cotton
|
walkable = farming_plants
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] =
|
[2] =
|
||||||
@ -135,7 +160,7 @@ local farmer_def = {
|
|||||||
task = npc.actions.cmd.WALK_TO_POS,
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
args = {
|
args = {
|
||||||
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
walkable = farming_plants.cotton
|
walkable = farming_plants
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] =
|
[2] =
|
||||||
@ -172,7 +197,7 @@ local farmer_def = {
|
|||||||
task = npc.actions.cmd.WALK_TO_POS,
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
args = {
|
args = {
|
||||||
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
walkable = farming_plants.cotton
|
walkable = farming_plants
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] =
|
[2] =
|
||||||
@ -209,7 +234,7 @@ local farmer_def = {
|
|||||||
task = npc.actions.cmd.WALK_TO_POS,
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
args = {
|
args = {
|
||||||
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
walkable = farming_plants.cotton
|
walkable = farming_plants
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] =
|
[2] =
|
||||||
@ -246,7 +271,7 @@ local farmer_def = {
|
|||||||
task = npc.actions.cmd.WALK_TO_POS,
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
args = {
|
args = {
|
||||||
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
walkable = farming_plants.cotton
|
walkable = farming_plants
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] =
|
[2] =
|
||||||
@ -283,7 +308,7 @@ local farmer_def = {
|
|||||||
task = npc.actions.cmd.WALK_TO_POS,
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
args = {
|
args = {
|
||||||
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
walkable = farming_plants.cotton
|
walkable = farming_plants
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] =
|
[2] =
|
||||||
@ -320,7 +345,7 @@ local farmer_def = {
|
|||||||
task = npc.actions.cmd.WALK_TO_POS,
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
args = {
|
args = {
|
||||||
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
walkable = farming_plants.cotton
|
walkable = farming_plants
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] =
|
[2] =
|
||||||
@ -349,38 +374,45 @@ local farmer_def = {
|
|||||||
action = npc.actions.cmd.STAND,
|
action = npc.actions.cmd.STAND,
|
||||||
args = {}
|
args = {}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
["farming:wheat_8"] =
|
||||||
|
{
|
||||||
|
[1] =
|
||||||
|
{
|
||||||
|
task = npc.actions.cmd.WALK_TO_POS,
|
||||||
|
args = {
|
||||||
|
end_pos = npc.places.PLACE_TYPE.SCHEDULE.TARGET,
|
||||||
|
walkable = farming_plants
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[2] =
|
||||||
|
{
|
||||||
|
action = npc.actions.cmd.DIG,
|
||||||
|
args = {
|
||||||
|
bypass_protection = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[3] =
|
||||||
|
{
|
||||||
|
action = npc.actions.cmd.STAND,
|
||||||
|
args = {}
|
||||||
|
},
|
||||||
|
[4] =
|
||||||
|
{
|
||||||
|
action = npc.actions.cmd.PLACE,
|
||||||
|
args =
|
||||||
|
{
|
||||||
|
node = "farming:wheat_1",
|
||||||
|
bypass_protection = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[5] =
|
||||||
|
{
|
||||||
|
action = npc.actions.cmd.STAND,
|
||||||
|
args = {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[3] =
|
|
||||||
{
|
|
||||||
check = true,
|
|
||||||
range = 3,
|
|
||||||
random_execution_times = true,
|
|
||||||
min_count = 8,
|
|
||||||
max_count = 8,
|
|
||||||
nodes = {"farming:wheat_8"},
|
|
||||||
actions =
|
|
||||||
{
|
|
||||||
["farming:wheat_8"] =
|
|
||||||
{
|
|
||||||
[1] =
|
|
||||||
{
|
|
||||||
action = npc.actions.cmd.WALK_STEP,
|
|
||||||
},
|
|
||||||
[2] =
|
|
||||||
{
|
|
||||||
action = npc.actions.cmd.DIG,
|
|
||||||
},
|
|
||||||
[3] =
|
|
||||||
{
|
|
||||||
action = npc.actions.cmd.PLACE,
|
|
||||||
args =
|
|
||||||
{
|
|
||||||
node = "farming:wheat_1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
none_actions =
|
none_actions =
|
||||||
{
|
{
|
||||||
-- Walk a single step in a random direction
|
-- Walk a single step in a random direction
|
||||||
@ -397,9 +429,117 @@ local farmer_def = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
[13] = {
|
||||||
|
-- Walk to a sittable node
|
||||||
|
[1] = {
|
||||||
|
task = npc.actions.cmd.WALK_TO_POS, args = {
|
||||||
|
end_pos = {place_type=npc.places.PLACE_TYPE.SITTABLE.PRIMARY, use_access_node=true},
|
||||||
|
walkable = {"cottages:bench"}
|
||||||
|
},
|
||||||
|
chance = 75
|
||||||
|
},
|
||||||
|
-- Sit on the node
|
||||||
|
[2] = {
|
||||||
|
task = npc.actions.cmd.USE_SITTABLE, args = {
|
||||||
|
pos = npc.places.PLACE_TYPE.SITTABLE.PRIMARY,
|
||||||
|
action = npc.actions.const.sittable.SIT
|
||||||
|
},
|
||||||
|
depends = {1}
|
||||||
|
},
|
||||||
|
-- Stay put into place
|
||||||
|
[3] = {
|
||||||
|
action = npc.actions.cmd.SET_INTERVAL, args = {
|
||||||
|
freeze = true,
|
||||||
|
interval = 35
|
||||||
|
},
|
||||||
|
depends = {2}
|
||||||
|
},
|
||||||
|
[4] = {
|
||||||
|
action = npc.actions.cmd.SET_INTERVAL, args = {
|
||||||
|
freeze = true,
|
||||||
|
interval = npc.actions.default_interval
|
||||||
|
},
|
||||||
|
depends = {3}
|
||||||
|
},
|
||||||
|
-- Get up from sit
|
||||||
|
[5] = {
|
||||||
|
action = npc.actions.cmd.USE_SITTABLE, args = {
|
||||||
|
pos = npc.places.PLACE_TYPE.SITTABLE.PRIMARY,
|
||||||
|
action = npc.actions.const.sittable.GET_UP
|
||||||
|
},
|
||||||
|
depends = {4}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[14] = {
|
||||||
|
-- Give NPC money to buy from player
|
||||||
|
[1] = {
|
||||||
|
property = npc.schedule_properties.put_multiple_items, args = {
|
||||||
|
itemlist = {
|
||||||
|
{name="default:iron_lump", random=true, min=2, max=4}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
chance = 50
|
||||||
|
},
|
||||||
|
-- Change trader status to "trader"
|
||||||
|
[2] = {
|
||||||
|
property = npc.schedule_properties.trader_status, args = {
|
||||||
|
status = npc.trade.TRADER
|
||||||
|
},
|
||||||
|
chance = 90
|
||||||
|
},
|
||||||
|
[3] = {
|
||||||
|
property = npc.schedule_properties.can_receive_gifts, args = {
|
||||||
|
can_receive_gifts = false
|
||||||
|
},
|
||||||
|
depends = {1}
|
||||||
|
},
|
||||||
|
-- Allow mobs_redo wandering
|
||||||
|
[4] = {action = npc.actions.cmd.FREEZE, args = {freeze = false}}
|
||||||
|
},
|
||||||
|
-- Schedule entry for 6 in the evening
|
||||||
|
[18] = {
|
||||||
|
-- Change trader status to "none"
|
||||||
|
[1] = {
|
||||||
|
property = npc.schedule_properties.trader_status, args = {
|
||||||
|
status = npc.trade.NONE
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- Enable gift receiving again
|
||||||
|
[2] = {
|
||||||
|
property = npc.schedule_properties.can_receive_gifts, args = {
|
||||||
|
can_receive_gifts = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- Get inside home
|
||||||
|
[3] = {
|
||||||
|
task = npc.actions.cmd.WALK_TO_POS, args = {
|
||||||
|
end_pos = npc.places.PLACE_TYPE.BED.PRIMARY,
|
||||||
|
walkable = {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- Allow mobs_redo wandering
|
||||||
|
[4] = {action = npc.actions.cmd.FREEZE, args = {freeze = false}}
|
||||||
|
},
|
||||||
|
[22] = {
|
||||||
|
[1] = {
|
||||||
|
task = npc.actions.cmd.WALK_TO_POS, args = {
|
||||||
|
end_pos = {place_type=npc.places.PLACE_TYPE.BED.PRIMARY, use_access_node=true},
|
||||||
|
walkable = {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- Use bed
|
||||||
|
[2] = {
|
||||||
|
task = npc.actions.cmd.USE_BED, args = {
|
||||||
|
pos = npc.places.PLACE_TYPE.BED.PRIMARY,
|
||||||
|
action = npc.actions.const.beds.LAY
|
||||||
|
}
|
||||||
|
},
|
||||||
|
-- Stay put on bed
|
||||||
|
[3] = {action = npc.actions.cmd.FREEZE, args = {freeze = true} }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Register occupation
|
-- Register occupation
|
||||||
npc.occupations.register_occupation("farmer", farmer_def)
|
npc.occupations.register_occupation("default_farmer", farmer_def)
|
||||||
|
@ -1,68 +1,51 @@
|
|||||||
-- WIP miner by NewbProgrammer101 or roboto
|
-- WIP miner by NewbProgrammer101 or roboto
|
||||||
|
|
||||||
local miner_def = {
|
local miner_def = {
|
||||||
dialogues = {},
|
dialogues = {},
|
||||||
textures = {"miner.png"},
|
textures = {"miner.png"},
|
||||||
initial_inventory = {
|
initial_inventory = {
|
||||||
{name="default:pick_steel", chance=1},
|
{name="default:pick_steel", chance=1},
|
||||||
{name="default:shovel_bronze", chance=1}
|
{name="default:shovel_bronze", chance=1}
|
||||||
},
|
},
|
||||||
schedule_entries = {
|
schedule_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.OTHER.HOME_OUTSIDE,
|
||||||
walkable = {}
|
walkable = {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[2] = {
|
[2] = {
|
||||||
check = true,
|
check = true,
|
||||||
range = 3,
|
range = 3,
|
||||||
random_execution_times = true,
|
random_execution_times = true,
|
||||||
min_count = 20,
|
min_count = 20,
|
||||||
max_count = 99,
|
max_count = 99,
|
||||||
nodes = {"default:dirt", "default:dirt_with_grass", "default:sand", "default:desert_sand", "default:silver_sand", "default:gravel", "default:clay", "default:snow", "default:snowblock", "default:},
|
nodes = {"default:dirt", "default:dirt_with_grass", "default:sand", "default:desert_sand", "default:silver_sand", "default:gravel", "default:clay", "default:snow", "default:snowblock"},
|
||||||
actions = {
|
actions = {
|
||||||
["default:dirt"] = {
|
["default:dirt"] = {
|
||||||
[1] = {
|
[1] = {
|
||||||
action = npc.actions.cmd.WALK_STEP
|
action = npc.actions.cmd.WALK_STEP
|
||||||
},
|
},
|
||||||
[2] = {
|
[2] = {
|
||||||
action = npc.actions.cmd.DIG
|
action = npc.actions.cmd.DIG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[3] = {
|
|
||||||
check = true,
|
none_actions = {
|
||||||
range = 3,
|
[1] = {
|
||||||
random_execution_times = true,
|
action = npc.actions.cmd.WALK_STEP,
|
||||||
min_count = 20,
|
args = {
|
||||||
max_count = 99,
|
dir = "random"
|
||||||
nodes = {"default:stone", "default:stonebrick", "default:stone_block", "default:mossycobble", "default:desert_stone", "default:desert_cobble", "default:desert_stonebrick", "default:desert_stone_block"},
|
}
|
||||||
actions = {
|
}
|
||||||
["default:stone"] = {
|
}
|
||||||
[1] = {
|
}
|
||||||
action = npc.actions.cmd.WALK_STEP
|
}
|
||||||
},
|
|
||||||
[2] = {
|
|
||||||
action = npc.actions.cmd.DIG
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
none_actions = {
|
|
||||||
[1] = {
|
|
||||||
action = npc.actions.cmd.WALK_STEP,
|
|
||||||
args = {
|
|
||||||
dir = "random"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Occupation registration
|
-- Occupation registration
|
||||||
npc.occupations.register_occupation("miner", miner_def)
|
npc.occupations.register_occupation("default_miner", miner_def)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
local priest_def = {
|
local priest_def = {
|
||||||
dialogues = {
|
dialogues = {
|
||||||
type = "given",
|
type = "given",
|
||||||
|
max_count = 5,
|
||||||
data = {
|
data = {
|
||||||
{
|
{
|
||||||
text = "Blessings be upon you, my child!",
|
text = "Blessings be upon you, my child!",
|
||||||
@ -20,6 +21,7 @@ local priest_def = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
text = "The temple will always open the doors to everyone.",
|
text = "The temple will always open the doors to everyone.",
|
||||||
|
flag = {name="on_church", value=true},
|
||||||
tags = {"unisex"}
|
tags = {"unisex"}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -28,6 +30,7 @@ local priest_def = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
text = "Thanks for coming to greet me, I hope you have a blessed day! ",
|
text = "Thanks for coming to greet me, I hope you have a blessed day! ",
|
||||||
|
flag = {name="on_church", value=false},
|
||||||
tags = {"unisex"}
|
tags = {"unisex"}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -57,7 +60,7 @@ local priest_def = {
|
|||||||
else
|
else
|
||||||
npc.chat(self.npc_name, player:get_player_name(),
|
npc.chat(self.npc_name, player:get_player_name(),
|
||||||
"Receive the blessings of the Creator!")
|
"Receive the blessings of the Creator!")
|
||||||
effect(self.object:getpos(), 20, "default_coral_skeleton.png", 0.1, 0.3, 3, 10)
|
npc.effect(self.object:getpos(), 20, "default_coral_skeleton.png", 0.1, 0.3, 3, 10)
|
||||||
-- Heal one heart
|
-- Heal one heart
|
||||||
player:set_hp(player:get_hp() + 2)
|
player:set_hp(player:get_hp() + 2)
|
||||||
end
|
end
|
||||||
@ -117,7 +120,8 @@ local priest_def = {
|
|||||||
},
|
},
|
||||||
properties = {
|
properties = {
|
||||||
initial_trader_status = npc.trade.NONE,
|
initial_trader_status = npc.trade.NONE,
|
||||||
enable_gift_items_hints = false
|
enable_gift_items_hints = false,
|
||||||
|
can_receive_gifts = false
|
||||||
},
|
},
|
||||||
building_types = {},
|
building_types = {},
|
||||||
surrounding_building_types = {
|
surrounding_building_types = {
|
||||||
@ -208,4 +212,4 @@ local priest_def = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Register occupation
|
-- Register occupation
|
||||||
npc.occupations.register_occupation("priest", priest_def)
|
npc.occupations.register_occupation("default_priest", priest_def)
|
||||||
|
Loading…
Reference in New Issue
Block a user