Entity Element (Data): Difference between revisions

From HLKitWiki
Jump to navigationJump to search
New page: {{context|Kit Reference|Structural File Reference}} ==The "entity" Element== There will be times when you need to create a separate container for picks that is distinct from an actor. Fo...
 
No edit summary
 
Line 5: Line 5:
There will be times when you need to create a separate container for picks that is distinct from an actor. For example, a customizable weapon or vehicle can have its own set of picks that tailor that specific object. These objects are referred to as [[Advanced Gizmos|entities and gizmos]]. Each entity is defined through the use of a "entity" element. The complete list of attributes for this element is below.
There will be times when you need to create a separate container for picks that is distinct from an actor. For example, a customizable weapon or vehicle can have its own set of picks that tailor that specific object. These objects are referred to as [[Advanced Gizmos|entities and gizmos]]. Each entity is defined through the use of a "entity" element. The complete list of attributes for this element is below.


{ "id", e_xml_required, NULL, NULL, 0, NULL },
{ "usernamable", e_xml_set, l_maybe[0], NULL, SIZE_MAYBE, l_maybe },
{ "stackable", e_xml_set, l_yes_no[1], NULL, SIZE_YES_NO, l_yes_no },
{ "forceunique", e_xml_set, l_maybe[0], NULL, SIZE_MAYBE, l_maybe }
:{| class="infotable"
:{| class="infotable"
|class="leftnormal"|id
|class="leftnormal"|id
|Id – Specifies the unique id of the compset. This id is used in all references to the compset.
|Id – Specifies the unique id of the entity. This id is used in all references to the entity.
|-
|-
|usernamable
|form
|(Optional) Set Designates whether the user is allowed to rename picks that are based on this compset. Must be one of these values:<br>
|(Optional) Id Specifies the unique id of the form that will be used to edit the contents of all gizmos based on this entity. If empty, there is no ability for the user to directly edit the contents of the gizmo. Default: Empty.
yes – The user is always allowed to rename picks derived from this compset.<br>
no – The user is never allowed to rename picks derived from this compset.<br>
default – Whether the user can rename picks derived from this compset is dictated by the components upon which the compset is based. If '''any''' component allows renaming, so does the compset.<br>
Default: "default".
|-
|-
|stackable
|defaultthing
|(Optional) Boolean – Indicates whether picks derived from this compset enable [[Stackable vs. Non-Stackable|stacking behavior]]. Default: "no".
|(Optional) Id – Specifies the unique id of a thing to be used as the "default" within the context of the entity. All tables assume a "default" thing of the "actor" pick. However, if you define tables for manipulating picks within a gizmo, attempts to use the "actor" pick will fail. This attribute allows you to specify an alternate pick to be used as the default and must designate a pick that always exists within the gizmo (i.e. a thing that is bootstrapped into it). If empty, no suitable default is setup, but you won't always need one. Default: Empty.
|-
|forceunique
|(Optional) Set – Specifies whether all things derived from this compset must be [[Uniqueness of Things|designated as unique or non-unique]]. Must be one of these values:<br>
yes – All things derived from this compset must be designated as unique.<br>
no – No things derived from this compset may be designated as unique.<br>
default – Author is free to designate a mixture of unique and non-unique things based on this compset.<br>
Default: "default".
{{note}}If uniqueness is forced either direction, the compiler will report an error for any thing that is designated incorrectly.
|-
|-
|}
|}


The "compset" element also possesses child elements that pertain to the handling of its components. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.
The "entity" element also possesses child elements that pertain to its handling. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.


:{| class="infotable"
:{| class="infotable"
|class="leftnormal"|[[#compref|compref]]
|class="leftnormal"|[[Bootstrap Element (Data)|bootstrap]]
|One or more "compref" elements must appear as defined by the given link. This element specifies the individual components that comprise the compset.
|Zero or more "bootstrap" elements may appear as defined by the given link. This element specifies any things that are automatically bootstrapped into every gizmo derived from the entity.
|-
|[[#distinct|distinct]]
|Zero or more "distinct" elements may appear as defined by the given link. This element identifies additional criteria for determining whether two things can be stacked.
|-
|-
|}
|[[#integrity|integrity]]
 
|An optional "integrity" element may appear as defined by the given link. This element defines an [[Integrity Script]] for the entity.
==The "compref" Element{{anchor|compref}}==
 
The "compref" element identifies each of the components that the compset will be built upon. The complete list of attributes for this element is below.
 
:{| class="infotable"
|class="leftnormal"|component
|Id – Specifies the unique id of the component to be included in the compset.
|-
|-
|}
|}


==The "distinct" Element{{anchor|distinct}}==
==The "integrity" Element{{anchor|integrity}}==
 
The "distinct" element identifies specially treated fields within the compset (i.e. its components). These fields are used to uniquely identify picks and potentially preclude whether those picks can be [[Stackable vs. Non-Stackable|stacked with other picks]]. If two picks have the same values for the specified fields, their stackable behavior is dictated by the normal rules for stackability. However, if any "distinct" field differs, the two picks are considered to be '''not''' stackable.
The complete list of attributes for this element is below.


{{note}}If no "distinct" fields are specified, normal stacking rules apply. If one or more "distinct" fields are given, all components within the compset must be stackable. Array-based and matrix-based fields cannot be designated as "distinct".
The "integrity" element defines an [[Integrity Script]] for the entity that imposes rules for the ensuring the user can only save changes to a valid gizmo. The complete list of attributes for this element is below.  


:{| class="infotable"
:{| class="infotable"
|class="leftnormal"|field
|class="leftnormal"|PCDATA
|Id – Specifies the unique id of the field to be verified as distinct before stacking is allowed.
|Script – Specifies the code comprising the Integrity script.
|-
|-
|}
|}
Line 69: Line 40:
==Example==
==Example==


The following example demonstrates what an "compset" element might look like. All default values are assumed for optional attributes.
The following example demonstrates what an "entity" element might look like. All default values are assumed for optional attributes.


<pre>
<pre>
<compset id="Melee" stackable="yes">
<entity id="MyEntity" panel="EntityForm" defaultthing="EntityHelp">
  <compref component="WeaponBase"/>
   <bootstrap thing="EntityHelp"/>
  <compref component="WeapMelee"/>
   <bootstrap thing="EntityInfo"/>
   <compref component="Equippable"/>
   </entity>
   <compref component="Gear"/>
   </compset>
</pre>
</pre>

Latest revision as of 01:19, 1 December 2008

Context: HL Kit &#133; Kit Reference &#133; Structural File Reference 

The "entity" Element

There will be times when you need to create a separate container for picks that is distinct from an actor. For example, a customizable weapon or vehicle can have its own set of picks that tailor that specific object. These objects are referred to as entities and gizmos. Each entity is defined through the use of a "entity" element. The complete list of attributes for this element is below.

id Id – Specifies the unique id of the entity. This id is used in all references to the entity.
form (Optional) Id – Specifies the unique id of the form that will be used to edit the contents of all gizmos based on this entity. If empty, there is no ability for the user to directly edit the contents of the gizmo. Default: Empty.
defaultthing (Optional) Id – Specifies the unique id of a thing to be used as the "default" within the context of the entity. All tables assume a "default" thing of the "actor" pick. However, if you define tables for manipulating picks within a gizmo, attempts to use the "actor" pick will fail. This attribute allows you to specify an alternate pick to be used as the default and must designate a pick that always exists within the gizmo (i.e. a thing that is bootstrapped into it). If empty, no suitable default is setup, but you won't always need one. Default: Empty.

The "entity" element also possesses child elements that pertain to its handling. The list of these child elements is below and must appear in the order shown. Click on the link to access the details for each element.

bootstrap Zero or more "bootstrap" elements may appear as defined by the given link. This element specifies any things that are automatically bootstrapped into every gizmo derived from the entity.
integrity An optional "integrity" element may appear as defined by the given link. This element defines an Integrity Script for the entity.

The "integrity" Element

The "integrity" element defines an Integrity Script for the entity that imposes rules for the ensuring the user can only save changes to a valid gizmo. The complete list of attributes for this element is below.

PCDATA Script – Specifies the code comprising the Integrity script.

Example

The following example demonstrates what an "entity" element might look like. All default values are assumed for optional attributes.

<entity id="MyEntity" panel="EntityForm" defaultthing="EntityHelp">
  <bootstrap thing="EntityHelp"/>
  <bootstrap thing="EntityInfo"/>
  </entity>