FORUM PTT -

POMOC inne - Kierunkowskazy?

Thalys - 14-11-2010, 21:21
: Temat postu: Kierunkowskazy?
Witajcie.
Do Trainza istnieje sobie skrypt o nazwie "tramkier". W skrypcie tym jest taki oto wpis umożliwiający używanie kierunkowskazów:
Kod:
 public void Init (void) {
    inherited();

    //Für funktionierene Blinker
    AddHandler(me, "Blinker", "", "Blinker");
    //Für funktionierende Lichter
    AddHandler(me, "Licht", "", "Licht");

    //Für Richtungswechsel
    AddHandler(me, "Richtungswechsel", "", "Richtungswechsel");
 train = GetMyTrain();

    SetFXCoronaTexture("blinker_vl",null);
    SetFXCoronaTexture("blinker_hl",null);
    SetFXCoronaTexture("blinker_vr",null);
    SetFXCoronaTexture("blinker_hr",null);

    SetFXCoronaTexture("licht_hr",null);
    SetFXCoronaTexture("licht_hl",null);

    SetFXCoronaTexture("brems_hr",null);
    SetFXCoronaTexture("brems_hl",null);
 }

 void Richtungswechsel(Message msg) {

   int value = Str.ToInt(msg.minor);
   SetEngineSetting("reverser",value);
 }
 void Licht(Message msg) {

   if(msg.minor == "Brems-An") {
     SetFXCoronaTexture("brems_hr",coronaRot);
     SetFXCoronaTexture("brems_hl",coronaRot);
   }

   if(msg.minor == "Brems-Aus") {
     SetFXCoronaTexture("brems_hr",null);
     SetFXCoronaTexture("brems_hl",null);
   }

   if(msg.minor == "Blinker-Links-An") {
     SetFXCoronaTexture("blinker_vl",coronaOrange);
     SetFXCoronaTexture("blinker_hl",coronaOrange);
   }

   if(msg.minor == "Blinker-Rechts-An") {
     SetFXCoronaTexture("blinker_vr",coronaOrange);
     SetFXCoronaTexture("blinker_hr",coronaOrange);
   }

   if(msg.minor == "Blinker-Aus") {
     SetFXCoronaTexture("blinker_vl",null);
     SetFXCoronaTexture("blinker_hl",null);
     SetFXCoronaTexture("blinker_vr",null);
     SetFXCoronaTexture("blinker_hr",null);
   }
 }
 void Ruecklicht(Message msg) {

              if(focus==true) {
                if(train.GetHeadlightState()== false) {
                  SetFXCoronaTexture("licht_hr",coronaRot);
                  SetFXCoronaTexture("licht_hl",coronaRot);
                  Interface.Log("Ruecklicht an");
                }
                else {
                  SetFXCoronaTexture("licht_hr",null);
                  SetFXCoronaTexture("licht_hl",null);
                  Interface.Log("Ruecklicht aus");

               }
            }
        }
};


Teraz pytanie. Co i jak wpisać w mesh i config.txt, żeby ten kierunkowskaz (blinker) zadziałał zgodnie ze skryptem?
zgred - 17-11-2010, 18:03
:
Cytat:
string-table
{
Brems-An "Hamulce wł: "
Brems-Aus "Hamulce wył: "
Blinker-Links-An "kierunek lewy wł: "
Blinker-Links-Aus "kierunek lewy wył: "
Blinker-Rechts-An "kierunek prawy wł: "
Blinker-Rechts-Aus "kierunek prawy wył: "
}

-----------------------------------------

mesh-table
{
default
{
mesh "xxx"
auto-create 1

effects
{

blinker_vl
{
kind "corona"
att "a.blinker_vl"
directional 1
object-size 0.1
}

blinker_hl
{
kind "corona"
att "a.blinker_hl"
directional 1
object-size 0.1
}

blinker_vr
{
kind "corona"
att "a.blinker_vr"
directional 1
object-size 0.1
}

blinker_hr
{
kind "corona"
att "a.blinker_hr"
directional 1
object-size 0.1
}

licht_hr
{
kind "corona"
att "a.licht_hr"
directional 1
object-size 0.1
}

licht_hl
{
kind "corona"
att "a.licht_hl"
directional 1
object-size 0.1
}

brems_hr
{
kind "corona"
att "a.brems_hr"
directional 1
object-size 0.1
}

brems_hl
{
kind "corona"
att "a.brems_hl"
directional 1
object-size 0.1
}

}
}

--------------------

kuid-table
{
coronaOrange <kuid:xxx>
coronaRot <kuid:xxx>
...
}

----------------
Jakoś w ten deseń bym próbował to zrobić.