RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
990 stars 175 forks source link

setEventSimulatedValue does not work in multiplayer while server bot is present #3147

Open Xploder98 opened 3 months ago

Xploder98 commented 3 months ago

So, this is a rather specific issue. I was testing a multiplayer command to simulate a monster truck-type remote ignition interrupter (RII) using the InputEngineClass's setEventSimulatedValue() method to toggle EV_TRUCK_TOGGLE_CONTACT for a remote player. It generally works fine when I point the command at myself while I am on a server alone, but when I connect a server bot, the command suddenly stops working. The command then suddenly resumes working as soon as the bot disconnects from the server. Here is a copy of the full custom server command:

customCommand riiCommand(@chatSystem, "rii", customCommand_rii, null, false, AUTH_MOD | AUTH_ADMIN);
void customCommand_rii(chatMessage@ cmsg)
{
                int uid = parseInt(cmsg.emsg[1]);
                server.cmd(uid, "inputs.setEventSimulatedValue(EV_TRUCK_TOGGLE_CONTACT, 1.f);");
                server.say("RII activated for " + server.getUserName(uid), TO_ALL, FROM_SERVER);
                server.cmd(uid, "inputs.setEventSimulatedValue(EV_TRUCK_TOGGLE_CONTACT, 0.f);");
}

The usage of the command would be !rii [uid].