Update setZoneBox compatibility for release ver of Event_setZoneBox
This commit is contained in:
@ -163,7 +163,7 @@ function NDM_BoxSelect::onSelectObject(%this, %client, %obj, %pos, %normal)
|
||||
}
|
||||
else
|
||||
{
|
||||
%client.ndSelectionBox.ez_zoneBrick = "";
|
||||
%client.ndSelectionBox.zoneBrick = "";
|
||||
%box = %obj.getWorldBox();
|
||||
%p1 = getWords(%box, 0, 2);
|
||||
%p2 = getWords(%box, 3, 5);
|
||||
@ -185,7 +185,7 @@ function NDM_BoxSelect::onSelectObject(%this, %client, %obj, %pos, %normal)
|
||||
%box = ndGetBoxFromRom(%obj);
|
||||
} else if (isObject(%obj.physicalZone)) {
|
||||
%box = ndGetBoxFromZone(%obj);
|
||||
%client.ndSelectionBox.ez_zoneBrick = %obj;
|
||||
%client.ndSelectionBox.zoneBrick = %obj;
|
||||
} else {
|
||||
%box = ndGetPlateBoxFromRayCast(%pos, %normal);
|
||||
}
|
||||
@ -232,9 +232,12 @@ function ndGetBoxFromRom(%b) {
|
||||
function ndGetBoxFromZone(%b) {
|
||||
%z = %b.physicalZone;
|
||||
%pos = %z.position;
|
||||
%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);
|
||||
%scale = %z.getScale();
|
||||
%sx = getWord(%scale, 0);
|
||||
%sy = getWord(%scale, 1);
|
||||
%sz = getWord(%scale, 2);
|
||||
%bl = vectorAdd(%pos, 0 SPC -%sy SPC 0);
|
||||
%bh = vectorAdd(%pos, %sx SPC 0 SPC %sz);
|
||||
return ndCorrectBox(%bl SPC %bh);
|
||||
}
|
||||
|
||||
@ -354,12 +357,42 @@ function NDM_BoxSelect::onRotateBrick(%this, %client, %direction)
|
||||
%client.ndBoxChanged();
|
||||
}
|
||||
|
||||
function ndApplyZoneEvent(%brick, %p1a, %p2a, %client) {
|
||||
%pos = %brick.getPosition();
|
||||
%p1 = vectorSub(%p1a, %pos);
|
||||
%p2 = vectorSub(%p2a, %pos);
|
||||
|
||||
for(%i=0; %i<%brick.numEvents; %i++) {
|
||||
if(%brick.eventOutput[%i] $= "setZoneBox") {
|
||||
%brick.eventOutputParameter[%i, 1] = %p1;
|
||||
%brick.eventOutputParameter[%i, 2] = %p2;
|
||||
messageClient(%client, 'MsgError', "");
|
||||
commandToClient(%client, 'centerPrint',
|
||||
"<font:Verdana:20>\c6Applied selection box to zone event \c3" @ %i
|
||||
@ "\c6 on brick, and re-created zone.", 5);
|
||||
%brick.setZoneBox(%p1, %p2,
|
||||
%brick.eventOutputParameter[%i,3], 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
messageClient(%client, 'MsgError', "");
|
||||
commandToClient(%client, 'centerPrint', "<font:Verdana:20>\c6Cannot set zone" @
|
||||
" - Brick does not use the setZoneBox event.", 5);
|
||||
}
|
||||
|
||||
|
||||
//Plant Brick
|
||||
function NDM_BoxSelect::onPlantBrick(%this, %client)
|
||||
{
|
||||
if(!isObject(%client.ndSelectionBox))
|
||||
return;
|
||||
|
||||
if(isObject(%client.ndSelectionBox.zoneBrick)) {
|
||||
ndApplyZoneEvent(%client.ndSelectionBox.zoneBrick,
|
||||
%client.ndSelectionBox.point1, %client.ndSelectionBox.point2, %client);
|
||||
return;
|
||||
}
|
||||
|
||||
//If we have a selection, enter plant mode!
|
||||
if(%client.ndSelectionAvailable)
|
||||
{
|
||||
|
Reference in New Issue
Block a user