Prototyping.tscript 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. function Prototyping::onCreate(%this)
  2. {
  3. }
  4. function Prototyping::onDestroy(%this)
  5. {
  6. }
  7. //This is called when the server is initially set up by the game application
  8. function Prototyping::initServer(%this)
  9. {
  10. }
  11. //This is called when the server is created for an actual game/map to be played
  12. function Prototyping::onCreateGameServer(%this)
  13. {
  14. //These are common managed data files. For any datablock-based stuff that gets generated by the editors
  15. //(that doesn't have a specific associated file, like data for a player class) will go into these.
  16. //So we'll register them now if they exist.
  17. if(isFile("./scripts/managedData/managedDatablocks." @ $TorqueScriptFileExtension))
  18. %this.registerDatablock("./scripts/managedData/managedDatablocks");
  19. if(isFile("./scripts/managedData/managedForestItemData." @ $TorqueScriptFileExtension))
  20. %this.registerDatablock("./scripts/managedData/managedForestItemData");
  21. if(isFile("./scripts/managedData/managedForestBrushData." @ $TorqueScriptFileExtension))
  22. %this.registerDatablock("./scripts/managedData/managedForestBrushData");
  23. if(isFile("./scripts/managedData/managedParticleEmitterData." @ $TorqueScriptFileExtension))
  24. %this.registerDatablock("./scripts/managedData/managedParticleEmitterData");
  25. if(isFile("./scripts/managedData/managedParticleData." @ $TorqueScriptFileExtension))
  26. %this.registerDatablock("./scripts/managedData/managedParticleData");
  27. }
  28. //This is called when the server is shut down due to the game/map being exited
  29. function Prototyping::onDestroyGameServer(%this)
  30. {
  31. }
  32. //This is called when the client is initially set up by the game application
  33. function Prototyping::initClient(%this)
  34. {
  35. }
  36. //This is called when a client connects to a server
  37. function Prototyping::onCreateClientConnection(%this)
  38. {
  39. if (!isObject(screen_Canvas))
  40. {
  41. new GuiOffscreenCanvas(screen_Canvas) {
  42. targetName = "screen_Canvas";
  43. targetSize = "1280 720";
  44. dynamicTarget = false;
  45. canInteract = true;
  46. maxInteractDistance = "3";
  47. };
  48. }
  49. if(isObject(OptionsMenu))
  50. {
  51. screen_Canvas.setContent(OptionsMenu);
  52. }
  53. }
  54. //This is called when a client disconnects from a server
  55. function Prototyping::onDestroyClientConnection(%this)
  56. {
  57. }