Okay here's the thing. A lot of CocoMUD is still world-oriented, versus session-oriented. Worlds were here before characters or sessions. What it means is that a lot of feature are still centered on a world, and common to a world, instead of being spread on several clients as it should.
In our case, different clients are indeed created. However, only one sharp engine per world is created. Here's a very simple test:
- Open CocoMUD.
- Open a world (connect to it).
- Open the same world in a different tab of CocoMUD.
- Open the Python console in this tab (menu tools -> open Python console...).
- Type in the following:
(panel.client, panel.client.factory.sharp_engine.client)
- Compare both numbers. Repeat these steps in the other tab.
What happens is quite simple:
- CocoMUD connects the first time to the world.
- It creates a sharp engine for this world.
- It then connects another client to the same world.
- It already has a sharp engine for this world, so both clients share the same sharp engine.
This explains the situation. Now, a quick fix isn't a simple matter: the best option would be to remove the sharp engine from the world, and place it in the session (see source:src/session.py) which is incidentally ready for the change as you can see. A client equals a session, this is the closest analogy we have, so I would think the sharp engine should be bound here.
It's not a coincidence, however, if worlds are bound to a sharp engine: most methods used by the sharp engine and its functions work on the world. Take #macro
for instance which creates a macro in the world. When the world first loads, it reads the content of `config.set` file which contains the configuration specific to this world. This configuration shouldn't be read several times, just the first time the world is loaded.
Fix #136: remove the dependency of the sharp engine on world, add it to sessions