Viewer is ready to go, I think

This commit is contained in:
2021-01-22 17:35:23 -05:00
parent 351b923d68
commit b0440a4e12
11 changed files with 234 additions and 34 deletions

View File

@@ -21,17 +21,23 @@ public:
// Always points back to the world model.
World *world_;
// Animation queue and plane item.
// Animation queue.
//
// To update the position of this tangible, first add an animation in which
// the tangible moves, then call plane_item.set_pos_from(anim_queue_).
PlaneItem plane_item_;
AnimQueue anim_queue_;
// Plane Item.
//
// The PlaneItem also contains this tangible's ID.
// To move this Tangible, update the anim_queue first, then update
// this plane_item_ from the anim_queue.
PlaneItem plane_item_;
// Player ID pool
//
// Note: this is only allocated if this Tangible is a player.
std::unique_ptr<IdPlayerPool> id_player_pool_;
void be_a_player();
};
class World {
@@ -66,18 +72,34 @@ public:
//
~World();
// Initialize for single-player mode.
//
void init_standalone();
// get_lua_state
//
// Get the lua interpreter associated with this world model.
//
lua_State *get_lua_state() { return lua_state_; }
// Make a tangible with a generated ID.
// scan_near
//
// Pushes the database onto the lua stack and returns the tangible pointer.
// Get a list of the tangibles near the specified player ID.
//
Tangible *tangible_make(lua_State *L);
std::vector<int64_t> scan_radius(const std::string &plane, float x, float y, float radius);
// Make a tangible.
//
// If the ID is zero, allocates an ID using the thread's ID allocator. If
// pushdb is true, pushes the tangible's database onto the lua stack.
// Otherwise, leaves the lua stack untouched.
//
Tangible *tangible_make(lua_State *L, int64_t id, bool pushdb);
// Get a pointer to the specified tangible.
//
Tangible *tangible_get(int64_t id);
// Delete a tangible with the specified ID.
//
// If the tangible doesn't exist, does nothing.