Sha256: 11e2a4aeeebfd1f0f42c9f79d8b5bbd82d260c82039889e29403cb59beb015bb

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Gamefic
  module Standard
    module Actions
      module Drop
        extend Gamefic::Scriptable

        respond :drop, available do |actor, thing|
          actor.tell "You're not carrying #{the thing}."
        end

        respond :drop, children do |actor, thing|
          actor.execute :take, thing
          next unless thing.parent == actor

          thing.parent = actor.parent
          actor.tell "You drop #{the thing}."
        end

        respond :drop, children do |actor, thing|
          thing.parent = actor.parent
          actor.tell "You drop #{the thing}."
        end

        respond :drop, plaintext(/^(all|everything)$/) do |actor, _all|
          if actor.children.empty?
            actor.tell "You're not carrying anything."
          else
            actor.children.each { |item| actor.execute :drop, item }
          end
        end

        interpret 'put down :thing', 'drop :thing'
        interpret 'put :thing down', 'drop :thing'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-standard-3.3.0 lib/gamefic-standard/actions/drop.rb