mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 22:09:19 +02:00
add oneshot eventlauncher (0)
This commit is contained in:
14
EvLaunch.cpp
14
EvLaunch.cpp
@@ -68,7 +68,7 @@ bool TEventLauncher::Load(cParser *parser)
|
|||||||
}
|
}
|
||||||
parser->getTokens();
|
parser->getTokens();
|
||||||
*parser >> DeltaTime;
|
*parser >> DeltaTime;
|
||||||
if (DeltaTime < 0)
|
if (DeltaTime <= 0)
|
||||||
DeltaTime = -DeltaTime; // dla ujemnego zmieniamy na dodatni
|
DeltaTime = -DeltaTime; // dla ujemnego zmieniamy na dodatni
|
||||||
else if (DeltaTime > 0)
|
else if (DeltaTime > 0)
|
||||||
{ // wartość dodatnia oznacza wyzwalanie o określonej godzinie
|
{ // wartość dodatnia oznacza wyzwalanie o określonej godzinie
|
||||||
@@ -157,7 +157,12 @@ bool TEventLauncher::check_activation() {
|
|||||||
|
|
||||||
auto bCond { false };
|
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 ) {
|
if( UpdatedTime > DeltaTime ) {
|
||||||
UpdatedTime = 0; // naliczanie od nowa
|
UpdatedTime = 0; // naliczanie od nowa
|
||||||
bCond = true;
|
bCond = true;
|
||||||
@@ -255,7 +260,10 @@ TEventLauncher::export_as_text_( std::ostream &Output ) const {
|
|||||||
Output << "none ";
|
Output << "none ";
|
||||||
}
|
}
|
||||||
// activation interval or hour
|
// activation interval or hour
|
||||||
if( DeltaTime != 0 ) {
|
if (DeltaTime == 0.0) {
|
||||||
|
Output << "0 ";
|
||||||
|
}
|
||||||
|
else if( DeltaTime < 0.0 ) {
|
||||||
// cyclical launcher
|
// cyclical launcher
|
||||||
Output << -DeltaTime << ' ';
|
Output << -DeltaTime << ' ';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ void state_manager::process_commands() {
|
|||||||
|
|
||||||
TAnimModel *model = simulation::State.create_model(data, name, commanddata.location);
|
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())
|
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) {
|
if (commanddata.command == user_command::deletemodel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user