As any world can contain multiple domains, we let the domain handle the
sights calculations.
This is a change from how this previously was done, as previously
sight checks were only done for the top level World entity. This has
changes however, so that sights checks now are done for all entities.
When determining whether an entity can be seen, the system first checks
the size of the entity against the distance from the observer. If this
check fails, the system makes exceptions if the entity in case is
outfitted or wielded.
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.
* 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.
* common/Property.h: Add a flag to indicate a properties value
has been changed, but the new value has not been broadcast.
* rulesets/Thing.cpp: Re-write the Update handler to ignore the
operation arguments, and broadcast an update for all properties
marked as unsent.
* rulesets/Character.cpp: Update all code which sent an update
operation so that it sets the flags rather than naming them
in the argument.
* rulesets/attributes.h: Remove old attribute flags used for
persistence from the build.
* rulesets/Entity.h: Replace obsolete update flags with a more
general flags field, and define three needed to track the
cleanness of basic location data.
* rulesets/Plant.cpp, rulesets/World.cpp: Remove now unused update
flags from property initialisation.
* rulesets/Entity.cpp, rulesets/Thing.cpp, server/EntityFactory.cpp:
Replace code which updated update flags with simpler changes to
the new flags field.
* rulesets/LocatedEntity.h: Add onUpdated() virtual method to be
called when the attributes of an Entity are changed.
* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/LocatedEntity.cpp,
rulesets/Thing.cpp, server/WorldRouter.cpp: Implement onUpdated()
to emit the updated signal on Entity, and change all code to
call onUpdated instead of emiting the signal.
* rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h:
Don't allocated storage for m_contains by default, only
on demand. Add a convenience method which checks, and
allocates the storage if required. Set up the ID property
on this base class rather then Entity.
* rulesets/Py_Thing.cpp: Remove special handling of ID attribute
as it is now handled by the property.
* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/MemMap.cpp,
rulesets/Motion.cpp, rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp:
Make sure all parts of the code where contains is used have
the right checks, as it could be null.
* rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/LocatedEntity.cpp, rulesets/LocatedEntity.h,
rulesets/MemMap.cpp, rulesets/Motion.cpp, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/WorldRouter.cpp: Change LocatedEntity::m_contains into
a pointer so that the majority of entities that can not contain
anything don't waste the storage.
* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h: Remove raw atlas attributes, and use
properties for everything, cutting down the differences in
interface.
* rulesets/Py_Thing.cpp, rulesets/Thing.cpp: Remove code that accessed
soft attributes directly.
* client/CreatorClient.cpp, client/CreatorClient.h,
client/Py_CreatorClient.cpp, common/BaseWorld.h, common/types.h,
modules/Location.cpp, modules/Location.h,
rulesets/AtlasProperties.cpp, rulesets/AtlasProperties.h,
rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Character.h,
rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/EntityProperties.cpp, rulesets/LocatedEntity.cpp,
rulesets/LocatedEntity.h, rulesets/MemEntity.cpp,
rulesets/MemEntity.h, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Motion.h, rulesets/Py_Location.h, rulesets/Py_Mind.cpp,
rulesets/Py_Thing.cpp, rulesets/Py_Thing.h,
rulesets/PythonMindScript.h, rulesets/PythonScript.h,
rulesets/PythonThingScript.cpp, rulesets/PythonThingScript.h,
rulesets/Python_API.cpp, rulesets/Script.cpp, rulesets/Script.h,
rulesets/Thing.cpp, rulesets/World.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Refactor all the entity code so there is now
a new base class for entities in the world simulation, and in the
mind which only contains things which are trully common to both.
This moves a lot of functionality which should not have been
present in mind entities away, and makes that code safer and more
efficient.
* tests/TestWorld.h: Update the test world API to match the base
class.
* rulesets/Thing.cpp: Provide a more verbose error message about
incorrect updates.
* rulesets/mason/define_world.py: Make sure the arguments to
the python builtin range() is always an integer.
* rulesets/StatusProperty.cpp, rulesets/StatusProperty.h:
Add a dynamic property that deletes the entity when it goes
below zero, removing the need for the hard coded property
of the same name.
* rulesets/Makefile.am: Add the new property to the build.
* server/CorePropertyManager.cpp: Add the new property to the system.
* rulesets/mason/define_world.py: Add a test for setting the status
to below zero.
* rulesets/Entity.cpp: Remove the hard property for status.
* rulesets/Thing.cpp: Remove the code that checks the hard
status property to see if the entity needs to be deleted.
* client/BaseClient.cpp, client/CharacterClient.cpp,
client/CharacterClient.h, client/CreatorClient.cpp,
client/CreatorClient.h, rulesets/BaseMind.cpp, rulesets/BaseMind.h,
rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/MindFactory.cpp, rulesets/MindFactory.h, rulesets/Thing.cpp,
rulesets/World.cpp, server/Account.cpp, server/Connection.cpp,
server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp: Remove the hard name attribute, now that
most entities don't set it.
* rulesets/Entity.cpp: Initialise motion pointer to zero, so
so tests know whether it is there.
* rulesets/Thing.cpp: Don't attempt to do a movement update if
LOC is zero. It is a sign something not quite right is going on.
* tests/IGEntityExerciser.h: Check motion is not null before using
it.
* rulesets/Character.cpp, rulesets/MemMap.cpp, rulesets/Motion.cpp,
rulesets/Python_API.cpp, rulesets/TerrainProperty.cpp,
rulesets/Thing.cpp, rulesets/World.cpp: Don't use camel casing for
local variables or function arguments.
* 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/Thing.cpp: When moving, check if the entity has
LOC set. If not, print an error, and assert. This may be a
valid way to check for the TLVE, rather than relying on the
world class.
* rulesets/Thing.cpp: When deleting, check if the entity has
LOC set. If not, print an error, and assert. This may be a
valid way to check for the TLVE, rather than relying on the
world class.
* common/BaseEntity.cpp, common/BaseEntity.h, common/custom.cpp,
common/op_switch.h, rulesets/BaseMind.cpp, rulesets/Character.cpp,
rulesets/Character.h, rulesets/Thing.cpp, rulesets/Thing.h,
tests/EntityExerciser.h: Remove the long obsolete Action op from
the core code.
* data/mason.xml: Set default mass on bottle entity.
* tools/cycmd.cpp: Add help for upcoming delete command. Improve
readability by using available typedefs.
* rulesets/Thing.cpp: Hide some debug output.
* 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.
* rulesets/Thing.h, rulesets/Thing.cpp: Make updateProperties
const for the time being. Only treap Update operations as
generic updates if they don't have a refno. Improve the
Update operation handler comments.
* rulesets/Thing.cpp: Add some debug instrumentation to the new
Property update mechanism.
* rulesets/Character.cpp: Re-write the Wield handling code to use
Update ops.
* rulesets/Thing.cpp, rulesets/Thing.h: Add a new method to
generate a Sight(Set) for a designated set of modified attributes.
* ThingupdatePropertiestest.cpp: Add a test for the new method.
* rulesets/BaseMind.cpp, rulesets/Character.cpp, rulesets/Food.cpp,
rulesets/Plant.cpp, rulesets/Stackable.cpp, rulesets/Thing.cpp:
Remove script override calls from the individual C++ operation
methods, as script overrides are now done centrally.