Class: Door

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

Overview

An openable and lockable portal.

Instance Attribute Summary

Attributes included from Gamefic::Standard::Lockable

#lock_key

Attributes inherited from Portal

#destination, #direction

Instance Method Summary collapse

Methods included from Gamefic::Standard::Lockable

#lock_key?, #locked?, #unlocked?

Methods included from Gamefic::Standard::Openable

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

Methods inherited from Portal

#instruction, #name, #reverse, #synonyms

Instance Method Details

#locked=(bool) ⇒ Object



21
22
23
24
# File 'lib/gamefic-standard/entities/door.rb', line 21

def locked=(bool)
  super
  update_reverse_lock
end

#open=(bool) ⇒ Object



14
15
16
17
18
19
# File 'lib/gamefic-standard/entities/door.rb', line 14

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

#post_initializeObject



9
10
11
12
# File 'lib/gamefic-standard/entities/door.rb', line 9

def post_initialize
  update_reverse_open
  update_reverse_lock
end

#two_way_lock_key=(key) ⇒ Object



26
27
28
29
# File 'lib/gamefic-standard/entities/door.rb', line 26

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