source: ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_infantry.xml@ 25223

Last change on this file since 25223 was 25223, checked in by wraitii, 3 years ago

Allow arbitrary compositions in TemplateLoader template names.

  • Allows compositing any two templates in TemplateLoader, and not just filters: 'A|B|C' is now valid for any template A, B and C.
  • Allows parents to be composited paths 'A|B|C'. In such a schema, if A or B themselves specify a parent, the actual composition becomes A|pA|B|pB|C and so on.

This allows, by leveraging the common schema of our entities, to reduce duplication.

For convenience, templates in "special/filters/" and "mixins/" can be included by their direct name. Others have to be completely specified.

See the two provided cases for examples:

  • 'hoplite' becomes a mixin that can be used to apply the Phalanx formation
  • 'builder' becomes a mixin that can be give a template the ability to build the standard structures, and gives the 'Builder' identity class. This also allows deduplicating that list of tokens.

Update checkrefs & swap std::map for std::unordered_map in TemplateLoader.

Differential Revision: https://code.wildfiregames.com/D3801

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/xml
File size: 3.4 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<Entity parent="builder|template_unit">
3 <Attack>
4 <Capture>
5 <AttackName>Capture</AttackName>
6 <Capture>2.5</Capture>
7 <MaxRange>4</MaxRange>
8 <RepeatTime>1000</RepeatTime>
9 <RestrictedClasses datatype="tokens">Field Palisade Wall</RestrictedClasses>
10 </Capture>
11 <Slaughter>
12 <AttackName>Slaughter</AttackName>
13 <Damage>
14 <Hack>1000</Hack>
15 </Damage>
16 <MaxRange>2</MaxRange>
17 </Slaughter>
18 </Attack>
19 <Cost>
20 <BuildTime>12</BuildTime>
21 <Resources>
22 <food>50</food>
23 <wood>0</wood>
24 <stone>0</stone>
25 <metal>0</metal>
26 </Resources>
27 </Cost>
28 <Health>
29 <Max>80</Max>
30 </Health>
31 <Identity>
32 <GenericName>Infantry</GenericName>
33 <Classes datatype="tokens">Human CitizenSoldier</Classes>
34 <VisibleClasses datatype="tokens">Citizen Worker Soldier Infantry</VisibleClasses>
35 <Rank>Basic</Rank>
36 </Identity>
37 <Loot>
38 <xp>100</xp>
39 <food>5</food>
40 <wood>0</wood>
41 <stone>0</stone>
42 <metal>0</metal>
43 </Loot>
44 <Position>
45 <Anchor>upright</Anchor>
46 </Position>
47 <Promotion>
48 <RequiredXp>100</RequiredXp>
49 </Promotion>
50 <Resistance>
51 <Entity>
52 <Damage>
53 <Hack>2</Hack>
54 <Pierce>4</Pierce>
55 <Crush>15</Crush>
56 </Damage>
57 </Entity>
58 </Resistance>
59 <ResourceGatherer>
60 <MaxDistance>2.0</MaxDistance>
61 <BaseSpeed>1.0</BaseSpeed>
62 <Rates>
63 <food.fruit>0.5</food.fruit>
64 <food.grain>0.25</food.grain>
65 <food.meat>1</food.meat>
66 <wood.tree>0.75</wood.tree>
67 <wood.ruins>5</wood.ruins>
68 <stone.rock>0.5</stone.rock>
69 <stone.ruins>2</stone.ruins>
70 <metal.ore>0.5</metal.ore>
71 </Rates>
72 <Capacities>
73 <food>10</food>
74 <wood>10</wood>
75 <stone>10</stone>
76 <metal>10</metal>
77 </Capacities>
78 </ResourceGatherer>
79 <Sound>
80 <SoundGroups>
81 <attack_slaughter>attack/weapon/knife_attack.xml</attack_slaughter>
82 <order_attack>voice/{lang}/civ/civ_{phenotype}_attack.xml</order_attack>
83 <order_build>voice/{lang}/civ/civ_{phenotype}_build.xml</order_build>
84 <order_garrison>voice/{lang}/civ/civ_{phenotype}_garrison.xml</order_garrison>
85 <order_gather>voice/{lang}/civ/civ_{phenotype}_gather.xml</order_gather>
86 <order_repair>voice/{lang}/civ/civ_{phenotype}_repair.xml</order_repair>
87 <order_walk>voice/{lang}/civ/civ_{phenotype}_walk.xml</order_walk>
88 <select>voice/{lang}/civ/civ_{phenotype}_select.xml</select>
89 <walk>actor/human/movement/walk.xml</walk>
90 <run>actor/human/movement/run.xml</run>
91 <death>actor/human/death/{phenotype}_death.xml</death>
92 <build>resource/construction/con_wood.xml</build>
93 <gather_fruit>resource/foraging/forage_leaves.xml</gather_fruit>
94 <gather_grain>resource/farming/farm.xml</gather_grain>
95 <gather_meat>resource/gathering/gather_meat.xml</gather_meat>
96 <gather_tree>resource/lumbering/lumbering.xml</gather_tree>
97 <gather_rock>resource/mining/pickaxe.xml</gather_rock>
98 <gather_ore>resource/mining/mining.xml</gather_ore>
99 <gather_ruins>resource/mining/mining.xml</gather_ruins>
100 <trained>interface/alarm/alarm_create_infantry.xml</trained>
101 <invalid_building_placement>interface/alarm/alarm_invalid_building_placement.xml</invalid_building_placement>
102 </SoundGroups>
103 </Sound>
104 <Vision>
105 <Range>80</Range>
106 </Vision>
107</Entity>
Note: See TracBrowser for help on using the repository browser.