Astera-org / minetest

Minetest is an open source voxel game engine with easy modding and game creation
https://www.minetest.net/
Other
0 stars 0 forks source link

Accept commands in remote input handler #77

Open mickvangelderen opened 2 weeks ago

mickvangelderen commented 2 weeks ago

To enable environments that use commands, like https://github.com/Astera-org/dreamerv3/issues/7.

mickvangelderen commented 2 weeks ago

Solution direction:

Add some data to the Action struct in the capnp protocol:

struct Action {
  keyEvents @0 :List(KeyPressType.Key);
  mouseDx @1 :Int32;
  mouseDy @2 :Int32;
  inputString @3 : String; <-- something like this?
}

Then, at the right time (after the cmd keypress takes effect), send an SEvent or two to the right EventHandlers.

if (m_key_was_pressed[keycache.key[KeyType::CMD]]) {
  SEvent event;
  event.EventType = irr::EET_STRING_INPUT_EVENT;
  event.StringInput.Str = new core::stringw("max");
  m_rendering_engine->get_gui_env()->postEventFromUser(event);
  delete event.StringInput.Str;
}
mickvangelderen commented 5 days ago

Not needed for now because we implemented globo interactions through items instead: https://github.com/Astera-org/globo/pull/30