|
@@ -106,18 +106,31 @@ ConsoleDocClass( Explosion,
|
|
|
" lightEndBrightness = 0.0;\n"
|
|
|
" lightNormalOffset = 2.0;\n"
|
|
|
"};\n\n"
|
|
|
- "function createExplosion()\n"
|
|
|
+ "function ServerPlayExplosion(%position, %datablock)\n"
|
|
|
"{\n"
|
|
|
- " // Create a new explosion - it will explode automatically\n"
|
|
|
- " %pos = \"0 0 100\";\n"
|
|
|
- " %obj = new Explosion()\n"
|
|
|
+ " // Play the given explosion on every client.\n"
|
|
|
+ " // The explosion will be transmitted as an event, not attached to any object.\n"
|
|
|
+ " for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)\n"
|
|
|
" {\n"
|
|
|
- " position = %pos;\n"
|
|
|
- " dataBlock = GrenadeLauncherExplosion;\n"
|
|
|
- " };\n"
|
|
|
+ " %client = ClientGroup.getObject(%idx);\n"
|
|
|
+ " commandToClient(%client, 'PlayExplosion', %position, %datablock.getId());\n"
|
|
|
+ " }\n"
|
|
|
+ "}\n\n"
|
|
|
+ "function clientCmdPlayExplosion(%position, %effectDataBlock)\n"
|
|
|
+ "{\n"
|
|
|
+ " // Play an explosion sent by the server. Make sure this function is defined\n"
|
|
|
+ " // on the client.\n"
|
|
|
+ " if (isObject(%effectDataBlock))\n"
|
|
|
+ " {\n"
|
|
|
+ " new Explosion()\n"
|
|
|
+ " {\n"
|
|
|
+ " position = %position;\n"
|
|
|
+ " dataBlock = %effectDataBlock;\n"
|
|
|
+ " };\n"
|
|
|
+ " }\n"
|
|
|
"}\n\n"
|
|
|
"// schedule an explosion\n"
|
|
|
- "schedule(1000, 0, createExplosion);\n"
|
|
|
+ "schedule(1000, 0, ServerPlayExplosion, \"0 0 0\", GrenadeLauncherExplosion);\n"
|
|
|
"@endtsexample"
|
|
|
);
|
|
|
|