Instead of the root entity always being the default one (for new
entities being created etc.) we now can specify another entity which is
the default one.
When an Update op is generated it will contain a refno as generated by
the server.
However, when connected as a Creator client _all_ operations sent to the
entity will also be sent to the mind. The Update ops will thus collide
with the serialno/refno pairs as created by the client. To avoid this we
need to remove the refno.
Perhaps Update should use something else than refno/serialno for
matching?
The relay mechanism, through the new internal Relay operation, allows
one external client to relay an operation to another external client,
and get the response back.
This can currently only be used by Creator clients. It's main use is for
mind introspection.
All IG code should use the interface of LocatedEntity when dealing
with any entity, rather than sometimes requiring Entity. Add virtual
functions to the interface where required, and modify all other interfaces
to stop them using Entity. This makes the code way cleaner, and much better
de-coupled.
The Link reference provided is the object allowing direct communication
back to the external source of the operation. This allows us to handle
things more cleanly in some cases.
* common/Identified.cpp, common/Identified.h:
Flatten down the base classes into one called Router.
* client/CharacterClient.cpp, client/CreatorClient.cpp,
rulesets/BaseMind.cpp, rulesets/Character.cpp,
rulesets/Creator.cpp, rulesets/Entity.cpp,
rulesets/LocatedEntity.cpp, rulesets/MemEntity.cpp,
rulesets/Plant.cpp, rulesets/Stackable.cpp,
rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/Admin.cpp,
server/Connection.cpp, server/ExternalMind.cpp,
server/Lobby.cpp, server/Master.cpp,
server/Peer.cpp, server/Player.cpp,
server/ServerRouting.cpp, server/SlaveClientConnection.cpp,
server/TrustedConnection.cpp, tests/LocatedEntitytest.cpp,
tests/ThingupdatePropertiestest.cpp: Update all the operation
routing classes to use the modified base class correctly.
* rulesets/Creator.h, rulesets/Creator.cpp: Remove the special
case for sending to the mind of Creator, as the difference
is now handled by ExternalMind itself in a more general way.
* rulesets/Creator.cpp: Remove code for removing Creators once
they've been disconnected, and simply mark them as ephemeral.
* server/ExternalMind.h, server/ExternalMind.cpp: Change
the external mind so it stores a reference to the character it
is the mind for, and stores a pointer to the connection rather
than a reference so it can be nulled when the connection is
removed on unsubscribed. Implement removing an ephemeral avatar
character on disconnection.
* server/Connection.cpp: Re-work the connection code to deal with
a character still having an external mind on connection, and not
removing the external mind at disconnection.
* rulesets/Creator.cpp: Add a short path for the results of an
operation from an external mind to be returned to the external
mind, removing the need for remote admin clients to become
perceptive.
* data/basic.xml, data/characters.xml, data/mason.xml: Add tick
properties to a bunch of entity classes so they no longer need
a setup operation to get them going.
* rulesets/mason/world/objects/Weather.py,
rulesets/mason/world/objects/elements/Fire.py,
rulesets/mason/world/objects/plants/seeds/Apple.py: Remove setup
handlers from a bunch of scripts as it is now handled by
properties.
* data/buildings.xml: Add setup property to entity classes which
really need a setup op at startup.
* client/BaseClient.cpp: Send a look when creating the avatar, so
that notifications get back without the need for a special case.
* common/op_switch.h, rulesets/Creator.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, server/WorldRouter.cpp:
Remove the setup operation sent to all entities on startup by
default. Get rid of some special cases that depended on it.
* rulesets/InternalProperties.cpp, rulesets/InternalProperties.h:
Make the tick property schedule the operation on apply(), and
use the property value as the time to schedule it.
* rulesets/Entity.h: Move entity flags to the top of the header.
Replace destroyed and perceptive booleans with flag values,
and re-work check methods accordingly.
* rulesets/Entity.cpp, rulesets/Creator.cpp, rulesets/Character.cpp:
Ensure that destroyed and perceptive flags are used correctly.
* common/BaseEntity.cpp, common/custom.cpp, common/inheritance.cpp,
common/inheritance.h, common/op_switch.h, common/types.h,
rulesets/Character.cpp, rulesets/Creator.cpp,
rulesets/PythonThingScript.cpp, server/Account.cpp,
server/Connection.cpp, server/ExternalMind.cpp,
tests/OOGThingtest.cpp, tests/inheritancetest.cpp:
Remove a set of pointless definitions, and use the originals
throughout the code.
* common/log.cpp, common/log.h: Switch to taking a C++ string reference
rather than a char *, as it is not really an optimisation, and it
makes the code simpler to read and write.
* client/BaseClient.cpp, client/ClientConnection.cpp,
common/AtlasFileLoader.cpp, common/BaseEntity.cpp,
common/Database.cpp, common/globals.cpp, common/id.cpp,
common/inheritance.cpp, common/log.cpp, common/log.h,
rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
rulesets/MemMap.cpp, rulesets/Motion.cpp, rulesets/Pedestrian.cpp,
rulesets/Py_Object.cpp, rulesets/Py_RootEntity.cpp,
rulesets/PythonMindScript.cpp, rulesets/PythonThingScript.cpp,
rulesets/Python_API.cpp, rulesets/Thing.cpp, server/Account.cpp,
server/Admin.cpp, server/ArithmeticFactory.cpp,
server/CommClient.cpp, server/CommListener.cpp,
server/CommMDNSPublisher.cpp, server/CommServer.cpp,
server/Connection.cpp, server/EntityFactory.cpp,
server/Persistance.cpp, server/Restoration.cpp,
server/ScriptFactory.cpp, server/TaskFactory.cpp,
server/WorldRouter.cpp, server/server.cpp: Convert over to using
new API correctly.
* data/mason.xml: Add biomass and transient to fircone, making its
script obsolete:
* rulesets/Character.cpp, rulesets/Creator.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Pedestrian.cpp, rulesets/Py_Thing.cpp,
rulesets/Stackable.cpp, rulesets/Thing.cpp, rulesets/World.cpp:
Remove m_world member variable from all Entity classes, and
access the world manager object as a singleton.
* common/BaseEntity.cpp, common/BaseEntity.h: Remove opEnumerate
method as its now a trivila call to another method.
* rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Creator.cpp:
Replace calls to opEnumerate with direct calls to getClassNo().
* common/BaseEntity.cpp, rulesets/Character.cpp, rulesets/Creator.cpp,
server/Account.cpp, server/Admin.cpp, server/Connection.cpp,
server/Lobby.cpp, server/WorldRouter.cpp: Don't bother with serial
numbers on ops generated inside the server. They just leak and upset
clients.
* rulesets/Entity.cpp, rulesets/Creator.cpp, common/BaseEntity.cpp:
Catch the last few places, and ensure refno is only set if
serialno is set on the causing op.
* common/BaseWorld.h, rulesets/Creator.cpp, rulesets/World.cpp,
server/WorldRouter.cpp, server/WorldRouter.h, tests/TestWorld.h:
Pass perceptive entities to the world by pointer rather than
by ID, avoiding a lookup in the dictionary.
* rulesets/Creator.cpp: Send an unseen op if admin attempts to
puppet something that does not exist. Add some comments and
a FIXME.
* TODO: Add a note about the lack of crossover between ops used
by OOG code and IG code.
* rulesets/Creator.cpp: When an op is being source routed by an admin
client, find its target and insert it into the world using the
target so it appears to be from the target, rather than using
the "cheat" marker.
* server/WorldRouter.cpp: Remove check for FROM=="cheat", and
simplify setting FROM on ops. Use flags to check for FUTURE_SECONDS.
* rulesets/Creator.cpp: Reply to client with Unseen op when client
looks for an IG entity by name or type which returns no results.
* tools/cycmd.cpp: Add a cancel command to stop current running task.
Detect Unseen at the end of a flush task, and end the task.
Remove a bunch of debug output. Fix typo in add_agent output.
* tools/cycmd.cpp: Modify flusher so it uses tick ops to schedule
regular queries, until no more are found rather then attempting
to purge all entities asap, which caused race conditions. Check
the type of entities before deleting them.
* rulesets/Creator.cpp: Improve debug output. Don't dispatch ops
from client to creator locally if the are scheduled to occur
in the future.
* rulesets/Creator.cpp: Ensure Look returns nothing when client
is searching by name or type, and nothing is found.
* tools/cycmd.cpp: Add help for some more commands. Ensure help is
formatted ok, no matter how long the commands are. Report an
error if commands that required an argument don't get one.
Ensure find_by_name and find_by_type still work ok if
nothing is seen.
* common/BaseEntity.h, common/BaseEntity.cpp: Add an integer ID
member variable, and accessor, and require it to be initialised
along with string ID in constructor.
* common/const.cpp, common/const.h: Add a const for the integer value
of the world ID.
* rulesets/Area.cpp, rulesets/Area.h, rulesets/BaseMind.cpp,
rulesets/BaseMind.h, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Creator.cpp, rulesets/Creator.h, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/Food.cpp, rulesets/Food.h,
rulesets/Line.cpp, rulesets/Line.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/Plant.cpp, rulesets/Plant.h,
rulesets/Stackable.cpp, rulesets/Stackable.h, rulesets/Structure.cpp,
rulesets/Structure.h, rulesets/Thing.cpp, rulesets/Thing.h,
rulesets/World.cpp, rulesets/World.h: Add integer ID handling to
constructors of all in-game entity classes.
* rulesets/MemMap.cpp: Initialise integer ID of entities in the mind
map.
* rulesets/MindFactory.cpp, rulesets/MindFactory.h: Handle integer
ID when constructing mind objects.
* server/EntityFactory.cpp, server/EntityFactory.h,
server/PersistantThingFactory_impl.h: Handle integer
ID when contructing entity objects.
* server/Restoration.cpp, server/Restoration.h, server/Restorer.h,
server/Restorer_impl.h: Handle integer ID when restoring from
database.
* server/WorldRouter.cpp: Assign integer ID when constructing the
world.
* rulesets/basic/mind/NPCMind.py: Don't respond to knowledge
queries if the character has no knowledge.
* server/Connection.cpp, rulesets/Creator.cpp, rulesets/Character.cpp:
Use flag check to see if operations have FROM set, rather than
checking for an empty string.
* rulesets/Thing.cpp: When handling move ops, avoid lookup of LOC
in world unless it has changed.
* rulesets/Character.cpp, rulesets/Creator.cpp: Modify operations
in place rather than copying first in the mind operation interface
as this should be much more efficient.
* common/BaseEntity.cpp, common/custom.cpp, common/op_switch.h,
common/types.h, rulesets/BaseMind.cpp, rulesets/Character.cpp,
rulesets/Creator.cpp, rulesets/Food.cpp, rulesets/Plant.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/Admin.cpp,
server/Admin.cpp: Replace OpNo enumeration with defines for the
integer class numbers. Expand the switch statements used for op
dispatch because runtime extended op definitions don't have a const
number.
* server/EntityFactory.cpp: Re-order installation of ops to ensure
the number registered in enumeration maps is the one returned by
the Atlas factories.
* rulesets/Character.cpp: Improve debug output for op handling when
debug is enabled for this file.
* server/Account.cpp, server/Admin.cpp, server/CommClient.cpp,
server/Connection.cpp: Don't set refno on unicast OOG ops,
instead set them at the interface with the client in one
place.
* server/WorldRouter.cpp: Modify setting refno on IG ops so its
now only set on unicast responses.
* rulesets/Creator.cpp: Set refno on responses direct ops from creator
clients more manually.
* common/BaseEntity.cpp: Only set refno on unicast error ops.
* common/refno.h: Disable as this file is no longer used.