Commit graph

266 commits

Author SHA1 Message Date
Erik Ogenvik
4dfba8e043 Added a Propel property, describing propel force.
This is mainly the force used to propel characters forward. I.e.
walking, running and so on.
For now it's not activated, since we rely on proper physics to be
implemented first.
2016-01-21 09:26:43 +01:00
Erik Ogenvik
212b53acc7 Offset transforms when updating from Move.
The pos and orientation sent is after transformations have
been apply, so in order to set the correct entity transformation
we need to remove any external transformations from these values
first.
2016-01-20 15:34:48 +01:00
Erik Ogenvik
f72b8a5c26 Allow properties to alter other properties.
In order for this to work, we must always issue an Update
op after a Set op, so that we can handle any updated properties too.
We also have to add a new Entity flag to handle when the location
has been dirtied, since this isn't handled by normal properties.
2016-01-20 15:34:48 +01:00
Erik Ogenvik
4680f81ffb Altered signature to prevent ambiguity. 2016-01-20 15:34:48 +01:00
Erik Ogenvik
470d0e22fd Affect position directly.
No need to use an external transform for this kind of
ajustment.
2016-01-20 15:34:48 +01:00
Erik Ogenvik
8a161407f2 Let "transforms" property determine pos and orient
Instead of directly setting position and orientation we've now
added a "transforms" property. This property contains zero or many
transformations. The result of these is what drives changes to an
entity's position and orientation.
By cleanly separate disrete transformations we can more easily undo
or alter them. This allows us to do things where the position or
orientation of an entity is affected by other properties, or other
entities.

The client protocol is intact. Changes to position and orientation is
still sent the same way, by specifying "pos" and "orientation". However,
these values will now not be written directly to corresponding values on
 the entity. Instead they will first be written to the "transforms" property,
with the final values being a result of combining all data in the property.
2016-01-20 15:34:48 +01:00
Erik Ogenvik
d075dbf23b Take plantable adjustment into account.
When an entity which is "planted" is adjusted, we also look
for if there's any offset specified for the height adjustment.
2016-01-16 12:12:34 +01:00
Erik Ogenvik
29053340f0 Don't store domain in the motion object.
Though this change isn't fully set in stone. We have to revisit if we
add motion between physical domains. This change would at least prevent
segfaults when domains are destroyed.
2015-04-28 20:59:20 +02:00
Erik Ogenvik
3456d3f30a Return Unseen if Sight fails.
This should fix an issue with flushing not working, as well as making
the protocol work in a more stringent manner.
2015-04-15 23:07:28 +02:00
Erik Ogenvik
ea59b13819 Fix possible segfaults. 2014-09-30 23:36:10 +02:00
Erik Ogenvik
bb7d004e64 Send Disappear when moving out of domain.
It would be better to use a Broadcast of the Disappear op though, but
that would require a change so that the location is encoded in the op
which will be broadcasted. Otherwise the WorldRouter will just use the
location of the entity as it is when the op is processed, which will be
wrong for this case.
2014-09-22 20:14:41 +02:00
Erik Ogenvik
f837532dd8 Added methods for adding and removing children.
Virtual so that they can be caught in subclasses. This is mainly meant
for the Limbo entity.
2014-09-20 22:09:00 +02:00
Erik Ogenvik
d02ddca0d0 Moved collision detection to the Domain.
Collision detection should fully be handled by the domain, as should
sight checking.
The plan is to let the domain keep a separate structure of all collision
geometry, optimized in something like a quad or oct tree. Since the vast
majority of geometry is static, in the sense that it very seldom moves,
the Domain should keep a flat representation of all geometry, with
precomputer meshes for fast lookup.
Similarily it should keep a separate structure, or structures, for sight
checks.
And it should of course also use Bullet for collision detection.
2014-09-18 21:45:35 +02:00
Erik Ogenvik
23b2b71986 Moved visibility change calculations to the domain.
Currently it just iterates over all child entities, but this should of
course be done more efficient, with spacial trees.
2014-09-15 21:11:36 +02:00
Erik Ogenvik
0ed5fc60bd Mark the sending entity as perceptive. 2014-09-15 21:11:36 +02:00
Erik Ogenvik
2f3ab1da18 Let the Domain handle sights.
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.
2014-09-15 21:11:36 +02:00
Erik Ogenvik
b171410b05 Let the domain be specified by a property.
This means that we only attach domains to entities that have the
"domain" property. The "land" entity type for example.
2014-09-15 21:11:35 +02:00
Erik Ogenvik
118b3201ee Only send direct sights to perpective entities. 2013-11-24 00:59:35 +01:00
Erik Ogenvik
9ab3a7e723 Make entities destroy themselves.
This allows for other features to preempt the destruction.
2013-11-16 13:13:49 +01:00
Erik Ogenvik
e21622e742 Fixed issue with delete not seen by deleted entity
This resulted in any clients never getting any operation signalling that
the entity they are controlling has been deleted.
2013-08-05 20:42:22 +02:00
Olek Wojnar
7f9ff2246d Remove CVS $Id tags
The legacy tags are causing build issues in Debian.
2013-07-15 20:31:59 +02:00
Alistair Riddoch
ee12e2cd10 Remove obsolete dynamic cast 2013-01-18 14:57:40 +00:00
Alistair Riddoch
4a9c7078f7 Refactor to use LocatedEntity as base class
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.
2013-01-17 10:17:07 +00:00
Alistair Riddoch
ec03a3b546 Remove Thing_parent typedef 2012-12-04 23:48:40 +00:00
Alistair Riddoch
23823670a2 Merge branch 'transfercleanup'
Conflicts:
	TODO
2012-07-27 18:32:35 +01:00
Alistair Riddoch
e5177dddf2 Optionally return Info as a result of create
If the sender of the create op wants a response, they can specify a
serialno and this response will be generated.
2012-06-29 14:53:15 -07:00
Alistair Riddoch
e75eb13a74 Set refno on the result of look 2012-06-09 18:39:45 -07:00
Alistair Riddoch
5838626242 Remove dependency on WFMATH_EPSILON 2012-02-28 13:41:33 +00:00
Alistair Riddoch
fbbd7e0722 Avoid excessive conversions in time calculations 2011-04-27 19:55:32 +01:00
Alistair Riddoch
335e162cb0 Use movement domain to do all height constraint requests. 2009-05-12 23:30:19 +01:00
Al Riddoch
ab54d0fea2 2009-02-02 Al Riddoch <alriddoch@googlemail.com>
* 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.
2009-02-02 02:28:45 +00:00
Al Riddoch
497377be43 2008-11-11 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Character.cpp: Clean up some unused declarations and
	  headers.

	* rulesets/Plant.cpp, rulesets/Thing.cpp: Remove some unused
	  includes.
2008-11-11 00:45:52 +00:00
Al Riddoch
0015259b08 2008-10-01 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Thing.cpp, rulesets/Thing.h: Fix updateProperties() to be
	  not const, so it now compiles.
2008-10-01 15:32:39 +00:00
Al Riddoch
9043bba74b 2008-10-01 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Thing.cpp: When properties have been updated,
	  mark them to be stored in the Database, and emit the necessary
	  signal.
2008-10-01 10:47:53 +00:00
Al Riddoch
d656b2c708 2008-09-23 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-09-22 23:47:04 +00:00
Al Riddoch
77add6a173 2008-09-03 Al Riddoch <alriddoch@googlemail.com>
* rulesets/Thing.cpp: Correct the logic when checking whether
	  the entity has changed.
2008-09-03 10:17:50 +00:00
Al Riddoch
15faa7a6d7 2008-08-21 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-08-21 17:10:38 +00:00
Al Riddoch
b9e5f8d79f 2008-08-17 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-08-16 23:21:06 +00:00
Al Riddoch
ccf8bebcb0 2008-01-26 Al Riddoch <alriddoch@googlemail.com>
* common/BaseEntity.cpp, common/BaseEntity.h: Remove the code that
	  handle ID, and just inherit from Identified.

	* client/CharacterClient.cpp, client/CreatorClient.cpp,
	  common/OOGThing.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/Structure.cpp,
	  rulesets/Thing.cpp, rulesets/World.cpp, server/Account.cpp,
	  server/Admin.cpp, server/ExternalMind.cpp, server/Lobby.cpp,
	  server/Peer.cpp, server/Player.cpp, server/ServerRouting.cpp,
	  server/SlaveClientConnection.cpp: Add calls to the virtually
	  inherited Identified constructor as required.
2008-01-26 17:43:20 +00:00
Al Riddoch
24aa46bc4d 2008-01-05 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-01-05 14:05:05 +00:00
Al Riddoch
41bed0431b 2007-12-31 Al Riddoch <alriddoch@googlemail.com>
* 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.
2007-12-31 17:39:25 +00:00
Al Riddoch
0ccb03b1f6 2007-12-24 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-12-24 00:32:11 +00:00
Al Riddoch
8e8df5b482 2007-12-02 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-12-02 23:49:05 +00:00
Al Riddoch
e51bc5f622 2007-11-29 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-11-29 02:37:51 +00:00
Al Riddoch
bc880b3fe2 2007-11-29 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-11-29 01:13:27 +00:00
Al Riddoch
bd3a9e153c 2007-11-28 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-11-28 20:22:42 +00:00
Al Riddoch
82cf89acac 2007-11-23 Al Riddoch <alriddoch@zepler.org>
* rulesets/Thing.cpp: Set FROM and SECONDS on Set operations generated
	  by Updates.
2007-11-23 11:17:25 +00:00
Al Riddoch
a3e772fc37 2007-08-02 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-08-01 23:05:28 +00:00
Al Riddoch
7570359f75 2007-07-29 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-07-29 21:23:40 +00:00
Al Riddoch
2069f3dd4c 2007-07-29 Al Riddoch <alriddoch@zepler.org>
* 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:
2007-07-29 03:33:33 +00:00