source: AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-knockdown-.oni-patch@ 971

Last change on this file since 971 was 965, checked in by iritscen, 11 years ago

Latest version of glass-breaking patch (this ONCC patch does not work, though). Removed DangerousGlass as it is now a package on Depot.

File size: 1.2 KB
Line 
1@XML_TOOLS Version "2.0"
2
3@CUSTOM_CODE
4<code>
5 var myBuilder = new JSXMLBuilder();
6 myBuilder.load($xmlData);
7
8 var elements = myBuilder.elements[0];
9 var particles = elements.childElement("Animation").childElement("Particles");
10
11 // Check to see if glass_break is already added to Head
12 for (var i = 0; (particles.childElement(i)); i++)
13 {
14 var particle = particles.childElement(i);
15 if (particle.childElement("Bone").text == "Head" &&
16 particle.childElement("Name").text == "glass_break")
17 return;
18 }
19
20 // Exit if we are past Oni's limit on TRAM particles
21 if (particles.length >= 16)
22 return;
23
24 // Add the glass_break particle to Head for duration of animation
25 var heights = elements.childElement("Animation").childElement("Heights");
26 var anim_length;
27 for (anim_length = 0; (heights.childElement(anim_length)); anim_length++) {;}
28 myBuilder.addElementAt("Particle",
29 "",
30 "<Start>0</Start>\
31 <End>" + (anim_length-1) + "</End>\
32 <Bone>Head</Bone>\
33 <Name>glass_break</Name>",
34 particles.index + 1,
35 particles.level + 1);
36
37 // Update the global variable with the new XML
38 $xmlData = myBuilder.generateXML();
39</code>
Note: See TracBrowser for help on using the repository browser.