ID:2860399
 
Resolved
A new /pixloc primitive has been added, representing an x,y,z position including step_x/y offsets. It has support in various movement procs. As a primitive, it doesn't descend from /datum and can't be overridden.

Additionally, an atom.pixloc var has been added. This can be used to directly read or (for movables) write an atom's pixloc.

The new pixloc() proc creates a pixloc, and bound_pixloc() grabs the pixloc of the center/edge/corner of an atom's bounding box.
Applies to:DM Language
Status: Resolved (516.1648)

This issue has been resolved.
In my recent game jam entry, I found myself doing a lot of overrides to New() to allow easy creation of atoms off the turf grid. --I believe that 490 should have implemented a coordinate datum, which should have x and y values in absolute coordinates and integer z coordinate, and pseudo-variables that allow you to extract tile_x, tile_y, step_x, and step_y values from them.

This would facilitate the following:

* Overhaul New() to natively take a /coord *or* an atom as a loc argument, and simplify the process of doing pixel movement quite a lot.

* movable.Move(coord,Dir), to move to a location and face a specific direction.

* bounds(coord,w,h), obounds(coord,w,h)

* bounds(coords,coords) //grabs all objects overlapping two points

* get_step(coord,dir) //returns turf

* oview/range/hearers/viewers(dist,coord) //boils coords into tiles

* movable.loc = coord shorthand

* atom.coord(anchor), where anchor is 0..15, SOUTHWEST = bottom left corner, NORTHEAST = top right corner, EAST|WEST, NORTH|SOUTH, 0 = center, returns new coordinate of specified bounds anchor point.

* get_dir(coord | atom, coord | atom) //manhattan direction

* get_direction(coord | atom, coord | atom) //direction along 22.5 degree arc sections

* get_dist(coord | atom, coord | atom) //manhattan distance

* get_distance(coord | atom, coord | atom) //pythagorean distance

* bounds_dist(ref, coord | atom) //manhattan bounds distance

* bounds_distance(coord | atom, coord | atom) //pythagorean bounds distance

* get_angle(coord | atom, coord | atom) //arctan dx, dy shorthand

* locate(coords) //grabs the turf at point

* block(coords,coords) //grabs all turfs between two points


Coord should have at least the following methods:

Step(dir,dist)
Step(ang=0,dist)
Clamp(x=1,w=world_max_abs_x,h=1,h=world_max_abs_y)
getStep(dir,dist) //returns new coord
getStep(ang=0,dist) //returns new coord
getClamped(x=1,w=world_max_abs_x,h=1,h=world_max_abs_y) //returns new coord
Locate() //returns turf
Bounds(x,y,w,h) //similar to bounds() function


coords would be 1-indexed to match bounds(), but the default Move() override would subtract 1 automatically from them when used.


See my megathread in Design Philosophy:

https://www.byond.com/forum/post/2860395
Lummox JR resolved issue with message:
A new /pixloc primitive has been added, representing an x,y,z position including step_x/y offsets. It has support in various movement procs. As a primitive, it doesn't descend from /datum and can't be overridden.

Additionally, an atom.pixloc var has been added. This can be used to directly read or (for movables) write an atom's pixloc.

The new pixloc() proc creates a pixloc, and bound_pixloc() grabs the pixloc of the center/edge/corner of an atom's bounding box.