diff --git a/entity/action/error_log/ErrorLog.gd b/entity/action/error_log/ErrorLog.gd index 022435d3..94026f8a 100644 --- a/entity/action/error_log/ErrorLog.gd +++ b/entity/action/error_log/ErrorLog.gd @@ -1,10 +1,13 @@ extends LynxAction var _text: String +var _user_id: String + @onready var _output_console = get_node("/root/Scene/CanvasLayer/UI/AgentCreator/ColorRect/OutputConsole") func _init(): - self.accepted_attributes = ["text"] + self.accepted_attributes = ["text", "user_id"] func _execute(): - self._output_console.print(self._text, Color.DARK_RED) + if _user_id == Globals.USER_ID: + self._output_console.print(self._text, Color.DARK_RED) diff --git a/entity/action/print/Print.gd b/entity/action/print/Print.gd index 3d542700..12b68e44 100644 --- a/entity/action/print/Print.gd +++ b/entity/action/print/Print.gd @@ -1,10 +1,12 @@ extends LynxAction var _text: String +var _user_id: String @onready var _output_console = get_node("/root/Scene/CanvasLayer/UI/AgentCreator/ColorRect/OutputConsole") func _init(): - self.accepted_attributes = ["text"] + self.accepted_attributes = ["text", "user_id"] func _execute(): - self._output_console.print(self._text, Color.WHITE) + if _user_id == Globals.USER_ID: + self._output_console.print(self._text, Color.WHITE) diff --git a/globals.gd b/globals.gd index 5332ffdc..b7d26e64 100644 --- a/globals.gd +++ b/globals.gd @@ -7,3 +7,4 @@ var DEFAULT_ACTION_SPEED: float = 0.5 var ACTION_SPEED_MULTIPLIER: int var OBJECTS_IN_CREATION: Array[int] = [] var BUSY_HTTP_STATUSES: Array[int] = [HTTPClient.STATUS_CONNECTING, HTTPClient.STATUS_REQUESTING] +var USER_ID: String = str(RandomNumberGenerator.new().randi()) diff --git a/scene/AgentCreator.gd b/scene/AgentCreator.gd index c91925e8..dc51c670 100644 --- a/scene/AgentCreator.gd +++ b/scene/AgentCreator.gd @@ -16,7 +16,7 @@ func post_agent(new_agent): func create_agent(_code, _position = Vector2(0, 0), _id = randi(), _owner = ""): var new_agent = Agent.instantiate() - new_agent.init(_position, _id, _owner, _code) + new_agent.init(_position, _id, Globals.USER_ID, _code) post_agent(new_agent) new_agent.queue_free()