Sha256: 30114f72598a8f2845ae6785c0e6d4b929920b398d728bc0341cb35baeaa7cfd
Contents?: true
Size: 962 Bytes
Versions: 1
Compression:
Stored size: 962 Bytes
Contents
# @gamefic.script standard/openable # A module for entities that are openable. # module Openable def open= bool @open = bool end def open? @open ||= false end def closed? !open? end def accessible? open? end end Gamefic.script do respond :open, Use.available do |actor, thing| actor.tell "You can't open #{the thing}." end respond :open, Use.available(Openable) do |actor, thing| if thing.open? actor.tell "#{The thing} is already open." else actor.tell "You open #{the thing}." thing.open = true end end respond :close, Use.available do |actor, thing| actor.tell "You can't close #{the thing}." end respond :close, Use.available(Openable) do |actor, thing| if thing.open? actor.tell "You close #{the thing}." thing.open = false else actor.tell "#{The thing} is already open." end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gamefic-standard-2.1.0 | lib/gamefic-standard/openable.rb |