-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Setup bases for EntityMapActionSystem
- Loading branch information
1 parent
2719bba
commit dee1f34
Showing
7 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
apps/game_service/lib/game_service/events/direction_changed.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule GameService.Events.DirectionChanged do | ||
@moduledoc """ | ||
Event triggered when an Entity change his direction. | ||
""" | ||
use ElvenGard.ECS.Event, fields: [] | ||
|
||
@type t :: %__MODULE__{} | ||
end |
8 changes: 8 additions & 0 deletions
8
apps/game_service/lib/game_service/events/entity_info_request.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule GameService.Events.EntityInfoRequest do | ||
@moduledoc """ | ||
Event triggered when a player request informations for an Entity. | ||
""" | ||
use ElvenGard.ECS.Event, fields: [] | ||
|
||
@type t :: %__MODULE__{} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule GameService.Events.Movement do | ||
@moduledoc """ | ||
Event triggered when an Entity move. | ||
""" | ||
use ElvenGard.ECS.Event, fields: [] | ||
|
||
@type t :: %__MODULE__{} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
defmodule GameService.Events.Sitting do | ||
@moduledoc """ | ||
Event triggered when an Entity sitting down or standing up. | ||
""" | ||
use ElvenGard.ECS.Event, fields: [] | ||
|
||
@type t :: %__MODULE__{} | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
apps/game_service/lib/game_service/systems/entity_map_action.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
defmodule GameService.EntityMapActionSystem do | ||
@moduledoc """ | ||
TODO: Documentation for GameService.EntityMapActionSystem | ||
Note: All Entities must have a PositionComponent or this system will raise | ||
""" | ||
|
||
use ElvenGard.ECS.System, | ||
lock_components: [ | ||
GameService.EntityComponents.PositionComponent, | ||
GameService.EntityComponents.DirectionComponent, | ||
GameService.EntityComponents.LevelComponent, | ||
GameService.PlayerComponents.HeroLevelComponent, | ||
GameService.EntityComponents.CombatComponent, | ||
# GameService.EntityComponents.BuffComponent, | ||
GameService.EntityComponents.SpeedComponent, | ||
GameService.EntityComponents.SittingComponent | ||
], | ||
event_subscriptions: [ | ||
GameService.Events.DirectionChanged, | ||
GameService.Events.EntityInfoRequest, | ||
GameService.Events.Movement, | ||
GameService.Events.Sitting | ||
] | ||
|
||
require Logger | ||
|
||
# System behaviour | ||
|
||
@impl true | ||
def run(event, _delta) do | ||
Logger.warn("#{inspect(__MODULE__)} unhandled event #{inspect(event)}") | ||
end | ||
end |