added automatic registration for non-builtin gate datablocks
This commit is contained in:
		| @@ -60,18 +60,18 @@ textbrick_idxToPrint = textbrick_idxToPrint or { | ||||
| 	[0x35] = "apostrophe2", | ||||
| 	[0x36] = "colon", | ||||
| 	[0x37] = "comma", | ||||
| 	[0x38] = "curlybracketleft", | ||||
| 	[0x39] = "curlybracketright", | ||||
| 	[0x38] = "curlybracketright", | ||||
| 	[0x39] = "curlybracketleft", | ||||
| 	[0x3A] = "currencysign", | ||||
| 	[0x3B] = "euro", | ||||
| 	[0x3C] = "onehalf", | ||||
| 	[0x3D] = "poundsymbol", | ||||
| 	[0x3E] = "roundbracketleft", | ||||
| 	[0x3F] = "roundbracketright", | ||||
| 	[0x3E] = "roundbracketright", | ||||
| 	[0x3F] = "roundbracketleft", | ||||
| 	[0x40] = "slashleft", | ||||
| 	[0x41] = "slashright", | ||||
| 	[0x42] = "squarebracketleft", | ||||
| 	[0x43] = "squarebracketright", | ||||
| 	[0x42] = "squarebracketright", | ||||
| 	[0x43] = "squarebracketleft", | ||||
| 	[0x44] = "tilde", | ||||
| 	[0x45] = "umlaut", | ||||
| 	[0x46] = "underscore", | ||||
|   | ||||
| @@ -119,6 +119,6 @@ activatePackage("LuaLogic"); | ||||
| function llr(){ | ||||
| 	deleteVariables("$LuaLogic*"); | ||||
| 	resetAllOpCallFunc(); | ||||
| 	exec("./server.cs"); | ||||
| 	exec("./lualogic.cs"); | ||||
| 	schedule(3000, 0, lualogic_connect, 25000); | ||||
| } | ||||
|   | ||||
| @@ -10,10 +10,18 @@ function lualogic_escapelogicfunction(%text){ | ||||
| 	return %text; | ||||
| } | ||||
|  | ||||
| function lualogic_registergatedefinition(%data) | ||||
| function lualogic_registergatedefinition(%data){ | ||||
| 	lualogic_registergatedefinition_auto(%data); | ||||
| } | ||||
|  | ||||
| function lualogic_registergatedefinition_auto(%data) | ||||
| { | ||||
| 	if(!isObject(%data)) | ||||
| 		return; | ||||
| 	 | ||||
| 	if(%data.luaLogic_isRegistered) | ||||
| 		return; | ||||
| 	 | ||||
| 	%id = %data.getID(); | ||||
| 	 | ||||
| 	if((%idx = $LuaLogic::GateDefinitionIDX[%id]) $= "") | ||||
| @@ -39,8 +47,21 @@ function lualogic_registergatedefinition(%data) | ||||
| 	} | ||||
|  | ||||
| 	$LuaLogic::GateDefintion[%idx] = %def; | ||||
| 	 | ||||
| 	%data.luaLogic_isRegistered = true; | ||||
| } | ||||
|  | ||||
| function lualogic_registerAllGateDefinitions(){ | ||||
| 	for(%dbidx=0; %dbidx<DatablockGroup.getCount(); %dbidx++){ | ||||
| 		%db = DatablockGroup.getObject(%dbidx); | ||||
| 		if(%db.isLogic && %db.isLogicGate){ | ||||
| 			lualogic_registergatedefinition_auto(%db); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| lualogic_registerAllGateDefinitions(); | ||||
|  | ||||
| function lualogic_print(%text) | ||||
| { | ||||
| 	echo("LuaLogic -> ", %text); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Redo
					Redo