16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 00:49:19 +02:00

add oneshot eventlauncher (0)

This commit is contained in:
milek7
2019-04-10 11:26:25 +02:00
parent e22f020a59
commit 491debdd5e
2 changed files with 12 additions and 4 deletions

View File

@@ -68,7 +68,7 @@ bool TEventLauncher::Load(cParser *parser)
}
parser->getTokens();
*parser >> DeltaTime;
if (DeltaTime < 0)
if (DeltaTime <= 0)
DeltaTime = -DeltaTime; // dla ujemnego zmieniamy na dodatni
else if (DeltaTime > 0)
{ // wartość dodatnia oznacza wyzwalanie o określonej godzinie
@@ -157,7 +157,12 @@ bool TEventLauncher::check_activation() {
auto bCond { false };
if( DeltaTime > 0 ) {
if (DeltaTime == 0.0) {
if (UpdatedTime == 0.0)
bCond = true;
UpdatedTime = 1.0;
}
else if( DeltaTime > 0 ) {
if( UpdatedTime > DeltaTime ) {
UpdatedTime = 0; // naliczanie od nowa
bCond = true;
@@ -255,7 +260,10 @@ TEventLauncher::export_as_text_( std::ostream &Output ) const {
Output << "none ";
}
// activation interval or hour
if( DeltaTime != 0 ) {
if (DeltaTime == 0.0) {
Output << "0 ";
}
else if( DeltaTime < 0.0 ) {
// cyclical launcher
Output << -DeltaTime << ' ';
}

View File

@@ -190,7 +190,7 @@ void state_manager::process_commands() {
TAnimModel *model = simulation::State.create_model(data, name, commanddata.location);
simulation::State.create_eventlauncher("node -1 0 launcher eventlauncher 0 0 0 " + std::to_string(model->radius())
+ " none -0.1 obstacle_collision end", name + "_snd", commanddata.location);
+ " none 0.0 obstacle_collision end", name + "_snd", commanddata.location);
}
if (commanddata.command == user_command::deletemodel) {