Permalink
Browse files

Don't require an explicit call to init_reactor when extending

  • Loading branch information...
tjkirch committed Mar 13, 2011
1 parent 376e8db commit 685f9e775899f641bb22244837d13b412d530874
Showing with 5 additions and 3 deletions.
  1. +0 −1 events/admin.rb
  2. +5 −2 traits/reacts.rb
View
@@ -899,7 +899,6 @@ def areaction(event, player, room)
elsif not object.is_a? Reacts and (event[:command] == "load" or event[:command] == "reload")
player.output "Object cannot react, adding react ability."
object.extend(Reacts)
object.init_reactor
end
case event[:command]
View
@@ -11,8 +11,11 @@ def uses_reaction? file
@reactions_files.include? file
end
#This is called when the object is created, but if the
#module is mixed in dynamically this needs to be called before being used
# Automatically set up the reactor when we extend an object
def self.extended(obj)
obj.init_reactor
end
def init_reactor
@reactor ||= Reactor.new(self)
@reaction_files ||= Set.new

0 comments on commit 685f9e7

Please sign in to comment.