package util func RemoveFromSlice[T any](s []T, i int) []T { s[i] = s[len(s)-1] return s[:len(s)-1] } func SliceSwap[T any](s []T, x, y int) { tmp := s[x] s[x] = s[y] s[y] = tmp } func SafeGet[T any](s [][]T, at Vec2) T { var none T if at.X < 0 || at.Y < 0 || at.Y >= int64(len(s)) || at.X >= int64(len(s[0])) { return none } return s[at.Y][at.X] }