diff options
author | anon5 <anon5clam@protonmail.com> | 2021-06-21 18:47:26 +0000 |
---|---|---|
committer | anon5 <anon5clam@protonmail.com> | 2021-06-21 18:47:26 +0000 |
commit | 425da65ed46061303604610bb539d6495b2b1f3f (patch) | |
tree | 10ae3e665132c369ce0207676321cef870679923 /dir.go | |
parent | 9f239d341ef46b656dda759020da87bdd0606344 (diff) |
Add high-level protocol (de)serialization
Diffstat (limited to 'dir.go')
-rw-r--r-- | dir.go | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -0,0 +1,23 @@ +package mt + +// A Dir represents a direction parallel to an axis. +type Dir uint8 + +const ( + East Dir = iota // +X + Above // +Y + North // +Z + South // -Z + Below // -Y + West // -X + NoDir +) + +// Opposite returns the Dir's opposite. +// NoDir is its own opposite. +func (d Dir) Opposite() Dir { + if d >= NoDir { + return NoDir + } + return 5 - d +} |