working on better auto mode options
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>de.srsoftware</groupId>
|
<groupId>de.srsoftware</groupId>
|
||||||
<artifactId>web4rail</artifactId>
|
<artifactId>web4rail</artifactId>
|
||||||
<version>1.5.26</version>
|
<version>1.5.27</version>
|
||||||
<name>Web4Rail</name>
|
<name>Web4Rail</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description>Java Model Railway Control</description>
|
<description>Java Model Railway Control</description>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
abort : abbrechen
|
abort : abbrechen
|
||||||
|
AbortActions : Aktions-Ausführung abbrechen
|
||||||
Aborting route allocation... : Routen-Reservierung wird abgebrochen...
|
Aborting route allocation... : Routen-Reservierung wird abgebrochen...
|
||||||
Accessory : Zubehör
|
Accessory : Zubehör
|
||||||
Action : Aktion
|
Action : Aktion
|
||||||
@@ -376,12 +377,13 @@ SetRelayOrSwitch : Relais oder Schalter schalten
|
|||||||
SetSignal : Signal stellen
|
SetSignal : Signal stellen
|
||||||
SetSignalsToStop : Signale auf Halt stellen
|
SetSignalsToStop : Signale auf Halt stellen
|
||||||
SetSpeed : Geschwindigkeit ändern
|
SetSpeed : Geschwindigkeit ändern
|
||||||
Set {} to {} {} : {} auf {} {} gesetzt
|
|
||||||
Set speed to {} {} : Geschwindigkeit auf {} {} setzen
|
Set speed to {} {} : Geschwindigkeit auf {} {} setzen
|
||||||
|
Set {} to {} {} : {} auf {} {} gesetzt
|
||||||
Set {} to {} : {} auf {} setzen
|
Set {} to {} : {} auf {} setzen
|
||||||
Set "{}" to "{}" : „{}“ auf „{}“ setzen
|
Set "{}" to "{}" : „{}“ auf „{}“ setzen
|
||||||
Set "{}" to value from {} : Setze „{}“ auf Wert von {}
|
Set "{}" to value from {} : Setze „{}“ auf Wert von {}
|
||||||
setting : Einstellung
|
setting : Einstellung
|
||||||
|
Set train of {} as context : Setze Zug von {} als Kontext
|
||||||
SetPower : Strom schalten
|
SetPower : Strom schalten
|
||||||
Set speed to : Geschwindigkeit setzen
|
Set speed to : Geschwindigkeit setzen
|
||||||
SetTurnout : Weiche stellen
|
SetTurnout : Weiche stellen
|
||||||
@@ -410,6 +412,7 @@ Stop settings : Halte-Einstellungen
|
|||||||
Store : Speicher
|
Store : Speicher
|
||||||
Store "{}" does not have value "{}" : Wert des Speichers „{}“ ist nicht „{}”
|
Store "{}" does not have value "{}" : Wert des Speichers „{}“ ist nicht „{}”
|
||||||
Store "{}" has value "{}" : Wert des Speichers „{}“ ist gleich „{}“
|
Store "{}" has value "{}" : Wert des Speichers „{}“ ist gleich „{}“
|
||||||
|
StoreHasValue : Wert eines Speichers prüfen
|
||||||
Start autopilot : Autopilot starten
|
Start autopilot : Autopilot starten
|
||||||
Start delay : Start-Verzögerung
|
Start delay : Start-Verzögerung
|
||||||
Started {} : {} gestartet
|
Started {} : {} gestartet
|
||||||
@@ -476,6 +479,8 @@ Trigger {} : {} betätigen
|
|||||||
Trigger a feedback sensor to assign it with this contact! : Rückmeldekontakt auslösen, um ihn diesem Kontakt zuzuweisen!
|
Trigger a feedback sensor to assign it with this contact! : Rückmeldekontakt auslösen, um ihn diesem Kontakt zuzuweisen!
|
||||||
TriggerContact : Kontakt oder Schalter auslösen
|
TriggerContact : Kontakt oder Schalter auslösen
|
||||||
Trigger contact to learn new contact : Kontakt auslösen, um neuen Kontakt zu lernen
|
Trigger contact to learn new contact : Kontakt auslösen, um neuen Kontakt zu lernen
|
||||||
|
Trigger Contact/Switch at destination : Kontakt/Schalter am Ziel auslösen
|
||||||
|
Triggers {} when reaching destination : Löst bei Erreichen des Ziels {} aus
|
||||||
Turn : Richtung wechseln
|
Turn : Richtung wechseln
|
||||||
turn train : Richtung des Zuges Wechseln
|
turn train : Richtung des Zuges Wechseln
|
||||||
Turn allowed : Wenden erlaubt
|
Turn allowed : Wenden erlaubt
|
||||||
@@ -497,6 +502,7 @@ Turns the train, as if it went through a loop. : Dreht den Zug, als wenn er eine
|
|||||||
Type : Typ
|
Type : Typ
|
||||||
Unknown action\: {} : Unbekannte Aktion: {}
|
Unknown action\: {} : Unbekannte Aktion: {}
|
||||||
Unknown decoder type : Unbekannter Decoder-Typ
|
Unknown decoder type : Unbekannter Decoder-Typ
|
||||||
|
Updating {}\: {} → {} : Aktualisiere {}: {} → {}
|
||||||
Use negative number to count from end. : Nutze negative Nummern, um von Ende zu zählen.
|
Use negative number to count from end. : Nutze negative Nummern, um von Ende zu zählen.
|
||||||
unset : ungesetzt
|
unset : ungesetzt
|
||||||
update : aktualisieren
|
update : aktualisieren
|
||||||
|
|||||||
@@ -74,10 +74,10 @@ public class Store {
|
|||||||
intValue = null;
|
intValue = null;
|
||||||
for (char c : value.toCharArray()) {
|
for (char c : value.toCharArray()) {
|
||||||
if (!Character.isDigit(c)) {
|
if (!Character.isDigit(c)) {
|
||||||
if (isSet(intValue)) break;
|
if (BaseClass.isSet(intValue)) break;
|
||||||
} else {
|
} else {
|
||||||
int add = ((byte)c-48);
|
int add = ((byte)c-48);
|
||||||
intValue = isNull(intValue) ? add : 10*intValue + add;
|
intValue = BaseClass.isNull(intValue) ? add : 10*intValue + add;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listeners.forEach(listener -> listener.storeUpdated(this));
|
listeners.forEach(listener -> listener.storeUpdated(this));
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package de.srsoftware.web4rail.actions;
|
||||||
|
|
||||||
|
import de.srsoftware.web4rail.BaseClass;
|
||||||
|
|
||||||
|
public class AbortActions extends Action{
|
||||||
|
|
||||||
|
public AbortActions(BaseClass parent) {
|
||||||
|
super(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean fire(Context context) {
|
||||||
|
context.invalidate();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,6 +41,7 @@ public abstract class Action extends BaseClass {
|
|||||||
|
|
||||||
public static List<Class<? extends Action>> classes() {
|
public static List<Class<? extends Action>> classes() {
|
||||||
return List.of(
|
return List.of(
|
||||||
|
AbortActions.class,
|
||||||
AddRemoveDestination.class,
|
AddRemoveDestination.class,
|
||||||
AddRemoveTag.class,
|
AddRemoveTag.class,
|
||||||
AlterDirection.class,
|
AlterDirection.class,
|
||||||
|
|||||||
@@ -15,15 +15,19 @@ import de.srsoftware.web4rail.tags.Checkbox;
|
|||||||
import de.srsoftware.web4rail.tags.Fieldset;
|
import de.srsoftware.web4rail.tags.Fieldset;
|
||||||
import de.srsoftware.web4rail.tags.Window;
|
import de.srsoftware.web4rail.tags.Window;
|
||||||
import de.srsoftware.web4rail.tiles.Block;
|
import de.srsoftware.web4rail.tiles.Block;
|
||||||
|
import de.srsoftware.web4rail.tiles.Contact;
|
||||||
|
import de.srsoftware.web4rail.tiles.Switch;
|
||||||
import de.srsoftware.web4rail.tiles.Tile;
|
import de.srsoftware.web4rail.tiles.Tile;
|
||||||
|
|
||||||
public class AddRemoveDestination extends Action {
|
public class AddRemoveDestination extends Action {
|
||||||
|
|
||||||
private static final String TURN = "turn";
|
private static final String TURN = "turn";
|
||||||
private static final String SHUNTING = "shunting";
|
private static final String SHUNTING = "shunting";
|
||||||
|
private static final String TRIGGER = "destination_trigger";
|
||||||
private Block destination;
|
private Block destination;
|
||||||
private boolean turnAtDestination;
|
private boolean turnAtDestination;
|
||||||
private boolean shunting;
|
private boolean shunting;
|
||||||
|
private Tile destinationTrigger = null;
|
||||||
|
|
||||||
public AddRemoveDestination(BaseClass parent) {
|
public AddRemoveDestination(BaseClass parent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
@@ -53,6 +57,7 @@ public class AddRemoveDestination extends Action {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
train.addTag(dest);
|
train.addTag(dest);
|
||||||
|
train.setDestinationTrigger(destinationTrigger);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +73,7 @@ public class AddRemoveDestination extends Action {
|
|||||||
if (isSet(destination)) json.put(Train.DESTINATION,destination.id().toString());
|
if (isSet(destination)) json.put(Train.DESTINATION,destination.id().toString());
|
||||||
if (turnAtDestination) json.put(TURN,true);
|
if (turnAtDestination) json.put(TURN,true);
|
||||||
if (shunting) json.put(SHUNTING, true);
|
if (shunting) json.put(SHUNTING, true);
|
||||||
|
if (isSet(destinationTrigger)) json.put(TRIGGER, destinationTrigger.id());
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +87,13 @@ public class AddRemoveDestination extends Action {
|
|||||||
destination = BaseClass.get(Id.from(json, Train.DESTINATION));
|
destination = BaseClass.get(Id.from(json, Train.DESTINATION));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (json.has(TRIGGER)) new LoadCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterLoad() {
|
||||||
|
destinationTrigger = Tile.get(Id.from(json, TRIGGER));
|
||||||
|
}
|
||||||
|
};
|
||||||
return super.load(json);
|
return super.load(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +105,7 @@ public class AddRemoveDestination extends Action {
|
|||||||
formInputs.add(t("Destination")+": "+(isNull(destination) ? t("Clear destinations") : destination),span);
|
formInputs.add(t("Destination")+": "+(isNull(destination) ? t("Clear destinations") : destination),span);
|
||||||
formInputs.add(t("Turn at destination"),new Checkbox(TURN, t("Turn"), turnAtDestination));
|
formInputs.add(t("Turn at destination"),new Checkbox(TURN, t("Turn"), turnAtDestination));
|
||||||
formInputs.add(t("Shunting"),new Checkbox(SHUNTING, t("Shunting"), shunting));
|
formInputs.add(t("Shunting"),new Checkbox(SHUNTING, t("Shunting"), shunting));
|
||||||
|
formInputs.add(t("Trigger Contact/Switch at destination")+": "+(isNull(destinationTrigger) ? t("unset") : destinationTrigger),button(t("Select from plan"),Map.of(ACTION,ACTION_UPDATE,ASSIGN,CONTACT)));
|
||||||
return super.properties(preForm, formInputs, postForm,errors);
|
return super.properties(preForm, formInputs, postForm,errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +132,10 @@ public class AddRemoveDestination extends Action {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (params.containsKey(CONTACT)) {
|
||||||
|
Tile tile = Tile.get(Id.from(params,CONTACT));
|
||||||
|
if (tile instanceof Contact || tile instanceof Switch) destinationTrigger = tile;
|
||||||
|
}
|
||||||
turnAtDestination = "on".equals(params.getString(TURN));
|
turnAtDestination = "on".equals(params.getString(TURN));
|
||||||
shunting = "on".equals(params.getString(SHUNTING));
|
shunting = "on".equals(params.getString(SHUNTING));
|
||||||
return context().properties();
|
return context().properties();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import org.json.JSONObject;
|
|||||||
import de.srsoftware.web4rail.BaseClass;
|
import de.srsoftware.web4rail.BaseClass;
|
||||||
import de.srsoftware.web4rail.LoadCallback;
|
import de.srsoftware.web4rail.LoadCallback;
|
||||||
import de.srsoftware.web4rail.Params;
|
import de.srsoftware.web4rail.Params;
|
||||||
|
import de.srsoftware.web4rail.moving.Car;
|
||||||
import de.srsoftware.web4rail.moving.Train;
|
import de.srsoftware.web4rail.moving.Train;
|
||||||
import de.srsoftware.web4rail.tags.Fieldset;
|
import de.srsoftware.web4rail.tags.Fieldset;
|
||||||
import de.srsoftware.web4rail.tags.Window;
|
import de.srsoftware.web4rail.tags.Window;
|
||||||
@@ -14,6 +15,7 @@ import de.srsoftware.web4rail.tags.Window;
|
|||||||
public class SetContextTrain extends Action {
|
public class SetContextTrain extends Action {
|
||||||
|
|
||||||
private Train train = null;
|
private Train train = null;
|
||||||
|
private Car car = null;
|
||||||
|
|
||||||
public SetContextTrain(BaseClass parent) {
|
public SetContextTrain(BaseClass parent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
@@ -21,7 +23,9 @@ public class SetContextTrain extends Action {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fire(Context context) {
|
public boolean fire(Context context) {
|
||||||
context.train(train);
|
Train t = isSet(train) ? train : car.train();
|
||||||
|
if (isNull(t)) return false;
|
||||||
|
context.train(t);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,6 +33,7 @@ public class SetContextTrain extends Action {
|
|||||||
public JSONObject json() {
|
public JSONObject json() {
|
||||||
JSONObject json = super.json();
|
JSONObject json = super.json();
|
||||||
if (isSet(train)) json.put(REALM_TRAIN, train.id());
|
if (isSet(train)) json.put(REALM_TRAIN, train.id());
|
||||||
|
if (isSet(car)) json.put(REALM_CAR, car.id());
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,12 +45,19 @@ public class SetContextTrain extends Action {
|
|||||||
train = Train.get(Id.from(json,REALM_TRAIN));
|
train = Train.get(Id.from(json,REALM_TRAIN));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (json.has(REALM_CAR)) new LoadCallback() {
|
||||||
|
@Override
|
||||||
|
public void afterLoad() {
|
||||||
|
car = Car.get(Id.from(json,REALM_CAR));
|
||||||
|
}
|
||||||
|
};
|
||||||
return super.load(json);
|
return super.load(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm,String...errors) {
|
protected Window properties(List<Fieldset> preForm, FormInput formInputs, List<Fieldset> postForm,String...errors) {
|
||||||
formInputs.add(t("Select train"),Train.selector(train, null));
|
formInputs.add(t("Select train"),Train.selector(train, null));
|
||||||
|
formInputs.add(t("Select car"),Car.selector(car, null));
|
||||||
return super.properties(preForm, formInputs, postForm,errors);
|
return super.properties(preForm, formInputs, postForm,errors);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,14 +68,31 @@ public class SetContextTrain extends Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return isSet(train) ? t("Set {} as context",train) : "["+t("Click here to select train!")+"]";
|
if (isSet(train)) return t("Set {} as context",train);
|
||||||
|
if (isSet(car)) return t("Set train of {} as context",car);
|
||||||
|
return "["+t("Click here to select train!")+"]";
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object update(Params params) {
|
protected Object update(Params params) {
|
||||||
LOG.debug("update: {}",params);
|
LOG.debug("update: {}",params);
|
||||||
Id trainId = Id.from(params,Train.class.getSimpleName());
|
Id trainId = Id.from(params,Train.class.getSimpleName());
|
||||||
if (isSet(trainId)) train = Train.get(trainId);
|
if (isSet(trainId)) {
|
||||||
|
Train newTrain = Train.get(trainId);
|
||||||
|
if (newTrain != train) {
|
||||||
|
train = newTrain;
|
||||||
|
car = null;
|
||||||
|
params.remove(Car.class.getSimpleName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Id carId = Id.from(params,Car.class.getSimpleName());
|
||||||
|
if (isSet(carId) && !carId.equals(0)) {
|
||||||
|
car = Car.get(carId);
|
||||||
|
train = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return super.update(params);
|
return super.update(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ public class BlockFree extends Condition {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fulfilledBy(Context context) {
|
public boolean fulfilledBy(Context context) {
|
||||||
return block.isFreeFor(context) != inverted;
|
if (!inverted) return block.isFreeFor(context);
|
||||||
|
return !block.isFreeFor(new Context(block)); // block.isFreeFor würde true liefern, wenn der Zug im Kontext gleich dem Zug im Block wäre. Da wir aber nur wissen wollen, ob der Block belegt ist, brauchen wir einen Context ohne Zug.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,6 +70,7 @@ public class BlockFree extends Condition {
|
|||||||
if (tile instanceof Block) {
|
if (tile instanceof Block) {
|
||||||
block = (Block) tile;
|
block = (Block) tile;
|
||||||
} else return t("Clicked tile is not a {}!",t("block"));
|
} else return t("Clicked tile is not a {}!",t("block"));
|
||||||
|
return context().properties();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.update(params);
|
return super.update(params);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import de.srsoftware.web4rail.threads.DelayedExecution;
|
|||||||
import de.srsoftware.web4rail.threads.RoutePrepper;
|
import de.srsoftware.web4rail.threads.RoutePrepper;
|
||||||
import de.srsoftware.web4rail.tiles.Block;
|
import de.srsoftware.web4rail.tiles.Block;
|
||||||
import de.srsoftware.web4rail.tiles.Contact;
|
import de.srsoftware.web4rail.tiles.Contact;
|
||||||
|
import de.srsoftware.web4rail.tiles.Switch;
|
||||||
import de.srsoftware.web4rail.tiles.Tile;
|
import de.srsoftware.web4rail.tiles.Tile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,6 +102,8 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
|
|
||||||
private BrakeProcess brake;
|
private BrakeProcess brake;
|
||||||
|
|
||||||
|
private Tile destinationTrigger;
|
||||||
|
|
||||||
public static Object action(Params params, Plan plan) throws IOException {
|
public static Object action(Params params, Plan plan) throws IOException {
|
||||||
String action = params.getString(ACTION);
|
String action = params.getString(ACTION);
|
||||||
if (isNull(action)) return t("No action passed to Train.action!");
|
if (isNull(action)) return t("No action passed to Train.action!");
|
||||||
@@ -500,11 +503,18 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isNull(destTag)) {
|
if (isNull(destTag)) {
|
||||||
|
Tile trigger = destinationTrigger; // quitAutopilot drops destinationTrigger
|
||||||
quitAutopilot();
|
quitAutopilot();
|
||||||
plan.stream(t("{} reached it`s destination!",this));
|
plan.stream(t("{} reached it`s destination!",this));
|
||||||
|
if (isSet(trigger)) new DelayedExecution(1000,this) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
if (trigger instanceof Contact) ((Contact)trigger).trigger(200);
|
||||||
|
if (trigger instanceof Switch) ((Switch)trigger).trigger(new Context(Train.this));
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (isSet(brake)) brake.updateTime();
|
if (isSet(brake)) brake.updateTime();
|
||||||
Integer waitTime = route.waitTime();
|
Integer waitTime = route.waitTime();
|
||||||
@@ -521,7 +531,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
stuckTrace = null;
|
stuckTrace = null;
|
||||||
if (autopilot) {
|
if (autopilot) {
|
||||||
if (isNull(waitTime)) waitTime = 0;
|
if (isNull(waitTime)) waitTime = 0;
|
||||||
if (waitTime>0) plan.stream(t("{} waiting {} secs",this,(int)(waitTime/1000)));
|
if (waitTime>0) plan.stream(t("{} waiting {} secs.",this,(int)(waitTime/1000)));
|
||||||
new DelayedExecution(waitTime,this) {
|
new DelayedExecution(waitTime,this) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -789,6 +799,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
button(t("Select from plan"),Map.of(ACTION,ACTION_MOVE,ASSIGN,DESTINATION)).addTo(dest);
|
button(t("Select from plan"),Map.of(ACTION,ACTION_MOVE,ASSIGN,DESTINATION)).addTo(dest);
|
||||||
|
|
||||||
dest.addTo(propList);
|
dest.addTo(propList);
|
||||||
|
if (isSet(destinationTrigger)) new Tag("li").content(t("Triggers {} when reaching destination",destinationTrigger)).addTo(propList);
|
||||||
if (isSet(route)) route.link("li", route).addTo(propList);
|
if (isSet(route)) route.link("li", route).addTo(propList);
|
||||||
int ms = maxSpeed();
|
int ms = maxSpeed();
|
||||||
if (ms < Integer.MAX_VALUE) new Tag("li").content(t("Maximum Speed")+COL+maxSpeed()+NBSP+speedUnit).addTo(propList);
|
if (ms < Integer.MAX_VALUE) new Tag("li").content(t("Maximum Speed")+COL+maxSpeed()+NBSP+speedUnit).addTo(propList);
|
||||||
@@ -810,6 +821,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
carList().addTo(propList);
|
carList().addTo(propList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
formInputs.add(t("Name"), new Input(NAME,name()));
|
formInputs.add(t("Name"), new Input(NAME,name()));
|
||||||
formInputs.add(t("Shunting"),new Checkbox(SHUNTING, t("train is shunting"), shunting));
|
formInputs.add(t("Shunting"),new Checkbox(SHUNTING, t("train is shunting"), shunting));
|
||||||
formInputs.add(t("Push-pull train"),new Checkbox(PUSH_PULL, t("Push-pull train"), pushPull));
|
formInputs.add(t("Push-pull train"),new Checkbox(PUSH_PULL, t("Push-pull train"), pushPull));
|
||||||
@@ -825,6 +837,7 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String quitAutopilot() {
|
public String quitAutopilot() {
|
||||||
|
destinationTrigger = null;
|
||||||
if (isSet(routePrepper)) {
|
if (isSet(routePrepper)) {
|
||||||
routePrepper.stop();
|
routePrepper.stop();
|
||||||
routePrepper = null;
|
routePrepper = null;
|
||||||
@@ -950,6 +963,11 @@ public class Train extends BaseClass implements Comparable<Train> {
|
|||||||
return properties(t("{} is not a block!",tile));
|
return properties(t("{} is not a block!",tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDestinationTrigger(Tile destinationTrigger) {
|
||||||
|
this.destinationTrigger = destinationTrigger;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Object setFunction(int num, boolean active) {
|
public Object setFunction(int num, boolean active) {
|
||||||
// TODO
|
// TODO
|
||||||
return properties();
|
return properties();
|
||||||
|
|||||||
@@ -162,7 +162,9 @@ public class Switch extends Tile{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean trigger(Context context) {
|
public boolean trigger(Context context) {
|
||||||
return state ? actionsOn.fire(context) : actionsOff.fire(context);
|
return state ?
|
||||||
|
actionsOn.fire(context) :
|
||||||
|
actionsOff.fire(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void state(boolean newState) {
|
public void state(boolean newState) {
|
||||||
|
|||||||
@@ -74,8 +74,10 @@ public class TextDisplay extends StretchableTile implements Store.Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public TextDisplay text(String tx) {
|
public TextDisplay text(String tx) {
|
||||||
text = tx;
|
if (isNull(text) || !text.equals(tx)) {
|
||||||
displayText = tx;
|
displayText = tx;
|
||||||
|
}
|
||||||
|
text = tx;
|
||||||
int pos = text.indexOf("{");
|
int pos = text.indexOf("{");
|
||||||
Store.removeListener(this);
|
Store.removeListener(this);
|
||||||
while (pos > -1) {
|
while (pos > -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user