How to get a custom InputEventAction to trigger is_action_just_pressed()

Godot Version

4.5.1 Stable

Question

Currently I have a scene to hold my interact ray, which I want to re-use on an NPC character so they could do the exact same thing as my player, for that I’m detecting if the parent node is that of the NPCscene and if it is hijack the input and set it to the corresponding action for the interaction to occur. The problem is that I have the input as an action_just_pressed to prevent any weird interactions with holding the interact keys, but I don’t know how I could imitate it using the custom code run input.

The code currently looks like this:

extends RayCast3D

@onready var parent = get_node("..")
var input = InputEventAction


func _ready():
	if parent.is_in_group("Opponent"):
		input = InputEventAction.new()
	

func _physics_process(_delta):	
	if is_colliding():
		var collider: Object = get_collider()
		if collider is Interactable or collider is Pushable:
			var entry_angle = -global_transform.basis.z
			entry_angle = Vector2(entry_angle.x, entry_angle.z)
			if parent.is_in_group("Opponent"):
				input.action = collider.prompt_input
				input.pressed = true
			if Input.is_action_just_pressed(collider.prompt_input):
				print("interact")
				collider.interact(owner, entry_angle)

Check this documentation page, it gives some hints