File: GetDefinitionGroupPath.xml

package info (click to toggle)
openclonk 8.1-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 169,520 kB
  • sloc: cpp: 180,479; ansic: 108,988; xml: 31,371; python: 1,223; php: 767; makefile: 145; sh: 101; javascript: 34
file content (33 lines) | stat: -rw-r--r-- 1,523 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
  SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
  <func>
    <title>GetDefinitionGroupPath</title>
    <category>Objects</category>
    <version>8.0 OC</version>
    <syntax>
      <rtype>string</rtype>
    </syntax>
    <desc>Returns the editor group path of the calling definition. This is the path at which the definition is shown in the creator window and can be used to gorup definitions in large dropdown enumerations.</desc>
    <examples>
      <example>
        <code>var index = 0, weapon_def, weapon_list = [];
while (weapon_def = GetDefinition(index))
{
	if (<funclink>WildcardMatch</funclink>(weapon_def->GetDefinitionGroupPath(), "*/Weapons")
		weapon_list[GetLength(weapon_list)] = weapon_def;
	index++;
}
var spawn_weapon = weapon_list[<funclink>Random</funclink>(<funclink>GetLength</funclink>(weapon_list))];
<funclink>CreateObject</funclink>(spawn_weapon,<funclink>AbsX</funclink>(<funclink>Random</funclink>(<funclink>LandscapeWidth</funclink>())),0);</code>
				<text>Searches through all loaded definitions and all that are placed directly in a group folder named "Weapons" are put into an array. After that, a random item of these defintions is selected to spawn at a random position in the landscape.</text>
      </example>
    </examples>
    <related>
      <funclink>GetDefinition</funclink>
    </related>
  </func>
  <author>Sven2</author><date>2016-09</date>
</funcs>