CCG/Example: TrainCar (Coal Hopper)

From TrainzOnline
< CCG
Jump to: navigation, search

Contents

Traincar (Coal Hopper)

Directory Structure

A typical asset of this kind has the following File\Directory Structure:

CCG traincar hopper dir1.jpg


Required Files

config.txt - The config file for the asset.

thumb.jpg - The thumbnail image for this asset. A 240x180 jpeg.

coal_dump1.wav, coal_load1.wav, coupling_1.wav - Sound files referenced within the hopper.gs script file.

hopper.gs - Script file detailing some functionality of the traincar asset.

coal_hopper_art_512.texture.txt, coal_hopper_art_512.tga - These image files are used to show a 512x512 preview texture when the image is available on the download station. These file have been replaced with the 240x180 thumbnail image referenced in the thumbnails container.

coal_hopper_art_icon.texture.txt, coal_hopper_art_icon.tga - The icon texture files. 128x64 pixels in dimension.

coal_hopper_body.lm.txt - Level of Detail (or 'LOD') file. See the section on LOD meshes on Page 378 for more information.

erz3d.texture.txt, erz3d.tga, black.texture.txt, black. tga, load_map.texture.txt, load_map.tga - The texture files used by the indexed meshes. See the section on Texture.txt files on Page 96 for more information.

unload_left.kin, unload_right.kin, load.kin - The animation files used by th traincar asset for loading and unloading operations.

load.im, coal_hopper_shadow.im, unload_left.im, unload_right.im, coal_hopper_body.im, coal_hopper_body_low.im - The indexed mesh files used by the traincar asset.


Config.txt File Listing

kuid                     <kuid:56113:1001>
trainz-build             2.9
category-class           "XG"
username                 "testTraincar (Hopper)"
kind                     "traincar"
engine                   0
mass                     15000
category-region          "00"
category-era             "1990s;2000s;2010s"
enginespec               <kuid:-1:42004201>
script                   "hopper.gs"
class                    "Hopper"
icon0                    <kuid:-3:10164>
description              "Test Coal Hopper Asset."
soundscript
{
  door_close
    {
      trigger            "door_close"
      nostartdelay       1
      repeat-delay       1,0
      distance           5,170
      sound
      {
        0                "coupling_1.wav"
      }
}
   
mesh-table
{
  default
    {
      mesh               "coal_hopper_body/coal_hopper_body.lm"
      auto-create        1
    }
  shadow
    {
      mesh               "coal_hopper_shadow/coal_hopper_shadow.im"
    }
  load
    {
      mesh               "coal_hopper_body/load/load.im"
      anim               "coal_hopper_body/load/load.kin"
      auto-create        1
      use-parent-bounds  1
      effects
       {
        product-texture
         {
          kind           "texture-replacement"
          texture        "load_map.texture"
         }
       }
    }
  left-door
    {
      mesh               "coal_hopper_body/unload_left/unload_left.im"
      anim               "coal_hopper_body/unload_left/unload_left.kin"
      auto-create        1
    }
  right-door
    {
      mesh               "coal_hopper_body/unload_right/unload_right.im"
      anim               "coal_hopper_body/unload_right/unload_right.kin"
      auto-create        1
    }
}
  
queues
{
  load0
    {
      size               54300
      initial-count      0
      animated-mesh      "load"
      product-kuid       <kuid:44179:60013>
      allowed-categories
        {
          0              <kuid:-3:10040>
        }
    }
}
  
smoke0
{
  attachment             "a.unload_left_pfx0"
  mode                   "time"
  color                  0,0,0,250
  rate                   8
  velocity               2
  lifetime               2
  minsize                1
  maxsize                4
  enabled                0
}
smoke1
{
  attachment             "a.unload_left_pfx1"
  mode                   "time"
  color                  0,0,0,250
  rate                   8
  velocity               2
  lifetime               2
  minsize                1
  maxsize                4
  enabled                0
}
smoke2
{
  attachment             "a.unload_right_pfx0"
  mode                   "time"
  color                  0,0,0,250
  rate                   8
  velocity               2
  lifetime               2
  minsize                1
  maxsize                4
  enabled                0
}
smoke3
{
  attachment             "a.unload_right_pfx1"
  mode                   "time"
  color                  0,0,0,250
  rate                   8
  velocity               2
  lifetime               2
  minsize                1
  maxsize                4
  enabled                0
}
  
bogeys
{
  0
    {
      bogey              <kuid:-1:100063>
      reversed           0
    }
}
  
thumbnails
{
  0
    {
      image              "thumb.jpg"
      width              240
      height             180
    }
  1
    {
      image              "coal_hopper_art/coal_hopper_art_icon.texture"
      width              128
      height             64
    }
}


Script File Listing

hopper.gs

//
// Hopper.gs
//
// Copyright (C) 2003 Auran Developments Pty Ltd
// All Rights Reserved.
//
//
include "vehicle.gs"
//
// Hopper scriplet class. No threads - 
// only call overridden callbacks from Vehicle that are called by an Industry.
//
class Hopper isclass Vehicle
{
    // Play sound hopper is starting to be loaded.
    float BeginLoad(LoadingReport report)
    {
     Asset meAsset = GetAsset();
  World.PlaySound(meAsset, "coal_load.wav", 000.0f, 20.0f, 000.0f, me, "");
        return 0.0;
    }
 // Activate particles and play a sound as the hopper is beginning to unload.
    float BeginUnload(LoadingReport report)
    {
        SetMeshAnimationState("left-door", true);
        SendMessage(me, "pfx", "+0+");
        SetMeshAnimationState("right-door", true);
        SendMessage(me, "pfx", "+2+3");
     Asset meAsset = GetAsset();
     World.PlaySound(meAsset, "coal_dump.wav", 000.0f, 20.0f, 000.0f, me, "");
        return .0;
   }
// Deactivate particles and play a sound as the hopper is ending the unload operation.
float EndUnload(LoadingReport report)
   {
    Sleep(.0);
    SetMeshAnimationState("left-door", false);
    SendMessage(me, "pfx", "-0-");
    SetMeshAnimationState("right-door", false);
    SendMessage(me, "pfx", "-2-3");
    return .0;
   }
};


LOD File Listing

coal_hopper_body.lm.txt

 version .0
 offset = 0.0;
 calcPoint = center;
 multiplier = .0;
 animationCutOff = 0.00;
 mesh("0.2")
 {
    name="coal_hopper_body_low.im";
 }
 mesh(".0")
 {
    name="coal_hopper_body.im";
 }


Return to CCG Index

Content Creator's Guide

Kind Examples

Personal tools