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.
* 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.
* common/const.h: Add a second const for the non-squared default
box size for visibility calculations.
* modules/Location.cpp: Initialise cached box size members with
defaults from consts.
* rulesets/basic/mind/goals/common/move.py: Don't remove focus
knowledge about item just because it has been picked up. This
fixes eating acorns.
* rulesets/basic/mind/goals/common/misc_goal.py: Remove focus knowledge
when something is eaten.
* modules/Location.h, modules/Location.cpp: Add members to store
box diagonal size and bounding radius.
* tests/Locationtest.cpp: Test that the diagonal size and bounding
radius are updated correctly.
* modules/Location.h, modules/Location.cpp: Add methods to modify
bbox, and to report if it has been modifed so that cached values
can be computed.
* common/Property.h, common/Property_impl.h: Add a new type of
Property which emits a signal when modified.
* rulesets/EntityProperties.cpp, rulesets/Entity.cpp: Implement
signal Property and use it for bbox, so linking its signal
to Location so that the necessary values can be computed after
modification.
* rulesets/Character.cpp: Re-order code so that its not necessary
to lookup an entity that is to be moved unless we already know
its not the current entity.
* rulesets/Character.cpp: Implement destination based movement when
the target position is specified with a different LOC to the
current LOC of the character.
* modules/Location.cpp: Document the functions used to determine
relative distance vectors.
* modules/Location.cpp, modules/Location.h:
Add const accessors for location data, in preparation for
adding cached collision data which must be updated every
time data is modified.
* physics/Collision.cpp, rulesets/Character.cpp, rulesets/Entity.cpp,
rulesets/Entity.h, rulesets/MemMap.cpp, rulesets/Movement.cpp,
rulesets/Pedestrian.cpp, rulesets/Plant.cpp,
rulesets/Py_Location.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/Account.cpp, server/EntityFactory.cpp, server/Persistor.cpp,
server/Persistor_impl.h, server/Restorer_impl.h,
server/WorldRouter.cpp, tests/Locationtest.cpp:
Use the const accessors whenver reading data from Location.
* modules/Location.cpp: Fix a bug where POS was being corrupted
whenever velocity was supposed to be set.
* rulesets/basic/mind/goals/humanoid/mason.py: Convert ID to entity
before checking location.
* rulesets/mason/mind/PigMind.py: Convert ID to entity before
passing location to another function.
* modules/Location.h, modules/Location.cpp: Remove handling of
LOC attribute from readFromEntity() as every use of this function
has differen requirements.
* rulesets/MemMap.cpp: Implement setting LOC so that the minimum
of lookups in the world dictionary are required.
* server/EntityFactory.cpp: Implement setting LOC in a much simpler
way, as its always uninitialised at this point.
* client/BaseClient.cpp: Add a note that LOC is currently unhandled,
as there is nothing sane to do with it.
* modules/Location.cpp, modules/Location.h: Add a new method to
read location data from an Atlas Entity.
* rulesets/MemMap.cpp, server/EntityFactory.cpp, client/BaseClient.cpp:
Switch to using new function rather than Entity::getLocation.
* rulesets/Entity.h, rulesets/Entity_getLocation.h: Remove obsolete
getLocation method.
* modules/Location.cpp, modules/Location.h, rulesets/Python_API.cpp:
Implement a function for determining the horizontal distance
between two locations neglecting height difference, as for
locations on the terrain it is not relevant.
* rulesets/basic/mind/goals/common/move.py: Improve the coding of
the move_me_to_it goal, so distance determination is more effective.
Make distance independant of height.
Relax distances at which character is concidered to have arrived at
its destination.
* rulesets/basic/mind/Goal.py: Modify goal so that it understands
that a subgoal can be unfulfilled, but still not need to take any
action.
* modules/Location.cpp, modules/Location.h: Rejig flags on Location
so that there is one to indicate contents should be checked for
collision, and one to indicate contents is not a collision volume.
* rulesets/Movement.cpp: Modify collision code to check if an
entity is supposed to be checked for collisions.
* rulesets/Structure.cpp: Tweak the flag set on structures to
correctly show that their contents should be checked for collision.
* data/mason.xml: Make ploughed field into an area, and sort
out its bbox to be the right size.
* cyphesis.spec.in: Ensure rpm spec correctly obsoletes the old
mason and service rpms.
* modules/Location.cpp: Get rid of accidentally commited change
that screws up orientation.
* rulesets/Character.cpp: Provide more info about ops which
have TO set incorrectly.
* rulesets/MemMap.cpp: Don't set TO on look ops from memory.
* rulesets/basic/mind/NPCMind.py: Don't set TO on tick ops
from the mind.
* rulesets/Character.cpp: Add notes, and a check to ensure that
ops from the mind don't have TO set.
* rulesets/basic/mind/NPCMind.py,
rulesets/basic/mind/goals/common/misc_goal.py,
rulesets/basic/mind/goals/humanoid/mason.py: Don't set TO or FROM
on goals from the mind.
* common/Property.cpp: Add required type checks to property set
methods.
* modules/Location.cpp: Don't send LOC attribute when the
pointer is NULL.
* rulesets/EntityProperties.cpp: Add a Property specialisation
for list of IDs.
* rulesets/MemMap.cpp: Fix the memory code to use the correct
PARENTS attribute rather than type, which is not an Atlas
attribute.
* tests/IGEntityExerciser.h: Add debugging output to attribute
checks.
* modules/Location.cpp: Ensure that orientation is not used
when its invalid.
* rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp: Assert that the
return value of getXyz() is valid.
* rulesets/mason/define_world.py: Add a test function to add
a deer and a chicken.
* modules/Location.cpp, modules/Location.h: Add new function for
usefully calculating the distance vector of another entity.
* tests/distancetest.cpp: Update test to check new distance
function.
* rulesets/Python_API.cpp: Make the new distance vector function
available to python rather than the relative postion function.
* rulesets/basic/mind/Knowledge.py, rulesets/basic/mind/NPCMind.py:
Ensure that Knowledge really does handle arbitrary triples.
* rulesets/basic/mind/goals/common/misc_goal.py: Add new version
of transaction goal for transactions for hirelings.
* rulesets/basic/mind/goals/humanoid/transaction.py: Complete
the implementation of the trigger goal for hirelings.
* rulesets/mason/define_world.py: Move the mercenaries closer to
origin for debugging.
* modules/Location.cpp, physics/Collision.cpp, rulesets/Character.cpp,
rulesets/Entity.cpp, rulesets/Movement.cpp, rulesets/Movement.h,
rulesets/Pedestrian.cpp: Make sure orientation is not used if it
is not valid.
* modules/Location.cpp, modules/Location.h: Improve algorithm
of distance function to handle corner cases, and add a second
interface so that both scalar distance and relative position
can be found.
* tests/distancetest.cpp: Update tests to test for cases where
distance to or from an entity directly below.
* modules/Location.cpp, modules/Location.h: Add new improved
function to measure the distance between two entities.
* tests/distancetest.cpp: New test for new distance measuring
function.
* server/WorldRouter.cpp: Fixe debug output to work with new
pos type.
* modules/Location.cpp: Fix one of the transforms, so distance
calculation works again.
* physics/Vector3D.h, physics/Vector3D.cpp, modules/Location.h,
modules/Location.cpp: Convert to using WFMath::Point instead of
WFMath::Vector for position.
* physics/Collision.h, physics/Collision.cpp: Update collision code
to use new pos type.
* rulesets/Py_Point3D.h, rulesets/Py_Point3D.cpp: New python
wrappers for WFMath::Point.
* rulesets/Py_Location.cpp, rulesets/Py_Vector3D.cpp,
rulesets/Python_API.cpp:
Update python wrappers to take into account new pos type.
Ensure that only apropriate functionality is available for
point and vector.
* rulesets/Character.cpp, rulesets/Entity.cpp, rulesets/Entity.h,
rulesets/Line.cpp, rulesets/Movement.cpp, rulesets/Movement.h,
rulesets/Pedestrian.cpp, rulesets/Pedestrian.h,
rulesets/Plant.cpp, rulesets/Thing.cpp, rulesets/World.cpp,
server/EntityFactory.cpp, server/WorldRouter.cpp,
server/WorldRouter.h: Update the rest of the code for new pos
type, converting all places where entity parenting is changed
to use WFMath toParentCoords() and toLocalCoords() methods,
so that orientation is handled correctly.
* tests/transformtest.cpp: New test to ensure that toParentCoords()
and toLocalCoords() perform as expected.
* tests/Creatortest.cpp, tests/Locationtest.cpp, tests/Worldtest.cpp,
tests/collisiontest.cpp, tests/emergencetest.cpp:
Update the rest of the tests.