The Action system's v1.73 update

AC's Action system has been updated as part of its v1.73.0 update. Such changes aim to make Actions more flexible, reduce filesize, and improve performance. This page serves as a guide for developers looking to upgrade custom Actions to the new system.

First of all, Actions no longer have constructors in which their classification data (title, category, etc) is set. Instead, these fields are now set by overriding properties:

  • The title string variable is now a Title string property
  • The category ActionCategory enum variable is now a Category ActionCategory enum property
  • The description string variable is now a Desciption string property

As an example, here's how the Engine: Wait Action's classification data used to be declared:

public ActionPause ()
	this.isDisplayed = true;
	category = ActionCategory.Engine;
	title = "Wait";
	description = "Waits a set time before continuing.";

This data is now set as follows:

public override ActionCategory Category { get { return ActionCategory.Engine; }}
public override string Title { get { return "Wait"; }}
public override string Description { get { return "Waits a set time before continuing."; }}

The isDisplayed bool variable is no longer necessary.

Additionally, Actions now have a NumSockets integer property, which can be used to set the number of output sockets that the Action has:

public override int NumSockets { get { return 3; }}

If an Action has more than one socket, which one is run next can be set by overriding the GetNextOutputIndex function. This function returns the intended socket as an index, i.e.:

public override int GetNextOutputIndex ()
	if (someCondition)
		return 0; // For first socket
	return 1; // For second socket etc

This function replaces the old system's End function, which returned the output socket as an ActionEnd class.

Due to these changes, Actions that have multiple sockets (for example, "check" Actions) no longer need to be derived from Action subclasses such as ActionCheck. ActionCheck still exists, however, for convenience. When an Action derives from ActionCheck, the NumSockets property is automatically set to 2, and the output socket (true vs false) can continue to be determined by overriding the CheckCondition function.