From 4b43d9b984ce139c6fd4a3c5088a8d2c8bcc6a2c Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Date: Mon, 4 May 2020 15:37:06 +0200
Subject: [PATCH] Tweaked actions and action groups.

---
 conf/config.yaml                          |  2 +-
 lib/aethyr/core/actions/action.rb         | 14 +++++++++++---
 lib/aethyr/core/actions/action_groups.rb  | 22 ++++++++++++++++++++++
 lib/aethyr/core/actions/command_action.rb |  2 +-
 4 files changed, 35 insertions(+), 5 deletions(-)
 create mode 100644 lib/aethyr/core/actions/action_groups.rb

diff --git a/conf/config.yaml b/conf/config.yaml
index b5da3ca..af12965 100644
--- a/conf/config.yaml
+++ b/conf/config.yaml
@@ -9,7 +9,7 @@
 :restart_delay: 10
 :address: 0.0.0.0
 :intro_file: intro.txt
-:start_room: 16326a80-4ec1-91b7-cfad-3e3d79b7a619
+:start_room: 46cf2781-1e5e-d6e4-18e6-ea72ea437aa9
 :restart_limit: 15
 :mccp: false
 :mssp: false
diff --git a/lib/aethyr/core/actions/action.rb b/lib/aethyr/core/actions/action.rb
index 8c4448c..3e40235 100644
--- a/lib/aethyr/core/actions/action.rb
+++ b/lib/aethyr/core/actions/action.rb
@@ -1,14 +1,22 @@
 module Aethyr
   module Core
     module Actions
-      class Action
-        def initialize(**data)
-          @data = data.freeze
+      module Action
+        def concurrency
+          return :single
         end
 
         def action()
         end
       end
+
+      class Event
+        include Aethyr::Core::Actions::Action
+
+        def initialize(**data)
+          @data = data.freeze
+        end
+      end
     end
   end
 end
diff --git a/lib/aethyr/core/actions/action_groups.rb b/lib/aethyr/core/actions/action_groups.rb
new file mode 100644
index 0000000..62938e2
--- /dev/null
+++ b/lib/aethyr/core/actions/action_groups.rb
@@ -0,0 +1,22 @@
+module Aethyr
+  module Core
+    module Actions
+      class ActionGroup
+        attr_reader :concurrency
+
+        def initialize(concurrency, *actions)
+          @actions = *actions
+          @concurrency = concurrency
+
+          raise "Invalid concurrency type" if @concurrency != :parallel && @concurrency != :sequenial
+          raise "actions needs to have at least two values" if @actions.nil? || @actions.length < 2
+        end
+
+        def each
+          @actions.each { |e| yield e }
+        end
+      end
+
+    end
+  end
+end
diff --git a/lib/aethyr/core/actions/command_action.rb b/lib/aethyr/core/actions/command_action.rb
index 31c844a..d576d78 100644
--- a/lib/aethyr/core/actions/command_action.rb
+++ b/lib/aethyr/core/actions/command_action.rb
@@ -3,7 +3,7 @@ require "aethyr/core/actions/action"
 module Aethyr
   module Core
     module Actions
-      class CommandAction < Action
+      class CommandAction < Event
         def initialize(actor, **data)
           super(**data)
           @player = actor
-- 
GitLab