Commit graph

331 commits

Author SHA1 Message Date
Erik Ogenvik
7c591308f5 Honour spacing when planting.
This is to make sure the seeds aren't planted too closely.
2013-07-26 12:05:39 +02:00
Erik Ogenvik
689afa4732 Remove seed focus if it has disappeared. 2013-07-26 11:23:20 +02:00
Erik Ogenvik
309a65b233 Only spot sources in the area. 2013-07-25 18:34:52 +02:00
Erik Ogenvik
44ed7096f3 Modify forester and lumberjack.
Make them behave a little better.
2013-07-25 17:14:59 +02:00
Erik Ogenvik
4503b10d99 Remove "roam" from planting.
Movement can be handled by a separate goal.
2013-07-25 17:14:29 +02:00
Erik Ogenvik
89d2d8c060 Only harvest adult plants.
If there's a "sizeAdult" property available; else just try to harvest
them as they are.
2013-07-23 23:17:20 +02:00
Erik Ogenvik
38580dcfbd Use better param names. 2013-07-17 23:32:36 +02:00
Erik Ogenvik
e3d6c5a5ec Improve planting task.
Look for seeds within the area first and foremost before looking for
sources.
2013-07-16 23:18:01 +02:00
Erik Ogenvik
ef68b41a39 Allow range to be specified in plant seed goal. 2013-06-30 14:02:52 +02:00
Erik Ogenvik
69ffa29783 Make clear that this code isn't used.
All tree code is now handle by Plant.cpp. However, this file is kept as
reference (it's of course still in Git, but people tend to never look
for it there if it's removed).
2013-06-29 23:01:57 +02:00
Erik Ogenvik
432d647029 Only search in area when planting. 2013-06-29 15:47:36 +02:00
Erik Ogenvik
3b0e191c70 Added goal of spotting in area. 2013-06-29 15:47:17 +02:00
Erik Ogenvik
ddcaeed05c Restrict import. 2013-06-29 15:44:06 +02:00
Erik Ogenvik
097982eebe Improve plant_seeds goal.
The NPC will now move between the sources and look for seeds.
2013-06-27 21:59:50 +02:00
Erik Ogenvik
313b247213 Added a "move me near" goal.
This goal will move a character close to something, and then keep the
character within a certain distance of this thing.
This is useful when you want the character to get close to something,
but then search for something else within the vicinity.
2013-06-27 21:54:35 +02:00
Erik Ogenvik
0a50c56a2c Don't focus on things we've already discovered.
Also forget these after a while.
This makes sure that this goal doesn't result in the character getting
stuck on one thing. If used with the clear_focus goal the character can
instead move on to other things, and then return to the same thing after
a while after it's "forgotten".
2013-06-27 21:52:48 +02:00
Erik Ogenvik
49420ba35f Added goal for clearing focus.
This is useful when we need to forget our current focus and move on.
2013-06-27 21:49:09 +02:00
Erik Ogenvik
e630e01ba1 Removed problematic logging code.
Which caused crashes.
2013-06-23 00:08:34 +02:00
Erik Ogenvik
194f2e4f63 Make sure we can see what we want to plant. 2013-06-16 00:14:15 +02:00
Erik Ogenvik
43cab79a97 Take into account size of entity when moving.
Else the NPC would always want to walk into even solid objects.
We should of course also add checks for solid and non-solid entities.
2013-06-16 00:12:05 +02:00
Erik Ogenvik
44402e0f73 Send last processed goals in report.
Also don't send data if there's nothing in the collections or maps.
2013-06-01 23:17:16 +02:00
Erik Ogenvik
a70b7c1ed3 Store last processed goals as debug data. 2013-06-01 23:17:16 +02:00
Erik Ogenvik
fb2f073841 Print out the entity id in debug when thinking. 2013-06-01 23:17:16 +02:00
Erik Ogenvik
09ba0c4edc Make goals behave more stringent.
I.e. make functions behave just like subgoals.
2013-06-01 23:17:16 +02:00
Erik Ogenvik
fff8695022 Make goal checking code more robust and add docs.
Instead of checking whether there's a debug string available we should
check for any operation being returned.
2013-06-01 23:17:16 +02:00
Erik Ogenvik
9ca9e64b7a Added roam goal.
This makes the NPC wander aimlessly within a specified series of
location. This is often more suitable than "wander", as that goal will
make the NPC wander over the whole map, which often isn't what you want.
2013-05-21 21:31:44 +02:00
Erik Ogenvik
af6ca21694 Fixed "wander" goal.
The NPC will now wander randomly. However, this isn't completely
natural. The change in direction is too erratic. And the goal should be
expanded to stay within a certain area.
2013-05-19 22:52:30 +02:00
Erik Ogenvik
d2a5486c05 Also persist ownership. 2013-04-21 11:30:48 +02:00
Erik Ogenvik
479495258d Handle locations better.
It's now possible to specify parent entity as well as coordinates.
2013-04-20 22:00:03 +02:00
Erik Ogenvik
6832d54c8d Added extra sanity check. 2013-04-20 17:56:55 +02:00
Erik Ogenvik
69f1008fb8 Don't send thoughts when adding knowledge.
In fact we need to refactor the interlinguish code so that knowledge
isn't set directly and instead passed to the entity through a Thought
op.
2013-04-17 21:14:11 +02:00
Erik Ogenvik
3f3f212c9c Correctly handle serializing Location. 2013-04-13 23:32:44 +02:00
Erik Ogenvik
9beee13a21 Send thoughts as "Thought" op.
Instead of wrapping it in a "Set" op. This is more idiomatic.
2013-04-13 23:25:16 +02:00
Erik Ogenvik
54b8249bd7 Make sure subject is transmitted as string.
Else we risk automatic conversions, which for example will turn tuples
into lists.
2013-04-11 23:04:26 +02:00
Erik Ogenvik
0a3aa68062 Handle the location being incomplete.
This can happen if the entity is in such a state that the location isn't
valid. We should handle it by consider the memory recall operation as
failed, but not as an exception.
2013-04-08 20:17:01 +02:00
Erik Ogenvik
333ae7832f Be more forgiving with goal errors.
Instead of treating a goal error as something which will make the entity
inactive, we instead allow for some errors (namely three currently) to
occur before the goal is deactivated. Any other goals are however
allowed to carry on even though one goal is faulty.
We also expose this through the goal_info query functionality, allowing
for world authors to better debug faulty goals.
2013-04-07 23:20:23 +02:00
Erik Ogenvik
34f1544b1a Spelling fixes. 2013-04-05 20:56:55 +02:00
Erik Ogenvik
4807f7856b Clean up debug code and add docs. 2013-04-05 20:53:46 +02:00
Erik Ogenvik
929f964b7d Allow to query for specific goals.
One can specify both the "subject" and the "goal". If no "goal" is
specified, all goals for the "subject" will be queried. If no "subject"
is specified, all goals will be queried.
2013-04-02 22:32:52 +02:00
Erik Ogenvik
4d982173bb Allow admin client to query goals.
This is done in a way similar to how thoughts are queries. A Get op is
sent, containing a Goal_info op. The mind code is then responsible for
composing data about the goals, which is sent back to the client.
2013-04-01 22:18:40 +02:00
Erik Ogenvik
3697ba8c42 Allow goals to be queried.
This will return a map containing various useful data about the goal.
This is meant to be used for debugging and inspection of goals and
behaviours.
2013-04-01 22:17:58 +02:00
Erik Ogenvik
6420d0afaf Fixed issue with setting multiple goals. 2013-03-31 21:02:13 +02:00
Erik Ogenvik
d227515c43 Improve goal creation.
We'll make sure all new goals are valid before we remove the old ones.
2013-03-31 21:02:13 +02:00
Erik Ogenvik
678f439fb9 Improve settings of goals.
When a goal is set, the supplied 'object' can also be a list of strings
(i.e. a list of goals). All existing goals for the supplied subject will
be deleted. This allows for much better editing capabilities.
2013-03-31 21:02:13 +02:00
Erik Ogenvik
ea1331b601 Store knowledge of goal differently.
Goals are handled differently than other knowledge, so we need to store
it in a separate dict.
2013-03-31 21:02:13 +02:00
Erik Ogenvik
76878899ad Return all goals when asked.
The goal code is a little messy, because we can't rely on looking into
the knowledge map for them, as the knowledge will only keep one goal per
subject.
In order to fix this we instead look for the goals in either "goals" or
"trigger_goals".
2013-03-31 21:02:13 +02:00
Erik Ogenvik
ce242b7307 Avoid NPE. 2013-03-31 21:02:13 +02:00
Erik Ogenvik
86bbfb4a0d Handle goals correctly. 2013-02-10 14:50:54 +01:00
Erik Ogenvik
d9ced4cb6c Perform more proper op handling. 2013-02-10 12:50:45 +01:00
Erik Ogenvik
c077abbd6f Fixed op iteration. 2013-02-10 11:47:46 +01:00