gamefic-standard 3.1.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96d1958de544c9250c33c49061d6db246d9f3ff3b1fbc9fc5d141a6e49d79107
4
- data.tar.gz: d940749ca8f20bcb81d21335f7318a56ca93e203d6e0b8481de4580df643bfe6
3
+ metadata.gz: 5b0c82ed182ca48a25af31d675e7a661d2956403c56ffbe74a1f88ded22ab667
4
+ data.tar.gz: 7f7a7c1d1ef4eb12d1f41fa8e004e2ca92833ba2b4583bf0bcd9ac6d9df63ae4
5
5
  SHA512:
6
- metadata.gz: ee2922a83f750237cd27e3ce0b2e0fd3ca4c80480334398695603308b522e3a9830e59388bc181ecc5be13d1aa4261c1b28f7611d9fdc9212a4c6256fc17135a
7
- data.tar.gz: 37a6191847035deb12caeaef9f99d35be5b6a3c6e4e5166cafec28ae2be86e4704ea903e54d625f8972bf71181115e6cfaee396a216116d5cbf1feecd09bc629
6
+ metadata.gz: fc01bbb87e5631b207b152611eed41449279ee4f25f99e5897855aaf6ffd9e558bdbc056f68c7bd48f96ec8169b891480442f1b2f0e5a8115a4466efba9bdfc8
7
+ data.tar.gz: 3e090e4e91037020f9b3956f5d864be29ab0e97bebd8b813c684ca111f3234d24407c952ac324f801c1bedc79db56655018a9df905da5ab8ff5d46e9c18b0b92
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 3.2.1 - July 23, 2024
2
+ - Help actions are meta
3
+ - Ignore empty commands
4
+
5
+ ## 3.2.0 - July 10, 2024
6
+ - Recognize pronouns in commands
7
+
1
8
  ## 3.1.0 - April 8, 2024
2
9
  - Minor response fixes
3
10
  - Update gamefic dependency
@@ -3,7 +3,7 @@
3
3
  module Gamefic
4
4
  module Standard
5
5
  script do
6
- respond :verbs do |actor|
6
+ meta :verbs do |actor|
7
7
  list = rulebook.synonyms.reject { |syn| syn.to_s.start_with?('_') }
8
8
  .map { |syn| "<kbd>#{syn}</kbd>"}
9
9
  .join_and
@@ -15,7 +15,7 @@ module Gamefic
15
15
  interpret 'commands', 'verbs'
16
16
  interpret 'help', 'verbs'
17
17
 
18
- respond :help, plaintext do |actor, command|
18
+ meta :help, plaintext do |actor, command|
19
19
  if rulebook.synonyms.include?(command.to_sym) && !command.start_with?('_')
20
20
  available = rulebook.syntaxes.select { |syntax| syntax.synonym == command.to_sym }
21
21
  .uniq(&:signature)
@@ -1,5 +1,7 @@
1
1
  Gamefic::Standard.script do
2
2
  meta nil, plaintext do |actor, string|
3
+ next if string.strip.empty?
4
+
3
5
  words = string.keywords
4
6
  list = actor.epic.synonyms
5
7
  if list.include?(words[0]&.to_sym)
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gamefic::Standard.script do
4
+ introduction do |actor|
5
+ actor[:standard_pronoun_targets] = []
6
+ end
7
+
8
+ after_action do |action|
9
+ next unless action.verb
10
+
11
+ action.actor[:standard_pronoun_targets].replace action.arguments.that_are(Thing)
12
+ end
13
+
14
+ meta nil, plaintext do |actor, string|
15
+ keywords = string.keywords
16
+ list = actor.epic.synonyms
17
+ next actor.proceed unless list.include?(keywords.first&.to_sym)
18
+
19
+ xlation = keywords[1..].map do |word|
20
+ next word unless %w[him her it them].include?(word)
21
+
22
+ actor[:standard_pronoun_targets].find { |obj| Grammar::Pronoun.objective(obj) == word }
23
+ end
24
+ next actor.proceed if xlation.any?(&:nil?) || xlation.that_are(Thing).empty?
25
+
26
+ actor.perform "#{keywords[0].to_sym} #{xlation.join(' ')}"
27
+ end
28
+ end
@@ -21,3 +21,4 @@ require 'gamefic-standard/actions/wait'
21
21
  require 'gamefic-standard/actions/repeat'
22
22
  require 'gamefic-standard/actions/help'
23
23
  require 'gamefic-standard/actions/save-restore-undo'
24
+ require 'gamefic-standard/actions/pronouns'
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # An entity that provides access from one room to another.
4
+ #
3
5
  class Portal < Thing
4
6
  # @return [Gamefic::Entity]
5
7
  attr_accessor :destination
@@ -19,6 +21,7 @@ class Portal < Thing
19
21
  # @return [Room, nil]
20
22
  def reverse
21
23
  return nil if destination.nil?
24
+
22
25
  destination.children.that_are(Portal).find do |portal|
23
26
  portal.destination == parent
24
27
  end
@@ -30,7 +33,7 @@ class Portal < Thing
30
33
  end
31
34
 
32
35
  def name
33
- @name || (direction.nil? ? destination.name : direction.name)
36
+ @name || direction&.name || destination.name
34
37
  end
35
38
 
36
39
  def instruction
@@ -1,7 +1,4 @@
1
- # The StandardMethods module provides a namespace to define additional methods
2
- # for plots and subplots. Examples include the `connect` method for creating
3
- # portals between rooms.
4
- #
1
+ # frozen_string_literal: true
5
2
 
6
3
  require 'gamefic-standard/modules/standardized'
7
4
  require 'gamefic-standard/modules/enterable'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gamefic
4
4
  module Standard
5
- VERSION = '3.1.0'
5
+ VERSION = '3.2.1'
6
6
  end
7
7
  end
@@ -18,7 +18,6 @@ module Gamefic
18
18
  require 'gamefic-standard/entities'
19
19
  require 'gamefic-standard/actions'
20
20
  require 'gamefic-standard/introduction'
21
-
22
21
  require 'gamefic-standard/give'
23
22
 
24
23
  def connect(origin, destination, direction = nil, type: Portal, two_way: true)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamefic-standard
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-08 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gamefic
@@ -133,6 +133,7 @@ files:
133
133
  - lib/gamefic-standard/actions/nil.rb
134
134
  - lib/gamefic-standard/actions/open.rb
135
135
  - lib/gamefic-standard/actions/place.rb
136
+ - lib/gamefic-standard/actions/pronouns.rb
136
137
  - lib/gamefic-standard/actions/quit.rb
137
138
  - lib/gamefic-standard/actions/repeat.rb
138
139
  - lib/gamefic-standard/actions/save-restore-undo.rb