Что-то я ничего не понял((
Вроде понятно, в CabinData сохраняются параметры при пересаживании в другую кабину...
А вот как из этого собрать сабж - не пойму..
ехать будет Просто ты не сможешь рычажки двигать, так что вызвать обработку контроллёра ты не сможешь, пока бот не остановитсяЧто будет с таким контроллером, если вагоном управляет бот?
include "defaultlocomotivecabin.gs"
include "locomotive.gs"
include "trainz.gs"
include "gs.gs"
include "common.gs"
include "world.gs"
include "vehicle.gs"
include "train.gs"
class ALS_Cab isclass DefaultLocomotiveCabin
{
public void Attach(GameObject obj);
thread void ALSG(void);
void ARS (int ALSCode);
public void Init(void);
int ARSState = 0;
Asset myasset;
thread void KB(void)
{
int cpos = 0;
int cposc = 0;
float a = 0.0;
bool vz1_locked = false;
bool add = false;
float tadd = 0.0;
while(true)
{
Sleep(0.12);
tadd = 0.0;
float vel = loco.GetVelocity() * 3.6;
int kv_pos = GetNamedControl("throttle_lever2").GetValue();
if (GetNamedControl("throttle_lever2").GetValue() > 0)
kv_pos = GetNamedControl("throttle_lever2").GetValue() + 0.3;
if (GetNamedControl("throttle_lever2").GetValue() < 0)
kv_pos = GetNamedControl("throttle_lever2").GetValue() - 0.3;
if (kv_pos > 3)
kv_pos = 3;
if (kv_pos < -3)
kv_pos = -3;
if ((ARSState == 1) or (ARSState == 2))
kv_pos = -3;
if (vel > 0.1)
{
if (vz1_locked)
loco.SetEngineSetting("loco-auto-brake",100);
if ((kv_pos < -1) and (cposc > 16) and (a > -0.4))
loco.SetEngineSetting("loco-auto-brake",100);
}
if (kv_pos == 0)
{
if (loco.GetEngineSetting("reverser") != 1)
World.PlaySound(myasset,"sound/razbor.wav",1.0f,2,10,loco,"a.cabfront");
cpos = 0;
cposc = 0;
loco.SetEngineSetting("throttle",0);
loco.SetEngineSetting("dynamic-brake",0);
loco.SetEngineSetting("reverser",1);
}
if (kv_pos == 1)
{
loco.SetEngineSetting("loco-auto-brake",0);
loco.SetEngineSetting("dynamic-brake",0);
loco.SetEngineSetting("reverser",2);
if (cpos == 0)
cposc = 1;
if (cposc > 0)
cpos = cposc;
}
if (kv_pos == 2)
{
cpos = (vel / 25.0) *24 + 8;
if (cposc < 8)
cposc = 8;
if (cpos > 32)
cpos = 32;
if (cposc < cpos)
++cposc;
if ((cposc < 32) and (loco.GetEngineParam("applied-force") < 33000) and (vel < 25))
tadd = 8.0;
}
if (kv_pos == 3)
{
if (cpos < 32)
cpos = (vel / 25.0) *24 + 8;
if (cpos >= 32)
cpos = 32 + (vel - 25)*4 / 5.0;
if (cpos > 36)
cpos = 36;
if (cposc < cpos)
++cposc;
if ((cposc < 32) and (loco.GetEngineParam("applied-force") < 33000) and (vel < 30))
tadd = 8.0;
}
if (kv_pos > 0)
{
float ttl = 0;
if (vel > 5.5)
vz1_locked = false;
loco.SetEngineSetting("loco-auto-brake",0);
if (cposc == 1)
ttl = 1;
if (cposc <= 32)
ttl = 1 + (cposc / 32.0)*3.0;
if (cposc > 32)
ttl = 4 + ((cposc - 32) / 4.0);
if ((cpos - cposc > 0) and (cpos - cposc < 7) )
ttl = 8;
loco.SetEngineSetting("reverser",2);
loco.SetEngineSetting("throttle",ttl + tadd);
if (loco.GetEngineSetting("reverser") != 2)
{
loco.SetEngineSetting("throttle",0);
loco.SetEngineSetting("reverser",2);
}
}
a = (-0.06 - cposc*0.17/18.0) * (vel - (35 - cposc*32/18.0));
if (kv_pos == -1)
{
loco.SetEngineSetting("reverser",2);
loco.SetEngineSetting("dynamic-brake",2);
loco.SetEngineSetting("throttle",0.01);
if (!vz1_locked)
loco.SetEngineSetting("loco-auto-brake",0);
if (cposc == 0)
{
//a = -0.03 * (vel - 30);
if (a < -0.4)
a = -0.4;
}
add = false;
}
if (kv_pos == -2)
{
if (cposc == 0)
{
//a = -0.03 * (vel - 30);
if (a < -1.2)
a = -1.2;
}
if ((cposc >16) and (a > -0.6))
loco.SetEngineSetting("loco-auto-brake",100);
if ((a > -1.2) and (!add))
{
add = true;
cposc++;
}
add = true;
}
if (kv_pos == -3)
{
cpos =18;// 18 - (vel - 10)*18 / 55;
if (cpos > 18)
cpos = 18;
if (cpos < 0)
cpos = 0;
if ( (a > -1.2) and (cposc < 18) )
{
++cposc;
}
if ((cposc >16) and (a > -0.6))
loco.SetEngineSetting("loco-auto-brake",100);
}
if (kv_pos < 0)
{
//float ttl = 0;
//loco.SetEngineSetting("throttle",1);
if ((vel < 1) and (kv_pos < -1) and (cposc > 16))
vz1_locked = true;
//if (cposc != 0)
// a = (-0.03 - cposc*0.18/18.0) * (vel - (30 - cposc*25/18.0));
if (a < -1.5)
a = -1.5;
if (a > 0)
a = 0;
loco.GetMyTrain().AddVelocity(a*0.12);
//Interface.Print("KB=" + kv_pos + " pos=" + cposc + " ttl=" + loco.GetEngineSetting("throttle") + " f=" + loco.GetEngineParam("applied-force") + " a=" + a);
}
}
}
float vz1st = 0.0;
public void Update()
{
inherited();
if (loco.GetEngineSetting("loco-auto-brake") < vz1st)
World.PlaySound(myasset,"sound/vz1_o.wav",1.0f,2,10,loco,"a.cabfront");
if (loco.GetEngineSetting("loco-auto-brake") > vz1st)
World.PlaySound(myasset,"sound/vz1_t.wav",1.0f,2,10,loco,"a.cabfront");
vz1st = loco.GetEngineSetting("loco-auto-brake");
}
public void Attach(GameObject obj)
{
inherited(obj);
SetFXNameText("als_lcd","99");
ALSG();
KB();
int i = 0;
for (i=0;i < loco.GetMyTrain().GetVehicles().size(); ++i)
{loco.GetMyTrain().GetVehicles()[i].SetProductDisabled();}
}
Browser vdb;
public void Init(void)
{
inherited();
myasset = GetAsset();
SetFXNameText("als_lcd","00");
vdb = Constructors.NewBrowser();
vdb.SetWindowStyle(2);
vdb.SetWindowWidth(400);
vdb.SetWindowHeight(70);
vdb.SetWindowPosition(Interface.GetDisplayWidth()/2.0 - 200,50);
vdb.SetCloseEnabled(false);
}
thread void ALSG(void)
{
StringTable ST = GetAsset().GetStringTable();
while(true)
{
Sleep(0.5);
GSTrackSearch GSTS=loco.BeginTrackSearch(true);
MapObject mo=GSTS.SearchNext();
int ALSCode = 1;
while(mo){
if(mo.isclass(Signal) and GSTS.GetFacingRelativeToSearchDirection())
{
Soup props=mo.GetProperties();
if (props.GetNamedTag("MSig-type") != "")
{
ALSCode = props.GetNamedTagAsInt("MSig-als-fq");
break;
}
}
mo=GSTS.SearchNext();
if (GSTS.GetDistance() > 1000)
break;
}
string sALS = "";
if ((ALSCode == 1) or (ALSCode == 2) or (ALSCode == -1))
sALS = ST.GetString("als-och");
if (ALSCode == 0)
sALS = "0";
if (ALSCode > 3)
sALS = ALSCode * 10;
int vel = loco.GetVelocity() * 3.6;
SetFXNameText("als_lcd",sALS + " " + vel);
ARS(ALSCode);
}
}
void ARS (int ALSCode)
{
int MaxSpeed = ALSCode*10;
if ((ALSCode == 1) or (ALSCode == 2) or (ALSCode == -1))
MaxSpeed = 999;
if (ALSCode == 0)
MaxSpeed = 20;
int Speed = Math.Abs(loco.GetVelocity()*3.6);
if ((Speed == MaxSpeed) and (ARSState == 0) and (Speed != 0))
{
ARSState = 3;
loco.SetEngineSetting("throttle",0);
}
if (Speed > MaxSpeed)
{
if (loco.GetEngineSetting("dynamic-brake") != 2)
{
loco.SetEngineSetting("throttle",0);
loco.SetEngineSetting("dynamic-brake",2);
}
Sleep(0.5);
loco.SetEngineSetting("dynamic-brake",2);
loco.SetEngineSetting("throttle",2);
ARSState = 2;
}
if ((Speed < MaxSpeed) and (ARSState == 2))
{
ARSState = 1;
}
if ((Speed < MaxSpeed) and (ARSState == 3) and (Speed != 0))
{
ARSState = 0;
World.PlaySound(myasset,"sound/ARSend.wav",1.0f,2,10,loco,"a.cabfront");
}
if (ARSState != 0)
World.PlaySound(myasset,"sound/ARSsig.wav",1.0f,2,10,loco,"a.cabfront");
string s="<html><body bgcolor='#010101' leftmargin=50 rightmargin=50>";
if (Speed < 10)
s=s+"<b><font color='#00FF00' size=16 face='arial'>0" + Speed + " </font>";
else
s=s+"<b><font color='#00FF00' size=16 face='arial'>" + Speed + " </font>";
if (MaxSpeed == 999)
s=s+"<b><font color='#FF0000' size=16 face='arial'>"+ GetAsset().GetStringTable().GetString("als-och") + " </font>";
else
s=s+"<b><font color='#300000' size=16 face='arial'>"+ GetAsset().GetStringTable().GetString("als-och") + " </font>";
if (ALSCode == 0)
s=s+"<b><font color='#FF0000' size=16 face='arial'>0 </font>";
else
s=s+"<b><font color='#300000' size=16 face='arial'>0 </font>";
if (ALSCode == 4)
s=s+"<b><font color='#FFFF00' size=16 face='arial'>40 </font>";
else
s=s+"<b><font color='#303000' size=16 face='arial'>40 </font>";
if (ALSCode == 6)
s=s+"<b><font color='#00FF00' size=16 face='arial'>60 </font>";
else
s=s+"<b><font color='#003000' size=16 face='arial'>60 </font>";
if (ALSCode == 7)
s=s+"<b><font color='#00FF00' size=16 face='arial'>70 </font>";
else
s=s+"<b><font color='#003000' size=16 face='arial'>70 </font>";
if (ALSCode == 8)
s=s+"<b><font color='#00FF00' size=16 face='arial'>80 </font>";
else
s=s+"<b><font color='#003000' size=16 face='arial'>80 </font>";
s=s+"</body></html>";
vdb.LoadHTMLString(GetAsset(),s);
}
public void UserPressKey(string s)
{
if ((s == "shovel-coal") and (ARSState == 1))
{
loco.SetEngineSetting("throttle",0);
loco.SetEngineSetting("dynamic-brake",0);
ARSState = 0;
World.PlaySound(myasset,"sound/ARSend.wav",1.0f,2,10,loco,"a.cabfront");
}
if (s == "steam-regulator-up")
{
GetNamedControl("throttle_lever2").SetValue(GetNamedControl("throttle_lever2").GetValue() + 1.2);
}
if (s == "steam-regulator-down")
{
GetNamedControl("throttle_lever2").SetValue(GetNamedControl("throttle_lever2").GetValue() - 1.2);
}
inherited(s);
}
thread void LockKB(void)
{
GetNamedControl("throttle_lever2").SetLocked(true);
Sleep(0.2);
GetNamedControl("throttle_lever2").SetLocked(false);
}
public void UserSetControl(CabinControl control, float value)
{
if ((control.GetName() == "throttle_lever2") and (value == 0))
LockKB();
inherited(control, value);
}
};
kuid <kuid:160177:52200>
kind "engine"
rem "81-717"
epbrakes 1
flowsize
{
trainbrakepipe 170000
epreservoirpipe 0.1
no3pipe 0.1
no4pipe 0.1
auxreservoirvent 0.1
auxreservoir_no3 0.1
auxreservoir_trainbrakepipe 0.1
autobrakecylindervent 1
auxreservoir_autobrakecylinder 1
equaliser_mainreservoir 0.06
equaliservent 0.06
equaliserventhandleoff 0
equaliserventemergency 0.1
no3pipevent 1.5
no3pipe_mainreservoir 0.1
compressor 2
trainbrakepipe_reservoir 1
trainbrakepipevent 0.06
no3pipe_autobrakecylinder 2
epreservoirpipe_autobrakecylinder 0.1
mainreservoir_ep 0.1
vacuumbrakepipe 0.1
vacuumbrakepipereleasevent 0.1
vacuumbrakepipevent 0.1
vacuumbrakereservoir_vacuumbrakepipe 0.1
vacuumbrakecylinder_vacuumbrakepipe 0.1
highspeedexhauster_vacuumbrakepipe 0.1
}
volume
{
scale 1
trainbrakepipe 0.029
epreservoirpipe 0.029
no3pipe 0.029
no4pipe 0.029
auxreservoir 0.1
autobrakecylinder 0.042
vacuumbrakepipe 0
vacuumbrakereservoir 0
vacuumbrakecylinder 0
mainreservoir 0.425
equaliser 0.0095
independantbrakecylinder 0.014
}
pressure
{
scale 1
compressor 0.00852036
mainreservoir 0.00852036
highspeedexhauster 0
brakepipe 0.00602471
brakeinitial 0.00532593
brakefull 0.00402819
indbrakefull 0.00203167
trainbrakepipe_start 0.00472697
epreservoirpipe_start 0
no3pipe_start 0
no4pipe_start 0
auxreservoir_start 0.00472697
autobrakecylinder_start 0.00362889
vacuumbrakepipe_start 0
vacuumbrakereservoir_start 0
vacuumbrakecylinder_start 0
mainreservoir_start 0.00852036
equaliser_start 0.00472697
independantbrakecylinder_start 0
}
mass
{
scale 1
fuel "6.2156e+006"
}
motor
{
resistance 0.1
adhesion 0.1
maxvoltage 600
maxspeed 25
brakeratio 35000
max-accel 10000
max-decel 40000
throttle-notches 8
axle-count 4
surface-area 80
moving-friction-coefficient 0.02
air-drag-coefficient 0.0002
}
throttle-power
{
0
{
0 0
}
1
{
0 40
0.05 8
0.2 7
2.77 3
5.5 1
}
2
{
0 100
0.3 42
1.1 42
1.4 33
2.8 13
6 8
}
3
{
0 100
0.3 42
4.17 42
5 18
6 13
10 6
25 2
}
4
{
0 100
2.0 36
4.3 36
4.4 36
7.8 34
8.3 32
10 20
12 16
14 10
16.7 8
22.2 5
25 3
}
5
{
0 100
2.3 38
4.4 39
2.0 37
7.8 35
8.3 32
13.8 30
16.7 25
19.5 17
22.2 12
25 7
}
6
{
0 40
25 40
}
}
description "81-717_engine_config"
trainz-build 2.2
category-class "RC"
category-region-0 "RU"
category-era-1 "1990s"
category-era-0 "1980s"
asset-filename "81-717_engine"
thumbnail
username "81-717_engine"
author "Jam"
organisation "Trainz.ru"
contact-email "jamd@mail.ru"
contact-website "www.metro.trainz.ru"
license "View License.txt"
kuid-table
{
}
во-первых, тебе надо написать "ручку" этого контроллера. Для этого в конфиге кабины обзываешь её мешь каким-нибудь своим именем, например "kontroller" .
public void UserPressKey(string s)
{
if ((s == "shovel-coal") and (ARSState == 1))
{
loco.SetEngineSetting("throttle",0);
loco.SetEngineSetting("dynamic-brake",0);
ARSState = 0;
World.PlaySound(myasset,"sound/ARSend.wav",1.0f,2,10,loco,"a.cabfront");
правда она заточена под M-Signals, поэтому у вас будет ОЧ
Отпуск ВЗ№1 и щелчки ЛК при разборе схемы. Я взял из MSTS. Также нужны звуки ARSend.wav — отключение АРС и ARSsig.wav — предупреждение АРС.Жалуется на отсутствие звуков (vz1.wav, razbor.wav), ну это не проблема.
M-Signals это моя собственная попытка создания метрошной сигнализации. Вот кино с ней.Что за M-Signals? Может zm-signals?
Если склероз не врет, то value <число> в контейнере КВ.И еще: после того как мы сели в кабину, мы видим, что рукоятка КВ стоит в положении Т2 (notches 0). А как сделать чтобы она стояла в положении 0 (notches 0,5)?
В должна называться throttle_lever2 и иметь семь положений, от -3 до 3
Если склероз не врет, то value <число> в контейнере КВ.
Вот я не помню, в вэлью надо писать нотч, или же реальное значение...
throttle_lever2 {
kind "lever"
auto-create 1
mesh "kocherga.pm"
att "a.kocherga"
limits -3,3
angles 0.6,-0.5
notches 0,0.16667,0.3333,0.5,0.6667,0.8333,1
notchheight 1,2,2,1,2,2,1
radius 0.3
att-parent "default"
mousespeed 0.3
}
простите, что врываюсь , а можно ли написать скрипт ПАМа или ПКСД вообщем бортового компа в номере? он будет реагировать на мареры станции и на компе будет изобпажаться на какой станции поезд и какой участок он проехал. для каждой карты будет изготавливаться схемя в компьютер по заказу и выходить обновление ежемесечное типо trainnavdata ? как вам идея?
Вернуться в [TZ] Подвижной состав
Сейчас этот форум просматривают: Claude [Bot] и гости: 0