fix start bug and timing tuning
This commit is contained in:
parent
eba657c484
commit
4dc877ef68
@ -307,7 +307,11 @@ bool RPBot::onEvent(const Message::Events::MessageConstruct& e) {
|
|||||||
|
|
||||||
auto& timeout = _cr.get<StateIdle>(rpbot_contact).timeout;
|
auto& timeout = _cr.get<StateIdle>(rpbot_contact).timeout;
|
||||||
// TODO: config with id
|
// TODO: config with id
|
||||||
timeout = std::min<float>(timeout, _conf.get_double("RPBot", "max_interactive_delay").value_or(4.f));
|
timeout = std::clamp<float>(
|
||||||
|
timeout,
|
||||||
|
1.5f, // minimum, helps when activly history syncing
|
||||||
|
_conf.get_double("RPBot", "max_interactive_delay").value_or(4.f)
|
||||||
|
);
|
||||||
std::cout << "RPBot: onMsg new timeout: " << timeout << "\n";
|
std::cout << "RPBot: onMsg new timeout: " << timeout << "\n";
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -65,6 +65,14 @@ void RPBot::registerCommands(void) {
|
|||||||
auto view = _cr.view<Contact::Components::ID>();
|
auto view = _cr.view<Contact::Components::ID>();
|
||||||
for (auto it = view.begin(), it_end = view.end(); it != it_end; it++) {
|
for (auto it = view.begin(), it_end = view.end(); it != it_end; it++) {
|
||||||
if (view.get<Contact::Components::ID>(*it).data == id_bin) {
|
if (view.get<Contact::Components::ID>(*it).data == id_bin) {
|
||||||
|
if (_cr.any_of<StateIdle, StateNextActor, StateGenerateMsg, StateTimingCheck>(*it)) {
|
||||||
|
_rmm.sendText(
|
||||||
|
contact_from,
|
||||||
|
"RPBot already running"
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
auto& new_state = _cr.emplace<StateIdle>(*it);
|
auto& new_state = _cr.emplace<StateIdle>(*it);
|
||||||
new_state.timeout = 10.f;
|
new_state.timeout = 10.f;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user