Changes between Initial Version and Version 1 of XML.Entity


Ignore:
Timestamp:
Feb 23, 2008, 4:18:59 AM (16 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • XML.Entity

    v1 v1  
     1Entities are objects in the game world that participate in gameplay, such as units, buildings, and resource nodes (as opposed to purely decorative objects such as grass patches). Each entity can have a number of properties that are available to the game engine and game scripts. Entity properties are specified in XML files in `binaries/data/mods/official/entities` and its subdirectories. Because many objects have similar properties (for example, all infantry tend to have the same speed, all spearmen tend to have the same armour, etc), the entity files use inheritance to let you import traits from a "template" and just modify the ones you wish to change. Each file has a parent specified in the `<Entity>` tag and inherits that parent's properties, then any properties set or modified in its own XML file are applied on top of that.
     2
     3Currently, the `template_*` entities in `binaries/data/mods/official/entities`, such as `template_unit_infantry_spearman`, hold most of the traits, and the civilization-specific entities in `binaries/data/mods/official/entities/[civ]`, such as `celt_infantry_spearman`, just inherit from them.
     4
     5The root parent for most entities is `template_entity_full`. Some very simple entities, such as trees, also have `template_entity_quasi`, which defines fewer event handlers and properties and is therefore more efficient to load.
     6
     7'''Example:'''
     8
     9{{{
     10  <?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
     11 
     12  // Beware! The string "false" maps to 'true'. The only string that maps to 'false' is "". -->
     13 
     14  <Entity
     15        parent="template_entity"
     16  >
     17        <Traits
     18                extant="true"
     19                corpse="template_corpse"
     20        >
     21                <Id>
     22                        <Internal_Only /> 
     23 
     24                        <Generic>Infantry Spearman</Generic>
     25                        <Specific>Caldeer</Specific>
     26 
     27                        <Icon>sheet_civ</Icon>
     28                        <Icon_Cell>42</Icon_Cell>
     29 
     30                        <Classes>Unit, Infantry, Melee, Organic, CitizenSoldier, Male</Classes>
     31                        <Civ>Celts</Civ>
     32 
     33                        <Rollover>blah</Rollover>
     34                        <History>blah</History>
     35 
     36                        <Personal />
     37                </Id>
     38               
     39                <AI>
     40                        <Behaviour>Support</Behaviour>
     41                                               
     42                        <Stance>
     43                                <List>
     44                                        <Aggress />
     45                                        <Defend />
     46                                        <Avoid />
     47                                        <Stand />
     48                                        <Hold />
     49                                </List>
     50                               
     51                                <Curr>Defend</Curr>
     52                        </Stance>
     53                </AI>
     54 
     55                <Anchor>
     56                        <type>Ground</type>
     57                </Anchor>
     58 
     59                <Armour>
     60                        <crush>2.0</crush>
     61                        <hack>1.0</hack>
     62                        <pierce>0.0</pierce>
     63                </Armour>
     64 
     65                <Audio>
     66                        <path>audio/voices/hellenes/soldier</path>
     67                </Audio>
     68 
     69                <Creation>
     70                        <Time>20</Time>
     71                        <Resource>
     72                                <Food>2</Food>
     73                                <Wood>1</Wood>
     74                                <Stone>3</Stone>
     75                        </Resource>
     76                </Creation>
     77 
     78                <Footprint>
     79                        <radius>1.5</radius>
     80                        <width>3.0</width>
     81                        <depth>3.0</depth>
     82                        <height>7.5<height>
     83                </Footprint>
     84               
     85                <Formation>
     86                        <Category>Melee</Category>
     87                        <Curr>Loose</Curr>
     88                        <List>
     89                                <Loose/>
     90                                <Box/>
     91                                <Column_C/>
     92                                <Line_C/>
     93                                <Column_O/>
     94                                <Line_O/>
     95                                <Flank/>
     96                                <Skirmish/>
     97                                <Wedge/>
     98                                <Testudo/>
     99                                <Phalanx/>
     100                        </List>
     101                </Formation>
     102 
     103                <Garrison>
     104                        <max>6</max>
     105                </Garrison>
     106   
     107                <Health>
     108                        <Bar_Height>-1.0</Bar_Height>
     109                        <Bar_Size>20</Bar_Size>
     110                        <Bar_Width>2.0</Bar_Width>
     111                        <Regen_Rate>5.0</Regen_Rate>
     112                        <Regen_Start>15.0</Regen_Start>
     113                        <Decay_Rate>5.0</Decay_Rate>
     114 
     115                        <Border_Height>7</Border_Height>
     116                        <Border_Width>28</Border_Width>
     117                        <Border_Name>bar.dds</Border_Name>
     118                </Health>
     119                <Stamina>
     120                        <Bar_Height>-1.0</Bar_Height>
     121                        <Bar_Size>20</Bar_Size>
     122                        <Bar_Width>2.0</Bar_Width>
     123                        <Border_Height>7</Border_Height>
     124                        <Border_Width>28</Border_Width>
     125                        <Border_Name>bar.dds</Border_Name>
     126                </Stamina>
     127                 
     128                <Loot>
     129                        <XP>200</XP>
     130                        <Food>1</Food>
     131                        <Wood>1</Wood>
     132                        <Stone>1</Stone>
     133                        <Ore>1</Ore>
     134                </Loot>
     135                 
     136                <MiniMap>
     137                        <type>Unit</type>
     138                        <red>100</red>
     139                        <green>200</green>
     140                        <blue>50</blue>
     141                </Minimap>
     142 
     143                <Population>
     144                        <Add>1</Add>
     145                        <Rem>1</Rem>
     146                </Population>
     147               
     148                <Promotion>
     149                        <req>900</req>
     150                        <newentity>bob</newentity> (only if you want to do something other than normal rank progression)
     151                <Promotion/>
     152   
     153                <Rank>
     154                        <Width>7.0</Width>
     155                        <Size>17</Size>
     156                        <Height>-1.0</Height>
     157                        <Name></Name>
     158                </Rank>
     159                 
     160                <Supply>
     161                        <max>50</max>
     162                        <type>food</type>
     163                        <subtype>fruit<subtype>
     164                </Supply>
     165 
     166                <Vision>
     167                        <LOS>4</LOS>
     168                        <Permanent />
     169                </Vision>
     170 
     171                <Auras>
     172                        <Courage>
     173                                <Radius>20</Radius>
     174                                <Bonus>5</Bonus>
     175                        </Courage>
     176                        <Fear>
     177                                <Radius>20</Radius>
     178                                <Bonus>5</Bonus>
     179                        </Fear>
     180                        <Infidelity>
     181                                <Radius>20</Radius>
     182                                <Time>0</Time>
     183                        </Infidelity>
     184                        <Dropsite>
     185                                <Radius>50</Radius>
     186                                <Types>
     187                                        <Food/>
     188                                        <Wood/>
     189                                        <Stone/>
     190                                        <Ore/>
     191                                </Types>
     192                        </Dropsite>
     193                        <Heal>
     194                                <Radius>30</Radius>
     195                                <Rate>5</Rate>
     196                                <Speed>2000</Speed>
     197                        </Heal>
     198                        <Trample>
     199                                <Radius>8</Radius>
     200                                <Speed>1000</Speed>
     201                                <Duration>3</Duration>
     202                                <Damage>20.0</Damage>
     203                                <Crush>0.0</Crush>
     204                                <Hack>0.5</Hack>
     205                                <Pierce>0.5</Pierce>
     206                        </Trample>
     207                </Auras>
     208 
     209                <Flank_Penalty>
     210                        <Sectors>6</Sectors>
     211                        <Value>.2</Value>
     212                </Flank_Penalty>
     213                <Pitch>
     214                        <Max_Actor>0.03</Max_Actor>
     215                        <Min_Actor>-0.03</Min_Actor>
     216                        <Divs>9</Divs>
     217                        <Value>.2</Value>
     218                </Pitch>
     219   
     220        </Traits>
     221 
     222        <Actor>structures/celts/civil_centre.xml</Actor>
     223 
     224        <Actions>
     225                <Attack>
     226                        <Crush>0.0</Crush>
     227                        <Hack>5.0</Hack>
     228                        <Pierce>5.0</Pierce>
     229                        <Range>2.0</Range>
     230                        <Speed>1500</Speed>
     231                </Attack>
     232 
     233                <Create>
     234                        <List>
     235                                <StructCiv>civil_centre;farmstead;house;mill;market;temple</StructCiv>
     236                                <StructMil>barracks;dock;fortress;scout_tower;wall;wall_gate;wall_tower</StructMil>
     237                                <Unit>infantry_swordsman_b;infantry_spearman_b;infantry_javelinist_b;
     238                                       infantry_archer_b;infantry_slinger_b;cavalry_swordsman_b;
     239                                       cavalry_spearman_b;cavalry_javelinist_b;cavalry_archer_b;
     240                                       female_citizen</Unit>
     241                                <Tech>bob</Tech>
     242                        </List>
     243                        <Speed>100</Speed>
     244                </Create>
     245               
     246                <Gather>
     247                        <Resource>
     248                                <Food>
     249                                        <Meat>3000</Meat>
     250                                        <Fruit>3000</Fruit>
     251                                        <Grain>3000</Grain>
     252                                        <Fish>3000</Fish>
     253                                </Food>
     254                                <Wood>3000</Wood>
     255                                <Stone>3000</Stone>
     256                                <Ore>3000</Ore>
     257                        </Resource>
     258                        <Range>2.0</Range>
     259                </Gather>
     260               
     261                <Loot>
     262                        <Resources />
     263                        <XP />
     264                </Loot>
     265 
     266                <Move>
     267                        <Speed>5.0</Speed>
     268                        <TurningRadius>0.0</TurningRadius>
     269                        <Run>
     270                                <Speed>10.0</Speed>
     271                                <Range>5.5</Range>
     272                                <RangeMin>2.0</RangeMin>
     273                               
     274                                <Regen_Rate>10.0</Regen_Rate>
     275                                <Decay_Rate>5.0</Decay_Rate>
     276                        </Run>
     277                </Move>
     278 
     279                <Patrol />
     280        </Actions>
     281 
     282        <Script File="entities/template_entity_script.js" />
     283        <Event On="Initialize" Function="entityInit" />
     284        <Event On="Death" Function="entityDeath" />
     285 
     286        <Event On="TargetChanged" Function ="entityEvent_TargetChanged" />
     287        <Event On="PrepareOrder" Function="entityEvent_PrepareOrder" />
     288 
     289        <Event On="Attack" Function="entityEvent_Attack_Melee" />
     290        <Event On="Attack" Function="entityEvent_Attack_Ranged" />
     291        <Event On="Gather" Function="entityEvent_Gather" />
     292         
     293        <Event On="StartProduction" Function="entityStartProduction" />
     294        <Event On="CancelProduction" Function="entityCancelProduction" />
     295        <Event On="FinishProduction" Function="entityFinishProduction" />
     296  </Entity>
     297}}}
     298
     299----
     300
     301= Extant =
     302
     303Set to "true" for the top-most entity in the heirarchy (ie template_entity). Otherwise defaults to false.
     304
     305= Corpse =
     306
     307The entity is replaced with this entity when it dies. (For example, a dead tree, a corpse, or a broken siege weapon.)
     308
     309{{Template:TODO||Make corpse entities disappear from the map after a period of time. This will likely require properties to indicate the method of removal (fade / sink into the ground) and the delay period before removal occurs should be available to JS for the graphics options menu. }}
     310
     311= Parent =
     312
     313Indicates the name of the entity from which this entity inherits any unspecified properties. If specified, any attributes -- including Events -- that are not defined in this XML object will be inherited from the specified parent object (which in turn inherits from its own parent, and so forth).
     314
     315This makes the declaration of properties more efficient, since shared properties can simply bem declared just once and propagate down the entity tree to those that share them.
     316
     317This inheritance tree means that we can be very efficient about our XML content. For example, we can express the events of upgrading, getting a new appearance on certain ranks, etc, in a single generic Citizen Soldier entity (which in turn could inherit even more basic building blocks from the grandparent), which each Citizen Soldier inherits. Where they differ from the norm, each unit then just specifies any unique attributes.
     318
     319There's less repetition of data, global changes are a snap (make all infantry faster? No problem), the XMLs are smaller and load faster too.
     320
     321= Traits =
     322
     323Group object for "passive" properties: innate attributes that do not require any action on the part of the entity and little to no intervention from the player. Here we have information such as the entity's health, armour, and vision, what units can garrison in it, and how much it costs to create one. It also covers abilities and effects that occur automatically.
     324
     325== [wiki:XML.Entity.Traits.ID ID] ==
     326These properties identify and classify an entity. Attributes include the unit's name, icon, class properties, tooltip rollover, historical information, and civilisation ownership.
     327== [wiki:XML.Entity.Traits.AI AI] ==
     328Entity action that is controlled by the computer is required to have an Artificial Intelligence attached to it.
     329{{Template:TODO|| These properties are distinctly the product of guesswork and speculation based on other games ... The precise content will ultimately depend on what's needed for unit AI.}}
     330== [wiki:XML.Entity.Traits.Anchor Anchor] ==
     331This trait simply indicates the manner in which this entity should be attached to the terrain plane.
     332== [wiki:XML.Entity.Traits.Armour Armour] ==
     333Armour is an attribute that absorbs/deflects attack damage.
     334== [wiki:XML.Entity.Traits.Audio Audio] ==
     335These attributes handle the behaviours of sounds associated with this entity.
     336{{Template:TODO|| The audio properties will be revised/implemented depending on those needed by the new sound requirements.}}
     337== [wiki:XML.Entity.Traits.Auras Auras] ==
     338An "Aura" is a passive ability that affects other entities within a certain radius of the entity with an aura. It usually changes the statistics of affected units.
     339== [wiki:XML.Entity.Traits.Creation Creation] ==
     340An entity with this trait can be created (constructed, trained) by an entity that has it in its '''Actions.Create.List'''. The '''Traits.Creation''' attributes define the requirements for creation of this entity (cost, time, pre-requisites, etc).
     341== [wiki:XML.Entity.Traits.Footprint Footprint] ==
     342These attributes define the "bounding box" of an entity (the area that it occupies). This is used in collision detection, for example. This area is also highlighted when the unit is selected.
     343== [wiki:XML.Entity.Traits.Formation Formation] ==
     344Indicates how this entity is used in formations (the role it takes in a formation, and which formations it can use).
     345== [wiki:XML.Entity.Traits.Garrison Garrison] ==
     346If an entity has this trait, specified entities are able to garrison (be contained) within it.
     347== [wiki:XML.Entity.Traits.Health Health] ==
     348An object with this trait has a certain number of hitpoints that sustains him.
     349== [wiki:XML.Entity.Traits.Loot Loot] ==
     350This trait determines the quantity of resources automatically added to an opponent's Resource Pool, and/or the experience points he receives, when he destroys this entity.
     351== [wiki:XML.Entity.Traits.!MiniMap !MiniMap] ==
     352This attribute specifies how the entity appears on the Mini-Map.
     353== [wiki:XML.Entity.Traits.Population Population] ==
     354This object affects population in some way.
     355== [wiki:XML.Entity.Traits.Promotion Promotion] ==
     356An entity with this trait can accumulate experience points (see Traits.Loot.XP) and eventually accumulate enough to gain a promotion. This basically replaces him with a more advanced version of the unit.
     357== [wiki:XML.Entity.Traits.Rank Rank] ==
     358Attributes of the rank bar.
     359== [wiki:XML.Entity.Traits.Supply Supply] ==
     360An object with this attribute contains some kind of resource which can be harvested (generically known as "Supply").
     361== [wiki:XML.Entity.Traits.Transform Transform] ==
     362An entity with this attribute can be replaced with another entity under certain conditions.
     363'''Not yet implemented.'''
     364== [wiki:XML.Entity.Traits.Vision Vision] ==
     365The object is able to reveal areas of the map within his sight radius, lifting Shroud of Darkness and Fog of War.
     366
     367= Actions =
     368
     369Group object for "active" properties (those that relate to actions that the entity can take ... How much damage it inflicts when it attacks, its gather rate, its ability to heal other units, construction rate, and so forth.
     370
     371Actions are abilities that the entity can use, such as attacking an opponent, gathering a resource, or patrolling an area. These in turn have additional attributes that further define the behaviour of the action (such as how much damage the entity inflicts in attacks, and against what armour types, and how quickly the entity moves when performing a move action).
     372
     373If there is no action assigned to the entity, then we can assume that it doesn't have that ability. Actions typically have a cursor and GUI button that can be used to command the entity to perform this action.
     374
     375== [wiki:XML.Entity.Actions.Attack Attack] ==
     376An object with this ability is able to attack opponents or wild animals.
     377== [wiki:XML.Entity.Actions.Barter Barter] ==
     378An entity with the Barter action has a special market interface to buy and sell resources in exchange for other resources (used by the Market).
     379'''Not yet implemented.'''
     380== [wiki:XML.Entity.Actions.Create Create] ==
     381An entity with the Create action is able to create (train, construct) other entities. For details about an entity's prerequisites and costs for creation, see the '''Traits.Creation''' trait.
     382== [wiki:XML.Entity.Actions.Escort Escort] ==
     383Has an Escort GUI button (also performed by right-clicking a friendly entity). When commanded to Escort, the entity remains within close range of the target until directed otherwise, following and defending it.
     384'''Not yet implemented.'''
     385== [wiki:XML.Entity.Actions.Gather Gather] ==
     386An object with this ability can gather resources from some source of Supply and transfer it to the player's Resource Pool.
     387== [wiki:XML.Entity.Actions.Graze Graze] ==
     388This is an action that's only used by animals. It simply causes the animal to move to the specified location and initiate a grazing animation there, to add more variety to its wander AI.
     389'''Not yet implemented.'''
     390== [wiki:XML.Entity.Actions.Heal Heal] ==
     391The Heal Action is used by the Healer unit to regenerate the health of the player's organic units. While the action is applied to a viable damaged target, his hitpoints increase until restored to maximum, while the entity performs his "Heal" animation.
     392'''Not yet implemented.'''
     393== [wiki:XML.Entity.Actions.Lock Lock] ==
     394The entity has alternating Lock and Unlock buttons in the GUI, which can be used to force its gate open or closed (unlocked gates stay open if a player entity is adjacent, but close to deny entry to the enemy).
     395'''Not yet implemented.'''
     396== [wiki:XML.Entity.Actions.Loot Loot] ==
     397This action allows a unit to retrieve an opponent's "loot" and experience points when he kills them (see Traits.Loot).
     398== [wiki:XML.Entity.Actions.Move Move] ==
     399An object with this ability can be commanded to move from one location to another.
     400== [wiki:XML.Entity.Actions.Patrol Patrol] ==
     401Has a Patrol button in the GUI. Once put on a patrol route, entity(s) repeatedly moves from one extreme limit back to the other, back and forth. There is no limit to the number of Patrol routes that may be set up.
     402== [wiki:XML.Entity.Actions.Repair Repair] ==
     403The Repair Action is used by econ units (Citizen Soldiers) to regenerate the health of the player's mechanical mobile and non-mobile entities (structures, ships, siege weapons). While the action is applied to a viable damaged target, his hitpoints increase until restored to maximum, while the entity performs his "Repair" animation.
     404'''Not yet implemented.'''
     405== [wiki:XML.Entity.Actions.Scout Scout] ==
     406The entity has a Scout command in the GUI. Once put into Scout mode, the entity moves methodically back and forth through an enemy's Civ Territory in ever expanding arcs to reveal the terrain/entities there.
     407'''Not yet implemented.'''
     408== [wiki:XML.Entity.Actions.Trade Trade] ==
     409An entity with this ability is able to generate supply (resources) by travelling on a patrol route between two specified structures. (Note: The quantity it can carry and the type of resource is specified by the entity's '''Traits.Supply''' attributes.)
     410'''Not yet implemented.'''
     411
     412= Event =
     413
     414Events are the conditions under which effects occur. An event is true when an entity enters a certain state. Generally the event jumps in just before the actual event takes place. For example, logic written for the Death event occurs just before the unit is about to die.
     415
     416See below for a listing of all intended events.
     417
     418== Introduction ==
     419
     420We want to hardcode the bare minimum of game logic into the engine. In designing these XML attributes, we strive to keep it flexible so that designers can easily adjust the nature and behaviour of the game's units and other objects with minimal bugging of overworked programmers.
     421
     422However, trying to create an XML attribute for every contingency that could ever be required ("!BelchesGreenFire=true") is an exercise in futility.
     423
     424The event/action model uses the flexibility of !JavaScript to embed script commands/functions/calls directly into the XML of a game object (entity, cliff, water, terrain, tech, actor, etc), which is then executed when a specific event occurs for an instance of this entity.
     425
     426This allows custom logic to be written for an entity and encapsulated with its data, instead of having a special XML attribute that flags some logic which we assume to be "handled elsewhere".
     427
     428Like the GUI, these commands could also call a function written in another file (good for reuse of code) or an engine function.
     429
     430=== Warnings ===
     431
     432Before we describe how events can be used, a couple of warnings:
     433
     434 * Allowing script-based game logic gives modders and developers great power.. But that same power could be used to make 0 A.D. a hacker's paradise. We need to ensure that each player's data in a multiplayer game is sufficiently validated so that a player can't alter the script of his local version to give himself an unfair advantage (eg give himself resources every tick). Client/server architecture, out-of-sync checks, hashing, checksums, we need to use any means necessary to ensure modders have the freedom to adapt game data, while ensuring that players must have the same data version in order to play together.
     435
     436 * Script code isn't as fast as engine code, so lots of resource-intensive script logic could slow the game down. Time will tell exactly how much we can get away with it. But initially, at least, we want to script almost everything. !JavaScript at least makes a token effort to efficiency; if the same script is used multiple times, it only has to be parsed and compiled to bytecode once. There are two ways that we can take advantage of this feature to reduce the overhead:
     437
     438 1. Wrap logic in a function wherever possible and call that, so that it can be called by other entities if needed.
     439 1. Entities can inherit attributes from each other, including event logic. For example, the behaviour for unit upgrading could be written once, in the generic-citizen-soldier entity. All Citizen Soldiers could then inherit from this entity, gaining the upgrade script automatically.
     440
     441 * Events should generally be used for one-offs (eg raising/lowering of sails) or complicated exceptions (eg auras). For example, it isn't worth scripting the upgrade system into each Citizen Soldier's XML because so many units make use of it ... that would probably double the size of the entity files. Even wrapped in a function, it means more repetition of the same commands, which all have to be parsed and processed.
     442
     443== On ==
     444
     445This list will grow as we implement and hammer down the details of game logic (eg formations, repairing, town bell, AI) ... It's easy for programmers to add additional events, but remember to minimise the amount of script that needs to be executed every frame. For example, it's less costly to check XYZBegin and XYZCancel than check XYZ every frame.
     446
     447All the relevant data for an event will be copied to a special 'ev' object, allowing easy passing of event information to a script (i.e., for !TakesDamage, there'd be ev.inflictor, ev.damage.crush, ev.damage.pierce, ev.range and so on).
     448
     449Currently planned events are:
     450
     451=== Attack ===
     452Occurs when the entity is commanded to attack another entity.
     453=== !AuraComplete ===
     454When an entity has remained in aura radius for the length of time specified by Aura.Time.
     455'''Not yet implemented.'''
     456=== !AuraEnter ===
     457When an entity enters the aura radius of this entity.
     458'''Not yet implemented.'''
     459=== !AuraLeave ===
     460When an entity leaves the aura radius of this entity.
     461'''Not yet implemented.'''
     462=== !CancelProduction ===
     463Occurs when production of an entity has been prematurely cancelled (usually deliberately by the user). This is the time to refund any spent resources, remove the item for the GUI queue, etc.
     464=== !CreateBegin ===
     465Occurs when creation (training/building/researching) of this entity has started.
     466'''Not yet implemented.'''
     467=== !CreateCancel ===
     468Occurs when creation (training/building/researching) of this entity has been cancelled by the user.
     469'''Not yet implemented.'''
     470=== !CreateComplete ===
     471Occurs when creation (training/building/researching) of this entity has finished.
     472'''Not yet implemented.'''
     473=== Death ===
     474Occurs immediately before the entity is destroyed.
     475
     476=== !FinishProduction ===
     477Occurs when a production in the entity's queue completes its production time. At this point, the new entity should be spawned or the technology applied.
     478=== !GarrisonEmpty ===
     479Occurs when all garrison slots are empty.
     480'''Not yet implemented.'''
     481=== !GarrisonEnter ===
     482Occurs when an entity is garrisoned in this entity.
     483'''Not yet implemented.'''
     484=== !GarrisonExit ===
     485Occurs when an entity is ungarrisoned from this entity.
     486'''Not yet implemented.'''
     487=== !GarrisonFull ===
     488Occurs when all garrison slots are occupied.
     489'''Not yet implemented.'''
     490=== Gather ===
     491Occurs when the entity is commanded to Gather supply from another entity.
     492=== !HoverStart ===
     493Occurs when the player places the cursor over the entity.
     494'''Not yet implemented.'''
     495=== Initialize ===
     496Occurs when the entity first enters the world.
     497=== !HoverStop ===
     498Occurs when the player moves the cursor off of the entity.
     499'''Not yet implemented.'''
     500=== LOSEnter ===
     501When an entity enters the sight radius of this entity.
     502'''Not yet implemented.'''
     503=== LOSLeave ===
     504When an entity leaves the sight radius of this entity.
     505'''Not yet implemented.'''
     506=== !MouseDown ===
     507Occurs when the player clicks on the entity.
     508'''Not yet implemented.'''
     509=== !MouseUp ===
     510Occurs when the player releases the mouse button, or moves the cursor off the entity.
     511'''Not yet implemented.'''
     512=== !OrderBegin ===
     513Occurs when the entity has been given a command and is about to start carrying it out.
     514'''Not yet implemented.'''
     515=== !OrderCancel ===
     516Occurs when the user cancels the order.
     517'''Not yet implemented.'''
     518=== !OrderComplete ===
     519Occurs when the entity has finished an order.
     520'''Not yet implemented.'''
     521=== !PrepareOrder ===
     522Occurs when the entity is given a new order.
     523=== !SocketEnter ===
     524Occurs when an entity occupies a socket (prop point) in this entity.
     525'''Not yet implemented.'''
     526=== !SocketEmpty ===
     527Occurs when all sockets are empty.
     528'''Not yet implemented.'''
     529=== !SocketExit ===
     530Occurs when an entity occupies a socket (prop point) in this entity.
     531'''Not yet implemented.'''
     532=== !SocketFull ===
     533Occurs when all sockets are occupied.
     534'''Not yet implemented.'''
     535=== !StartProduction ===
     536Dispatched by ORDER_PRODUCE and occurs when the entity has started producing another entity which has been added to its queue. Resources and population space should be subtracted at this time.
     537 * evt.name: Name of the production, usually its entity name.
     538 * evt.productionType: int indicating the type of production (research, training, etc).
     539 * evt.time: The time it will take to complete the production. The event handler must set this value for each production so the game knows how long it should last. (Usually calculated from the entity's property Traits.Creation properties, plus any build speed bonuses, etc).
     540 * evt.preventDefault(): Prevent this production from starting (e.g. if the player doesn't have enough resources for it).
     541
     542=== !SupplyEmpty ===
     543Occurs when all Supply has been gathered from an entity.
     544'''Not yet implemented.'''
     545=== !SupplyFull ===
     546Occurs when an entity has reached its maximum Supply.
     547'''Not yet implemented.'''
     548=== !TakesDamage ===
     549Occurs when the entity is attacked by another entity.
     550
     551''NOTE'': Right now this event has been removed, and the script calls a damage() function itself, so that the C++ engine doesn't need to know anything about damage types. If it is determined that some damage behaviour should be inherited, we can add in some functions to allow !JavaScript to dispatch an event up the entity hierarchy and attach arbitary data to it.
     552
     553=== !TargetChanged ===
     554Occurs when the entity is given a new target.
     555=== Tick ===
     556Occurs every simulation frame; currently 10 Hz unless this framerate cannot be achieved. !JavaScript isn't particularly efficient, so while this is a very powerful feature, it's almost always better to add an additional event to this list than constantly scan for a condition.
     557=== !WalkOver ===
     558Occurs when an entity moves over the surface of it. Typically only used by terrains.
     559'''Not yet implemented.'''
     560
     561== Function ==
     562
     563Specifies a JS function that is executed when the event occurs. Note that the .js file that contains the function must first be included in the entity XML's scope using the <Script File="" /> attribute.
     564
     565= Dynamic Properties =
     566
     567A number of entity properties are not specified in the entity XML files, but are provided by the game for each entity to allow scripts to interact with it.
     568
     569== Last_Combat_Time ==
     570
     571The variable entity.last_combat_time is used by the game to decide when to start health regeneration. It should be set by the scripts for any millitary events (when the entity is either attacking or receiving damage).
     572
     573== Production_Queue ==
     574
     575The production queue of a given entity can be accessed through entity.production_queue. It provides the following fields and methods:
     576 * entity.production_queue.length: The number of items in the queue (read-only).
     577 * entity.production_queue.get(i): Get the production item at a particular index in the queue. A production item has the following properties (all read-only):
     578  * item.type: The production type, as in the event above.
     579  * item.name: The production name, as in the event above.
     580  * item.totalTime: How long the production takes to complete.
     581  * item.elapsedTime: How much time the entity has spent "working" on this production (i.e. with it at the head of its queue). When elapsedTime reaches totalTime, the production is complete and a !FinishProduction event is fired.
     582 * entity.production_queue.cancel(i): Cancel production of the item at a particular index in the queue. This will cause a !CancelProduction event to be fired, where the entity can grant back resources, etc to the player.