Pyrogenesis Object Model : EntityTemplate class

The properties of the EntityTemplate object are used to initialize corresponding properties of entities of the same type. EntityTemplate, like Entity, is designed in such a way that the engine itself only defines the minimum set of properties needed for the class to be useable. It is expected that most properties required by the game will primarily be described through external XML files, though they can also be defined by script. This class uses Prometheus' data-inheritance system, so each EntityTemplate object can specify a parent object to initialize properties from, overriding them as needed. In turn, Entity objects inherit properties from EntityTemplate objects of their class. Objects of this class cannot be constructed from script; instead, an object is created for each entity class defined in XML files at load-time.

EntityTemplate Global Functions

getEntityTemplate

  • Overview:
    • Look up an EntityTemplate by name.
  • Syntax:
    • template = getEntityTemplate(name);
  • Parameters:
    • template name [wstring]
  • Returns:
    • entity template object
  • Notes:

EntityTemplate Methods

toString (Implicit)

  • Overview:
    • Overrides the default string conversion to include the class name of this template.
  • Syntax:
    • toString();
  • Parameters:
    • None.
  • Returns:
    • A string of the form '[object EntityTemplate: <Name>]'.
  • Notes:
    • This function is called implicitly by the JavaScript engine to convert this object to a string.

EntityTemplate Properties

These are the properties currently defined for entity classes by the engine. A more complete list, including the properties defined by data for 0 A.D., can be found in the design document.

super

  • Overview:
    • Gets or sets a reference to the parent object, from which properties of this template can be inherited.
  • Type:
    • EntityTemplate

name

  • Overview:
    • Gets or sets the displayed class name.
  • Type:
    • string
  • Notes:
    • This property can be inherited from the parent template.

speed

  • Overview:
    • Gets or sets the default maximum speed of entities of this class.
  • Type:
    • double
  • Notes:
    • This property can be inherited from the parent template.

turningRadius

  • Overview:
    • Gets or sets the default minimum turning radius of entities of this class.
  • Type:
    • double
  • Notes:
    • This property can be inherited from the parent template.
Last modified 16 years ago Last modified on Feb 23, 2008, 4:19:00 AM
Note: See TracWiki for help on using the wiki.