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:
2026-07-09 00:19:14 +02:00
parent 2c3890502a
commit 8a955f3c29
7 changed files with 11 additions and 1 deletions
+4 -1
View File
@@ -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:
@@ -5,6 +5,7 @@ extends Resource
@export var display_name: String
@export var visual_color := Color.WHITE
@export var prop_color := Color(0.35, 0.25, 0.15, 1.0)
@export_range(-0.12, 0.12, 0.005) var schedule_offset := 0.0
func validate() -> Array[String]:
@@ -8,3 +8,4 @@ profession_id = &"farmer"
display_name = "Farmer"
visual_color = Color(0.36, 0.62, 0.28, 1)
prop_color = Color(0.65, 0.45, 0.2, 1)
schedule_offset = -0.04
@@ -8,3 +8,4 @@ profession_id = &"guard"
display_name = "Guard"
visual_color = Color(0.25, 0.42, 0.68, 1)
prop_color = Color(0.72, 0.75, 0.78, 1)
schedule_offset = 0.02
@@ -8,3 +8,4 @@ profession_id = &"scholar"
display_name = "Scholar"
visual_color = Color(0.52, 0.34, 0.68, 1)
prop_color = Color(0.78, 0.66, 0.28, 1)
schedule_offset = 0.05
@@ -8,3 +8,4 @@ profession_id = &"woodcutter"
display_name = "Woodcutter"
visual_color = Color(0.67, 0.34, 0.2, 1)
prop_color = Color(0.34, 0.22, 0.14, 1)
schedule_offset = -0.02