From 9bf0caad8dd9f63bf860e139254eeee3d8f75672 Mon Sep 17 00:00:00 2001 From: "Joel Z. Leibo" Date: Mon, 4 Nov 2024 03:04:40 -0800 Subject: [PATCH] add get/set state functions for the person_representation component. PiperOrigin-RevId: 692898477 Change-Id: I43a4dca9987fad5c043ac87fd8cb64a62e7b1311 --- concordia/components/agent/person_representation.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/concordia/components/agent/person_representation.py b/concordia/components/agent/person_representation.py index baaddd0a..18daae94 100644 --- a/concordia/components/agent/person_representation.py +++ b/concordia/components/agent/person_representation.py @@ -185,3 +185,15 @@ def _make_pre_act_value(self) -> str: }) return result + + def get_state(self) -> entity_component.ComponentState: + """Converts the component to JSON data.""" + with self._lock: + return { + 'names_detected': self._names_detected, + } + + def set_state(self, state: entity_component.ComponentState) -> None: + """Sets the component state from JSON data.""" + with self._lock: + self._names_detected = state['names_detected']