Sha256: af6978040a29babaa8c52f997d5043f22b7139c958c960a93f3a6d51c0f9a6c4

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

script 'standard/entities/portal'

class Gamefic::Door < Gamefic::Portal
  include Openable
  include Lockable
  
  serialize :open?, :locked?, :lock_key, :automatic?
  
  def post_initialize
    super
    if @name.nil? and !@direction.nil?
      proper_named = false
      rev = @direction.reverse
      self.name = "the #{@direction.adjective} door"
    end
  end
  def open=(bool)
    super
    rev = find_reverse
    if !rev.nil? and rev.open? != bool
      rev.open = bool
    end
  end
  def locked=(bool)
    super
    rev = find_reverse
    if !rev.nil? and rev.locked? != bool
      rev.locked = bool
    end
  end
  def automatic=(bool)
    @automatic = bool
    rev = find_reverse
    if !rev.nil? and rev.automatic? != bool
      rev.automatic = bool
    end
  end
  # HACK Even though Door includes Lockable, we need
  # to add the lock_key definitions here for Opal.
  def lock_key
    @lock_key
  end
  def lock_key=(entity)
    @lock_key = entity
    rev = find_reverse
    if !rev.nil? and rev.lock_key != entity
      rev.lock_key = entity
    end
  end
  def automatic?
    @automatic ||= true
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gamefic-sdk-1.5.0 scripts/standard/entities/door.plot.rb
gamefic-sdk-1.4.1 scripts/standard/entities/door.plot.rb
gamefic-sdk-1.4.0 scripts/standard/entities/door.plot.rb
gamefic-sdk-1.3.1 scripts/standard/entities/door.plot.rb
gamefic-sdk-1.3.0 scripts/standard/entities/door.plot.rb
gamefic-sdk-1.2.0 scripts/standard/entities/door.plot.rb
gamefic-sdk-1.1.0 scripts/standard/entities/door.plot.rb
gamefic-sdk-1.0.1 scripts/standard/entities/door.plot.rb