changed the way callbacks work internally

This commit is contained in:
Redo 2019-09-15 04:43:54 -05:00
parent 1926d21962
commit 46f8d92ed2
2 changed files with 15 additions and 11 deletions

View File

@ -48,8 +48,8 @@ function lualogic_removegate(%gate)
if(%gate.logicIsRemoved == false) if(%gate.logicIsRemoved == false)
{ {
%db = %gate.getDataBlock(); %db = %gate.getDataBlock();
if(isFunction(%db.getName(), "Logic_onRemove")) //if(isFunction(%db.getName(), "Logic_onRemove"))
%db.Logic_onRemove(%gate); // %db.Logic_onRemove(%gate);
lualogic_send("RG;" @ %gate); lualogic_send("RG;" @ %gate);
%gate.logicIsRemoved = true; %gate.logicIsRemoved = true;
@ -67,7 +67,7 @@ function lualogic_sendall()
{ {
%brick = %group.getObject(%a); %brick = %group.getObject(%a);
%data = %brick.getDataBlock(); %data = %brick.getDataBlock();
if(%data.isLogic && %brick.isPlanted()) if(%data.isLogic && %brick.isPlanted() && !%brick.logicIsRemoved)
{ {
if(%data.isLogicWire) if(%data.isLogicWire)
lualogic_addwire(%brick); lualogic_addwire(%brick);
@ -149,14 +149,14 @@ package LuaLogic_Bricks
{ {
if(%this.isLogic) if(%this.isLogic)
{ {
%brick.Logic_HandleRemove();
if(%this.isLogicWire) if(%this.isLogicWire)
lualogic_removewire(%brick); lualogic_removewire(%brick);
else if(%this.isLogicGate) else if(%this.isLogicGate)
lualogic_removegate(%brick); lualogic_removegate(%brick);
%brick.Logic_HandleRemove();
} }
parent::onDeath(%this, %brick); parent::onDeath(%this, %brick);
} }
@ -164,14 +164,14 @@ package LuaLogic_Bricks
{ {
if(%this.isLogic && %brick.logicIsAdded) if(%this.isLogic && %brick.logicIsAdded)
{ {
%brick.Logic_HandleRemove();
if(%this.isLogicWire) if(%this.isLogicWire)
lualogic_removewire(%brick); lualogic_removewire(%brick);
else if(%this.isLogicGate) else if(%this.isLogicGate)
lualogic_removegate(%brick); lualogic_removegate(%brick);
%brick.Logic_HandleRemove();
} }
parent::onRemove(%this, %brick); parent::onRemove(%this, %brick);
} }

View File

@ -96,8 +96,8 @@ function lualogic_send(%data)
{ {
if(isObject(LuaLogicTCP) && LuaLogicTCP.isConnected) if(isObject(LuaLogicTCP) && LuaLogicTCP.isConnected)
{ {
while(strpos(%data, ";;") != -1) //while(strpos(%data, ";;") != -1)
%data = strReplace(%data, ";;", "; ;"); // %data = strReplace(%data, ";;", "; ;");
if(strlen(LuaLogicTCP.data) + strlen(%data) >= 1024) if(strlen(LuaLogicTCP.data) + strlen(%data) >= 1024)
LuaLogicTCP.sendData(); LuaLogicTCP.sendData();
@ -123,6 +123,10 @@ function lualogic_sendoptions()
lualogic_send("OPT;FX_TIME;" @ $Pref::Server::LuaLogic::OPT_FX_TIME); lualogic_send("OPT;FX_TIME;" @ $Pref::Server::LuaLogic::OPT_FX_TIME);
} }
function lualogic_savedata(){
lualogic_send("SAVE");
}
function lualogic_sendinput(%gate, %argc, %arg0, %arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10, %arg11, %arg12, %arg13, %arg14, %arg15) function lualogic_sendinput(%gate, %argc, %arg0, %arg1, %arg2, %arg3, %arg4, %arg5, %arg6, %arg7, %arg8, %arg9, %arg10, %arg11, %arg12, %arg13, %arg14, %arg15)
{ {
%args = %arg0; %args = %arg0;