occupancy

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package occupancy maps grid cells to owning entities (placed buildings, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map struct {
	Width  int
	Height int
	// contains filtered or unexported fields
}

Map tracks which entity occupies each cell. Empty cells hold ecs.Nil.

func New

func New(width, height int) *Map

New creates a Width×Height occupancy map (all empty).

func (*Map) At

func (m *Map) At(x, y int) (ecs.Entity, bool)

At returns the entity at (x,y), if any.

func (*Map) Clear

func (m *Map) Clear(x, y int)

Clear empties a single cell.

func (*Map) ClearRect

func (m *Map) ClearRect(fp grid.Rect, e ecs.Entity)

ClearRect empties every cell in fp that currently holds e (or any if e is Nil).

func (*Map) Set

func (m *Map) Set(x, y int, e ecs.Entity)

Set assigns e to a single cell.

func (*Map) SetRect

func (m *Map) SetRect(fp grid.Rect, e ecs.Entity)

SetRect assigns e to every cell in fp.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL