Commit graph

68 commits

Author SHA1 Message Date
Erik Ogenvik
3a41f8fc62 Reload all python tasks scripts too. 2018-05-01 14:42:02 +02:00
Erik Ogenvik
e80d07560c Reload entity scripts when python code changes.
For now we reload all scripts. We should be smarter and only reload
those scripts which are affected though.
2018-04-30 23:34:58 +02:00
Erik Ogenvik
7ae19d5038 Use Singleton base class.
I.e. make sure that all objects have a defined life time. This requires
that we actually set up and tear down the singletons.
2018-04-25 20:15:29 +02:00
Erik Ogenvik
e7fa53214b Use nullptr instead of NULL. 2018-02-06 13:45:11 +01:00
Erik Ogenvik
7fb146eb36 Standardize installation of standard types.
This way the base types are exposed to clients.
2018-02-06 13:45:10 +01:00
Erik Ogenvik
99640d26aa Use a left hand coord system. 2018-02-06 13:45:10 +01:00
Erik Ogenvik
b4fe395b51 Make creator entity large enough to walk stairs. 2017-05-28 15:43:14 +02:00
Erik Ogenvik
7aaa9b9ba7 Optimize includes. 2017-03-19 21:36:52 +01:00
Erik Ogenvik
eaf66c9846 Make plants use cylinder geom by default.
This fits most plants.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
d632cd63ac Use capsule for creator entity. 2016-12-15 18:27:42 +01:00
Erik Ogenvik
8351a06946 Make sure plants always have a status. 2016-12-15 18:27:42 +01:00
Erik Ogenvik
c7a41c39f9 Added density to most types.
Which should be ok for most ones, but could need some adjustments.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
137e455725 Added "density" property.
Density is in kg/m3. This property will update mass when size changes.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
1f18eb9a13 Make all things "planted" by default.
This is the only sensible option; else all entities will interact physically
by default which will make for a strange world.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
bb19956c8d Install class default attributes for native types.
Though we strive towards moving all of the specific functionality
into attributes and removing the native subtypes altogether.

Note that we default to all plants being planted by default.
2016-12-15 18:27:42 +01:00
Erik Ogenvik
2344c73837 Quote monitor tags. 2015-04-05 22:17:25 +02:00
Erik Ogenvik
dccaec3c41 Don't set default attributes when restoring.
When we're restoring from storage we don't want to apply any properties
at all when the entity is created, since we'll do that ourselves in a
later pass. This is done by submitting an invalid RootOperation pointer.
2014-09-15 21:11:35 +02:00
Erik Ogenvik
3b295ca0a1 Added concept of a default entity.
Instead of the root entity always being the default one (for new
entities being created etc.) we now can specify another entity which is
the default one.
2014-08-27 22:17:09 +02:00
Erik Ogenvik
37e6cc29c1 Improve logging and creation error handling. 2013-11-15 21:40:29 +01:00
Erik Ogenvik
45555fd698 Use custom format for archetypes.
This required the EntityKit to be refactored, so that most fields are
pushed into EntityFactory. Due to the nature of how the rule handlers
and the factories interact the code is pretty messy. It works, but it's
tangled and not really clean.
2013-11-15 21:39:35 +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
de230e5833 Moved creation logic to the factory.
This is in preparation for nested entity creation and archetypes.
2013-11-15 21:38:24 +01: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
79c65603aa Use insert instead of [] 2013-03-03 23:37:30 +00:00
Alistair Riddoch
745d263709 Fail cleanly if a type exists
The code would segfault if installing a new entity class failed at the last
stage in Inheritance. Inheritance would return null, which would be assigned
to the factory's m_type. addProperties() assumes the pointer is not null.
This fix adds a check, and reports a failure undoing the whole process.
2013-02-21 21:53:11 +00:00
Alistair Riddoch
3d6f39cdee Modify Property install method to take name
This change also switches DecaysProperty to using delegates as a proof of
concept.
2013-02-13 00:45:36 +00:00
Alistair Riddoch
17b9631aa1 Remove some old debug output 2013-01-22 08:32:42 +00:00
Alistair Riddoch
e4755475ac Remove unneeded Entity.h include 2013-01-18 19:43:53 +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
8649ee9137 Use "extern template" to reduce dependencies 2012-12-14 18:40:51 +00:00
Alistair Riddoch
2b26bdf9ca These don't need consts any more 2011-12-20 15:49:18 +00:00
Alistair Riddoch
73ae410683 This class doesn't need Property 2011-12-20 15:46:07 +00:00
Alistair Riddoch
354a358e38 This class no longer needs to know about Task 2011-12-20 15:42:27 +00:00
Alistair Riddoch
bf27269cfe Remove legacy code from before all Tasks had scripts 2011-12-20 15:41:08 +00:00
Alistair Riddoch
306fc5533c Remove dependence on concrete script factory 2011-12-20 15:40:13 +00:00
Alistair Riddoch
15391164a6 Remove dependence on concrete factory 2011-12-20 15:33:31 +00:00
Alistair Riddoch
8fb4a30bde Simplify base types vs rule types
This is the second step in cleaning up a rather messy call path
which was different when installing the classes a game actually uses
from the data files from the base rules that are common to all.
2011-12-18 03:48:30 +00:00
Alistair Riddoch
577539aa6e Make installing types a little more consistent 2011-12-17 18:37:28 +00:00
Alistair Riddoch
74fb3d2ce9 Merge branch 'master' of github.com:worldforge/cyphesis 2011-12-15 18:27:33 +00:00
Alistair Riddoch
1f4b7bf1b9 Move PythonScriptFactory into the correct named file in the right place 2011-12-15 18:26:37 +00:00
Alistair Riddoch
0bc46a38be Remove header coupleying to ScriptFactory 2011-12-15 14:03:56 +00:00
Alistair Riddoch
9b26e6e04a Remove unused include 2011-12-15 01:03:00 +00:00
Alistair Riddoch
8b9cd49dfd Strip out unused populate() method from EntityFactory 2011-12-13 11:50:46 +00:00
Alistair Riddoch
e47076482c Remove obsolete method 2011-12-11 05:26:37 +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
a516f55197 Remove TaskScript subclass
This class really wasn't used. Task had pure virtual methods, and TaskScript
was the only subclass
2011-11-03 22:57:46 +00:00
Alistair Riddoch
d3eb9d40f2 Ensure all factories get deleted
EntityBuilder wasn't deleting the collection of factories it owns at shutdown
2011-09-30 22:25:05 +01:00
Alistair Riddoch
e0c92ebf39 Remove reference to BaseWorld in EntityBuilder 2011-09-21 12:45:18 +01:00
Alistair Riddoch
07201f1358 Handle Inheritance more consistently
Add an internal method for base classes, allowing the code that manipulates
the inheritance tree to be in a consistent place.
2011-09-18 17:26:26 +01:00