Skip to content

Commit e675d84

Browse files
committed
gamestate: Process ApplyEffect command from input system.
1 parent c41e585 commit e675d84

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

libopenage/gamestate/event/send_command.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "coord/phys.h"
88
#include "gamestate/component/internal/command_queue.h"
9+
#include "gamestate/component/internal/commands/apply_effect.h"
910
#include "gamestate/component/internal/commands/idle.h"
1011
#include "gamestate/component/internal/commands/move.h"
1112
#include "gamestate/component/types.h"
@@ -75,7 +76,10 @@ void SendCommandHandler::invoke(openage::event::EventLoop & /* loop */,
7576
coord::phys3{0, 0, 0})));
7677
break;
7778
case component::command::command_t::APPLY_EFFECT:
78-
// TODO: add command
79+
command_queue->add_command(
80+
time,
81+
std::make_shared<component::command::ApplyEffect>(
82+
params.get("target", 0)));
7983
break;
8084
default:
8185
break;

libopenage/gamestate/event/spawn_entity.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,6 @@ void SpawnEntityHandler::invoke(openage::event::EventLoop & /* loop */,
207207
entity->get_component(component::component_t::OWNERSHIP));
208208
entity_owner->set_owner(time, owner_id);
209209

210-
// ASDF: Remove demo code below for applying effects
211-
// add apply effect command to the command queue
212-
if (entity->has_component(component::component_t::APPLY_EFFECT)) {
213-
// auto command_queue = std::dynamic_pointer_cast<component::CommandQueue>(
214-
// entity->get_component(component::component_t::COMMANDQUEUE));
215-
// auto apply_command = std::make_shared<component::command::ApplyEffect>(entity->get_id());
216-
// command_queue->add_command(time, apply_command);
217-
}
218-
219210
auto activity = std::dynamic_pointer_cast<component::Activity>(
220211
entity->get_component(component::component_t::ACTIVITY));
221212
activity->init(time);

0 commit comments

Comments
 (0)