
| Kod: |
| SetCabLightIntensity (1) |
| Kod: |
| SetMeshLightIntensity ("noc_light", true, 1); |
| Kod: |
| } else if (control == noc_switch_1) {
if (value > 0.9 and !light) { light = true; SetMeshVisible("noc_light", true, 0.1f); SetMeshLightIntensity ("noc_light", true, 1); } else if (light) { light = false; SetMeshVisible("noc_light", false, 0.1f); } |
| Kod: |
| anzeigen {
mesh "Anzeigen.im" auto-create 1 att "a.anzeigen" } |
| Kod: |
| noc_light {
mesh "noc.im" auto-create 0 att "a.noc" } noc_light1 { mesh "noc1.im" auto-create 0 att "a.noc1" } |
| Kod: |
| include "defaultlocomotivecabin.gs"
class st43 isclass DefaultLocomotiveCabin { float gametime = 0; float normalizedgametime; float cablight = 1; CabinControl throttle_l; CabinControl throttle_r; CabinControl wiper_switch; CabinControl wiper_switch_1; CabinControl noc_switch_1; CabinControl noc_switch_2; public bool wiping = false; public bool light = false; public void Init(void) { inherited(); throttle_l = GetNamedControl("throttle_lever"); throttle_r = GetNamedControl("throttle_lever-r"); wiper_switch = GetNamedControl("wiper_switch"); wiper_switch_1 = GetNamedControl("wiper_switch_1"); noc_switch_1 = GetNamedControl("noc_switch_1"); noc_switch_2 = GetNamedControl("noc_switch_2"); AddHandler(me, "Cablight", null, "Cablight"); PostMessage(me, "Cablight", "", 0.1f); } public void Update(void) { inherited(); float value; // Wskazowka // value = loco.GetEngineSetting("throttle"); throttle_l.SetValue(value); throttle_r.SetValue(value); } void UserSetControl(CabinControl control, float value) { if (control == throttle_l or control == throttle_r) { loco.SetEngineSetting("throttle", value); } else if (control == wiper_switch) { if (value > 0.9 and !wiping) { wiping = true; StartMeshAnimationLoop("wipers"); SetMeshAnimationSpeed("wipers", 1.0); } else if (wiping) { wiping = false; StopMeshAnimation("wipers"); } } else if (control == wiper_switch_1) { if (value > 0.9 and !wiping) { wiping = true; StartMeshAnimationLoop("wipers_1"); SetMeshAnimationSpeed("wipers_1", 1.0); } else if (wiping) { wiping = false; StopMeshAnimation("wipers_1"); } } else if (control == noc_switch_1) { if (value > 0.9 and !light) { light = true; SetMeshVisible("noc_light", true, 0.1f); } else if (light) { light = false; SetMeshVisible("noc_light", false, 0.1f); } } else if (control == noc_switch_2) { if (value > 0.9 and !light) { light = true; SetMeshVisible("noc_light1", true, 0.1f); } else if (light) { light = false; SetMeshVisible("noc_light1", false, 0.1f); } } else { inherited(control, value); } } void Cablight(Message msg) { gametime = World.GetGameTime(); if (gametime < 0.5) { normalizedgametime = (1 - gametime - 0.5) * 2; } else { normalizedgametime = (gametime - 0.5) *2; } if (normalizedgametime < 0.4) SetCabLightIntensity (0.2); if (normalizedgametime > 0.55) SetCabLightIntensity (1); if (normalizedgametime > 0.4 and normalizedgametime < 0.55) SetCabLightIntensity (0.2 + ( normalizedgametime - 0.4 ) * ( normalizedgametime / 0.103125 ) ); PostMessage(me, "Cablight", "", 5.0f); } }; |
| Kod: |
| // reset the controls from saved values
DD40CabinData ddcd = cast<DD40CabinData>cd; float value = 0.0; |
| Kod: |
| } else if (control == noc_switch_1) {
if (value > 0.9 and !light) { light = true; SetMeshVisible("noc_light", true, 0.1f); } else if (light) { light = false; SetMeshVisible("noc_light", false, 0.1f); } |