Skip to content

Commit

Permalink
added optional code to require beacons to be owned.
Browse files Browse the repository at this point in the history
added optional code to require beacons to be owned.
  • Loading branch information
Jason LeBoeuf committed Feb 10, 2015
1 parent 5d02685 commit b7b780e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions SE_NoBeacon.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#delete grid if no beacon, then if no wheels, rotor, piston pieces.
$nodes = $myXML.SelectNodes("//SectorObjects/MyObjectBuilder_EntityBase[(@xsi:type='MyObjectBuilder_CubeGrid')]" , $ns)
ForEach($node in $nodes){
$randombeacon = $node.SelectNodes("CubeBlocks/MyObjectBuilder_CubeBlock[(@xsi:type='MyObjectBuilder_Beacon')]/Owner" , $ns)
$beaconcount = $node.SelectNodes("CubeBlocks/MyObjectBuilder_CubeBlock[@xsi:type='MyObjectBuilder_Beacon']", $ns).count
IF($beaconcount -eq 0){
$ignoretotal = 0
Expand All @@ -34,6 +35,24 @@
$node.ParentNode.RemoveChild($node)
}
}

#remove the <# and #> at the top and bottom of this section to enable requiring beacons to be owned.
<#
ElseIf(($randombeacon|Get-Random) -eq $null){
$ignoretotal = 0
$rotorcount = $node.SelectNodes("CubeBlocks/MyObjectBuilder_CubeBlock[@xsi:type='MyObjectBuilder_MotorRotor']", $ns)
$pistoncount = $node.SelectNodes("CubeBlocks/MyObjectBuilder_CubeBlock[@xsi:type='MyObjectBuilder_PistonTop']", $ns)
$wheelcount = $node.SelectNodes("CubeBlocks/MyObjectBuilder_CubeBlock[@xsi:type='MyObjectBuilder_Wheel']", $ns)
$advrotorcount = $node.SelectNodes("CubeBlocks/MyObjectBuilder_CubeBlock[@xsi:type='MyObjectBuilder_MotorAdvancedRotor']", $ns)
$ignoretotal = $ignoretotal + $rotorcount.count + $pistoncount.count + $wheelcount.count + $advrotorcount.count
IF($ignoretotal -eq 0){
Write-Host -ForegroundColor Green "[$($node.DisplayName)] Deleted for no beacon owner"
Add-Content -path $deletedpath -Value "[$($node.DisplayName)] Deleted for no beacon owner"
Add-Content -path $deletedpath -Value "[ ]"
$node.ParentNode.RemoveChild($node)
}
}
#>
}


Expand Down

0 comments on commit b7b780e

Please sign in to comment.