Sha256: cb400a1905011569de4caa59c1459152696cee0716229837fbb171658d8fccda

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 Bytes

Contents

Gamefic.script do
  respond :wear, Use.available(Clothing) do |actor, clothing|
    actor.perform :take, clothing unless clothing.parent == actor
    next unless clothing.parent == actor
    if clothing.attached?
      actor.tell "You're already wearing #{the clothing}."
    else
      already = actor.children.that_are(clothing.class).that_are(:attached?)
      if already.length == 0
        clothing.attached = true
        actor.tell "You put on #{the clothing}."
      else
        actor.tell "You're already wearing #{an already[0]}."
      end
    end
  end

  interpret "put on :clothing", "wear :clothing"
  interpret "put :clothing on", "wear :clothing"
  interpret "don :clothing", "wear :clothing"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-standard-2.2.0 lib/gamefic-standard/clothing/actions/wear.rb