Commit graph

145 commits

Author SHA1 Message Date
Erik Ogenvik
731383150c Improved logging and removed dead code. 2016-06-26 14:27:24 +02:00
Erik Ogenvik
c9ebbfd6c6 Added method for determining visibility.
And then use that to determine if parent locations should be shown.
2016-06-26 14:18:37 +02:00
Erik Ogenvik
5ab3e5e61f Made logic for distance checks more sound. 2016-06-26 13:17:32 +02:00
Erik Ogenvik
760f92f707 Alter how visibility is determined.
When checking visibility, we now use the Domains more extensively.
The base rules are:
* If an entity is a child of a domain-less entity, visiblity for the
  child is the same as for the parent.
* If an entity is a child of a domain-holding entity, visibility is
  determined by the Domain.
* Entities cannot observe things above a Domain.
* Entities can observe things below a Domain, if the Domain allows it.

These rules are not yet set in stone. We need some more time figuring out
exactly how we want visibility implemented. We're striving for a balance
between a powerful but not too complex system, with good performance.
2016-06-22 17:29:27 +02:00
Erik Ogenvik
4f368a6fbc Let parent domain decide visibility and movement.
When visibility is determined, we always query the parent domain, and
never any ancestor domain.

The idea is to make the system more easy to follow.
2016-06-22 17:29:27 +02:00
Erik Ogenvik
8c62d8afb4 Don't show children of the world by default.
The world, i.e. the root entity, is a little special in that its
properties can be seen by all other entities, but not its children
(unless it's a Domain entity).
2014-09-15 21:11:36 +02:00
Erik Ogenvik
8b9224b9ad Remove default root "terrain" property.
Since we now allow this to be placed on other entities.
2014-09-09 20:46:30 +02:00
Erik Ogenvik
2706c5558a Move terrain eat handling to property.
This follows earlier work where we've moved more and more functionality
out of the entity classes and into properties. One of the goals of this
change is to allow for the "terrain" property to be added to arbitrary
entities.
2014-08-26 21:09:51 +02:00
Erik Ogenvik
79d6bda7b2 Properly remove properties with delegates. 2014-08-26 21:09:02 +02:00
Erik Ogenvik
7293843265 Added method for resetting the world.
The world can be reset, i.e. all entities deleted and properties of the
root cleared, by sending a Delete to the world itself. It must have an
argument with both the world id and an int "force" attribute with the
value 1.
2013-11-24 11:32:10 +01:00
Erik Ogenvik
16eff14dc9 Allow instant deletion of entities through world.
If a Delete op is sent to the World with an arg with an id set the
entity with that id is instantly deleted.
This provides an override mechanism whereby an entity can be deleted
directly, by an administrator. This in contrast to the regular delete
flow where a Delete op is sent to the entity itself, and thus can be
intercepted and cancelled.
2013-11-16 17:56:32 +01:00
Erik Ogenvik
2c2ac52f54 Enable relayed ops for all entities.
When a relayed op is sent to an entity it's handled like any other
operation. As a relayed response a Sight of the original operation is
sent back.
2013-09-03 14:09:13 +02:00
Erik Ogenvik
0c48f89202 Added ability to relay ops through World.
Since the World entity is special, in that it always exists, it's
suitable as a point through which out of game instances can relay
operations to in-game entities.
2013-08-21 20:52:11 +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
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
0ccfcd9700 Remove World_parent typedef 2012-12-04 23:50:34 +00:00
Alistair Riddoch
c9c41fad4b Fix the plant nourishment calculation
This should result on a much more sane growth rate, though it does
still have to assume that there is one tick per minute.
2012-01-09 17:04:39 +00:00
Alistair Riddoch
a1331db7e4 Migrate World to using TypeNode inheritance checks 2011-12-09 13:16:11 +00:00
Alistair Riddoch
e179b009e1 Remove two protected functions and replace them with trivial inline code. 2009-08-21 14:27:41 +01:00
Alistair Riddoch
269dda30b5 Remove obsolete getHeight functions from the world. 2009-08-21 03:20:46 +01:00
Alistair Riddoch
610c5f2e87 Remove unnnecessary includes 2009-05-13 23:50:28 +01:00
Alistair Riddoch
15d6673aaa Remove the pointless flags argument to CalendarProeprty constructor 2009-05-13 23:43:35 +01:00
Alistair Riddoch
0c84ff582d Move terrain data store from the world entity to the property 2009-05-13 23:40:48 +01:00
Alistair Riddoch
9d9f2d2fa3 Depend on the Terrain property for surface calls 2009-05-13 17:57:12 +01:00
Alistair Riddoch
45df863891 Move terrain tracking data structures to the terrain property 2009-05-13 16:45:50 +01:00
Alistair Riddoch
cd1f42c3f9 Rename Inheritance class files to match class name. 2009-03-20 15:31:38 +00: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
b088a5138e 2008-11-17 Al Riddoch <alriddoch@googlemail.com>
* rulesets/World.cpp: Improve error reporting.
2008-11-17 18:11:55 +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
d1fc9166a2 2008-08-14 Al Riddoch <alriddoch@googlemail.com>
* rulesets/TerrainProperty.cpp, rulesets/World.cpp: Fix the code
	  to take account of the modified semantics of Segment member
	  variable xref and yref.

	* configure.ac: Add a requirement for the latest version of
	  Mercator.
2008-08-14 11:20:09 +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
555c8976b3 2007-12-27 Al Riddoch <alriddoch@zepler.org>
* rulesets/World.cpp: Fix a brief and blatantly obvious comment.
2007-12-29 01:31:04 +00:00
Al Riddoch
1f0c5d1f4d 2007-12-03 Al Riddoch <alriddoch@zepler.org>
* data/animals.xml: Give all the animals BIOMASS.

	* data/characters.xml: Add mass to some character classes that were
	  missing it.

	* rulesets/Character.cpp, rulesets/Character.h, rulesets/Entity.cpp,
	  rulesets/Entity.h, rulesets/Plant.cpp, rulesets/Statistics.cpp,
	  rulesets/World.cpp, server/CorePropertyManager.cpp,
	  server/Persistor.cpp, server/Persistor_impl.h,
	  server/Restorer_impl.h: Remove the hard coded mass property from
	  Entity.

	* rulesets/mason/world/statistics/Statistics.py: Fix scripts which
	  assume entities will have mass.
2007-12-03 23:18:51 +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
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
12e5d50b5b 2007-11-26 Al Riddoch <alriddoch@zepler.org>
* common/inheritance.cpp, common/inheritance.h: Introduce a type
	  node class as a carrier for all information, including default
	  values for a type.

	* rulesets/Entity.h, rulesets/Entity.cpp, rulesets/Character.cpp:
	  Use a TypeNode pointer rather than a string giving the type
	  of an entity.

	* client/Py_CreatorClient.cpp, rulesets/MemMap.cpp, rulesets/MemMap.h,
	  rulesets/MindFactory.cpp, rulesets/MindFactory.h,
	  rulesets/Py_Mind.cpp, rulesets/Py_Thing.cpp, rulesets/Stackable.cpp,
	  rulesets/World.cpp, server/PersistantThingFactory.h,
	  server/Restorer_impl.h, server/WorldRouter.cpp:
	  Adapt all the code that deals with types. Set the type pointer
	  up correctly in BaseMind.

	* server/EntityFactory.cpp: Initialise the TypeNode pointer on new
	  entities.

	* tests/inheritancetest.cpp: Adapt the test to cope with TypeNode.
2007-11-26 02:57:04 +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
ef4942372a 2007-07-04 Al Riddoch <alriddoch@zepler.org>
* data/basic.xml: Strip entity scripts off pickaxe and shovel.

	* rulesets/World.h, rulesets/World.cpp: Remove handlers used to
	  to implement pickaxe and shovel, which are now handled as tasks.

	* common/Delve.h, common/Dig.h, common/Mow.h, common/custom.cpp,
	  common/operations.cpp: Remove a bunch of operations from the build
	  which were only used to do things in an over simple hard coded way.
2007-07-04 21:20:40 +00:00
Al Riddoch
c5960ed932 2007-07-04 Al Riddoch <alriddoch@zepler.org>
* data/basic.xml: Remove the script for scythe as it is no longer
	  used.

	* rulesets/World.cpp: Remove mow operation from World, as this is now
	  handled by a task.
2007-07-04 17:09:39 +00:00
Al Riddoch
00d108db65 2007-07-04 Al Riddoch <alriddoch@zepler.org>
* rulesets/Py_TerrainProperty.cpp: New wrapper for terrain property.
	  Work in progress.
2007-07-04 01:06:59 +00:00
Al Riddoch
5b69541c95 2007-06-22 Al Riddoch <alriddoch@zepler.org>
* common/BaseEntity.cpp, common/BaseEntity.h, common/op_switch.h,
	  rulesets/Character.cpp, rulesets/Character.h, rulesets/Food.cpp,
	  rulesets/Food.h, rulesets/World.cpp, rulesets/World.h,
	  tests/EntityExerciser.h: Purge the burn operation from the core
	  operation handling code. One down, many still to go.
2007-06-22 12:56:33 +00:00
Al Riddoch
23851b3fd0 2007-01-01 Al Riddoch <alriddoch@zepler.org>
* 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.
2007-01-01 17:57:06 +00:00
Al Riddoch
02cf540c09 2006-12-10 Al Riddoch <alriddoch@zepler.org>
* rulesets/Entity.cpp, rulesets/Entity.h, rulesets/Task.h,
	  rulesets/TerrainProperty.cpp, rulesets/TerrainProperty.h,
	  rulesets/Thing.cpp, rulesets/World.cpp, server/TrustedConnection.cpp,
	  server/WorldRouter.cpp: Add inline documentation.
2006-12-10 17:53:52 +00:00
Al Riddoch
9a56dac06c 2006-10-26 Al Riddoch <alriddoch@zepler.org>
* Add RCS Id keywords to every file, for better version tracking.
2006-10-26 00:48:00 +00:00
Al Riddoch
77cd095994 2006-08-01 Al Riddoch <alriddoch@zepler.org>
* rulesets/World.cpp: If Look op is from something that can't be
	  found, report an error rather than carrying on.

TODO: Remove completed tasks.
2006-08-01 19:58:14 +00:00
Al Riddoch
471c2184cd 2006-08-01 Al Riddoch <alriddoch@zepler.org>
* rulesets/World.cpp, rulesets/World.h, rulesets/mason/define_world.py:
	  Remove the special handling of Set ops in world which prevented
	  setting status below zero from generating a Delete op. Add a test
	  function to define_world which attempts to destroy the world by
	  setting its status to -1.
2006-08-01 18:11:20 +00:00
Al Riddoch
41a6bde58e 2006-07-31 Al Riddoch <alriddoch@zepler.org>
* rulesets/World.cpp: Use class numbers rather than names to
	  determine operation handler.
2006-07-31 22:58:35 +00:00
Al Riddoch
47d4dce82b 2006-07-31 Al Riddoch <alriddoch@zepler.org>
* rulesets/World.cpp: Add checks that operations have the class
	  number expected, so that this section can be converted to work on
	  class numbers.
2006-07-31 17:29:59 +00:00