Commit graph

79 commits

Author SHA1 Message Date
Erik Ogenvik
e85f0831b2 Restructure rule classes.
Classes under "rulesets" have been moved to "rules", and split up into
futher subdirectories matching their library. As a result we can now
better separate the python bindings, so that things that belongs to the
simulation are separeted from things that belongs to the ai.
2018-10-31 21:38:35 +01:00
Erik Ogenvik
c84f5fe926 Don't implicitly convert from Ref to ptr.
Since it's too easy to introduce subtle bugs.
2018-08-05 20:47:09 +02:00
Erik Ogenvik
a12b1a00a3 Delete when refs go to zero.
This changes how entities are dereferenced to work more like you would
expect.
2018-08-05 14:36:21 +02:00
Erik Ogenvik
04fe84821e Use proper singletons everywhere.
I.e. ones where the lifespan is fully controlled.
The only exception is Options, since it's accessed during static
initialization.
2018-08-04 18:01:20 +02:00
Erik Ogenvik
7634969eef Removed TaskFactory classes.
Since we always create Tasks from scripts.
Also fixed a lot of tests.
2018-08-04 18:01:20 +02:00
Erik Ogenvik
3f534b0b4a Use a Map for the Tasks property. 2018-08-04 18:01:20 +02:00
Erik Ogenvik
4d1dc775b0 Moved BaseWorld to rulesets.
Since it better belongs there.
2018-07-25 00:16:09 +02:00
Erik Ogenvik
ba539df70e Use PyCXX throughout. 2018-07-23 16:43:39 +02:00
Erik Ogenvik
e23e6e1251 Use Refs wherever possible. 2018-07-23 11:03:18 +02:00
Erik Ogenvik
e6bc7b2790 Use Ref for handling ref counting.
All LocatedEntities should always be handled through Ref instances.
These makes sure that the ref counting is correctly handled.
2018-07-22 23:48:42 +02:00
Erik Ogenvik
0ca22bcf68 Specify scripts for entity as property.
This allows multiple scripts to be used. In addition it allows for
entity with specific scripts.
2018-07-04 19:20:24 +02:00
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