-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seeking AI behaviour #18
base: master
Are you sure you want to change the base?
Changes from 1 commit
3d72012
e9913c3
59fa130
3792cbd
1fd1a23
239f2cc
165397c
f382506
e9c9693
6fdee5b
f15a24f
b2a2252
12af7b6
260666f
f718ddf
38b65ca
f819c1d
f7ab019
0c18581
d93eeb8
e6dc0a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,16 +22,15 @@ defmodule Entice.Logic.Seek do | |
def init(entity, %{aggro_distance: aggro_distance, escape_distance: escape_distance}), | ||
do: {:ok, entity |> put_attribute(%Seek{aggro_distance: aggro_distance, escape_distance: escape_distance})} | ||
|
||
def init(entity, _args), | ||
def init(entity, _args), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whitespace change - kittens gonna die! :'( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whitespace at end of line ;) |
||
do: {:ok, entity |> put_attribute(%Seek{})} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, no args = what behaviour? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right I'll add an init that only take an entity There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I meant: Do we need this case? Is this actually any use without parameters? |
||
|
||
#No introspection for npcs ;) | ||
def handle_event({:movement_agent_updated, %Position{pos: _}, moving_entity_id}, %Entity{id: my_id} = entity) | ||
when moving_entity_id == my_id, | ||
def handle_event({:entity_change, %{entity_id: eid}}, %Entity{id: eid} = entity), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we can actually receive our own updates, can you verify? |
||
do: {:ok, entity} | ||
|
||
def handle_event({:movement_agent_updated, %Position{pos: mover_pos}, moving_entity_id}, | ||
%Entity{attributes: %{Position => %Position{pos: my_pos}, | ||
def handle_event({:entity_change, %{changed: %{Position => %Position{pos: mover_pos}}, entity_id: moving_entity_id}}, | ||
%Entity{attributes: %{Position => %Position{pos: my_pos}, | ||
Movement => _, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we check for Movement here? I mean, if we need it for the behaviour, why not using the deconstructed variable? |
||
Npc => %Npc{init_pos: init_pos}, | ||
Seek => %Seek{aggro_distance: aggro_distance, escape_distance: escape_distance, target: target}}} = entity) do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to check already here if all the attributes we require being present are actually there...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean by that. We match on aggro_distance and escape_distance, if they're not there we get the default init, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I meant Attributes, as in if the entity has the attributes we need, i.e. Movement etc.