IDE: Isolate primitives-related code from objects

Far more maintainable than having this code rely on global variables
for its implementation.

Also will put common primitve objects (e.g. world_grid) in these files.