feat: profession-based staggered daily schedules
ProfessionDefinition gains schedule_offset (-0.12 to +0.12 fraction of day). ActionSelectionSystem shifts each NPC's effective time_of_day by their profession offset before determining sleep/meal/work periods. Farmers wake earliest (-0.04h = ~2:38am), woodcutters slightly early (-0.02h), guards slightly late (+0.02h), scholars latest (+0.05h = ~5:45am). Wanderers have no offset. The village now has naturally staggered rhythms instead of everyone doing the same thing at the same time.
This commit is contained in:
@@ -47,7 +47,10 @@ func select_action(npc: SimNPC, village: SimVillage, time_of_day: float = 0.5, a
|
||||
SimulationIds.ACTION_GATHER_FOOD, -1.0, "Critically hungry; must find food"
|
||||
)
|
||||
|
||||
var period := _get_period(time_of_day)
|
||||
var profession_def := SimulationDefinitions.get_profession(npc.profession)
|
||||
var offset: float = profession_def.schedule_offset if profession_def != null else 0.0
|
||||
var local_time := fmod(time_of_day + offset + 1.0, 1.0)
|
||||
var period := _get_period(local_time)
|
||||
|
||||
if period == SchedulePeriod.SLEEP:
|
||||
if npc.energy < 60.0:
|
||||
|
||||
Reference in New Issue
Block a user