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 4
// This file should not exist. Fix later...
// -------------------------------------------------------------------
@ -200,6 +202,21 @@ function NDM_BoxSelect::onSelectObject(%this, %client, %obj, %pos, %normal)
%client.ndUpdateBottomPrint();
}
function ndRound(%v, %step) {
return mFloor(%v/%step + 0.5)*%step;
}
function ndCorrectBox(%box) {
%xl = ndRound(getWord(%box, 0), 0.5);
%yl = ndRound(getWord(%box, 1), 0.5);
%zl = ndRound(getWord(%box, 2), 0.2);
%xh = ndRound(getWord(%box, 3), 0.5);
%yh = ndRound(getWord(%box, 4), 0.5);
%zh = ndRound(getWord(%box, 5), 0.2);
%box2 = %xl SPC %yl SPC %zl SPC %xh SPC %yh SPC %zh;
return %box2;
}
function ndGetBoxFromRom(%b) {
%db = %b.getDatablock();
%box = %b.getWorldBox();
@ -207,7 +224,7 @@ function ndGetBoxFromRom(%b) {
%bh = getWords(%box, 3, 5);
%bl = vectorAdd(%bl, "0 0 " SPC (%db.brickSizeZ * 0.2));
%bh = vectorAdd(%bh, "0 0 " SPC (%db.logicRomZ * 0.2));
return %bl SPC %bh;
return ndCorrectBox(%bl SPC %bh);
}
function ndGetBoxFromZone(%b) {
@ -216,7 +233,7 @@ function ndGetBoxFromZone(%b) {
%scale = %z.getScale(); %sx = getWord(%scale, 0); %sy = getWord(%scale, 1); %sz = getWord(%scale, 2);
%bl = %pos;
%bh = vectorAdd(%pos, %sx SPC (-%sy) SPC %sz);
return %bl SPC %bh;
return ndCorrectBox(%bl SPC %bh);
}

View File

@ -48,7 +48,7 @@ function NDM_FillColor::onPlantBrick(%this, %client)
//Admin limit
if($Pref::Server::ND::PaintAdminOnly && !%client.isAdmin)
{
messageClient(%client, '', "\c6Paint Mode is admin only. Ask an admin for help.");
ndmessageClient(%client, '', "\c6Paint Mode is admin only. Ask an admin for help.");
return;
}
@ -63,7 +63,7 @@ function NDM_FillColor::onPlantBrick(%this, %client)
//Admin limit
if($Pref::Server::ND::PaintFxAdminOnly && !%client.isAdmin)
{
messageClient(%client, '', "\c6Paint Fx Mode is admin only. Ask an admin for help.");
ndmessageClient(%client, '', "\c6Paint Fx Mode is admin only. Ask an admin for help.");
return;
}

View File

@ -1,3 +1,5 @@
//bls 4
// This file should not exist. Fix later...
// -------------------------------------------------------------------
@ -26,6 +28,7 @@ function NDM_PlantCopy::onChangeMode(%this, %client, %nextMode)
{
%client.ndSelection.deleteData();
}
%client.ndOwnership = false;
}
//Kill this mode
@ -33,6 +36,7 @@ function NDM_PlantCopy::onKillMode(%this, %client)
{
//Destroy the selection
%client.ndSelection.delete();
%client.ndOwnership = false;
}
@ -112,12 +116,21 @@ function NDM_PlantCopy::onPlantBrick(%this, %client)
{
if($Pref::Server::ND::FloatAdminOnly && !%client.isAdmin)
{
messageClient(%client, '', "\c6Force Plant has been disabled because it is admin only. Ask an admin for help.");
ndmessageClient(%client, '', "\c6Force Plant has been disabled because it is admin only. Ask an admin for help.");
%client.ndForcePlant = false;
}
}
%this.conditionalPlant(%client, %client.ndForcePlant);
if(%client.ndOwnership) {
if(!%client.isAdmin) {
%client.ndOwnership = false;
ndmessageClient(%client, '', "\c6Ownership plant has been disabled because it is admin only.");
}
}
%this.conditionalPlant(%client, %client.ndForcePlant, %client.ndOwnership);
%client.ndOwnership = false;
}
//Cancel Brick
@ -160,7 +173,9 @@ function NDM_PlantCopy::getBottomPrint(%this, %client)
%l0 = "Pivot: \c3" @ (%client.ndPivot ? "Whole Selection" : "Start Brick") @ "\c6 [Prev Seat]";
if(isObject(%client.ndSelection.targetGroup))
if(%client.ndOwnership)
%l1 = "Planting as: Original Owner";
else if(isObject(%client.ndSelection.targetGroup))
%l1 = "Planting as: \c3" @ %client.ndSelection.targetGroup.name;
else
%l1 = "Size: \c3" @ %x @ "\c6 x \c3" @ %y @ "\c6 x \c3" @ %z @ "\c6 Plates";
@ -222,7 +237,7 @@ function NDM_PlantCopy::moveBricksTo(%his, %client, %pos, %normal)
}
//Check time limit and attempt to plant bricks
function NDM_PlantCopy::conditionalPlant(%this, %client, %force)
function NDM_PlantCopy::conditionalPlant(%this, %client, %force, %ownership)
{
//Check timeout
if(!%client.isAdmin && %client.ndLastPlantTime + ($Pref::Server::ND::PlantTimeoutMS / 1000) > $Sim::Time)
@ -252,7 +267,7 @@ function NDM_PlantCopy::conditionalPlant(%this, %client, %force)
getTrustLevel(%client, %client.ndSelection.targetGroup) < 1 &&
(!%client.isAdmin || !$Pref::Server::ND::AdminTrustBypass2))
{
messageClient(%client, '', "\c6You need build trust with \c3"
ndmessageClient(%client, '', "\c6You need build trust with \c3"
@ %client.ndSelection.targetGroup.name @ "\c6 to plant bricks in their group.");
return;
@ -264,5 +279,5 @@ function NDM_PlantCopy::conditionalPlant(%this, %client, %force)
%ang = %client.ndSelection.ghostAngleID;
%client.ndSetMode(NDM_PlantCopyProgress);
%client.ndSelection.startPlant(%pos, %ang, %force);
%client.ndSelection.startPlant(%pos, %ang, %force, %ownership);
}

View File

@ -1,3 +1,5 @@
//bls 4
// This file should not exist. Fix later...
// -------------------------------------------------------------------
@ -71,8 +73,13 @@ function NDM_StackSelect::onSelectObject(%this, %client, %obj, %pos, %normal)
//Start selection
%client.ndSetMode(NDM_StackSelectProgress);
if(%client.ndMultiSelect)
if(%client.ndSelection.brickCount==0)
%client.ndInitialMultiSelect = %client.ndMultiSelect;
if(%client.ndInitialMultiSelect)
%client.ndSelection.startStackSelectionAdditive(%obj, 2, %client.ndLimited);
else if(%client.ndMultiSelect)
%client.ndSelection.startStackSelectionAdditive(%obj, %client.ndDirection, %client.ndLimited);
else
%client.ndSelection.startStackSelection(%obj, %client.ndDirection, %client.ndLimited);