rigs-of-rods
rigs-of-rods copied to clipboard
setEventSimulatedValue does not work in multiplayer while server bot is present
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]
.