add box features

This commit is contained in:
Redo
2025-02-26 17:36:12 -07:00
parent cd5b46cc3b
commit dd049be341
21 changed files with 1510 additions and 339 deletions

View File

@ -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();