source: GTP/trunk/App/Demos/Geom/Shark3D/clod_head_demo_win32/src/res/level/actor/levelplayer.s3d_actor @ 2236

Revision 2236, 10.8 KB checked in by gumbau, 17 years ago (diff)
Line 
1///////////////////////////////////////////////////////////////////////////////
2//
3//      ##  ######
4//       ######  ###
5//  ## ###############        Shark 3D Engine (www.shark3d.com)
6//   ########## # # #
7//    ########                Copyright (c) 1996-2006 Spinor GmbH.
8//   ######### # # #          All rights reserved.
9//  ##   ##########
10//      ##
11//
12///////////////////////////////////////////////////////////////////////////////
13
14// Definition of the player.
15//
16// In this case, the player basically only is a main camera
17// which is linked to a particular object in the world,
18// and a test camera which can be moved freely around to inspect the level.
19//
20// The player is not defined directly, but only a suppl for the player.
21// The reason for this is that not only one player must be created,
22// but a new player for every player which logs into the server.
23// As long as no client logs into a server, no player is created.
24// Each time a player logs into the server, the player suppl
25// is used to create a player.
26
27
28actor_ident "kit_base.group"
29actor_param
30{
31    active 1
32    child_array
33    {
34        // This dispatcher dispatches commands coming
35        // from outside the capsule.
36        ident "kit_base.dispatch"
37        param
38        {
39            name "dispatch_export"
40            entry_array
41            // notice_destroy the player:
42            {
43                cmds "destroy"
44                targets "capsule"
45            }
46            {
47                cmds "created_local"
48                targets
49            }
50            {
51                cmds "created_net"
52                targets "reproduce"
53                newcmd "set_blocked"
54            }
55            {
56                cmds "net_traverse"
57                targets
58            }
59            {
60                cmds "net_appear"
61                targets "reproduce"
62                newcmd "rework"
63            }
64            // Inform management:
65            {
66                // Store the inform-actor in "inform":
67                cmds "assign_inform" "set_inform"
68                targets "inform_deleg"
69                newcmd "set_deleg_target"
70            }
71            {
72                // Delegate the inform command:
73                cmds "assign_inform" "set_inform"
74                targets "informanswer"
75                    "oninform_gfxmgr" "oninform_sndmgr"
76                    "oninform_world" "oninform_sky"
77                    "oninform_sim"
78                    "oninform_noise"
79                    "oninform_sensorstate"
80                    "oninform_maincamera"
81                    "maininform_switch"
82            }
83            {
84                cmds "search_inform" "search_noinform"
85                targets "informanswer"
86            }
87            {
88                // Set the position of the player.
89                cmds "set_transf"
90                targets "scene_root"
91            }
92            {
93                cmds "add_motion"
94                targets "player_deleg"
95            }
96            {
97                cmds "god"
98                targets "god_switch"
99                newcmd "toggle_switch"
100            }
101            {
102                cmds "god_off"
103                targets "god_switch"
104                newcmd "disable_switch"
105            }
106            {
107                cmds "god_on"
108                targets "god_switch"
109                newcmd "enable_switch"
110            }
111            {
112                cmds "get_light_transl"
113                targets "^lightitem"
114                newcmd "get_transf_transl_xyz"
115            }
116            {
117                cmds "set_light_transl"
118                targets "^lightitem"
119                newcmd "set_transf_transl_xyz"
120            }
121        }
122    }
123    {
124        ident "kit_base.dispatch"
125        param
126        {
127            name "dispatch"
128            entry_array
129            {
130                // Disable god mode:
131                cmds "god_off"
132                targets "maininform_switch"
133                newcmd "select_normalmode"
134            }
135            {
136                // Disable godmode.
137                cmds "god_off"
138                targets "player_deleg_actor"
139                newcmd "disable"
140            }
141            {
142                // Enable godmode.
143                cmds "god_on"
144                targets "maininform_switch"
145                newcmd "select_godmode"
146            }
147            {
148                // Enable godmode.
149                cmds "god_on"
150                targets "player_deleg_actor"
151                newcmd "enable"
152            }
153            {
154                // Enable godmode.
155                cmds "god_on"
156                targets "godctrl"
157                newcmd "player_to_god"
158            }
159        }
160    }
161    {
162        ident "kit_base.deleg"
163        param
164        {
165            name "inform_deleg"
166            deleg_name "inform"
167            deleg_target ""
168            allow_no_target 1
169            enabled 1
170        }
171    }
172    {
173        ident "kit_engobj.informanswer"
174        param
175        {
176            name "informanswer"
177            answer_cmd "add_result"
178            answer_actor "capsule_deleg"
179        }
180    }
181    {
182        ident "kit_base.switch"
183        param
184        {
185            name "god_switch"
186            target "dispatch"
187            disable_switch_cmd "god_off"
188            enable_switch_cmd "god_on"
189            val 0
190        }
191    }
192    {
193        ident "kit_engobj.itemeye"
194        param
195        {
196            name "camera"
197            item_actor "^camposref"
198            item_name ""
199        }
200    }
201    {
202        ident "kit_engobj.item"
203        param
204        {
205            name "god_vehicle"
206            item_suppl "^stdsuppl"
207            item_ident "simplepos:"
208            item_param
209            {
210                env "^^env"
211            }
212        }
213    }
214    {
215        // Select the position of the godmode-camera
216        // (we want the position, not the wrapping actor,
217        // so "unwrap" it).
218        ident "kit_engobj.item"
219        param
220        {
221            name "god_camera"
222            item_suppl "^stdsuppl"
223            item_ident "simplepos:"
224            item_param
225            {
226                env "^^env"
227                parent "god_vehicle"
228            }
229        }
230    }
231    {
232        // The godplayer moves different than the normal player
233        // so pass the movement to this godmode-control actor.
234        ident "kit_engobj.godctrl"
235        param
236        {
237            active 1
238            name "godctrl"
239            move_dir 0.0 1.0 0.0
240            move_also 1.0 0.0 0.0
241            cam_dir 0.0 0.0 1.0
242            cam_also 1.0 0.0 0.0
243            god_vehicle "god_vehicle"
244            god_cam "god_camera"
245            player_vehicle ""
246            player_cam "camera"
247        }
248    }
249    {
250        // Split the motion-commands:
251        // up-down look is applied directly to the camera,
252        // rest of movement and rotation ia applied to position
253        // (here via godctrl).
254        // Splitting is necessary
255        // because we don't want the player to tilt backwards
256        // while looking up.
257        ident "kit_engobj.motionlook"
258        param
259        {
260            name "motionlook"
261            look_actor "god_camera"
262            look_target "god_camera"
263            look_get_cmd "get_transf"
264            look_set_cmd "set_transf"
265            other_target "godctrl"
266            other_cmd "add_motion"
267            axis 1.0 0.0 0.0
268            min_angle -170.0
269            max_angle -10.0
270        }
271    }
272    {
273        ident "kit_base.deleg"
274        param
275        {
276            name "player_deleg_actor"
277            deleg_name "player_deleg"
278            deleg_target "motionlook"
279            allow_no_target 1
280            enabled 0
281        }
282    }
283    {
284        ident "kit_engobj.oninform"
285        param
286        {
287            // Tell the client about performing
288            // the level change.
289            name "oninform_changelevel"
290            cmd "changelevel_perform"
291        }
292    }
293    {
294        ident "kit_engobj.oninformobj"
295        param
296        {
297            name "oninform_gfxmgr"
298            cmd "set_gfxmgr_level"
299            param "^gfxmgr"
300        }
301    }
302    {
303        ident "kit_engobj.oninformobj"
304        param
305        {
306            name "oninform_sndmgr"
307            cmd "set_sndmgr_level"
308            param "^sndmgr"
309        }
310    }
311    {
312        ident "kit_engobj.oninformobj"
313        param
314        {
315            name "oninform_world"
316            cmd "set_state_world"
317            param "^state_world"
318        }
319    }
320    {
321        ident "kit_engobj.oninformobj"
322        param
323        {
324            name "oninform_sky"
325            cmd "set_state_sky"
326            param "^state_sky"
327        }
328    }
329    {
330        ident "kit_engobj.oninformobj"
331        param
332        {
333            name "oninform_sim"
334            cmd "set_sim_world"
335            param "^sim_world"
336        }
337    }
338    {
339        ident "kit_engobj.oninformobj"
340        param
341        {
342            name "oninform_noise"
343            cmd "set_noise_world"
344            param "^noise_world"
345        }
346    }
347    {
348        ident "kit_engobj.oninformobj"
349        param
350        {
351            name "oninform_sensorstate"
352            cmd "set_sensorstate_world"
353            param "^sensorstate_world"
354        }
355    }
356    {
357        ident "kit_engobj.oninformobj"
358        param
359        {
360            name "oninform_maincamera"
361            cmd "set_camera"
362            param "camera"
363        }
364    }
365    {
366        ident "kit_engobj.oninformobj"
367        param
368        {
369            name "oninform_godcamera"
370            cmd "set_camera"
371            param "god_camera"
372        }
373    }
374    {
375        // This actor is used to switch between the main
376        // camera and the test camera.
377        // This actor switches between different actors
378        // which get the "assign_inform" or "set_inform"
379        // command with the current inform-actor, whereas
380        // all other disabled actors get a "assign_inform" or
381        // "set_inform" with 0 as argument.
382        ident "kit_engobj.oninformswitch"
383        param
384        {
385            name "maininform_switch"
386            deleg_name "maininform"
387            target "oninform_maincamera"
388            entry_array
389            {
390                cmd "select_godmode"
391                target "oninform_godcamera"
392            }
393            {
394                cmd "select_normalmode"
395                target "oninform_maincamera"
396            }
397        }
398    }
399    {
400        ident "kit_engbase.netreproduce"
401        param
402        {
403            name "reproduce"
404            producer "inform"
405            charge "capsule_deleg"
406            reproduce_cmd "reproduce"
407        }
408    }
409}
Note: See TracBrowser for help on using the repository browser.