Commit graph

322 commits

Author SHA1 Message Date
Erik Ogenvik
ce25a1d231 Added method for removing spawn points. 2013-11-24 15:01:38 +01:00
Erik Ogenvik
4778aa70b3 Fixed issue with relayed deletion ops and segfault. 2013-11-20 15:09:09 +01:00
Erik Ogenvik
328ba969fe Make spawns use entities and archetypes.
There's no reason to use the hacked in "contains" feature for creating
inventory. Instead we can rely on the Archtype features. Any entity
declaration for which we also want inventory created should use an
archetype.
The change is that the "contains" and "character_types" attributes are
removed. Instead there's a "entities" attribute, which is a map. The
keys are the names of the entities as seen to the client, and the values
are the entity specifications.
2013-11-16 22:55:47 +01:00
Erik Ogenvik
edc5fd604b Added property for respawning entity.
The "respawning" property makes an entity respawn instead of being
deleted. It intercepts the Delete op and instead of deleting the entity
it moves it to the specified spawn point.
A typical use case of this is to place the property on any user
controlled entity, thus making sure that it's never deleted and istead
respawned when killed or defeated.
2013-11-16 21:05:45 +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
b054382f2a Add "archetype" as new type.
An archetype is used for creating new entities. It contains one or many
definitions for entities, along with relationship between them. It also
contains any extra data needed for a world simultion, such as thoughts
and knowledge.
Archetypes should be seen as blueprints for entity types, as they
describe how new one should be composed. They are created just as
regular entities, using the existing Create op functionality.
As an example, there should be one "human" entity type, with archetypes
such as "settler", "merchant", "soldier" etc. This differs from the
current setup where each of these are separate entity types.
2013-11-15 21:39:35 +01:00
Erik Ogenvik
8e9fe41fcf Provide better error logging. 2013-09-08 23:25:40 +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
Erik Hjortsberg
6da14d3f62 Added a suspend world feature.
While in suspended state all "Tick" ops will be placed in a special queue
and not delivered until the world is resumed.

This is of most use for world authors who want to edit the world and
not worry about entities being altered.
2013-03-31 20:41:19 +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
7fd84c549d Fix a memory leak 2012-12-28 13:38:50 +00:00
Alistair Riddoch
a46a97a702 Check for errors setting up spawn 2012-12-27 23:06:16 +00:00
Alistair Riddoch
d67e092a0e Separate spawn setup code from the constructor 2012-12-27 23:02:04 +00:00
Alistair Riddoch
55c877dbf8 Fix incorrect map iterator usage 2012-12-24 10:50:44 +00:00
Alistair Riddoch
82054eb5ec Fix unsafe missuse of reference 2012-12-22 13:14:10 +00:00
Alistair Riddoch
68bd0c6e25 Refactor TaskFactory for more flexible activation matching
We can now match the target based on different critea by configuring the
factory to do different checks
2011-12-06 10:07:25 +00:00
Alistair Riddoch
eb9c58c153 Refactor the task setup interface to use LocatedEntity 2011-12-02 23:42:24 +00:00
Alistair Riddoch
e949f36c6c Use the new class for time updates 2011-10-31 11:19:33 +01:00
Alistair Riddoch
ac37383d8a Convery all the property get functions 2011-09-29 17:36:26 +01:00
Alistair Riddoch
e0c92ebf39 Remove reference to BaseWorld in EntityBuilder 2011-09-21 12:45:18 +01:00
Manohar Vanga
f7d97fb7bd Entity injection works (code needs a lot of cleanup) 2010-08-17 11:56:09 +05:30
Manohar Vanga
3c4163099a Made some changes based on code reviews 2010-08-17 11:56:09 +05:30
Manohar Vanga
3a565afcd2 Added test for InterServerConnection. Extra debugging in WorldRouter::idle() 2010-08-17 11:56:09 +05:30
Alistair Riddoch
e3012c88be Refactor creating Arithmetic objects to de-couple properties from scripting 2010-07-13 16:23:46 +01:00
Alistair Riddoch
a84543bf32 Fix a crash bug caused by malformed name data. 2010-01-03 21:06:24 +00:00
Alistair Riddoch
238f5c629c Improve debut output. 2010-01-03 02:14:52 +00:00
Alistair Riddoch
a6ccd6d36d Support reconfiguring or replacing a spawn. 2010-01-03 00:44:10 +00:00
Alistair Riddoch
b11821bf9a Add some checks when spawning fails. 2009-12-30 15:09:26 +00:00
Alistair Riddoch
309905fedf Extend Spawn interface to support richer Atlas descriptions. 2009-12-30 11:29:12 +00:00
Alistair Riddoch
7660afe705 Modify the interface of the Spawn base class for postprocessing. 2009-12-30 11:12:33 +00:00
Alistair Riddoch
6c89ed0785 Modify spawn interface to give the spawn more control. 2009-12-30 10:01:49 +00:00
Alistair Riddoch
97bd67ea65 Write a bunch more code related to implementing spawn points. 2009-12-30 01:45:16 +00:00
Alistair Riddoch
94350f78bf Add another function to expose the available spawn points. 2009-12-29 19:11:31 +00:00
Alistair Riddoch
14e7754c69 Extend the interface for world to support spawns, and add stubs. 2009-12-29 17:48:34 +00:00
Alistair Riddoch
d52550a9e3 Rename Monitor class tree to Variable for clarity. 2009-09-03 00:38:50 +01:00
Alistair Riddoch
958babd997 Add new Variable files to the build, remove copied code, and fix up includes. 2009-09-03 00:27:59 +01:00
Alistair Riddoch
96e3049cfa Simplify and fix code that queries the mode of an entity. 2009-08-05 19:00:14 +01:00
Alistair Riddoch
209f6842bd Remove the old constraint functions. 2009-05-12 23:38:31 +01:00
Alistair Riddoch
335e162cb0 Use movement domain to do all height constraint requests. 2009-05-12 23:30:19 +01:00
Alistair Riddoch
cd1f42c3f9 Rename Inheritance class files to match class name. 2009-03-20 15:31:38 +00:00
Al Riddoch
84c1a94412 Rename files for EntityBuilder from EntityFactory to match the class rename. 2009-03-12 00:50:25 +00:00
Al Riddoch
351058f34c 2008-09-13 Al Riddoch <alriddoch@googlemail.com>
* 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.
2008-09-13 18:02:08 +00:00
Al Riddoch
c5ad96fcbd 2008-09-03 Al Riddoch <alriddoch@googlemail.com>
* server/WorldRouter.cpp: Emit the updated signal when an entity
	  is destroyed and removed from the world, so that the store
	  can remove it.
2008-09-04 09:34:55 +00:00
Al Riddoch
d1695c9617 2008-09-01 Al Riddoch <alriddoch@googlemail.com>
* common/Monitors.cpp, common/Monitors.h: Add dynamic variable
	  monitor functionality, allowing arbitrary variables to appear
	  in the monitors output.

	* server/ServerRouting.cpp: Use the new monitor functionality for
	  variables prebviously pushed to monitors once.

	* server/WorldRouter.cpp, server/WorldRouter.h: Add a count of
	  in-game entities. Expose it to the monitors.
2008-09-01 16:14:42 +00:00
Al Riddoch
de4f241e4e 2008-08-29 Al Riddoch <alriddoch@googlemail.com>
* common/Monitors.cpp, common/Monitors.h: Add a new class to handle
	  storing key value pairs useful in monitoring the state of a server.

	* server/HttpCache.cpp, server/HttpCache.h: Add a function argument
	  to allow the content type to be controlled in the header.
	  Expose the Monitors class under /monitors URL.
2008-08-30 16:29:11 +00:00
Al Riddoch
34437a4a84 2008-08-17 Al Riddoch <alriddoch@googlemail.com>
* common/BaseWorld.h: Modify the addEntity() function so we no longer
	  need to specify whether it needs to be set up, as nowhere was ever
	  specifying.

	* server/WorldRouter.cpp, server/WorldRouter.h: Implement the modified
	  BaseWorld API, and ensure all entities are sent Setup operations
	  for now.

	* tests/TestWorld.h: Update test world so it implements the interface
	  correctly.
2008-08-17 21:17:35 +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
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
6da7ff7592 2007-12-27 Al Riddoch <alriddoch@zepler.org>
* common/TypeNode.h, common/TypeNode.cpp: Move TypeNode into
	  its own files.

	* common/Makefile.am, common/inheritance.cpp, common/inheritance.h:
	  Add the new files to the build and remove the old implementation.

	* client/Py_CreatorClient.cpp, rulesets/Character.cpp,
	  rulesets/Entity.cpp, rulesets/MemMap.cpp,
	  rulesets/MindFactory.cpp, rulesets/Py_Mind.cpp,
	  rulesets/Py_Thing.cpp, rulesets/Stackable.cpp,
	  server/WorldRouter.cpp: Fix up the includes for all code that
	  uses TypeNode.
2007-12-27 03:31:47 +00:00