Reveal selected ball centres before native split and verify exact selected IDs
This commit is contained in:
@@ -35,6 +35,21 @@ function BallPoint($Board,[string]$Id) {
|
||||
return @([int][Math]::Round(($width/2)+$local.X*$scale),[int][Math]::Round(($height/2)-$local.Y*$scale))
|
||||
}
|
||||
function WorldSafe($Point) { return $Point[0]-ge530-and$Point[0]-le1850-and$Point[1]-ge280-and$Point[1]-le750 }
|
||||
function BallClear($Board,[string]$Id) {
|
||||
$point=BallPoint $Board $Id
|
||||
if(!(WorldSafe $point)){return $false}
|
||||
$camera=$Board.camera
|
||||
$rotation=[Numerics.Quaternion]::new($camera.rotation.x,$camera.rotation.y,$camera.rotation.z,$camera.rotation.w)
|
||||
$origin=[Numerics.Vector3]::new($camera.target.x,($camera.target.y+.65),$camera.target.z)+[Numerics.Vector3]::Transform([Numerics.Vector3]::new(0,0,-$camera.distance),$rotation)
|
||||
foreach($ball in $Board.balls){
|
||||
if($ball.id-eq$Id){continue}
|
||||
$other=BallPoint $Board $ball.id
|
||||
$local=[Numerics.Vector3]::Transform([Numerics.Vector3]::new($ball.position.x,$ball.position.y,$ball.position.z)-$origin,[Numerics.Quaternion]::Inverse($rotation))
|
||||
$radius=540*.55/([Math]::Tan(31*[Math]::PI/180)*$local.Z)
|
||||
if([Math]::Pow($point[0]-$other[0],2)+[Math]::Pow($point[1]-$other[1],2)-lt[Math]::Pow($radius+8,2)){return $false}
|
||||
}
|
||||
return $true
|
||||
}
|
||||
function TapBall([string]$Name,$Board,[string]$Id) {
|
||||
$point=BallPoint $Board $Id
|
||||
if(!(WorldSafe $point)){throw "Refused unsafe native ball tap $Id at $($point-join',')"}
|
||||
|
||||
Reference in New Issue
Block a user