Advertisement
Guest User

TAMods v0.4 projectile customization

a guest
Jul 7th, 2015
1,107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.73 KB | None | 0 0
  1. function printModuleArray(arr, mod_type)
  2.    print(string.format("    %d %s found", arr:size(), mod_type))
  3.    for i=0, arr:size() - 1 do
  4.       local mod = arr:get(i)
  5.       print(string.format("      %s %d: %s", mod_type, i, mod:getFullName()))
  6.       if mod:getClassName() == "ParticleModuleColor" then
  7.          -- This module is usually used for bullets, things with fixed colors
  8.          -- Cast the ParticleModule to ParticleModuleColor
  9.          mod = cast.ParticleModuleColor(mod)
  10.          local color = mod.StartColor
  11.          print(string.format("      Color module: %d entries", color.LookupTable:size()))
  12.          -- Print the initial color to the console
  13.          print(string.format("      (r=%.3f, g=%.3f, b=%.3f)", color.LookupTable:get(2), color.LookupTable:get(3), color.LookupTable:get(4)))
  14.          -- The colors used are floating point colors, so normal white is (1.0, 1.0, 1.0)
  15.          -- (15.0, 15.0, 15.0) is equivalent of normal white, with a brightness of 15
  16.          -- Uncomment the following lines to replace the projectile color with bright white
  17.          -- color.LookupTable:set(2, 15.0)
  18.          -- color.LookupTable:set(3, 15.0)
  19.          -- color.LookupTable:set(4, 15.0)
  20.       elseif mod:getClassName() == "ParticleModuleColorOverLife" then
  21.          -- This module is usually used for trails and anything that changes color
  22.          -- Cast the ParticleModule to ParticleModuleColorOverLife
  23.          mod = cast.ParticleModuleColorOverLife(mod)
  24.          local tab = mod.ColorOverLife.LookupTable
  25.          print(string.format("      ColorOverLife module: %d entries", tab:size()))
  26.          -- Print the values
  27.          for c=2, tab:size() - 1 do
  28.             print("      " .. tostring(tab:get(c)))
  29.          end
  30.       end
  31.    end
  32. end
  33.  
  34. -- This function will print a lto of information about a projectile to the console
  35. -- It will also set the projectile color to bright white if the uncomment the 3 lines in printModuleArray
  36. function printParticleSystem(proj)
  37.    if not proj then
  38.       return
  39.    end
  40.    print(proj:getFullName())
  41.    print(proj.emitters:size() .. " emitters found")
  42.    for em=0, proj.emitters:size() - 1 do
  43.       local emitter = proj.emitters:get(em)
  44.       print(string.format("  Emitter %d", em))
  45.       print(string.format("  %d LODLevels found", emitter.LODLevels:size()))
  46.       for lodi=0, emitter.LODLevels:size() - 1 do
  47.          local lod = emitter.LODLevels:get(lodi)
  48.          print(string.format("    LODLevel %d", lodi))
  49.          -- Check modules used for creation and update
  50.          printModuleArray(lod.spawnModules, "SpawnModules")
  51.          printModuleArray(lod.updateModules, "UpdateModules")
  52.       end
  53.    end
  54. end
  55.  
  56. -- example use:
  57. -- printParticleSystem(getProjectile("SLD", "AR"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement