Skip to content

Commit 1ea81ec

Browse files
feat: Reducing Turtle Verbosity ( Fixes #160 )
1 parent dd66872 commit 1ea81ec

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

Types/Turtle/get_Heading.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
Gets the current heading of the turtle.
66
#>
77
param()
8-
if ($null -ne $this.'.TurtleHeading') {
9-
return $this.'.TurtleHeading'
8+
if ($this -and -not $this.psobject.properties['.TurtleHeading']) {
9+
$this.psobject.properties.add([PSNoteProperty]::new('.TurtleHeading', 0.0), $false)
1010
}
11-
return 0
11+
return $this.'.TurtleHeading'
1212

Types/Turtle/set_Heading.ps1

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,4 @@ $Heading
1515
if ($this -and -not $this.psobject.properties['.TurtleHeading']) {
1616
$this.psobject.properties.add([PSNoteProperty]::new('.TurtleHeading', 0), $false)
1717
}
18-
$this.'.TurtleHeading' = $Heading
19-
20-
# $this.psobject.properties.add([PSNoteProperty]::new('.TurtleHeading', $Heading), $false)
21-
# $this | Add-Member -MemberType NoteProperty -Force -Name '.TurtleHeading' -Value $Heading
22-
if ($VerbosePreference -ne 'SilentlyContinue') {
23-
Write-Verbose "Heading to $Heading"
24-
}
18+
$this.'.TurtleHeading' = $Heading

Types/Turtle/set_IsPenDown.ps1

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ param(
22
[bool]
33
$IsDown
44
)
5-
6-
$this |
7-
Add-Member -MemberType NoteProperty -Force -Name '.IsPenDown' -Value $IsDown
8-
9-
if ($VerbosePreference -ne 'SilentlyContinue') {
10-
Write-Verbose "Turtle is now $($IsDown ? 'down' : 'up')"
11-
}
5+
if ($null -eq $this.'.IsPenDown') {
6+
$this | Add-Member -MemberType NoteProperty -Force -Name '.IsPenDown' -Value $IsDown
7+
} else {
8+
$this.'.IsPenDown' = $IsDown
9+
}

0 commit comments

Comments
 (0)