/assets/blender/gleis/

log msg
path: root/advtrains/api_doc.txt
blob: 34f1beb1f559a33264dc7b54a3e055df45cad94b (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Advanced Trains [advtrains] API documentation
--------
To use the API, mods must depend on 'advtrains'.
All boolean values in definition tables default to 'false' and can be omitted.
### Wagons
Wagons are registered using the function

advtrains.register_wagon(name, prototype, description, inventory_image)
- 'name' is the internal name of the wagon. It should follow the mod naming convention, however, this is not enforced.
	For compatibility reasons, if a mod name is omitted, the wagon will be registered in the advtrains: namespace.
	Example: A wagon with name="engine_tgv" will be registered as "advtrains:engine_tgv".
	!IMPORTANT! You must not append a ":" at the start of the name, even if you want to bypass the mod naming convention check. This is because internally the register_wagon function
	appends a ":" automatically.
- 'prototype' is the lua entity prototype. The regular definition keys for luaentites apply. Additional required and optional properties see below. DO NOT define 'on_step', 'on_activate', 'on_punch', 'on_rightclick' and 'get_staticdata' since these will be overridden. Use 'custom_*' instead.
- 'description' is the description of the inventory item that is used to place the wagon.
- 'inventory_image' is the inventory image of said item.

# Wagon prototype properties
{
	... all regular luaentity properties (mesh, textures, collisionbox a.s.o)...
	drives_on = {default=true},
	^- used to define the tracktypes (see below) that wagon can drive on. The tracktype identifiers are given as keys, similar to privileges)
	max_speed = 10,
	^- optional, default 10: defines the maximum speed this wagon can drive. The maximum speed of a train is determined by the wagon with the lowest max_speed value.
	seats = {
	^- contains zero or more seat definitions. A seat is a place where a player can be attached when getting on a wagon.
		{
			name="Left front window",
			^- display name of this seat
			attach_offset={x=0, y=10, z=0},
			^- this value is passed to 'set_attach'
			view_offset={x=0, y=6, z=0},
			^- player:set_eye_offset is called with this parameter.
			group="default"
			^- optional. Defines the seat group. See 'seat_groups' below
			-!- Note: driving_ctrl_access field has moved to seat group definition,
			-!- but is still partwise supported here. If you don't use seat groups yet,
			-!- you really should change NOW!
		},
	},
	seat_groups = {
	^- If defined, activates advanced seating behavior. See "seating behavior".
		default = {
			name = "Seats"
			^- name of this seat group, to be shown in get-on menu.
			access_to = {"foo", "bar"}
			^- List of seat groups you can access from this seat using the menu when sitting inside the train.
			require_doors_open = true
			^- Only allow getting on and off if doors are open.
			driving_ctrl_access=false,
			^- If the seat is a driver stand, and players sitting here should get access to the train's driving control.
		}
	}
	assign_to_seat_group = {"default"},
	^- optional, like seat_groups. When player right_clicks the wagon, player will be assigned to the first free seat group in the list.
	
	doors={
	^- optional. If defined, defines door animation frames. Opposite door has to be closed during animation period.
	^- Remember, advtrains can't handle doors on both sides opened simultaneously.
		open={
			[-1]={frames={x=0, y=20}, time=1}, -- open left doors
			[1]={frames={x=40, y=60}, time=1}  -- open right doors
			sound = <simpleSoundSpec>
			^- The sound file of the doors opening. If none is specified, nothing is played.
		},
		close={
			[-1]={frames={x=20, y=40}, time=1}, -- close left doors
			[1]={frames={x=60, y=80}, time=1} -- close right doors
			sound = <simpleSoundSpec>
			^- The sound file of the doors closing. If none is specified, nothing is played.
		}
	},
	door_entry={ 1.5, -1.5 }
	^- optional. If defined, defines the locations of the doors on the model as distance from the object center on the path.
	^- Getting on by walking in then takes effect.
	^- Positive values mean front, negative ones back. Resulting position is automatically shifted to the right side.