Skip to content

grid.subgrid defaults to the last index instead of an IndexError #39

@jon-wurtz

Description

@jon-wurtz

The following code snippet, when run through an animator, generates the following animation. Observe that the Y destination index (7) is outside the bounds of the geometry (which goes from 0 to 4). This should raise an IndexError. Similarly, asking for index -1 gives you the second-to-last index instead of the last index.

@move
def foo_move():
    zone = spec.get_static_trap(zone_id="traps")
    src = grid.sub_grid(zone, [-1], [3])
    dst = grid.sub_grid(zone, [15], [7])
    waypoints = ilist.IList([src, dst])
    
    init.fill([spec.get_static_trap(zone_id="traps")])
    move_by_waypoints(waypoints, True, True)
error.mp4

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinginvalidThis doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions