2017-09-06 04:47:03 +02:00
|
|
|
----------------------------------------------------
|
|
|
|
-- Default occupation for Advanced NPC
|
|
|
|
-- By Zorman2000
|
|
|
|
----------------------------------------------------
|
|
|
|
-- The default "occupation" gives some schedule entries to the NPCs
|
|
|
|
-- which don't have any occupation. The rest is left as randomly
|
|
|
|
-- initialized.
|
|
|
|
|
|
|
|
local basic_def = {
|
|
|
|
-- Use random textures
|
|
|
|
textures = {},
|
|
|
|
-- Use random dialogues
|
|
|
|
dialogues = {},
|
|
|
|
-- Initialize inventory with random items
|
|
|
|
initial_inventory = {},
|
|
|
|
-- Initialize schedule
|
|
|
|
schedules_entries = {
|
|
|
|
-- Schedule entry for 7 in the morning
|
|
|
|
[7] = {
|
2017-09-21 15:02:41 +02:00
|
|
|
-- Change trader status to "none"
|
|
|
|
[1] = {
|
|
|
|
property = npc.schedule_properties.trader_status,
|
|
|
|
args = {
|
|
|
|
status = npc.trade.NONE
|
|
|
|
}
|
|
|
|
},
|
2017-09-06 04:47:03 +02:00
|
|
|
-- 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}}
|
|
|
|
},
|
|
|
|
-- Schedule entry for 7 in the morning
|
|
|
|
[8] = {
|
|
|
|
-- Walk to outside of home
|
|
|
|
[1] = {task = npc.actions.cmd.WALK_TO_POS, args = {
|
|
|
|
end_pos = npc.places.PLACE_TYPE.OTHER.HOME_OUTSIDE,
|
|
|
|
walkable = {}
|
|
|
|
},
|
|
|
|
chance = 75
|
|
|
|
},
|
|
|
|
-- Allow mobs_redo wandering
|
|
|
|
[2] = {action = npc.actions.cmd.FREEZE, args = {freeze = false}}
|
|
|
|
},
|
|
|
|
-- Schedule entry for 12 midday
|
|
|
|
[12] = {
|
|
|
|
-- Walk to a sittable node
|
2017-10-06 00:53:46 +02:00
|
|
|
[1] = {task = npc.actions.cmd.WALK_TO_POS,
|
|
|
|
args = {
|
|
|
|
end_pos = {
|
|
|
|
place_category=npc.places.PLACE_TYPE.CATEGORIES.SITTABLE,
|
|
|
|
place_type=npc.places.PLACE_TYPE.SITTABLE.PRIMARY,
|
|
|
|
use_access_node=true,
|
|
|
|
try_alternative_if_used=true,
|
|
|
|
mark_target_as_used = true
|
|
|
|
},
|
|
|
|
walkable = {"cottages:bench"}
|
|
|
|
},
|
2017-09-06 04:47:03 +02:00
|
|
|
chance = 75
|
|
|
|
},
|
|
|
|
-- Sit on the node
|
2017-10-06 00:53:46 +02:00
|
|
|
[2] = {task = npc.actions.cmd.USE_SITTABLE,
|
|
|
|
args = {
|
|
|
|
pos = npc.places.PLACE_TYPE.CALCULATED.TARGET,
|
|
|
|
action = npc.actions.const.sittable.SIT
|
|
|
|
},
|
2017-09-06 04:47:03 +02:00
|
|
|
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 = {
|
2017-10-06 00:53:46 +02:00
|
|
|
pos = npc.places.PLACE_TYPE.CALCULATED.TARGET,
|
2017-09-06 04:47:03 +02:00
|
|
|
action = npc.actions.const.sittable.GET_UP
|
|
|
|
},
|
2017-10-06 00:53:46 +02:00
|
|
|
--depends = {4}
|
2017-09-06 04:47:03 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
-- Schedule entry for 1 in the afternoon
|
|
|
|
[13] = {
|
|
|
|
-- 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 = 75
|
|
|
|
},
|
2017-09-21 15:02:41 +02:00
|
|
|
-- Change trader status to "casual trader"
|
2017-09-06 04:47:03 +02:00
|
|
|
[2] = {property = npc.schedule_properties.trader_status, args = {
|
2017-09-21 15:02:41 +02:00
|
|
|
status = npc.trade.CASUAL
|
2017-09-06 04:47:03 +02:00
|
|
|
},
|
|
|
|
chance = 75
|
|
|
|
},
|
|
|
|
[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.OTHER.HOME_INSIDE,
|
|
|
|
walkable = {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
-- Allow mobs_redo wandering
|
|
|
|
[4] = {action = npc.actions.cmd.FREEZE, args = {freeze = false}}
|
|
|
|
},
|
|
|
|
-- Schedule entry for 10 in the evening
|
|
|
|
[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
|
2017-10-06 00:53:46 +02:00
|
|
|
[2] = {task = npc.actions.cmd.USE_BED,
|
|
|
|
args = {
|
|
|
|
pos = npc.places.PLACE_TYPE.BED.PRIMARY,
|
|
|
|
action = npc.actions.const.beds.LAY
|
|
|
|
}
|
2017-09-06 04:47:03 +02:00
|
|
|
},
|
|
|
|
-- Stay put on bed
|
|
|
|
[3] = {action = npc.actions.cmd.FREEZE, args = {freeze = true}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
-- Register default occupation
|
|
|
|
npc.occupations.register_occupation(npc.occupations.basic_name, basic_def)
|