Class: Gamefic::Standard::Door

Inherits:
Portal show all
Includes:
Lockable, Openable
Defined in:
lib/gamefic/standard/entities/door.rb

Overview

An openable and lockable portal.

Instance Attribute Summary

Attributes included from Lockable

#lock_key

Attributes inherited from Portal

#destination, #direction

Attributes included from Standardized

#itemized, #locale_description, #portable

Instance Method Summary collapse

Methods included from Lockable

#lock, #lock_key?, #locked?, #unlock, #unlocked?

Methods included from Openable

#accessible, #close, #closed?, #open, #open?

Methods inherited from Portal

#instruction, #name, #reverse, #synonyms

Methods included from Standardized

#attached=, #attached?, #itemized?, #parent=, #portable?, #room

Instance Method Details

#locked=(bool) ⇒ Object



23
24
25
26
# File 'lib/gamefic/standard/entities/door.rb', line 23

def locked=(bool)
  super
  update_reverse_lock
end

#open=(bool) ⇒ Object



16
17
18
19
20
21
# File 'lib/gamefic/standard/entities/door.rb', line 16

def open=(bool)
  super
  reverse&.lock_key = lock_key
  update_reverse_open
  update_reverse_lock
end

#post_initializeObject



11
12
13
14
# File 'lib/gamefic/standard/entities/door.rb', line 11

def post_initialize
  update_reverse_open
  update_reverse_lock
end

#two_way_lock_key=(key) ⇒ Object



28
29
30
31
# File 'lib/gamefic/standard/entities/door.rb', line 28

def two_way_lock_key=(key)
  self.lock_key = key
  reverse&.lock_key = key
end

#type_nameObject



33
34
35
# File 'lib/gamefic/standard/entities/door.rb', line 33

def type_name
  @type_name ||= 'door'
end