made event timing more precise; allowed tick times <1ms

This commit is contained in:
Redo 2020-04-01 18:08:20 -05:00
parent 7cc28c5e97
commit e8f69cce08
3 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,7 @@ function serverCmdLST(%client, %time)
{ {
if(%client.isAdmin || %client.isSuperAdmin) if(%client.isAdmin || %client.isSuperAdmin)
{ {
%time = mClamp(%time, 0, 999999); %time = mClampFloat(%time, 0, 999999);
$Pref::Server::LuaLogic::OPT_TICK_TIME = %time/1000; $Pref::Server::LuaLogic::OPT_TICK_TIME = %time/1000;
messageAll('', '\c3%1\c6 has set the logic tick time to \c3%2\c6 millisecond%3.', %client.name, %time, %time == 1 ? "":"s"); messageAll('', '\c3%1\c6 has set the logic tick time to \c3%2\c6 millisecond%3.', %client.name, %time, %time == 1 ? "":"s");
lualogic_sendoptions(); lualogic_sendoptions();

View File

@ -1,7 +1,7 @@
function LuaLogicTCP::sendData(%this) function LuaLogicTCP::sendData(%this)
{ {
cancel(%this.lualogicTick); cancel(%this.lualogicTick);
%this.lualogicTick = %this.schedule(31, "sendData"); %this.lualogicTick = %this.schedule(1, "sendData");
if(%this.data !$= "") if(%this.data !$= "")
{ {

View File

@ -1,4 +1,8 @@
function mClampFloat(%x, %min, %max){
return %x<%min ? %min : (%x>%max ? %max : %x);
}
function lualogic_registergatedefinition(%data){ function lualogic_registergatedefinition(%data){
//lualogic_registergatedefinition_auto(%data); //lualogic_registergatedefinition_auto(%data);