Book Image

Mastering CryENGINE

By : Michelle Martin
Book Image

Mastering CryENGINE

By: Michelle Martin

Overview of this book

Table of Contents (17 chapters)
Mastering CryENGINE
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating nodes in C++ and Lua


There are many different types of component flow graph nodes and even more entity nodes. Usually, all the existing nodes with their input and output ports provide enough functionalities even for complex scenarios and setups. However, new ports and nodes can be added easily, should you have the need for them. Let's start by adding a new port to an entity-based node.

Adding ports to an entity flow graph node

Almost every Lua script entity in CryENGINE has a FlowEvents table defined in its script. In this table, the input and output ports of the node and the corresponding functions are defined. The FlowEvents table of a Light entity, for example, looks like the following:

Light.FlowEvents =
{
  Inputs =
  {
    Active = { Light.Event_Active,"bool" },
    Enable = { Light.Event_Enable,"bool" },
    Disable = { Light.Event_Disable,"bool" },
  },
  Outputs =
  {
    Active = "bool",
  },
}

The FlowEvents table has subtables defining the inputs and outputs. Inputs are...