add box features
This commit is contained in:
		| @@ -1,3 +1,5 @@ | ||||
| //bls 3 | ||||
|  | ||||
| // General server commands used to control the new duplicator. | ||||
| // ------------------------------------------------------------------- | ||||
|  | ||||
| @@ -7,7 +9,7 @@ | ||||
| //Shows version of blockland and the new duplicator | ||||
| function serverCmdDupVersion(%client) | ||||
| { | ||||
| 	messageClient(%client, '', "\c6Blockland version: \c3r" @ getBuildNumber()); | ||||
| 	//messageClient(%client, '', "\c6Blockland version: \c3r" @ getBuildNumber()); | ||||
| 	messageClient(%client, '', "\c6New duplicator version: \c3" @ $ND::Version); | ||||
|  | ||||
| 	if(%client.ndClient) | ||||
| @@ -17,19 +19,19 @@ function serverCmdDupVersion(%client) | ||||
| } | ||||
|  | ||||
| //Shows versions of other clients | ||||
| function serverCmdDupClients(%client) | ||||
| { | ||||
| 	messageClient(%client, '', "\c6New duplicator versions:"); | ||||
|  | ||||
| 	%cnt = ClientGroup.getCount(); | ||||
| 	for(%i = 0; %i < %cnt; %i++) | ||||
| 	{ | ||||
| 		%cl = ClientGroup.getObject(%i); | ||||
|  | ||||
| 		if(%cl.ndClient) | ||||
| 			messageClient(%client, '', "\c3" @ %cl.name @ "\c6 has \c3" @ %cl.ndVersion); | ||||
| 	} | ||||
| } | ||||
| //function serverCmdDupClients(%client) | ||||
| //{ | ||||
| //	messageClient(%client, '', "\c6New duplicator versions:"); | ||||
| // | ||||
| //	%cnt = ClientGroup.getCount(); | ||||
| //	for(%i = 0; %i < %cnt; %i++) | ||||
| //	{ | ||||
| //		%cl = ClientGroup.getObject(%i); | ||||
| // | ||||
| //		if(%cl.ndClient) | ||||
| //			messageClient(%client, '', "\c3" @ %cl.name @ "\c6 has \c3" @ %cl.ndVersion); | ||||
| //	} | ||||
| //} | ||||
|  | ||||
| //Shows list of commands | ||||
| function serverCmdDupHelp(%client) | ||||
| @@ -74,8 +76,8 @@ function serverCmdDupHelp(%client) | ||||
| } | ||||
|  | ||||
| //Alternative short commands | ||||
| function serverCmdDV(%client){serverCmdDupVersion(%client);} | ||||
| function serverCmdDC(%client){serverCmdDupClients(%client);} | ||||
| //function serverCmdDV(%client){serverCmdDupVersion(%client);} | ||||
| //function serverCmdDC(%client){serverCmdDupClients(%client);} | ||||
| function serverCmdDH(%client){serverCmdDupHelp(%client);} | ||||
|  | ||||
|  | ||||
| @@ -89,27 +91,33 @@ function serverCmdNewDuplicator(%client) | ||||
| 	//Check admin | ||||
| 	if($Pref::Server::ND::AdminOnly && !%client.isAdmin) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6The new duplicator is admin only. Ask an admin for help."); | ||||
| 		ndmessageClient(%client, '', "\c6The new duplicator is admin only. Ask an admin for help."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	//Check minigame | ||||
| 	if(isObject(%client.minigame) && !%client.minigame.enablebuilding) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6You cannot use the new duplicator while building is disabled in your minigame."); | ||||
| 		ndmessageClient(%client, '', "\c6You cannot use the new duplicator while building is disabled in your minigame."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	//Check player | ||||
| 	if(!isObject(%player = %client.player)) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6You must be spawned to equip the new duplicator."); | ||||
| 		ndmessageClient(%client, '', "\c6You must be spawned to equip the new duplicator."); | ||||
| 		return; | ||||
| 	} | ||||
| 	 | ||||
| 	// Abort if already holding the dup | ||||
| 	if(isObject(%player.getMountedImage(0)) && getSubStr(%player.getMountedImage(0).getName(), 0, 8) $= "ND_Image") | ||||
| 		return; | ||||
|  | ||||
| 	//Hide brick selector and tool gui | ||||
| 	%client.ndLastEquipTime = $Sim::Time; | ||||
| 	commandToClient(%client, 'setScrollMode', 3); | ||||
| 	// If a tool is equipped, hide brick selector and tool gui | ||||
| 	if(isObject(%player.getMountedImage(0))) { | ||||
| 		%client.ndLastEquipTime = $Sim::Time; | ||||
| 		commandToClient(%client, 'setScrollMode', 3); | ||||
| 	} | ||||
|  | ||||
| 	//Give player a duplicator | ||||
| 	%image = %client.ndImage; | ||||
| @@ -224,7 +232,8 @@ package NewDuplicator_Server | ||||
|  | ||||
| 				if(%obj.brickCount > 10 && %client.ndUndoConfirm != %obj) | ||||
| 				{ | ||||
| 					messageClient(%client, '', "\c6Next undo will affect \c3" @ %obj.brickCount @ "\c6 bricks. Press undo again to continue."); | ||||
| 					//messageClient(%client, '', "\c6Next undo will affect \c3" @ %obj.brickCount @ "\c6 bricks. Press undo again to continue."); | ||||
| 					commandToClient(%client, 'centerPrint', "<font:Verdana:20>\c6Next undo will affect \c3" @ %obj.brickCount @ "\c6 bricks. Press undo again to continue.", 4); | ||||
| 					%client.undoStack.push(%state); | ||||
| 					%client.ndUndoConfirm = %obj; | ||||
| 					return; | ||||
| @@ -237,7 +246,8 @@ package NewDuplicator_Server | ||||
|  | ||||
| 				%client.ndUndoConfirm = 0; | ||||
| 			}else{ | ||||
| 				talk("serverCmdUndoBrick(" @ %client.name @ ") - Nonexistent undo state " @ %state); | ||||
| 				// seems to happen when you SC a plant and then undo it | ||||
| 				//talk("serverCmdUndoBrick(" @ %client.name @ ") - Nonexistent undo state " @ %state); | ||||
| 			} | ||||
| 			return; | ||||
| 		} | ||||
| @@ -306,19 +316,19 @@ function serverCmdSuperCut(%client) | ||||
| { | ||||
| 	if(%client.ndModeIndex != $NDM::BoxSelect) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Supercut can only be used on box selection mode."); | ||||
| 		ndmessageClient(%client, '', "\c6Supercut can only be used on box selection mode."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(!isObject(%client.ndSelectionBox)) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Supercut can only be used with a selection box."); | ||||
| 		ndmessageClient(%client, '', "\c6Supercut can only be used with a selection box."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(%client.ndSelectionAvailable) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Supercut can not be used with any bricks selected."); | ||||
| 		ndmessageClient(%client, '', "\c6Supercut can not be used with any bricks selected."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -333,19 +343,19 @@ function serverCmdNdConfirmSuperCut(%client) | ||||
| { | ||||
| 	if(%client.ndModeIndex != $NDM::BoxSelect) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Supercut can only be used on box selection mode."); | ||||
| 		ndmessageClient(%client, '', "\c6Supercut can only be used on box selection mode."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(!isObject(%client.ndSelectionBox)) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Supercut can only be used with a selection box."); | ||||
| 		ndmessageClient(%client, '', "\c6Supercut can only be used with a selection box."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(%client.ndSelectionAvailable) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Supercut can not be used with any bricks selected."); | ||||
| 		ndmessageClient(%client, '', "\c6Supercut can not be used with any bricks selected."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -363,25 +373,25 @@ function serverCmdFillBricks(%client, %conf, %subsetname) | ||||
| { | ||||
| 	if($Pref::Server::ND::FillBricksAdminOnly && !%client.isAdmin) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Fill Bricks is admin only. Ask an admin for help."); | ||||
| 		ndmessageClient(%client, '', "\c6Fill Bricks is admin only. Ask an admin for help."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(!isObject(%client.ndSelectionBox)) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6The fillBricks command can only be used with a selection box."); | ||||
| 		ndmessageClient(%client, '', "\c6The fillBricks command can only be used with a selection box."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(%client.ndSelectionAvailable) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6The fillBricks command can not be used with any bricks selected."); | ||||
| 		ndmessageClient(%client, '', "\c6The fillBricks command can not be used with any bricks selected."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(!%client.ndSelectionBox.hasVolume()) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6The fillBricks command can only be used with a selection box that has a volume."); | ||||
| 		ndmessageClient(%client, '', "\c6The fillBricks command can only be used with a selection box that has a volume."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -403,25 +413,25 @@ function serverCmdNdConfirmFillBricks(%client, %subsetname) | ||||
| { | ||||
| 	if($Pref::Server::ND::FillBricksAdminOnly && !%client.isAdmin) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Fill Bricks is admin only. Ask an admin for help."); | ||||
| 		ndmessageClient(%client, '', "\c6Fill Bricks is admin only. Ask an admin for help."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(!isObject(%client.ndSelectionBox)) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6The fillBricks command can only be used with a selection box."); | ||||
| 		ndmessageClient(%client, '', "\c6The fillBricks command can only be used with a selection box."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(%client.ndSelectionAvailable) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6The fillBricks command can not be used with any bricks selected."); | ||||
| 		ndmessageClient(%client, '', "\c6The fillBricks command can not be used with any bricks selected."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(!%client.ndSelectionBox.hasVolume()) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6The fillBricks command can only be used with a selection box that has a volume."); | ||||
| 		ndmessageClient(%client, '', "\c6The fillBricks command can only be used with a selection box that has a volume."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -494,7 +504,7 @@ function GameConnection::ndMirror(%client, %axis) | ||||
| 		if(!$ND::SymmetryTableCreating) | ||||
| 			ndCreateSymmetryTable(); | ||||
|  | ||||
| 		messageClient(%client, '', "\c6Please wait for the symmetry table to finish, then mirror again."); | ||||
| 		ndmessageClient(%client, '', "\c6Please wait for the symmetry table to finish, then mirror again."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -513,7 +523,7 @@ function GameConnection::ndMirror(%client, %axis) | ||||
| 	} | ||||
|  | ||||
| 	//We didn't mirror anything | ||||
| 	messageClient(%client, '', "\c6The mirror command can only be used in plant mode or with a ghost brick."); | ||||
| 	ndmessageClient(%client, '', "\c6The mirror command can only be used in plant mode or with a ghost brick."); | ||||
| } | ||||
|  | ||||
| //List potential mirror errors in last plant | ||||
| @@ -555,6 +565,29 @@ function serverCmdME(%client){serverCmdMirErrors(%client);} | ||||
|  | ||||
|  | ||||
|  | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
| // Ownership | ||||
| function serverCmdOwnership(%client) { | ||||
| 	if(%client.ndModeIndex != $NDM::PlantCopy) { | ||||
| 		ndmessageClient(%client, '', "\c6Ownership plant can only be used in Plant Mode."); | ||||
| 		return; | ||||
| 	} | ||||
| 	if(!%client.isAdmin) { | ||||
| 		ndmessageClient(%client, '', "\c6Ownership plant is admin only."); | ||||
| 		return; | ||||
| 	} | ||||
| 	%client.ndOwnership = !%client.ndOwnership; | ||||
| 	if(%client.ndOwnership) { | ||||
| 		ndmessageClient(%client, '', "\c6Bricks will now be planted in the group of the original owner."); | ||||
| 	} else { | ||||
| 		ndmessageClient(%client, '', "\c6Bricks will now be planted in your own group."); | ||||
| 	} | ||||
| 	%client.ndUpdateBottomPrint(); | ||||
| } | ||||
| function serverCmdOwn(%client) { serverCmdOwnership(%client); } | ||||
| function serverCmdO(%client) { serverCmdOwnership(%client); } | ||||
|  | ||||
|  | ||||
| //Force plant | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| @@ -564,18 +597,18 @@ function serverCmdForcePlant(%client) | ||||
| 	//Check mode | ||||
| 	if(%client.ndModeIndex != $NDM::PlantCopy) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Force Plant can only be used in Plant Mode."); | ||||
| 		ndmessageClient(%client, '', "\c6Force Plant can only be used in Plant Mode."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	//Check admin | ||||
| 	if($Pref::Server::ND::FloatAdminOnly && !%client.isAdmin) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Force Plant is admin only. Ask an admin for help."); | ||||
| 		ndmessageClient(%client, '', "\c6Force Plant is admin only. Ask an admin for help."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	NDM_PlantCopy.conditionalPlant(%client, true); | ||||
| 	NDM_PlantCopy.conditionalPlant(%client, true, false); | ||||
| } | ||||
|  | ||||
| //Alternative short command | ||||
| @@ -587,16 +620,16 @@ function serverCmdToggleForcePlant(%client) | ||||
| 	//Check admin | ||||
| 	if($Pref::Server::ND::FloatAdminOnly && !%client.isAdmin) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Force Plant is admin only. Ask an admin for help."); | ||||
| 		ndmessageClient(%client, '', "\c6Force Plant is admin only. Ask an admin for help."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	%client.ndForcePlant = !%client.ndForcePlant; | ||||
|  | ||||
| 	if(%client.ndForcePlant) | ||||
| 		messageClient(%client, '', "\c6Force Plant has been enabled. Use \c3/toggleForcePlant\c6 to disable it."); | ||||
| 		ndmessageClient(%client, '', "\c6Force Plant has been enabled. Use \c3/toggleForcePlant\c6 to disable it."); | ||||
| 	else | ||||
| 		messageClient(%client, '', "\c6Force Plant has been disabled. Use \c3/toggleForcePlant\c6 to enable it again."); | ||||
| 		ndmessageClient(%client, '', "\c6Force Plant has been disabled. Use \c3/toggleForcePlant\c6 to enable it again."); | ||||
| } | ||||
|  | ||||
| //Alternative short command | ||||
| @@ -672,34 +705,34 @@ function serverCmdFillWrench(%client) | ||||
| 	//Check version | ||||
| 	if(!%client.ndClient) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6You need to have the new duplicator installed to use Fill Wrench."); | ||||
| 		ndmessageClient(%client, '', "\c6You need to have the new duplicator installed to use Fill Wrench."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if(ndCompareVersion("1.2.0", %client.ndVersion) == 1) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Your version of the new duplicator is too old to use Fill Wrench."); | ||||
| 		ndmessageClient(%client, '', "\c6Your version of the new duplicator is too old to use Fill Wrench."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	//Check admin | ||||
| 	if($Pref::Server::ND::WrenchAdminOnly && !%client.isAdmin) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Fill Wrench is admin only. Ask an admin for help."); | ||||
| 		ndmessageClient(%client, '', "\c6Fill Wrench is admin only. Ask an admin for help."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	//Check mode | ||||
| 	if(%client.ndModeIndex != $NDM::StackSelect && %client.ndModeIndex != $NDM::BoxSelect) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Fill Wrench can only be used in Selection Mode."); | ||||
| 		ndmessageClient(%client, '', "\c6Fill Wrench can only be used in Selection Mode."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	//Check selection | ||||
| 	if(!isObject(%client.ndSelection) || !%client.ndSelection.brickCount) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Fill Wrench can only be used with a selection."); | ||||
| 		ndmessageClient(%client, '', "\c6Fill Wrench can only be used with a selection."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -716,21 +749,21 @@ function serverCmdNdStartFillWrench(%client, %data) | ||||
| 	//Check admin | ||||
| 	if($Pref::Server::ND::WrenchAdminOnly && !%client.isAdmin) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Fill Wrench is admin only. Ask an admin for help."); | ||||
| 		ndmessageClient(%client, '', "\c6Fill Wrench is admin only. Ask an admin for help."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	//Check mode | ||||
| 	if(%client.ndModeIndex != $NDM::StackSelect && %client.ndModeIndex != $NDM::BoxSelect) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Fill Wrench can only be used in Selection Mode."); | ||||
| 		ndmessageClient(%client, '', "\c6Fill Wrench can only be used in Selection Mode."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	//Check selection | ||||
| 	if(!isObject(%client.ndSelection) || !%client.ndSelection.brickCount) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Fill Wrench can only be used with a selection."); | ||||
| 		ndmessageClient(%client, '', "\c6Fill Wrench can only be used with a selection."); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| @@ -757,21 +790,21 @@ package NewDuplicator_Server_Final | ||||
| 			if(%remain != 1) | ||||
| 				%s = "s"; | ||||
|  | ||||
| 			messageClient(%client, '', "\c6Please wait\c3 " @ %remain @ "\c6 second" @ %s @ " before saving again!"); | ||||
| 			ndmessageClient(%client, '', "\c6Please wait\c3 " @ %remain @ "\c6 second" @ %s @ " before saving again!"); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		//Check admin | ||||
| 		if($Pref::Server::ND::SaveAdminOnly && !%client.isAdmin) | ||||
| 		{ | ||||
| 			messageClient(%client, '', "\c6Saving duplications is admin only. Ask an admin for help."); | ||||
| 			ndmessageClient(%client, '', "\c6Saving duplications is admin only. Ask an admin for help."); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		//Check mode | ||||
| 		if(%client.ndModeIndex != $NDM::PlantCopy) | ||||
| 		{ | ||||
| 			messageClient(%client, '', "\c6Saving duplications can only be used in Plant Mode."); | ||||
| 			ndmessageClient(%client, '', "\c6Saving duplications can only be used in Plant Mode."); | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| @@ -958,7 +991,7 @@ function ND_SaveFileInfo(%filename) { | ||||
| 	%info = $ND::FileDate[%filename]; | ||||
| 	%info_aftername = getSubStr(%info, strStr(%info, " (")+2, strLen(%info)); | ||||
| 	%date = getSubStr(%info_aftername, strLen(%info_aftername)-17, 17); | ||||
| 	%blid = getSubStr(%info_aftername, 0, strStr(%info_aftername, ")")); | ||||
| 	//%blid = getSubStr(%info_aftername, 0, strStr(%info_aftername, ")")); | ||||
| 	%name = getSubStr(%info, 9, strStr(%info, " (") - 9); | ||||
| 	 | ||||
| 	// Fix date format for sorting | ||||
| @@ -970,7 +1003,7 @@ function ND_SaveFileInfo(%filename) { | ||||
| 	%filetext = %sort @ | ||||
| 		"\c3" @ %namepart TAB | ||||
| 		"\c3" @ %name TAB | ||||
| 		"\c6" @ %blid TAB | ||||
| 		//"\c6" @ %blid TAB | ||||
| 		"\c6" @ %date | ||||
| 	; | ||||
| 	 | ||||
| @@ -1031,7 +1064,7 @@ function serverCmdAllDups(%client, %pattern) | ||||
| 		 | ||||
| 		%format = "<tab:400,550,650,750>"; | ||||
| 		if(%fileCount>0) { | ||||
| 			messageClient(%client, '', %format @ "\c6Name\t\c6Saved By\t\c6BL_ID\t\c6Date"); | ||||
| 			messageClient(%client, '', %format @ "\c6Name\t\c6Saved By\t\t\c6Date"); | ||||
| 		} | ||||
| 		for(%i = 0; %i < %fileCount; %i++) { | ||||
| 			%text = %sort.getRowText(%i); | ||||
| @@ -1064,6 +1097,7 @@ function serverCmdAD(%client, %pattern) {serverCmdAllDups(%client, %pattern);} | ||||
| //Cancel all active dups in case of spamming | ||||
| function serverCmdClearDups(%client) | ||||
| { | ||||
| 	echo("serverCmdClearDups " @ %client.name); | ||||
| 	if(!%client.isAdmin) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6Canceling all duplicators is admin only. Ask an admin for help."); | ||||
| @@ -1084,6 +1118,7 @@ function serverCmdClearDups(%client) | ||||
| //Plant as a different brick group | ||||
| function serverCmdPlantAs(%client, %t0, %t1, %t2, %t3, %t4) | ||||
| { | ||||
| 	echo("serverCmdPlantAs " @ %client.name @ " - " @ %t0 SPC %t1 SPC %t2 SPC %t3 SPC %t4); | ||||
| 	//Check mode | ||||
| 	if(%client.ndModeIndex != $NDM::PlantCopy) | ||||
| 	{ | ||||
| @@ -1119,7 +1154,7 @@ function serverCmdPlantAs(%client, %t0, %t1, %t2, %t3, %t4) | ||||
| 	if(!isObject(%targetGroup)) | ||||
| 	{ | ||||
| 		messageClient(%client, '', "\c6No brick group was found for \"\c3" @ %target @ "\c6\"."); | ||||
| 		messageClient(%client, '', "\c6Bricks will be planted in your own group!"); | ||||
| 		ndmessageClient(%client, '', "\c6Bricks will be planted in your own group!"); | ||||
| 		%client.ndSelection.targetGroup = ""; | ||||
| 		%client.ndSelection.targetBlid = ""; | ||||
| 		%client.ndUpdateBottomPrint(); | ||||
|   | ||||
| @@ -1,6 +1,12 @@ | ||||
| // This file should not exist. Fix later... | ||||
| //bls 3 | ||||
|  | ||||
| // ------------------------------------------------------------------- | ||||
|  | ||||
| // Utility | ||||
| function ndmessageClient(%client, %ignore, %msg) { | ||||
| 	commandToClient(%client, 'centerPrint', "<font:Verdana:20>" @ %msg, 4); | ||||
| } | ||||
|  | ||||
| //Math functions | ||||
| /////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| @@ -33,6 +39,21 @@ function ndTransformDirection(%dir, %steps, %mirrX, %mirrY, %mirrZ) | ||||
| 	return %dir; | ||||
| } | ||||
|  | ||||
| function ndColorFToI(%f){ | ||||
| 	%i = %f*255; | ||||
| 	%i = mFloor(%i + 0.5); | ||||
| 	return %i; | ||||
| } | ||||
|  | ||||
| function ndGetColorI(%color){ | ||||
| 	%color2 =  | ||||
| 		ndColorFToI(getWord(%color, 0)) SPC | ||||
| 		ndColorFToI(getWord(%color, 1)) SPC | ||||
| 		ndColorFToI(getWord(%color, 2)) SPC | ||||
| 		ndColorFToI(getWord(%color, 3)) | ||||
| 	; | ||||
| } | ||||
|  | ||||
| //Get the closest paint color to an rgb value | ||||
| function ndGetClosestColorID(%rgb) | ||||
| { | ||||
| @@ -42,7 +63,7 @@ function ndGetClosestColorID(%rgb) | ||||
|  | ||||
| 	for(%i = 0; %i < 64; %i++) | ||||
| 	{ | ||||
| 		%color = getColorI(getColorIdTable(%i)); | ||||
| 		%color = ndGetColorI(getColorIdTable(%i)); | ||||
|  | ||||
| 		%diff = vectorLen(vectorSub(%rgb, %color)); | ||||
|  | ||||
| @@ -71,7 +92,7 @@ function ndGetClosestColorID2(%rgba) | ||||
|  | ||||
| 	for(%i = 0; %i < 64; %i++) | ||||
| 	{ | ||||
| 		%color = getColorI(getColorIdTable(%i)); | ||||
| 		%color = ndGetColorI(getColorIdTable(%i)); | ||||
| 		%alpha = getWord(%color, 3); | ||||
|  | ||||
| 		%diff = vectorLen(vectorSub(%rgb, %color)); | ||||
| @@ -292,7 +313,7 @@ function FxDtsBrick::ndMirrorGhost(%brick, %client, %axis) | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					messageClient(%client, '', "\c6Sorry, your ghost brick is asymmetric and cannot be mirrored."); | ||||
| 					ndmessageClient(%client, '', "\c6Sorry, your ghost brick is asymmetric and cannot be mirrored."); | ||||
| 					return; | ||||
| 				} | ||||
|  | ||||
| @@ -341,7 +362,7 @@ function FxDtsBrick::ndMirrorGhost(%brick, %client, %axis) | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					messageClient(%client, '', "\c6Sorry, your ghost brick is asymmetric and cannot be mirrored."); | ||||
| 					ndmessageClient(%client, '', "\c6Sorry, your ghost brick is asymmetric and cannot be mirrored."); | ||||
| 					return; | ||||
| 				} | ||||
|  | ||||
| @@ -384,7 +405,7 @@ function FxDtsBrick::ndMirrorGhost(%brick, %client, %axis) | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				messageClient(%client, '', "\c6Sorry, your ghost brick is not vertically symmetric and cannot be mirrored."); | ||||
| 				ndmessageClient(%client, '', "\c6Sorry, your ghost brick is not vertically symmetric and cannot be mirrored."); | ||||
| 				return; | ||||
| 			} | ||||
| 		} | ||||
| @@ -443,6 +464,7 @@ function ndCreateSimpleBrickTable() | ||||
| 			} | ||||
| 			 | ||||
| 			%db.ndSubset = ndSubsetOfDatablock(%db); | ||||
| 			if(%db.ndSubset $= "") continue; | ||||
|  | ||||
| 			%file.openForRead(%db.brickFile); | ||||
| 			%file.readLine(); | ||||
| @@ -694,34 +716,41 @@ function GameConnection::doFillBricks(%this, %subset) | ||||
| 	%box = %this.ndSelectionBox.getWorldBox(); | ||||
| 	$ND::FillBrickCount = 0; | ||||
| 	ndUpdateSpawnedClientList(); | ||||
| 	ndFillAreaWithBricks(getWords(%box, 0, 2), getWords(%box, 3, 5)); | ||||
| 	 | ||||
| 	if(%subset == $ND::SubsetLogicBus) { | ||||
| 		$ND::FillBrickSubset = $ND::SubsetLogicWire; | ||||
| 		ndFillBus(getWords(%box, 0, 2), getWords(%box, 3, 5), getAngleIDFromPlayer(%this.getControlObject()), %this.currentColor); | ||||
| 	} else { | ||||
| 		ndFillAreaWithBricks(getWords(%box, 0, 2), getWords(%box, 3, 5)); | ||||
| 	} | ||||
|  | ||||
| 	//%s = ($ND::FillBrickCount == 1 ? "" : "s"); | ||||
| 	//messageClient(%this, '', "\c6Filled in \c3" @ $ND::FillBrickCount @ "\c6 brick" @ %s); | ||||
| 	%s = ($ND::FillBrickCount == 1 ? "" : "s"); | ||||
| 	ndmessageClient(%this, '', "\c6Filled in \c3" @ $ND::FillBrickCount @ "\c6 brick" @ %s); | ||||
| } | ||||
|  | ||||
| $ND::SubsetDefault        = 0; | ||||
| $ND::SubsetLogicWire      = 1; | ||||
| $ND::SubsetLogicBuffer    = 2; | ||||
| $ND::SubsetLogicBufferAl  = 3; | ||||
| $ND::SubsetLogicDff       = 4; | ||||
| $ND::SubsetLogicDffAl     = 5; | ||||
| $ND::SubsetLogicEnabler   = 6; | ||||
| $ND::SubsetLogicEnablerAl = 7; | ||||
| $ND::SubsetLogicBus       = 2; | ||||
| //$ND::SubsetLogicBuffer    = 2; | ||||
| //$ND::SubsetLogicBufferAl  = 3; | ||||
| //$ND::SubsetLogicDff       = 4; | ||||
| //$ND::SubsetLogicDffAl     = 5; | ||||
| //$ND::SubsetLogicEnabler   = 6; | ||||
| //$ND::SubsetLogicEnablerAl = 7; | ||||
|  | ||||
| // Which subset of fill bricks to use - normal or wire | ||||
| function ndSubsetOfDatablock(%data){ | ||||
| 	if(%data.isLogic) { | ||||
| 		if(%data.isLogicWire) { | ||||
| 			return $ND::SubsetLogicWire; | ||||
| 		} else if(strStr(%data.uiName, "Buffer") == 0) { | ||||
| 			return (strStr(%data.uiName, "Active Low")==-1) ? $ND::SubsetLogicBuffer : $ND::SubsetLogicBufferAl; | ||||
| 		} else if(strStr(%data.uiName, "D FlipFlop") == 0) { | ||||
| 			return (strStr(%data.uiName, "Active Low")==-1) ? $ND::SubsetLogicDff : $ND::SubsetLogicDffAl; | ||||
| 		}else if(strStr(%data.uiName, "Enabler") == 0) { | ||||
| 			return (strStr(%data.uiName, "Active Low")==-1) ? $ND::SubsetLogicEnabler : $ND::SubsetLogicEnablerAl; | ||||
| 		//} else if(strStr(%data.uiName, "Buffer") == 0) { | ||||
| 		//	return (strStr(%data.uiName, "Active Low")==-1) ? $ND::SubsetLogicBuffer : $ND::SubsetLogicBufferAl; | ||||
| 		//} else if(strStr(%data.uiName, "D FlipFlop") == 0) { | ||||
| 		//	return (strStr(%data.uiName, "Active Low")==-1) ? $ND::SubsetLogicDff : $ND::SubsetLogicDffAl; | ||||
| 		//}else if(strStr(%data.uiName, "Enabler") == 0) { | ||||
| 		//	return (strStr(%data.uiName, "Active Low")==-1) ? $ND::SubsetLogicEnabler : $ND::SubsetLogicEnablerAl; | ||||
| 		} else { | ||||
| 			return $ND::SubsetDefault; | ||||
| 			return ""; | ||||
| 		} | ||||
| 	} else { | ||||
| 		return $ND::SubsetDefault; | ||||
|   | ||||
| @@ -17,28 +17,30 @@ package NewDuplicator_Server | ||||
| //Client responded, so he has new duplicator | ||||
| function serverCmdNdHandshake(%this, %version) | ||||
| { | ||||
| 	echo("serverCmdNdHandshake " @ %this.name @ " - " @ %version); | ||||
| 	cancel(%this.ndHandshakeTimeout); | ||||
|  | ||||
| 	%this.ndClient = true; | ||||
| 	%this.ndVersion = %version; | ||||
|  | ||||
| 	//Inform client whether he has an outdated version | ||||
| 	switch(ndCompareVersion($ND::Version, %version)) | ||||
| 	{ | ||||
| 		case 1: | ||||
| 			%m =      "\c6Your version of the \c3New Duplicator\c6 is outdated! Some features might not work. "; | ||||
| 			%m = %m @ "(Server Version: \c3" @ $ND::Version @ "\c6 | Your Version: \c0" @ %version @ "\c6)"; | ||||
| 			//messageClient(%this, '', %m); | ||||
|  | ||||
| 		case 2: | ||||
| 			//Hide this message on long-running dedicated servers | ||||
| 			if($Sim::Time < 86400) | ||||
| 			{ | ||||
| 				%m =      "\c6Your version of the \c3New Duplicator\c6 is newer than the server's! Ask the host to update it! "; | ||||
| 				%m = %m @ "(Server Version: \c0" @ $ND::Version @ "\c6 | Your Version: \c3" @ %version @ "\c6)"; | ||||
| 				//messageClient(%this, '', %m); | ||||
| 			} | ||||
| 	} | ||||
| 	// nobody gives a shit | ||||
| 	//switch(ndCompareVersion($ND::Version, %version)) | ||||
| 	//{ | ||||
| 	//	case 1: | ||||
| 	//		%m =      "\c6Your version of the \c3New Duplicator\c6 is outdated! Some features might not work. "; | ||||
| 	//		%m = %m @ "(Server Version: \c3" @ $ND::Version @ "\c6 | Your Version: \c0" @ %version @ "\c6)"; | ||||
| 	//		messageClient(%this, '', %m); | ||||
| 	// | ||||
| 	//	case 2: | ||||
| 	//		//Hide this message on long-running dedicated servers | ||||
| 	//		if($Sim::Time < 86400) | ||||
| 	//		{ | ||||
| 	//			%m =      "\c6Your version of the \c3New Duplicator\c6 is newer than the server's! Ask the host to update it! "; | ||||
| 	//			%m = %m @ "(Server Version: \c0" @ $ND::Version @ "\c6 | Your Version: \c3" @ %version @ "\c6)"; | ||||
| 	//			messageClient(%this, '', %m); | ||||
| 	//		} | ||||
| 	//} | ||||
| } | ||||
|  | ||||
| //Compares two version numbers (major.minor.patch) | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| //bls 3 | ||||
| // Handles interactions with the handheld duplicator item. | ||||
| // ------------------------------------------------------------------- | ||||
|  | ||||
| @@ -230,15 +231,22 @@ package NewDuplicator_Server | ||||
| 	//Prevent accidently unequipping the duplicator | ||||
| 	function serverCmdUnUseTool(%client) | ||||
| 	{ | ||||
| 		if(%client.ndLastEquipTime + 1.5 > $Sim::Time) | ||||
| 			return; | ||||
|  | ||||
| 		if(%client.ndModeIndex == $NDM::StackSelect || %client.ndModeIndex == $NDM::BoxSelect) | ||||
| 		{ | ||||
| 			%client.ndToolSchedule = %client.schedule(100, ndUnUseTool); | ||||
| 		if( | ||||
| 			%client.ndLastEquipTime + 1.5 > $Sim::Time && | ||||
| 			isObject(%client.player) && | ||||
| 			getSubStr(%client.player.getMountedImage(0).getName(), 0, 8) $= "ND_Image" | ||||
| 		) { | ||||
| 			%client.ndLastEquipTime = ""; | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		 | ||||
| 		if(%client.ndModeIndex == $NDM::StackSelect || %client.ndModeIndex == $NDM::BoxSelect) | ||||
| 		{ | ||||
| 			//%client.ndToolSchedule = %client.schedule(100, ndUnUseTool); | ||||
| 			%client.ndUnUseTool(); | ||||
| 			return; | ||||
| 		} | ||||
| 	 | ||||
| 		parent::serverCmdUnUseTool(%client); | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										29
									
								
								scripts/server/logicFillBus.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								scripts/server/logicFillBus.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | ||||
| //bls 3 | ||||
|  | ||||
| //function ndRotateVector(%vector, %steps) | ||||
| function ndFillBus(%pos1, %pos2, %angleId, %color) { | ||||
| 	talk(%pos1 @ ", " @ %pos2 @ ", " @ %angleId); | ||||
| 	$ND::FillBrickColorID = %color + 1; | ||||
| 	ndFillAreaWithBricks(%pos1, %pos2); | ||||
| } | ||||
|  | ||||
| function ndNormalizeBox(%box) { | ||||
| 	%x1 = getWord(%box, 0); | ||||
| 	%y1 = getWord(%box, 1); | ||||
| 	%z1 = getWord(%box, 2); | ||||
| 	%x2 = getWord(%box, 3); | ||||
| 	%y2 = getWord(%box, 4); | ||||
| 	%z2 = getWord(%box, 5); | ||||
| 	return | ||||
| 		mMin(%x1, %x2) SPC | ||||
| 		mMin(%y1, %y2) SPC | ||||
| 		mMin(%z1, %z2) SPC | ||||
| 		mMax(%x1, %x2) SPC | ||||
| 		mMax(%y1, %y2) SPC | ||||
| 		mMax(%z1, %z2)     ; | ||||
| } | ||||
| function ndFillAreaWithBricks_box(%pos, %boxSize) { | ||||
| 	%boxHalf = vectorScale(%boxSize, 0.5); | ||||
| 	%box = vectorSub(%pos, %boxHalf) SPC vectorAdd(%pos, %boxHalf); | ||||
| 	ndFillAreaWithBricks(getWords(%box, 0, 2), getWords(%box, 3, 5)); | ||||
| } | ||||
| @@ -21,17 +21,17 @@ function NewDuplicatorMode::onCancelBrick(%this, %client){} | ||||
|  | ||||
| function NewDuplicatorMode::onCopy(%this, %client) | ||||
| { | ||||
| 	messageClient(%client, '', "\c6Copy can not be used in your current duplicator mode."); | ||||
| 	ndmessageClient(%client, '', "\c6Copy can not be used in your current duplicator mode."); | ||||
| } | ||||
|  | ||||
| function NewDuplicatorMode::onPaste(%this, %client) | ||||
| { | ||||
| 	messageClient(%client, '', "\c6Paste can not be used in your current duplicator mode."); | ||||
| 	ndmessageClient(%client, '', "\c6Paste can not be used in your current duplicator mode."); | ||||
| } | ||||
|  | ||||
| function NewDuplicatorMode::onCut(%this, %client) | ||||
| { | ||||
| 	messageClient(%client, '', "\c6Cut can not be used in your current duplicator mode."); | ||||
| 	ndmessageClient(%client, '', "\c6Cut can not be used in your current duplicator mode."); | ||||
| } | ||||
|  | ||||
| function NewDuplicatorMode::getBottomPrint(%this, %client){} | ||||
|   | ||||
| @@ -48,7 +48,7 @@ function ndRegisterPrefsToRtb() | ||||
| 	RTB_registerPref("Scatter Ghost Bricks",        "New Duplicator | Advanced", "$Pref::Server::ND::ScatterGhostBricks",  "bool",             "Tool_NewDuplicator", true,    false, false, ""); | ||||
| 	RTB_registerPref("Process Bricks per Tick",     "New Duplicator | Advanced", "$Pref::Server::ND::ProcessPerTick",      "int 1 50000",      "Tool_NewDuplicator", 300,     false, false, ""); | ||||
| 	RTB_registerPref("Box Selection Chunk Size",    "New Duplicator | Advanced", "$Pref::Server::ND::BoxSelectChunkDim",   "int 1 50000",      "Tool_NewDuplicator", 6,       false, false, ""); | ||||
| 	RTB_registerPref("Create Sym Table on Start",   "New Duplicator | Advanced", "$Pref::Server::ND::SymTableOnStart",     "bool",             "Tool_NewDuplicator", false,   false, false, ""); | ||||
| 	RTB_registerPref("Create Sym Table on Start",   "New Duplicator | Advanced", "$Pref::Server::ND::SymTableOnStart",     "bool",             "Tool_NewDuplicator", true,    false, false, ""); | ||||
|  | ||||
| 	//Restore default prefs | ||||
| 	RTB_registerPref("Check to restore defaults", "New Duplicator | Reset Prefs", "$ND::RestoreDefaultPrefs", "bool", "Tool_NewDuplicator", false, false, false, "ndRestoreDefaultPrefs"); | ||||
| @@ -96,7 +96,7 @@ function ndExtendDefaultPrefValues() | ||||
| 	if($Pref::Server::ND::ScatterGhostBricks  $= "") $Pref::Server::ND::ScatterGhostBricks  = true; | ||||
| 	if($Pref::Server::ND::ProcessPerTick      $= "") $Pref::Server::ND::ProcessPerTick      = 300; | ||||
| 	if($Pref::Server::ND::BoxSelectChunkDim   $= "") $Pref::Server::ND::BoxSelectChunkDim   = 6; | ||||
| 	if($Pref::Server::ND::SymTableOnStart     $= "") $Pref::Server::ND::SymTableOnStart     = false; | ||||
| 	if($Pref::Server::ND::SymTableOnStart     $= "") $Pref::Server::ND::SymTableOnStart     = true; | ||||
|  | ||||
| 	//Always set this to false so we don't accidently reset the prefs | ||||
| 	$ND::RestoreDefaultPrefs = false; | ||||
| @@ -138,7 +138,7 @@ function ndApplyDefaultPrefValues() | ||||
| 	$Pref::Server::ND::ScatterGhostBricks  = true; | ||||
| 	$Pref::Server::ND::ProcessPerTick      = 300; | ||||
| 	$Pref::Server::ND::BoxSelectChunkDim   = 6; | ||||
| 	$Pref::Server::ND::SymTableOnStart     = false; | ||||
| 	$Pref::Server::ND::SymTableOnStart     = true; | ||||
|  | ||||
| 	//Always set this to false so we don't accidently reset the prefs | ||||
| 	$ND::RestoreDefaultPrefs = false; | ||||
| @@ -189,7 +189,7 @@ function ndDeleteOutdatedPrefs() | ||||
| 	$Pref::Server::ND::FloatAdminOnly      = %floatAdminOnly; | ||||
| 	$Pref::Server::ND::SaveAdminOnly       = %saveAdminOnly; | ||||
| 	$Pref::Server::ND::LoadAdminOnly       = %loadAdminOnly; | ||||
| 	$Pref::Server::ND::FillBricksAdminOnly = %fillBricksAdminOnl; | ||||
| 	$Pref::Server::ND::FillBricksAdminOnly = %fillBricksAdminOnly; | ||||
| 	//Settings | ||||
| 	$Pref::Server::ND::TrustLimit          = %trustLimit; | ||||
| 	$Pref::Server::ND::AdminTrustBypass1   = %adminTrustBypass1; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Redo
					Redo